Skip to content

Commit

Permalink
ADD_SET_STATES Add set states to the workunit context menu
Browse files Browse the repository at this point in the history
Signed-off-by: David de Hilster <[email protected]>
  • Loading branch information
dehilsterlexis committed Jan 22, 2024
1 parent 77b7628 commit 58fbac2
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 30 deletions.
126 changes: 112 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,64 @@
"enablement": "viewItem =~ /ECLWUNodeComplete/"
},
{
"command": "hpccPlatform.protectWU",
"command": "hpccPlatform.setStateCompiled",
"category": "ECL",
"title": "%Protect Workunit%",
"enablement": "viewItem =~ /ECLWUNodeComplete/"
"title": "%Compiled%"
},
{
"command": "hpccPlatform.unprotectWU",
"command": "hpccPlatform.setStateRunning",
"category": "ECL",
"title": "%Unprotect Workunit%",
"enablement": "viewItem =~ /ECLWUNodeComplete/"
"title": "%Running%"
},
{
"command": "hpccPlatform.setStateCompleted",
"category": "ECL",
"title": "%Completed%"
},
{
"command": "hpccPlatform.setStateFailed",
"category": "ECL",
"title": "%Failed%"
},
{
"command": "hpccPlatform.setStateArchived",
"category": "ECL",
"title": "%Archived%"
},
{
"command": "hpccPlatform.setStateAborting",
"category": "ECL",
"title": "%Aborting%"
},
{
"command": "hpccPlatform.setStateAborted",
"category": "ECL",
"title": "%Aborted%"
},
{
"command": "hpccPlatform.setStateBlocked",
"category": "ECL",
"title": "%Blocked%"
},
{
"command": "hpccPlatform.setStateSubmitted",
"category": "ECL",
"title": "%Submitted%"
},
{
"command": "hpccPlatform.setStateScheduled",
"category": "ECL",
"title": "%Scheduled%"
},
{
"command": "hpccPlatform.setStateCompiling",
"category": "ECL",
"title": "%Compiling%"
},
{
"command": "hpccPlatform.setStateWaiting",
"category": "ECL",
"title": "%Waiting%"
},
{
"command": "hpccPlatform.refresh",
Expand Down Expand Up @@ -664,7 +712,63 @@
}
}
],
"submenus": [
{
"id": "setState",
"label": "Set State"
}
],
"menus": {
"setState": [
{
"command": "hpccPlatform.setStateCompiled",
"group": "set@01"
},
{
"command": "hpccPlatform.setStateRunning",
"group": "set@02"
},
{
"command": "hpccPlatform.setStateCompleted",
"group": "set@03"
},
{
"command": "hpccPlatform.setStateFailed",
"group": "set@04"
},
{
"command": "hpccPlatform.setStateArchived",
"group": "set@05"
},
{
"command": "hpccPlatform.setStateAborting",
"group": "set@06"
},
{
"command": "hpccPlatform.setStateAborted",
"group": "set@07"
},
{
"command": "hpccPlatform.setStateBlocked",
"group": "set@08"
},
{
"command": "hpccPlatform.setStateSubmitted",
"group": "set@09"
},
{
"command": "hpccPlatform.setStateScheduled",
"group": "set@10"
},
{
"command": "hpccPlatform.setStateCompiling",
"group": "set@11"
},
{
"command": "hpccPlatform.setStateWaiting",
"group": "set@12"
}
],
"explorer/context": [
{
"when": "resourceLangId == ecl && resourceExtname == .ecl",
Expand Down Expand Up @@ -867,14 +971,8 @@
"group": "3action@920"
},
{
"when": "viewItem =~ /Unprotected/",
"command": "hpccPlatform.protectWU",
"group": "3action@930"
},
{
"when": "viewItem =~ /Protected/",
"command": "hpccPlatform.unprotectWU",
"group": "3action@940"
"submenu": "setState",
"group": "3action@950"
},
{
"command": "hpccResources.bundles.homepage",
Expand Down
15 changes: 12 additions & 3 deletions package.nls.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"A new configuration to submit ECL to localhost, hthor": "A new configuration to submit ECL to localhost, hthor",
"Aborted": "Aborted",
"Aborting": "Aborting",
"Abort Workunit": "Abort Workunit",
"Abort submit when errors are reported during archive generation": "Abort submit when errors are reported during archive generation",
"Activate": "Activate",
"Activate Client Tools": "Activate Client Tools",
"Add '-legacy' argument to eclcc": "Add '-legacy' argument to eclcc",
"Additional folders to use when resolving IMPORT statements": "Additional folders to use when resolving IMPORT statements",
"All workunits": "All workunits",
"Archived": "Archived",
"Auto Detect": "Auto Detect",
"Auto Detect Client Tools": "Auto Detect Client Tools",
"Automatically open Workunits on creation": "Automatically open Workunits on creation",
"Blocked": "Blocked",
"Browse ECL Watch": "Browse ECL Watch",
"Browse Metrics": "Browse Metrics",
"Build flags, to be passed to the eclcc compiler": "Build flags, to be passed to the eclcc compiler",
Expand All @@ -19,7 +23,10 @@
"Check syntax with KEL grammar (fast)": "Check syntax with KEL grammar (fast)",
"Clear all previously reported ECL Syntax Check results": "Clear all previously reported ECL Syntax Check results",
"Client Tools Homepage": "Client Tools Homepage",
"Completed": "Completed",
"Compile": "Compile",
"Compiled": "Compiled",
"Compiling": "Compiling",
"Compile ECL on the HPCC Platform": "Compile ECL on the HPCC Platform",
"Copy WUID": "Copy WUID",
"Copy as ECL ID": "Copy as ECL ID",
Expand All @@ -35,6 +42,7 @@
"ECL Watch": "ECL Watch",
"Edit Dashboard": "Edit Dashboard",
"Export ECL Markdown to HTML": "Export ECL Markdown to HTML",
"Failed": "Failed",
"For the currently selected text, search the online ECL language reference": "For the currently selected text, search the online ECL language reference",
"Force global 'proxySupport' to 'fallback'": "Force global 'proxySupport' to 'fallback'",
"Generate": "Generate",
Expand Down Expand Up @@ -71,8 +79,6 @@
"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 All @@ -81,12 +87,14 @@
"Reveals Generated ECL in File Explorer": "Reveals Generated ECL in File Explorer",
"Run 'eclcc -syntax' on load": "Run 'eclcc -syntax' on load",
"Run 'eclcc -syntax' on save": "Run 'eclcc -syntax' on save",
"Running": "Running",
"Save + check syntax of current file": "Save + check syntax of current file",
"Save All + check syntax of all files": "Save All + check syntax of all files",
"Save Data to File": "Save Data to File",
"Save file prior to submission": "Save file prior to submission",
"Save file prior to syntax check": "Save file prior to syntax check",
"Save Result to File": "Save Result to File",
"Scheduled": "Scheduled",
"Select Client Tools Version": "Select Client Tools Version",
"Select Client Tools Version from available options": "Select Client Tools Version from available options",
"Server IP/Domain address": "Server IP/Domain address",
Expand All @@ -98,6 +106,7 @@
"Showing all workunits": "Showing all workunits",
"Sign ECL": "Sign ECL",
"Submit": "Submit",
"Submitted": "Submitted",
"Submit (No Archive)": "Submit (No Archive)",
"Submit ECL to HPCC Platform": "Submit ECL to HPCC Platform",
"Submit Raw ECL to HPCC Platform": "Submit Raw ECL to HPCC Platform",
Expand All @@ -114,13 +123,13 @@
"Terminal": "Terminal",
"Uninstall": "Uninstall",
"Uninstall Bundle": "Uninstall Bundle",
"Unprotect Workunit": "Unprotect Workunit",
"User ID": "User ID",
"User password": "User password",
"Verify ECL Digital Signature": "Verify ECL Digital Signature",
"Verify ECL Signature": "Verify ECL Signature",
"View Dashboard": "View Dashboard",
"View ECL Markdown": "View ECL Markdown",
"Waiting": "Waiting",
"Write eclcc log file to specified file": "Write eclcc log file to specified file",
"eclcc syntax check arguments": "eclcc syntax check arguments"
}
111 changes: 98 additions & 13 deletions src/ecl/eclWatchTree.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Workunit, WUStateID, Result, WUInfo, WUDetails } from "@hpcc-js/comms";
import { Workunit, WUStateID, Result, WUInfo, WorkunitsService } from "@hpcc-js/comms";
import * as vscode from "vscode";
import { sessionManager } from "../hpccplatform/session";
import localize from "../util/localize";
Expand Down Expand Up @@ -93,14 +93,52 @@ export class ECLWatchTree extends Tree {
wuNode.delete();
});

