Skip to content

Commit 4cf6813

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

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
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

+17-8
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,18 @@ export class ECLWatchTree extends Tree {
8989
wuNode.abort();
9090
});
9191

92-
vscode.commands.registerCommand("hpccPlatform.resubmitWU", (wuNode: ECLWUNode) => {
93-
wuNode.resubmit();
94-
});
95-
9692
vscode.commands.registerCommand("hpccPlatform.deleteWU", (wuNode: ECLWUNode) => {
9793
wuNode.delete();
9894
});
9995

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+
100104
vscode.commands.registerCommand("hpccPlatform.moveJobUp", (wuNode: ECLWUNode) => {
101105
wuNode.moveJobUp();
102106
});
@@ -467,10 +471,14 @@ export class ECLWUNode extends Item<ECLWatchTree> {
467471
this._wu.abort().then(() => this._tree.refresh(this));
468472
}
469473

470-
resubmit() {
471-
this._wu.resubmit().then(() => this._tree.refresh(this));
474+
protect() {
475+
this._wu.protect().then(() => this._tree.refresh());
476+
}
477+
478+
unprotect() {
479+
this._wu.unprotect().then(() => this._tree.refresh());
472480
}
473-
481+
474482
moveJobUp() {
475483
const service = new SMCService({ baseUrl: this._wu.BaseUrl });
476484
return service.MoveJobUp({
@@ -596,7 +604,8 @@ export class ECLWUNode extends Item<ECLWatchTree> {
596604
}
597605

598606
contextValue(): string {
599-
return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode";
607+
const prot = this._wu.Protected ? ",ECLWUNodeProtected" : ",ECLWUNodeUnprotected";
608+
return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`;
600609
}
601610
}
602611

0 commit comments

Comments
 (0)