Skip to content

Commit

Permalink
Merge pull request #367 from dehilsterlexis/ADD_PROTECT
Browse files Browse the repository at this point in the history
feat: Add protect & unprotect workunit to WU context menu
  • Loading branch information
GordonSmith authored Feb 19, 2024
2 parents 5c96b3e + a249bf3 commit d255624
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
{
Expand Down
3 changes: 3 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
31 changes: 24 additions & 7 deletions src/ecl/eclWatchTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -391,12 +399,12 @@ export class ECLWUNode extends Item<ECLWatchTree> {

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() {
Expand Down Expand Up @@ -470,7 +478,15 @@ export class ECLWUNode extends Item<ECLWatchTree> {
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({
Expand Down Expand Up @@ -596,7 +612,8 @@ export class ECLWUNode extends Item<ECLWatchTree> {
}

contextValue(): string {
return this._wu.isComplete() ? "ECLWUNodeComplete" : "ECLWUNode";
const prot = this._wu.Protected ? ",ECLWUNodeProtected" : ",ECLWUNodeUnprotected";
return this._wu.isComplete() ? `ECLWUNodeComplete${prot}` : `ECLWUNode${prot}`;
}
}

Expand Down

0 comments on commit d255624

Please sign in to comment.