Skip to content
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

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Conversation

dehilsterlexis
Copy link
Contributor

No description provided.

@dehilsterlexis dehilsterlexis changed the title feqat:Add set states feat: Add set states Jan 17, 2024
@dehilsterlexis
Copy link
Contributor Author

@GordonSmith the update function uses the Request interface that does not have a StateID numeric argument, only a State string.

@GordonSmith
Copy link
Member

@dehilsterlexis ECL Watch calls WUAction with:

Wuids: W20240118-144332
WUActionType: SetToFailed
ActionType: SetToFailed

@dehilsterlexis
Copy link
Contributor Author

@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).

@GordonSmith
Copy link
Member

The generic method is "WUAction" which takes an array of wuids and the ActionType.

@dehilsterlexis
Copy link
Contributor Author

dehilsterlexis commented Jan 18, 2024

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.

@GordonSmith
Copy link
Member

@dehilsterlexis
Copy link
Contributor Author

@GordonSmith those are not them. Here is the list: click here


vscode.commands.registerCommand("hpccPlatform.setStateFailed", (wuNode: ECLWUNode) => {
wuNode.setStateFailed();
this.refresh();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.refresh


unprotect() {
this._wu.unprotect();
}
Copy link
Member

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

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

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"});
}

Copy link
Member

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());

@dehilsterlexis dehilsterlexis force-pushed the ADD_SET_STATES branch 3 times, most recently from 5e5c5c2 to cf88ba0 Compare January 19, 2024 19:23
@dehilsterlexis
Copy link
Contributor Author

@GordonSmith for review

}

setStateCompiled() {
this.setState(WUStateID.Compiled).then(() => this._tree.refresh());
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

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";

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank space?

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@GordonSmith GordonSmith merged commit 4ee1e25 into hpcc-systems:trunk Jan 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants