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

fix(api, ui): synchronous ended child workflow + navigation parent/child #5261

Merged
merged 2 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion engine/api/workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,6 @@ func (api *API) initWorkflowRun(ctx context.Context, projKey string, wf *sdk.Wor
report.Merge(ctx, r)
return
}

workflow.ResyncNodeRunsWithCommits(ctx, api.mustDB(), api.Cache, *p, report)

// Purge workflow run
Expand All @@ -1023,6 +1022,16 @@ func (api *API) initWorkflowRun(ctx context.Context, projKey string, wf *sdk.Wor
log.Error(ctx, "workflow.PurgeWorkflowRun> error %v", err)
}
}, api.PanicDump())

// Update parent
for i := range report.WorkflowRuns() {
run := &report.WorkflowRuns()[i]
reportParent, err := updateParentWorkflowRun(ctx, api.mustDB, api.Cache, run)
if err != nil {
log.Error(ctx, "unable to update parent workflow run: %v", err)
}
go WorkflowSendEvent(context.Background(), api.mustDB(), api.Cache, *p, reportParent)
}
}

func failInitWorkflowRun(ctx context.Context, db *gorp.DbMap, wfRun *sdk.WorkflowRun, err error) *workflow.ProcessorReport {
Expand Down
3 changes: 3 additions & 0 deletions ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ build: $(FILES_UI) $(INDEX) ui.tar.gz

ui.tar.gz:
tar cfz ui.tar.gz dist

lintfix:
./node_modules/.bin/ng lint --fix
12 changes: 10 additions & 2 deletions ui/src/app/views/workflow/run/workflow.run.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Select, Store } from '@ngxs/store';
import { PipelineStatus, SpawnInfo } from 'app/model/pipeline.model';
import { Project } from 'app/model/project.model';
import { WorkflowRun } from 'app/model/workflow.run.model';
import { NotificationService } from 'app/service/notification/notification.service';
import { RouterService } from 'app/service/router/router.service';
import { WorkflowStore } from 'app/service/workflow/workflow.store';
import { AutoUnsubscribe } from 'app/shared/decorator/autoUnsubscribe';
import { ProjectState } from 'app/store/project.state';
Expand Down Expand Up @@ -55,13 +56,20 @@ export class WorkflowRunComponent implements OnInit {
private _notification: NotificationService,
private _translate: TranslateService,
private _titleService: Title,
private _cd: ChangeDetectorRef
private _cd: ChangeDetectorRef,
private _router: Router,
private _routerService: RouterService
) {
this.project = this._store.selectSnapshot(ProjectState.projectSnapshot);
this.workflowName = this._store.selectSnapshot(WorkflowState.workflowSnapshot).name;
this._store.dispatch(new ChangeToRunView({}));

this.paramsSub = this._activatedRoute.params.subscribe(p => {
let allParamsSnapshot = this._routerService.getRouteSnapshotParams({}, this._router.routerState.snapshot.root);
if (allParamsSnapshot['workflowName'] !== this.workflowName) {
// If workflow change, component will be destroy by parent
return;
}
this.workflowRunData = {};
this._cd.markForCheck();
this._store.dispatch(
Expand Down