diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aa9e1b1..6ec59336 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.25.0](https://github.com/hpcc-systems/vscode-ecl/compare/v2.24.0...v2.25.0) (2023-12-19) + + +### Features + +* Adding matching WU Context Menu functionality from the ECL IDE ([9da291a](https://github.com/hpcc-systems/vscode-ecl/commit/9da291a87431e1da5a736bc95209075ee057e29b)) + + +### Bug Fixes + +* Workaround VSCode 1.85.x regression ([014ac55](https://github.com/hpcc-systems/vscode-ecl/commit/014ac55abe0a87aaffee9e05f65742d61cef3d7d)) + ## [2.24.0](https://github.com/hpcc-systems/vscode-ecl/compare/v2.23.7...v2.24.0) (2023-10-27) diff --git a/package-lock.json b/package-lock.json index 1cef8182..98998688 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ecl", - "version": "2.24.0", + "version": "2.25.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ecl", - "version": "2.24.0", + "version": "2.25.0", "dependencies": { "@vscode/webview-ui-toolkit": "1.2.2", "csv": "^6.3.5", @@ -15,7 +15,7 @@ "devDependencies": { "@fluentui/react": "8.111.2", "@hpcc-js/common": "2.71.11", - "@hpcc-js/comms": "2.86.0", + "@hpcc-js/comms": "2.87.0", "@hpcc-js/ddl-shim": "2.20.5", "@hpcc-js/dgrid2": "2.3.11", "@hpcc-js/loader": "2.104.28", @@ -971,9 +971,9 @@ } }, "node_modules/@hpcc-js/comms": { - "version": "2.86.0", - "resolved": "https://registry.npmjs.org/@hpcc-js/comms/-/comms-2.86.0.tgz", - "integrity": "sha512-+oNr7s/YFr4+quKK4ZBpWT/KjLO/0ZLXqg+aIY2leqL6Euog7z/VbA/6ClRdWNFblyxtgi47hH2rWR2Hd+vs4g==", + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/@hpcc-js/comms/-/comms-2.87.0.tgz", + "integrity": "sha512-ZEAu/i96kces6nKZOBMbtkgZalRIMYH9gxvRdOg+URK1vTQ6g/RnO6MKxc0BG73ttCMbWVP6Un1XxRAa/sb2Vw==", "dev": true, "dependencies": { "@hpcc-js/ddl-shim": "^2.20.6", @@ -983,7 +983,7 @@ "node-fetch": "2.7.0", "safe-buffer": "5.2.1", "tmp": "0.2.1", - "undici": "5.26.3" + "undici": "5.28.2" } }, "node_modules/@hpcc-js/comms/node_modules/@hpcc-js/ddl-shim": { @@ -13817,9 +13817,9 @@ "dev": true }, "node_modules/undici": { - "version": "5.26.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.3.tgz", - "integrity": "sha512-H7n2zmKEWgOllKkIUkLvFmsJQj062lSm3uA4EYApG8gLuiOM0/go9bIoC3HVaSnfg4xunowDE2i9p8drkXuvDw==", + "version": "5.28.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", + "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", "dev": true, "dependencies": { "@fastify/busboy": "^2.0.0" diff --git a/package.json b/package.json index 0971600f..15e07646 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "ecl", - "version": "2.24.0", + "version": "2.25.0", "publisher": "hpcc-systems", "displayName": "ECL Language", "description": "ECL (Enterprise Control Language) support for Visual Studio Code", @@ -413,6 +413,66 @@ "title": "%Unprotect Workunit%", "enablement": "viewItem =~ /ECLWUNodeComplete/" }, + { + "command": "hpccPlatform.setStateCompiled", + "category": "ECL", + "title": "%Compiled%" + }, + { + "command": "hpccPlatform.setStateRunning", + "category": "ECL", + "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", "category": "ECL", @@ -664,7 +724,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", @@ -876,6 +992,10 @@ "command": "hpccPlatform.unprotectWU", "group": "3action@940" }, + { + "submenu": "setState", + "group": "3action@950" + }, { "command": "hpccResources.bundles.homepage", "when": "view == hpccResources.bundles && viewItem =~ /^BundlesItem/", diff --git a/package.nls.json b/package.nls.json index 04574325..85c6eea9 100644 --- a/package.nls.json +++ b/package.nls.json @@ -1,5 +1,7 @@ { "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", @@ -7,9 +9,11 @@ "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", @@ -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", @@ -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", @@ -81,12 +89,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", @@ -98,6 +108,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", @@ -121,6 +132,7 @@ "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" } \ No newline at end of file diff --git a/src/ecl/eclWatchTree.ts b/src/ecl/eclWatchTree.ts index 93f7af5d..10f81cdf 100644 --- a/src/ecl/eclWatchTree.ts +++ b/src/ecl/eclWatchTree.ts @@ -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"; @@ -57,8 +57,8 @@ export class ECLWatchTree extends Tree { this.refresh(); }); - vscode.commands.registerCommand("hpccPlatform.refresh", () => { - this.refresh(); + vscode.commands.registerCommand("hpccPlatform.refresh", (element?: Item) => { + this.refresh(element); }); vscode.commands.registerCommand("hpccPlatform.openResults", (wuNode: ECLWUNode) => { @@ -68,7 +68,7 @@ export class ECLWatchTree extends Tree { vscode.commands.registerCommand("hpccPlatform.browseMetrics", (wuNode: ECLWUNode) => { wuNode.browseMetrics(); }); - + vscode.commands.registerCommand("hpccPlatform.browseECLWatch", (wuNode: ECLWUNode) => { wuNode.browseECLWatch(); }); @@ -101,6 +101,54 @@ export class ECLWatchTree extends Tree { wuNode.unprotect(); }); + vscode.commands.registerCommand("hpccPlatform.setStateCompiled", (wuNode: ECLWUNode) => { + wuNode.setStateCompiled(); + }); + + 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(); + }); + } static attach(ctx: vscode.ExtensionContext) { @@ -115,9 +163,9 @@ export class ECLWatchTree extends Tree { vscode.commands.executeCommand("setContext", "hpccPlatform.isAllWorkunits", !this._myWorkunits); } - refresh(): void { + refresh(element?: Item): void { this.updateMenu(); - super.refresh(); + super.refresh(element); } getRootChildren(): vscode.ProviderResult[]> { @@ -229,7 +277,6 @@ export const Circle = { const globe = new vscode.ThemeIcon("globe"); class ECLErrorNode extends Item { - private _wu: Workunit; constructor(tree: ECLWatchTree, private _error: Error) { super(tree); @@ -278,7 +325,6 @@ export class ECLResultNode extends Item { contextValue(): string { return "ECLResultNode"; } - } class ECLOutputsNode extends Item { @@ -318,17 +364,17 @@ export class ECLWUNode extends Item { this._wu = wu; this.url = `${wu.BaseUrl}/?Widget=WUDetailsWidget&Wuid=${wu.Wuid}`; if (!this._wu.isComplete()) { - let prevStateID; this._wu.watchUntilComplete(changes => { - if (prevStateID !== this._wu.StateID) { - prevStateID = this._wu.StateID; - this._tree._onDidChangeTreeData.fire(this); - } + tree.refresh(this); }); } } getLabel(): string { + return this._wu.Jobname || this._wu.Wuid; + } + + getDescription(): string { let primary = this._wu.Wuid; const extras: string[] = []; if (!this._wu.isComplete() || this._wu.isDeleted()) extras.push(this._wu.State); @@ -382,7 +428,7 @@ export class ECLWUNode extends Item { } browseMetrics() { - vscode.env.openExternal(vscode.Uri.parse(this.url+"/metrics")); + vscode.env.openExternal(vscode.Uri.parse(this.url + "/metrics")); } browseECLWatch() { @@ -392,7 +438,7 @@ export class ECLWUNode extends Item { openECL() { this._wu.fetchQuery().then((inf: WUInfo.Query) => { const ecl = inf.Text; - vscode.workspace.openTextDocument({content: ecl, language: "ecl"}).then(document => { + vscode.workspace.openTextDocument({ content: ecl, language: "ecl" }).then(document => { vscode.window.showTextDocument(document); }); }); @@ -408,7 +454,63 @@ export class ECLWUNode extends Item { } abort() { - this._wu.abort().then(() => this._tree._onDidChangeTreeData.fire(this)); + this._wu.abort().then(() => this._tree.refresh(this)); + } + + 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); + } + + setStateWait() { + this.setState(WUStateID.Wait); } protect() { diff --git a/src/ecl/tree.ts b/src/ecl/tree.ts index b3482505..ba423122 100644 --- a/src/ecl/tree.ts +++ b/src/ecl/tree.ts @@ -3,8 +3,8 @@ import { ExtensionContext, Event, EventEmitter, TreeItem, TreeDataProvider, Comm export class Tree implements TreeDataProvider { _ctx: ExtensionContext; - _onDidChangeTreeData: EventEmitter = new EventEmitter(); - readonly onDidChangeTreeData: Event = this._onDidChangeTreeData.event; + private _onDidChangeTreeData: EventEmitter = new EventEmitter(); + readonly onDidChangeTreeData: Event = this._onDidChangeTreeData.event; protected _treeView: TreeView; @@ -17,8 +17,8 @@ export class Tree implements TreeDataProvider { }); } - refresh(): void { - this._onDidChangeTreeData.fire(null); + refresh(element?: Item): void { + this._onDidChangeTreeData.fire(element); } getTreeItem(node: Item): TreeItem | Thenable { diff --git a/src/eclwatch/WUResult.tsx b/src/eclwatch/WUResult.tsx index 93d0536e..96325146 100644 --- a/src/eclwatch/WUResult.tsx +++ b/src/eclwatch/WUResult.tsx @@ -312,11 +312,15 @@ export class WUResultTable extends Common { this._prevHash = hash; this._result = this.calcResult(); if (this._result) { - this._result.fetchXMLSchema().then(schema => { - const store = new Store(this._result, schema, this.renderHtml()); - this._dgrid?.set("columns", store.columns()); - this._dgrid?.set("collection", store); - }); + this._result.fetchXMLSchema() + .then(schema => { + const store = new Store(this._result, schema, this.renderHtml()); + this._dgrid?.set("columns", store.columns()); + this._dgrid?.set("collection", store); + }).catch(e => { + this._prevHash = undefined; + }) + ; } } if (this._prevGrid !== this._dgrid) { diff --git a/src/eclwatch/WUResultStore.ts b/src/eclwatch/WUResultStore.ts index 9823a3c3..4c3221bf 100644 --- a/src/eclwatch/WUResultStore.ts +++ b/src/eclwatch/WUResultStore.ts @@ -186,7 +186,10 @@ export class Store { fetchRange(options): Promise { const retVal = new Deferred(); - this._request(options.start, options.end).then(response => retVal.resolve(response)); + this._request(options.start, options.end) + .then(response => retVal.resolve(response)) + .catch(e => retVal.reject(e)) + ; return new QueryResults(retVal.then(response => response.data), { totalLength: retVal.then(response => response.totalLength) });