Skip to content

Commit dc99a29

Browse files
authored
fix(ui): run workflow in the middle (#5077)
1 parent 9c2ac89 commit dc99a29

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

ui/src/app/shared/workflow/sidebar/run-node/workflow.sidebar.run.node.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class WorkflowSidebarRunNodeComponent implements OnDestroy, OnInit {
110110
});
111111

112112
this.nodeRunSubs = this.nodeRun$.subscribe( nrs => {
113-
if (!nrs && !this.currentWorkflowNodeRun) {
113+
if (!nrs) {
114114
return;
115115
}
116116
// If event on same noderun with same status, check if tests or artifacts changed

ui/src/app/shared/workflow/wnode/wnode.component.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import {
2020
AddHookWorkflow,
2121
AddJoinWorkflow,
2222
AddNodeTriggerWorkflow,
23-
OpenEditModal,
23+
OpenEditModal, SelectWorkflowNode,
2424
SelectWorkflowNodeRun,
2525
UpdateWorkflow
2626
} from 'app/store/workflow.action';
2727
import { WorkflowState, WorkflowStateModel } from 'app/store/workflow.state';
2828
import { Subscription } from 'rxjs';
29-
import { finalize } from 'rxjs/operators';
29+
import { finalize, tap } from 'rxjs/operators';
3030

3131
@Component({
3232
selector: 'app-workflow-wnode',
@@ -107,13 +107,17 @@ export class WorkflowWNodeComponent implements OnInit {
107107
if (this.workflow.previewMode || !popup) {
108108
return;
109109
}
110-
popup.open();
111-
if (this.currentNodeRun) {
110+
if (!this.currentNodeRun) {
111+
this._store.dispatch(new SelectWorkflowNode({
112+
node: this.node
113+
})).pipe(tap(popup.open));
114+
} else {
112115
this._store.dispatch(new SelectWorkflowNodeRun({
113116
workflowNodeRun: this.currentNodeRun,
114117
node: this.node
115-
}));
118+
})).pipe(tap(popup.open));
116119
}
120+
117121
}
118122

119123
dblClickOnNode() {

ui/src/app/store/workflow.action.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export class GetWorkflowNodeRun {
5757
constructor(public payload: { projectKey: string, workflowName: string, num: number, nodeRunID: number }) { }
5858
}
5959

60+
export class SelectWorkflowNode {
61+
static readonly type = '[Workflow] Select Workflow Node';
62+
constructor(public payload: { node: WNode }) { }
63+
}
64+
6065
export class SelectWorkflowNodeRun {
6166
static readonly type = '[Workflow] Select Workflow Node Run';
6267
constructor(public payload: { workflowNodeRun: WorkflowNodeRun, node: WNode }) { }

ui/src/app/store/workflow.state.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,21 @@ export class WorkflowState {
12291229
});
12301230
}
12311231

1232+
@Action(actionWorkflow.SelectWorkflowNode)
1233+
selectWorkflowNode(ctx: StateContext<WorkflowStateModel>, action: actionWorkflow.SelectWorkflowNode) {
1234+
const state = ctx.getState();
1235+
if (state.node && state.node.id === action.payload.node.id) {
1236+
return;
1237+
}
1238+
ctx.setState({
1239+
...state,
1240+
workflowNodeRun: null,
1241+
node: action.payload.node,
1242+
sidebar: WorkflowSidebarMode.RUNS
1243+
});
1244+
}
1245+
1246+
12321247
@Action(actionWorkflow.SelectWorkflowNodeRun)
12331248
selectWorkflowNodeRun(ctx: StateContext<WorkflowStateModel>, action: actionWorkflow.SelectWorkflowNodeRun) {
12341249
const state = ctx.getState();

0 commit comments

Comments
 (0)