vscode.commands.registerCommand("hpccPlatform.protectWU", (wuNode: ECLWUNode) => {
wuNode.protect();
this.refresh();
vscode.commands.registerCommand("hpccPlatform.setStateCompiled", (wuNode: ECLWUNode) => {
wuNode.setStateCompiled();
});

vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => {
wuNode.unprotect();
this.refresh();
vscode.commands.registerCommand("hpccPlatform.setStateRunning", (wuNode: ECLWUNode) => {
wuNode.setStateRunning();
});

vscode.commands.registerCommand("hpccPlatform.setStateCompleted", (wuNode: ECLWUNode) => {
wuNode.setStateCompleted();
});

vscode.commands.registerCommand("hpccPlatform.setStateFailed", (wuNode: ECLWUNode) => {
wuNode.setStateFailed();
});

vscode.commands.registerCommand("hpccPlatform.setStateArchived", (wuNode: ECLWUNode) => {
wuNode.setStateArchived();
});

vscode.commands.registerCommand("hpccPlatform.setStateAborting", (wuNode: ECLWUNode) => {
wuNode.setStateAborting();
});

vscode.commands.registerCommand("hpccPlatform.setStateAborted", (wuNode: ECLWUNode) => {
wuNode.setStateAborted();
});

vscode.commands.registerCommand("hpccPlatform.setStateBlocked", (wuNode: ECLWUNode) => {
wuNode.setStateBlocked();
});

vscode.commands.registerCommand("hpccPlatform.setStateSubmitted", (wuNode: ECLWUNode) => {
wuNode.setStateSubmitted();
});

vscode.commands.registerCommand("hpccPlatform.setStateScheduled", (wuNode: ECLWUNode) => {
wuNode.setStateScheduled();
});

vscode.commands.registerCommand("hpccPlatform.setStateCompiling", (wuNode: ECLWUNode) => {
wuNode.setStateCompiling();
});

vscode.commands.registerCommand("hpccPlatform.setStateWait", (wuNode: ECLWUNode) => {
wuNode.setStateWait();
});

}
Expand Down Expand Up @@ -410,12 +448,60 @@ export class ECLWUNode extends Item<ECLWatchTree> {
this._wu.abort().then(() => this._tree._onDidChangeTreeData.fire(this));
}

protect() {
this._wu.protect();
setState(stateID: WUStateID) {
const service = new WorkunitsService({ baseUrl: this._wu.BaseUrl });
return service.WUUpdate({
Wuid: this._wu.Wuid,
State: stateID as unknown as string
}).then(() => this._tree.refresh());
}

setStateCompiled() {
this.setState(WUStateID.Compiled);
}

setStateRunning() {
this.setState(WUStateID.Running);
}

setStateCompleted() {
this.setState(WUStateID.Completed);
}

setStateFailed() {
this.setState(WUStateID.Failed);
}

setStateArchived() {
this.setState(WUStateID.Archived);
}

setStateAborting() {
this.setState(WUStateID.Aborting);
}

setStateAborted() {
this.setState(WUStateID.Aborted);
}

setStateBlocked() {
this.setState(WUStateID.Blocked);
}

setStateSubmitted() {
this.setState(WUStateID.Submitted);
}

setStateScheduled() {
this.setState(WUStateID.Scheduled);
}

setStateCompiling() {
this.setState(WUStateID.Compiling);
}

unprotect() {
this._wu.unprotect();
setStateWait() {
this.setState(WUStateID.Wait);
}

delete() {
Expand All @@ -439,8 +525,7 @@ export class ECLWUNode extends Item<ECLWatchTree> {
}

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

Expand Down

0 comments on commit 58fbac2

Please sign in to comment.