From 659b0e47612afb00b6c7da667107558e5cabdd26 Mon Sep 17 00:00:00 2001 From: al Date: Sat, 18 Sep 2021 23:53:50 +0300 Subject: [PATCH] add commands and icons to refresh sources and deployments (#42) --- package.json | 24 ++++++++++++++++++++++++ src/commands.ts | 10 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 31871478..ab5fdbc0 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,8 @@ "onCommand:gitops.kubectl.version", "onCommand:gitops.flux.checkPrerequisites", "onCommand:gitops.views.refreshTreeViews", + "onCommand:gitops.views.refreshSourceTreeView", + "onCommand:gitops.views.refreshDeploymentTreeView", "onCommand:gitops.editor.openResource", "onView:gitops.views.clusters", "onView:gitops.views.sources", @@ -60,6 +62,18 @@ "category": "GitOps", "icon": "$(refresh)" }, + { + "command": "gitops.views.refreshSourceTreeView", + "title": "Refresh Sources tree view", + "category": "GitOps", + "icon": "$(refresh)" + }, + { + "command": "gitops.views.refreshDeploymentTreeView", + "title": "Refresh Deployment tree view", + "category": "GitOps", + "icon": "$(refresh)" + }, { "command": "gitops.editor.openResource", "title": "View Config", @@ -132,6 +146,16 @@ "command": "gitops.views.refreshTreeViews", "group": "navigation", "when": "view == gitops.views.clusters" + }, + { + "command": "gitops.views.refreshSourceTreeView", + "group": "navigation", + "when": "view == gitops.views.sources" + }, + { + "command": "gitops.views.refreshDeploymentTreeView", + "group": "navigation", + "when": "view == gitops.views.deployments" } ], "view/item/context": [], diff --git a/src/commands.ts b/src/commands.ts index e8843fe8..ac12d8f2 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -7,7 +7,11 @@ import { Uri } from 'vscode'; import { kubernetesTools } from './kubernetes/kubernetesTools'; -import { refreshTreeViews } from './views/treeViews'; +import { + refreshDeploymentTreeView, + refreshSourceTreeView, + refreshTreeViews +} from './views/treeViews'; import { runTerminalCommand } from './gitOps'; /** @@ -24,6 +28,8 @@ export enum ViewCommands { Open = 'vscode.open', SetContext = 'setContext', RefreshTreeViews = 'gitops.views.refreshTreeViews', + RefreshSourceTreeView = 'gitops.views.refreshSourceTreeView', + RefreshDeploymentTreeView = 'gitops.views.refreshDeploymentTreeView', } /** @@ -52,6 +58,8 @@ export function registerCommands(context: ExtensionContext) { registerCommand(KubectlCommands.Version, showKubectlVersion); registerCommand(KubectlCommands.SetCurrentContext, setKubernetesClusterContext); registerCommand(ViewCommands.RefreshTreeViews, refreshTreeViews); + registerCommand(ViewCommands.RefreshSourceTreeView, refreshSourceTreeView); + registerCommand(ViewCommands.RefreshDeploymentTreeView, refreshDeploymentTreeView); registerCommand(FluxCommands.CheckPrerequisites, checkFluxPrerequisites); // add open gitops resource in vscode editor command