Skip to content

Commit b30e763

Browse files
feat: Add protect & unprotect workunit to WU context menu
Signed-off-by: David de Hilster <[email protected]>
1 parent 4ee1e25 commit b30e763

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,18 @@
401401
"title": "%Delete Workunit%",
402402
"enablement": "viewItem =~ /ECLWUNodeComplete/"
403403
},
404+
{
405+
"command": "hpccPlatform.protectWU",
406+
"category": "ECL",
407+
"title": "%Protect Workunit%",
408+
"enablement": "viewItem =~ /ECLWUNodeComplete/"
409+
},
410+
{
411+
"command": "hpccPlatform.unprotectWU",
412+
"category": "ECL",
413+
"title": "%Unprotect Workunit%",
414+
"enablement": "viewItem =~ /ECLWUNodeComplete/"
415+
},
404416
{
405417
"command": "hpccPlatform.setStateCompiled",
406418
"category": "ECL",
@@ -970,6 +982,16 @@
970982
"when": "view == hpccPlatform && viewItem =~ /^ECLWUNode/",
971983
"group": "3action@920"
972984
},
985+
{
986+
"when": "view == hpccPlatform && viewItem =~ /ECLWUNodeUnprotected/",
987+
"command": "hpccPlatform.protectWU",
988+
"group": "3action@930"
989+
},
990+
{
991+
"when": "view == hpccPlatform && viewItem =~ /ECLWUNodeProtected/",
992+
"command": "hpccPlatform.unprotectWU",
993+
"group": "3action@940"
994+
},
973995
{
974996
"submenu": "setState",
975997
"group": "3action@950"

package.nls.json

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
"Ping interval (secs, -1 to disable)": "Ping interval (secs, -1 to disable)",
8080
"Pinned launch configurations": "Pinned launch configurations",
8181
"Private": "Private",
82+
"Protect": "Protect",
83+
"Protect Workunit": "Protect Workunit",
8284
"Public": "Public",
8385
"Refresh": "Refresh",
8486
"Refresh Tree": "Refresh Tree",
@@ -123,6 +125,7 @@
123125
"Terminal": "Terminal",
124126
"Uninstall": "Uninstall",
125127
"Uninstall Bundle": "Uninstall Bundle",
128+
"Unprotect Workunit": "Unprotect Workunit",
126129
"User ID": "User ID",
127130
"User password": "User password",
128131
"Verify ECL Digital Signature": "Verify ECL Digital Signature",

src/ecl/eclWatchTree.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,22 @@ export class ECLWatchTree extends Tree {
9393
wuNode.delete();
9494
});
9595

96+
vscode.commands.registerCommand("hpccPlatform.protectWU", (wuNode: ECLWUNode) => {
97+
wuNode.protect();
98+
});
99+
100+
vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => {
101+
wuNode.unprotect();
102+
});
103+
96104
vscode.commands.registerCommand("hpccPlatform.setStateCompiled", (wuNode: ECLWUNode) => {
97105
wuNode.setStateCompiled();
98106
});
99107

100108
vscode.commands.registerCommand("hpccPlatform.setStateRunning", (wuNode: ECLWUNode) => {
101109
wuNode.setStateRunning();
102110
});
103-
111+
104112
vscode.commands.registerCommand("hpccPlatform.setStateCompleted", (wuNode: ECLWUNode) => {
105113
wuNode.setStateCompleted();
106114
});
@@ -448,6 +456,14 @@ export class ECLWUNode extends Item<ECLWatchTree> {
448456
this._wu.abort().then(() => this._tree.refresh(this));
449457
}
450458

459+
protect() {
460+
this._wu.protect().then(() => this._tree.refresh());
461+
}
462+
463+
unprotect() {
464+
this._wu.unprotect().then(() => this._tree.refresh());
465+
}
466+
451467
setState(stateID: WUStateID) {
452468
const service = new WorkunitsService({ baseUrl: this._wu.BaseUrl });
453469
return service.WUUpdate({
@@ -525,7 +541,8 @@ export class ECLWUNode extends Item<ECLWatchTree> {
525541
}
526542

527543
contextValue(): string {
528-
return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode";
544+
const prot = this._wu.Protected ? ",ECLWUNodeProtected" : ",ECLWUNodeUnprotected";
545+
return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`;
529546
}
530547
}
531548

0 commit comments

Comments
 (0)