Skip to content

Commit

Permalink
Instantiates workflow steps from within the step constructor. re #4821
Browse files Browse the repository at this point in the history
  • Loading branch information
chiatt committed Jun 7, 2019
1 parent 22b3ed5 commit 907be95
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions arches/app/media/js/viewmodels/workflow-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ define([
}
return ret + ' ' + ko.unwrap(this.icon);
}, this);

this.ready = ko.observable(false);
var self = this;

require([config.component], function(componentViewmodel) {
self.componentViewmodel = componentViewmodel;
self.ready(true);
});
};
return WorkflowStep;
});
5 changes: 5 additions & 0 deletions arches/app/media/js/viewmodels/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ define([
step.loading = self.loading;
step.alert = self.alert;
self.steps[i] = new Step(step);
self.steps[i].ready.subscribe(function(val){
if (val) {
console.log(self.steps[i])
}
})
self.steps[i].complete.subscribe(function(complete) {
if (complete && self.advance) self.next();
});
Expand Down
6 changes: 4 additions & 2 deletions arches/app/templates/views/components/plugins/workflow.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
<div class="workflow-nav-controls right"><i class="fa fa-chevron-circle-right" data-bind="click: next"></i></div>
</div>
<div class='workflow-step-body'>
<!--ko if: activeStep().component-->
<!--ko if: activeStep().ready() -->
<!--ko if: activeStep().componentname-->
<!-- ko component: {
name: activeStep().component,
name: activeStep().componentname,
params: activeStep()
} --><!--/ko-->
<!--/ko-->
<!--/ko-->
</div>
</div>
Expand Down

0 comments on commit 907be95

Please sign in to comment.