Skip to content

Commit 04d60d5

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

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

package.json

+25-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"devDependencies": {
5252
"@fluentui/react": "8.111.2",
5353
"@hpcc-js/common": "2.71.11",
54-
"@hpcc-js/comms": "2.85.0",
54+
"@hpcc-js/comms": "2.86.0",
5555
"@hpcc-js/ddl-shim": "2.20.5",
5656
"@hpcc-js/dgrid2": "2.3.11",
5757
"@hpcc-js/loader": "2.104.28",
@@ -393,13 +393,25 @@
393393
"command": "hpccPlatform.abortWU",
394394
"category": "ECL",
395395
"title": "%Abort Workunit%",
396-
"enablement": "viewItem == ECLWUNode"
396+
"enablement": "viewItem =~ /ECLWUNode/"
397397
},
398398
{
399399
"command": "hpccPlatform.deleteWU",
400400
"category": "ECL",
401401
"title": "%Delete Workunit%",
402-
"enablement": "viewItem == ECLWUNodeComplete"
402+
"enablement": "viewItem =~ /ECLWUNodeComplete/"
403+
},
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/"
403415
},
404416
{
405417
"command": "hpccPlatform.refresh",
@@ -854,6 +866,16 @@
854866
"when": "view == hpccPlatform && viewItem =~ /^ECLWUNode/",
855867
"group": "3action@920"
856868
},
869+
{
870+
"when": "viewItem =~ /Unprotected/",
871+
"command": "hpccPlatform.protectWU",
872+
"group": "3action@930"
873+
},
874+
{
875+
"when": "viewItem =~ /Protected/",
876+
"command": "hpccPlatform.unprotectWU",
877+
"group": "3action@940"
878+
},
857879
{
858880
"command": "hpccResources.bundles.homepage",
859881
"when": "view == hpccResources.bundles && viewItem =~ /^BundlesItem/",

package.nls.json

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"Ping interval (secs, -1 to disable)": "Ping interval (secs, -1 to disable)",
7272
"Pinned launch configurations": "Pinned launch configurations",
7373
"Private": "Private",
74+
"Protect": "Protect",
75+
"Protect Workunit": "Protect Workunit",
7476
"Public": "Public",
7577
"Refresh": "Refresh",
7678
"Refresh Tree": "Refresh Tree",
@@ -112,6 +114,7 @@
112114
"Terminal": "Terminal",
113115
"Uninstall": "Uninstall",
114116
"Uninstall Bundle": "Uninstall Bundle",
117+
"Unprotect Workunit": "Unprotect Workunit",
115118
"User ID": "User ID",
116119
"User password": "User password",
117120
"Verify ECL Digital Signature": "Verify ECL Digital Signature",

src/ecl/eclWatchTree.ts

+20-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ export class ECLWatchTree extends Tree {
9393
wuNode.delete();
9494
});
9595

96+
vscode.commands.registerCommand("hpccPlatform.protectWU", (wuNode: ECLWUNode) => {
97+
wuNode.protect();
98+
this.refresh();
99+
});
100+
101+
vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => {
102+
wuNode.unprotect();
103+
this.refresh();
104+
});
105+
96106
}
97107

98108
static attach(ctx: vscode.ExtensionContext) {
@@ -400,6 +410,14 @@ export class ECLWUNode extends Item<ECLWatchTree> {
400410
this._wu.abort().then(() => this._tree._onDidChangeTreeData.fire(this));
401411
}
402412

413+
protect() {
414+
this._wu.protect();
415+
}
416+
417+
unprotect() {
418+
this._wu.unprotect();
419+
}
420+
403421
delete() {
404422
this._wu.delete().then(() => this._tree.refresh());
405423
}
@@ -421,7 +439,8 @@ export class ECLWUNode extends Item<ECLWatchTree> {
421439
}
422440

423441
contextValue(): string {
424-
return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode";
442+
const prot = this._wu.Protected ? "Protected" : "Unprotected";
443+
return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`;
425444
}
426445
}
427446

0 commit comments

Comments
 (0)