Skip to content

Show workspace owner and add filter toggle for cluster admins#8

Open
SupremeMortal wants to merge 1 commit into
redhat-developer:mainfrom
SupremeMortal:main
Open

Show workspace owner and add filter toggle for cluster admins#8
SupremeMortal wants to merge 1 commit into
redhat-developer:mainfrom
SupremeMortal:main

Conversation

@SupremeMortal

@SupremeMortal SupremeMortal commented Jun 12, 2026

Copy link
Copy Markdown

As a cluster administrator who can see all DevWorkspaces across the cluster, I want to be able to identify which workspace belongs to which user and quickly filter down to only my own workspaces, so that I can navigate a long list of workspaces with duplicate names without losing track of whose is whose.

  • Resolve workspace owner from the che.eclipse.org/username annotation on the DevWorkspace resource, falling back to the same annotation on the OpenShift Project/namespace
  • Display the owner alongside the workspace name, sorted alphabetically by owner
  • Add a "Show only my workspaces" toggle to the provider's action menu, resolved against the logged-in user via OpenShiftClient.currentUser()
  • Remove the unused cheEditor field from DevWorkspace
image

Copilot AI review requested due to automatic review settings June 12, 2026 11:35
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds owner-based filtering to Dev Spaces environments. A new owner field is extracted from OpenShift workspace and project metadata, environments can be displayed with or without the owner prefix, and a reactive "show only mine" toggle in the provider UI filters environments by the current user.

Changes

Owner-based Environment Filtering

Layer / File(s) Summary
Owner data contract
plugin/src/main/kotlin/com/redhat/devtools/toolbox/openshift/DevWorkspace.kt
DevWorkspace now exposes owner (extracted from che.eclipse.org/username annotation) instead of cheEditor.
Owner extraction and visibility
plugin/src/main/kotlin/com/redhat/devtools/toolbox/datasource/DevWorkspacesDataSource.kt, plugin/src/main/kotlin/com/redhat/devtools/toolbox/environment/DevSpacesRemoteEnvironment.kt
DevWorkspacesDataSource extracts owner from workspace and project annotations and includes it in environment config tags. DevSpacesRemoteEnvironment introduces setOwnerVisible() and builds descriptions that conditionally include owner with phase text.
Repository reactive filtering and state
plugin/src/main/kotlin/com/redhat/devtools/toolbox/EnvironmentRepository.kt
EnvironmentRepository adds a showOnlyMine toggle and reactive environments flow that combines unfiltered environments with the toggle to filter by current username. Polling and environment creation apply visibility changes immediately.
Provider and plugin integration
plugin/src/main/kotlin/com/redhat/devtools/toolbox/DevSpacesRemoteProvider.kt, plugin/src/main/kotlin/com/redhat/devtools/toolbox/DevSpacesPlugin.kt
DevSpacesRemoteProvider exposes filtered environments and adds an additionalPluginActions action that toggles the filter. DevSpacesPlugin passes the coroutine scope to the provider.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main changes: displaying workspace owner and adding a filter toggle for cluster admins to show only their workspaces.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description clearly articulates the feature purpose, user benefit, and implementation details aligned with the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds workspace ownership awareness to Dev Spaces environments, enabling filtering to “my workspaces” and optionally showing/hiding owner info in environment descriptions.

Changes:

  • Replace DevWorkspace cheEditor annotation usage with owner (username) extraction.
  • Propagate owner into EnvironmentConfig.tags and render it in DevSpacesRemoteEnvironment description (with visibility toggle).
  • Add repository-side filtering (showOnlyMine) and a provider UI action to toggle “Show only my workspaces”.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
plugin/src/main/kotlin/com/redhat/devtools/toolbox/openshift/DevWorkspace.kt Switches workspace annotation mapping from editor to owner username.
plugin/src/main/kotlin/com/redhat/devtools/toolbox/environment/DevSpacesRemoteEnvironment.kt Builds description including owner and adds owner-visibility toggle.
plugin/src/main/kotlin/com/redhat/devtools/toolbox/datasource/DevWorkspacesDataSource.kt Propagates owner (workspace or namespace-level) into environment tags.
plugin/src/main/kotlin/com/redhat/devtools/toolbox/EnvironmentRepository.kt Adds “only mine” filtering, username resolution, sorting, and owner visibility sync.
plugin/src/main/kotlin/com/redhat/devtools/toolbox/DevSpacesRemoteProvider.kt Adds UI action to toggle filtering and changes environments flow type to StateFlow.
plugin/src/main/kotlin/com/redhat/devtools/toolbox/DevSpacesPlugin.kt Wires coroutineScope into provider for stateIn usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/src/main/kotlin/com/redhat/devtools/toolbox/EnvironmentRepository.kt Outdated
As a cluster administrator who can see all DevWorkspaces across the
cluster, I want to be able to identify which workspace belongs to which
user and quickly filter down to only my own workspaces, so that I can
navigate a long list of workspaces with duplicate names without losing
track of whose is whose.

- Resolve workspace owner from the che.eclipse.org/username annotation
  on the DevWorkspace resource, falling back to the same annotation on
  the OpenShift Project/namespace
- Display the owner alongside the workspace phase in the description
  field (e.g. "john.doe | Running"), sorted alphabetically by owner
- Add a "Show only my workspaces" toggle to the provider's action menu,
  resolved against the logged-in user via OpenShiftClient.currentUser()
- Hide the owner prefix from the description when the filter is active,
  since all visible workspaces belong to the current user at that point
- Remove the unused cheEditor field from DevWorkspace

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

private var activePortForward: LocalPortForward? = null

// Public reactive properties (observed by Toolbox UI)
override val secondaryInformation: String? = initialConfig.tags["owner"]
Comment on lines +61 to +63
override fun run() {
repository.currentUserOnly.value = !repository.currentUserOnly.value
}
Comment on lines +60 to +61
// Username of the currently logged-in OpenShift user (resolved on first fetch)
private var currentUsername: String? = null
Comment on lines +172 to +175
} catch (e: Exception) {
logger.warn("Could not resolve current username: ${e.message}")
null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants