-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add set states #372
feat: Add set states #372
Conversation
Signed-off-by: David de Hilster <[email protected]>
@GordonSmith the update function uses the Request interface that does not have a StateID numeric argument, only a State string. |
@dehilsterlexis ECL Watch calls WUAction with:
|
@GordonSmith SetToFailed is the only state changing action right now. There are 12 of them in total. Either we implement each one in the same way or look into creating a more generic SetState function. My suggestion is to add a new action called "SetState" in comms and in onDFUWorkunitsAction. That is something I believe I could do in all three places (the third being vscode-ecl). |
The generic method is "WUAction" which takes an array of wuids and the ActionType. |
Yes, but the way it is currently set up, we can only do set failed. There is no way to pass the other states. |
I think they are all already implemented here: https://github.com/hpcc-systems/Visualization/blob/trunk/packages/comms/src/ecl/workunit.ts#L365-L407 ? |
@GordonSmith those are not them. Here is the list: click here |
src/ecl/eclWatchTree.ts
Outdated
|
||
vscode.commands.registerCommand("hpccPlatform.setStateFailed", (wuNode: ECLWUNode) => { | ||
wuNode.setStateFailed(); | ||
this.refresh(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.refresh
src/ecl/eclWatchTree.ts
Outdated
|
||
unprotect() { | ||
this._wu.unprotect(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protect / unprotect from diff PR
src/ecl/eclWatchTree.ts
Outdated
vscode.commands.registerCommand("hpccPlatform.unprotectWU", (wuNode: ECLWUNode) => { | ||
wuNode.unprotect(); | ||
this.refresh(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protect / unprotect from diff PR
setStateFailed() { | ||
this._wu.update({"State": "failed"}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try 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
});
}
setStateFailed() {
this.setState(WUStateID.Failed).then(() => this._tree.refresh());
5e5c5c2
to
cf88ba0
Compare
@GordonSmith for review |
src/ecl/eclWatchTree.ts
Outdated
} | ||
|
||
setStateCompiled() { | ||
this.setState(WUStateID.Compiled).then(() => this._tree.refresh()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move the .then(() => this._tree.refresh())
into the setState
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
src/ecl/eclWatchTree.ts
Outdated
import * as vscode from "vscode"; | ||
import { sessionManager } from "../hpccplatform/session"; | ||
import localize from "../util/localize"; | ||
import { Item, Tree } from "./tree"; | ||
import { eclWatchPanelView } from "./eclWatchPanelView"; | ||
import { SaveData } from "./saveData"; | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank space?
Signed-off-by: David de Hilster <[email protected]>
cf88ba0
to
58fbac2
Compare
No description provided.