diff --git a/package.json b/package.json index dd797ed..40f4c1e 100644 --- a/package.json +++ b/package.json @@ -412,6 +412,18 @@ "title": "%Delete Workunit%", "enablement": "viewItem =~ /ECLWUNodeComplete/" }, + { + "command": "hpccPlatform.protectWU", + "category": "ECL", + "title": "%Protect Workunit%", + "enablement": "viewItem =~ /ECLWUNode/" + }, + { + "command": "hpccPlatform.unprotectWU", + "category": "ECL", + "title": "%Unprotect Workunit%", + "enablement": "viewItem =~ /ECLWUNode/" + }, { "command": "hpccPlatform.setStateCompiled", "category": "ECL", @@ -1029,7 +1041,13 @@ "group": "3action@920" }, { - "submenu": "setPriority", + "when": "view == hpccPlatform && viewItem =~ /ECLWUNodeUnprotected/", + "command": "hpccPlatform.protectWU", + "group": "3action@930" + }, + { + "when": "view == hpccPlatform && viewItem =~ /ECLWUNodeProtected/", + "command": "hpccPlatform.unprotectWU", "group": "3action@940" }, { diff --git a/package.nls.json b/package.nls.json index fe0dfe2..fbb6608 100644 --- a/package.nls.json +++ b/package.nls.json @@ -85,6 +85,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", @@ -132,6 +134,7 @@ "Terminal": "Terminal", "Uninstall": "Uninstall", "Uninstall Bundle": "Uninstall Bundle", + "Unprotect Workunit": "Unprotect Workunit", "Up": "Up", "User ID": "User ID", "User password": "User password", diff --git a/src/ecl/eclWatchTree.ts b/src/ecl/eclWatchTree.ts index e39b7d4..25a3db5 100644 --- a/src/ecl/eclWatchTree.ts +++ b/src/ecl/eclWatchTree.ts @@ -97,6 +97,14 @@ export class ECLWatchTree extends Tree { wuNode.delete(); }); + vscode.commands.registerCommand("hpccPlatform.protectWU", (wuNode: ECLWUNode) => { + wuNode.protect(); + }); + + vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => { + wuNode.unprotect(); + }); + vscode.commands.registerCommand("hpccPlatform.moveJobUp", (wuNode: ECLWUNode) => { wuNode.moveJobUp(); }); @@ -391,12 +399,12 @@ export class ECLWUNode extends Item { getDescription(): string { const extras: string[] = []; - if (this._wu.Jobname) { - extras.push(this._wu.Wuid); - } - if (!this._tree._myWorkunits && this._wu.Owner) extras.push(this._wu.Owner); + if (this._wu.Jobname) extras.push(this._wu.Wuid); + if (this._wu.Protected) extras.push("Protected"); if (!this._wu.isComplete() || this._wu.isDeleted()) extras.push(this._wu.State); - return extras.join(" "); + if (this._wu.Owner) extras.push(this._wu.Owner); + if (this._wu.Cluster) extras.push(this._wu.Cluster); + return extras.join(", "); } iconPath() { @@ -470,7 +478,15 @@ export class ECLWUNode extends Item { resubmit() { this._wu.resubmit().then(() => this._tree.refresh(this)); } - + + protect() { + this._wu.protect().then(() => this._tree.refresh()); + } + + unprotect() { + this._wu.unprotect().then(() => this._tree.refresh()); + } + moveJobUp() { const service = new SMCService({ baseUrl: this._wu.BaseUrl }); return service.MoveJobUp({ @@ -596,7 +612,8 @@ export class ECLWUNode extends Item { } contextValue(): string { - return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode"; + const prot = this._wu.Protected ? ",ECLWUNodeProtected" : ",ECLWUNodeUnprotected"; + return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`; } }