Skip to content

Commit

Permalink
feat: Add protect & unprotect workunit to WU context menu
Browse files Browse the repository at this point in the history
Signed-off-by: David de Hilster <[email protected]>
  • Loading branch information
dehilsterlexis committed Jan 4, 2024
1 parent 470f6f4 commit 35ee399
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
26 changes: 24 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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/",
Expand Down
3 changes: 3 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 20 additions & 1 deletion src/ecl/eclWatchTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -400,6 +410,14 @@ export class ECLWUNode extends Item<ECLWatchTree> {
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());
}
Expand All @@ -421,7 +439,8 @@ export class ECLWUNode extends Item<ECLWatchTree> {
}

contextValue(): string {
return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode";
const prot = this._wu.Protected ? "Protected" : "Unprotected";
return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`;
}
}

Expand Down

0 comments on commit 35ee399

Please sign in to comment.