Skip to content

Commit

Permalink
fix(api): fix retro migrate, set node context from workflow maps (#3600)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux committed Nov 15, 2018
1 parent fbee444 commit d9d8695
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
27 changes: 27 additions & 0 deletions sdk/workflow.go
Expand Up @@ -72,6 +72,33 @@ func (w *Workflow) RetroMigrate() {
w.Joins = append(w.Joins, j.retroMigrateJoin())
}
}

// Set context on old node
for _, n := range w.Nodes(true) {
node := w.GetNode(n.ID)
if node.Context == nil {
continue
}

if node.Context.ApplicationID != 0 {
app, ok := w.Applications[node.Context.ApplicationID]
if ok {
node.Context.Application = &app
}
}
if node.Context.EnvironmentID != 0 {
env, ok := w.Environments[node.Context.EnvironmentID]
if ok {
node.Context.Environment = &env
}
}
if node.Context.ProjectPlatformID != 0 {
pp, ok := w.ProjectPlatforms[node.Context.ProjectPlatformID]
if ok {
node.Context.ProjectPlatform = &pp
}
}
}
}

// Migrate old workflow struct into new workflow struct
Expand Down
3 changes: 2 additions & 1 deletion ui/src/app/shared/workflow/wnode/wnode.component.ts
Expand Up @@ -103,7 +103,8 @@ export class WorkflowWNodeComponent implements OnInit {
if (this._workflowEventStore.isRunSelected() && this.currentNodeRun) {
this._router.navigate([
'node', this.currentNodeRun.id
], {relativeTo: this._activatedRoute, queryParams: {name: this.node.name}});
], {relativeTo: this._activatedRoute, queryParams: {name: this.node.name,
node_id: this.node.id, node_ref: this.node.ref}});
} else {
this._router.navigate([
'/project', this.project.key,
Expand Down
Expand Up @@ -75,7 +75,7 @@ export class WorkflowNodeRunComponent {
this._activatedRoute.params.subscribe(params => {
this.nodeRun = null;
let number = params['number'];
let nodeRunId = params['node_id'];
let nodeRunId = params['nodeId'];

if (this.project && this.project.key && this.workflowName && number && nodeRunId) {
// Get workflow Run
Expand Down

0 comments on commit d9d8695

Please sign in to comment.