From 35ee399794ba4a30cda492adbd1d1dcedc2fc097 Mon Sep 17 00:00:00 2001 From: David de Hilster Date: Wed, 13 Dec 2023 14:50:58 -0500 Subject: [PATCH] feat: Add protect & unprotect workunit to WU context menu Signed-off-by: David de Hilster --- package.json | 26 ++++++++++++++++++++++++-- package.nls.json | 3 +++ src/ecl/eclWatchTree.ts | 21 ++++++++++++++++++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 01712dc..4694084 100644 --- a/package.json +++ b/package.json @@ -393,13 +393,25 @@ "command": "hpccPlatform.abortWU", "category": "ECL", "title": "%Abort Workunit%", - "enablement": "viewItem == ECLWUNode" + "enablement": "viewItem =~ /ECLWUNode/" }, { "command": "hpccPlatform.deleteWU", "category": "ECL", "title": "%Delete Workunit%", - "enablement": "viewItem == ECLWUNodeComplete" + "enablement": "viewItem =~ /ECLWUNodeComplete/" + }, + { + "command": "hpccPlatform.protectWU", + "category": "ECL", + "title": "%Protect Workunit%", + "enablement": "viewItem =~ /ECLWUNodeComplete/" + }, + { + "command": "hpccPlatform.unprotectWU", + "category": "ECL", + "title": "%Unprotect Workunit%", + "enablement": "viewItem =~ /ECLWUNodeComplete/" }, { "command": "hpccPlatform.refresh", @@ -854,6 +866,16 @@ "when": "view == hpccPlatform && viewItem =~ /^ECLWUNode/", "group": "3action@920" }, + { + "when": "viewItem =~ /Unprotected/", + "command": "hpccPlatform.protectWU", + "group": "3action@930" + }, + { + "when": "viewItem =~ /Protected/", + "command": "hpccPlatform.unprotectWU", + "group": "3action@940" + }, { "command": "hpccResources.bundles.homepage", "when": "view == hpccResources.bundles && viewItem =~ /^BundlesItem/", diff --git a/package.nls.json b/package.nls.json index 4a93743..0457432 100644 --- a/package.nls.json +++ b/package.nls.json @@ -71,6 +71,8 @@ "Ping interval (secs, -1 to disable)": "Ping interval (secs, -1 to disable)", "Pinned launch configurations": "Pinned launch configurations", "Private": "Private", + "Protect": "Protect", + "Protect Workunit": "Protect Workunit", "Public": "Public", "Refresh": "Refresh", "Refresh Tree": "Refresh Tree", @@ -112,6 +114,7 @@ "Terminal": "Terminal", "Uninstall": "Uninstall", "Uninstall Bundle": "Uninstall Bundle", + "Unprotect Workunit": "Unprotect Workunit", "User ID": "User ID", "User password": "User password", "Verify ECL Digital Signature": "Verify ECL Digital Signature", diff --git a/src/ecl/eclWatchTree.ts b/src/ecl/eclWatchTree.ts index 4dff815..3b641c3 100644 --- a/src/ecl/eclWatchTree.ts +++ b/src/ecl/eclWatchTree.ts @@ -93,6 +93,16 @@ export class ECLWatchTree extends Tree { wuNode.delete(); }); + vscode.commands.registerCommand("hpccPlatform.protectWU", (wuNode: ECLWUNode) => { + wuNode.protect(); + this.refresh(); + }); + + vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => { + wuNode.unprotect(); + this.refresh(); + }); + } static attach(ctx: vscode.ExtensionContext) { @@ -400,6 +410,14 @@ export class ECLWUNode extends Item { this._wu.abort().then(() => this._tree._onDidChangeTreeData.fire(this)); } + protect() { + this._wu.protect(); + } + + unprotect() { + this._wu.unprotect(); + } + delete() { this._wu.delete().then(() => this._tree.refresh()); } @@ -421,7 +439,8 @@ export class ECLWUNode extends Item { } contextValue(): string { - return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode"; + const prot = this._wu.Protected ? "Protected" : "Unprotected"; + return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`; } }