Skip to content

Commit 088c789

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

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

package.json

+19-1
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,18 @@
412412
"title": "%Delete Workunit%",
413413
"enablement": "viewItem =~ /ECLWUNodeComplete/"
414414
},
415+
{
416+
"command": "hpccPlatform.protectWU",
417+
"category": "ECL",
418+
"title": "%Protect Workunit%",
419+
"enablement": "viewItem =~ /ECLWUNodeComplete/"
420+
},
421+
{
422+
"command": "hpccPlatform.unprotectWU",
423+
"category": "ECL",
424+
"title": "%Unprotect Workunit%",
425+
"enablement": "viewItem =~ /ECLWUNodeComplete/"
426+
},
415427
{
416428
"command": "hpccPlatform.setStateCompiled",
417429
"category": "ECL",
@@ -1029,7 +1041,13 @@
10291041
"group": "3action@920"
10301042
},
10311043
{
1032-
"submenu": "setPriority",
1044+
"when": "view == hpccPlatform && viewItem =~ /ECLWUNodeUnprotected/",
1045+
"command": "hpccPlatform.protectWU",
1046+
"group": "3action@930"
1047+
},
1048+
{
1049+
"when": "view == hpccPlatform && viewItem =~ /ECLWUNodeProtected/",
1050+
"command": "hpccPlatform.unprotectWU",
10331051
"group": "3action@940"
10341052
},
10351053
{

package.nls.json

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
"Ping interval (secs, -1 to disable)": "Ping interval (secs, -1 to disable)",
8686
"Pinned launch configurations": "Pinned launch configurations",
8787
"Private": "Private",
88+
"Protect": "Protect",
89+
"Protect Workunit": "Protect Workunit",
8890
"Public": "Public",
8991
"Refresh": "Refresh",
9092
"Refresh Tree": "Refresh Tree",
@@ -132,6 +134,7 @@
132134
"Terminal": "Terminal",
133135
"Uninstall": "Uninstall",
134136
"Uninstall Bundle": "Uninstall Bundle",
137+
"Unprotect Workunit": "Unprotect Workunit",
135138
"Up": "Up",
136139
"User ID": "User ID",
137140
"User password": "User password",

src/ecl/eclWatchTree.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ export class ECLWatchTree extends Tree {
9797
wuNode.delete();
9898
});
9999

100+
vscode.commands.registerCommand("hpccPlatform.protectWU", (wuNode: ECLWUNode) => {
101+
wuNode.protect();
102+
});
103+
104+
vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => {
105+
wuNode.unprotect();
106+
});
107+
100108
vscode.commands.registerCommand("hpccPlatform.moveJobUp", (wuNode: ECLWUNode) => {
101109
wuNode.moveJobUp();
102110
});
@@ -470,7 +478,15 @@ export class ECLWUNode extends Item<ECLWatchTree> {
470478
resubmit() {
471479
this._wu.resubmit().then(() => this._tree.refresh(this));
472480
}
473-
481+
482+
protect() {
483+
this._wu.protect().then(() => this._tree.refresh());
484+
}
485+
486+
unprotect() {
487+
this._wu.unprotect().then(() => this._tree.refresh());
488+
}
489+
474490
moveJobUp() {
475491
const service = new SMCService({ baseUrl: this._wu.BaseUrl });
476492
return service.MoveJobUp({
@@ -596,7 +612,8 @@ export class ECLWUNode extends Item<ECLWatchTree> {
596612
}
597613

598614
contextValue(): string {
599-
return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode";
615+
const prot = this._wu.Protected ? ",ECLWUNodeProtected" : ",ECLWUNodeUnprotected";
616+
return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`;
600617
}
601618
}
602619

0 commit comments

Comments
 (0)