Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add search filter to Coder Workspaces tree views#603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
EhabY merged 1 commit intocoder:mainfromEhabY:add-search-filter-to-tree-views
Oct 2, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@
{
"command": "coder.createWorkspace",
"title": "Create Workspace",
"category": "Coder",
"when": "coder.authenticated",
"icon": "$(add)"
},
Expand All@@ -226,7 +227,8 @@
},
{
"command": "coder.refreshWorkspaces",
"title": "Coder: Refresh Workspace",
"title": "Refresh Workspace",
"category": "Coder",
"icon": "$(refresh)",
"when": "coder.authenticated"
},
Expand All@@ -241,13 +243,33 @@
"title": "Coder: Open App Status",
"icon": "$(robot)",
"when": "coder.authenticated"
},
{
"command": "coder.searchMyWorkspaces",
"title": "Search",
"category": "Coder",
"icon": "$(search)"
},
{
"command": "coder.searchAllWorkspaces",
"title": "Search",
"category": "Coder",
"icon": "$(search)"
}
],
"menus": {
"commandPalette": [
{
"command": "coder.openFromSidebar",
"when": "false"
},
{
"command": "coder.searchMyWorkspaces",
"when": "false"
},
{
"command": "coder.searchAllWorkspaces",
"when": "false"
}
],
"view/title": [
Expand All@@ -262,12 +284,22 @@
{
"command": "coder.createWorkspace",
"when": "coder.authenticated && view == myWorkspaces",
"group": "navigation"
"group": "navigation@1"
},
{
"command": "coder.refreshWorkspaces",
"when": "coder.authenticated && view == myWorkspaces",
"group": "navigation"
"group": "navigation@2"
},
{
"command": "coder.searchMyWorkspaces",
"when": "coder.authenticated && view == myWorkspaces",
"group": "navigation@3"
},
{
"command": "coder.searchAllWorkspaces",
"when": "coder.authenticated && view == allWorkspaces",
"group": "navigation@3"
}
],
"view/item/context": [
Expand Down
18 changes: 16 additions & 2 deletionssrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,9 @@ import {
WorkspaceQuery,
} from "./workspace/workspacesProvider";

const MY_WORKSPACES_TREE_ID = "myWorkspaces";
const ALL_WORKSPACES_TREE_ID = "allWorkspaces";

export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
// The Remote SSH extension's proposed APIs are used to override the SSH host
// name in VS Code itself. It's visually unappealing having a lengthy name!
Expand DownExpand Up@@ -86,15 +89,15 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {

// createTreeView, unlike registerTreeDataProvider, gives us the tree view API
// (so we can see when it is visible) but otherwise they have the same effect.
const myWsTree = vscode.window.createTreeView("myWorkspaces", {
const myWsTree = vscode.window.createTreeView(MY_WORKSPACES_TREE_ID, {
treeDataProvider: myWorkspacesProvider,
});
myWorkspacesProvider.setVisibility(myWsTree.visible);
myWsTree.onDidChangeVisibility((event) => {
myWorkspacesProvider.setVisibility(event.visible);
});

const allWsTree = vscode.window.createTreeView("allWorkspaces", {
const allWsTree = vscode.window.createTreeView(ALL_WORKSPACES_TREE_ID, {
treeDataProvider: allWorkspacesProvider,
});
allWorkspacesProvider.setVisibility(allWsTree.visible);
Expand DownExpand Up@@ -298,6 +301,12 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
"coder.viewLogs",
commands.viewLogs.bind(commands),
);
vscode.commands.registerCommand("coder.searchMyWorkspaces", async () =>
showTreeViewSearch(MY_WORKSPACES_TREE_ID),
);
vscode.commands.registerCommand("coder.searchAllWorkspaces", async () =>
showTreeViewSearch(ALL_WORKSPACES_TREE_ID),
);

// Since the "onResolveRemoteAuthority:ssh-remote" activation event exists
// in package.json we're able to perform actions before the authority is
Expand DownExpand Up@@ -421,3 +430,8 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
}
}
}

async function showTreeViewSearch(id: string): Promise<void> {
await vscode.commands.executeCommand(`${id}.focus`);
await vscode.commands.executeCommand("list.find");
}
8 changes: 8 additions & 0 deletionssrc/workspace/workspacesProvider.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -262,6 +262,7 @@ export class WorkspaceProvider
// yet.
appStatuses.push(
new AppStatusTreeItem({
id: status.id,
name: status.message,
command: app.command,
workspace_name: element.workspace.name,
Expand DownExpand Up@@ -335,6 +336,7 @@ class AgentMetadataTreeItem extends vscode.TreeItem {
metadataEvent.result.collected_at,
).toLocaleString();

this.id = metadataEvent.description.key;
this.tooltip = "Collected at " + collected_at;
this.contextValue = "coderAgentMetadata";
}
Expand All@@ -343,13 +345,15 @@ class AgentMetadataTreeItem extends vscode.TreeItem {
class AppStatusTreeItem extends vscode.TreeItem {
constructor(
public readonly app: {
id: string;
name: string;
url?: string;
command?: string;
workspace_name?: string;
},
) {
super("", vscode.TreeItemCollapsibleState.None);
this.id = app.id;
this.description = app.name;
this.contextValue = "coderAppStatus";

Expand All@@ -369,6 +373,7 @@ type CoderOpenableTreeItemType =

export class OpenableTreeItem extends vscode.TreeItem {
constructor(
id: string,
label: string,
tooltip: string,
description: string,
Expand All@@ -379,6 +384,7 @@ export class OpenableTreeItem extends vscode.TreeItem {
contextValue: CoderOpenableTreeItemType,
) {
super(label, collapsibleState);
this.id = id;
this.contextValue = contextValue;
this.tooltip = tooltip;
this.description = description;
Expand All@@ -397,6 +403,7 @@ export class AgentTreeItem extends OpenableTreeItem {
watchMetadata = false,
) {
super(
agent.id, // id
agent.name, // label
`Status: ${agent.status}`, // tooltip
agent.status, // description
Expand DownExpand Up@@ -434,6 +441,7 @@ export class WorkspaceTreeItem extends OpenableTreeItem {
const detail = `Template: ${workspace.template_display_name || workspace.template_name} • Status: ${status}`;
const agents = extractAgents(workspace.latest_build.resources);
super(
workspace.id,
label,
detail,
workspace.latest_build.status, // description
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp