Skip to content

Commit

Permalink
Merge pull request #4743 from archesproject/4669_new_tile_workflow
Browse files Browse the repository at this point in the history
 minoir enhancements to map widget
  • Loading branch information
robgaston authored Apr 3, 2019
2 parents 70f160f + b450361 commit b726f05
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 40 deletions.
13 changes: 8 additions & 5 deletions arches/app/media/js/viewmodels/workflow-step.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
define([
'knockout', 'underscore'
'knockout',
'underscore'
], function(ko, _) {
var WorkflowStep = function(config) {
this.classUnvisited = 'workflow-step-icon';
this.classActive = 'workflow-step-icon active';
this.classComplete = 'workflow-step-icon complete';
this.icon = 'fa-chevron-circle-right';
this.title = config.title || 'Title';
this.subtitle = config.subtitle || 'Subtitle';
this.description = config.description || 'description of step here';
this.title = '';
this.subtitle = '';
this.description = '';
this.complete = ko.observable(false);
this.active = ko.observable(false);
this.active = ko.computed(function() {
return config.workflow.activeStep() === this;
}, this);

_.extend(this, config);

Expand Down
4 changes: 2 additions & 2 deletions arches/app/media/js/viewmodels/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ define([
this.ready.subscribe(function() {
self.steps.forEach(function(step, i) {
if (!(self.steps[i] instanceof Step)) {
step.workflow = self;
self.steps[i] = new Step(step);
}
self.steps[i]._index = i;
Expand All @@ -23,8 +24,7 @@ define([

this.next = function(){
var activeStep = self.activeStep();
if (activeStep && activeStep._index < self.steps.length - 1) {
activeStep.complete(true);
if (activeStep && activeStep.complete() && activeStep._index < self.steps.length - 1) {
self.activeStep(self.steps[activeStep._index+1]);
}
};
Expand Down
5 changes: 3 additions & 2 deletions arches/app/media/js/views/components/widgets/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,8 @@ define([
return layer.id === feature.layer.id;
});
});
return !overlay.invisible();
if (overlay) return !overlay.invisible();
else return true;
};

var highlightFeature = function(feature, layerIdSuffix, filterProperty, style) {
Expand Down Expand Up @@ -1476,7 +1477,7 @@ define([
}
});
}
if (sourceLayer.filter) {
if (sourceLayer && sourceLayer.filter) {
var clickCacheFeatureId;
var clickCacheFilterProperty;
if (self.clickSourceLayerCache && self.clickData()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ define([
return ko.components.register('new-tile-step', {
viewModel: function(params) {
console.log(params);
this.componentname = 'default';
this.selectedCard = '';
this.selectedTile = null;
this.provisionalTileViewModel = null;
this.reviewer = null;
this.loading = ko.observable(false);
params.complete(true);
},
template: {
require: 'text!templates/views/components/workflows/new-tile-step.htm'
Expand Down
54 changes: 30 additions & 24 deletions arches/app/media/js/views/resource/new-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,35 @@ define([
datatypes: data.datatypes
});

var topCards = _.filter(data.cards, function(card) {
var nodegroup = _.find(data.nodegroups, function(group) {
return group.nodegroupid === card.nodegroup_id;
});
return !nodegroup || !nodegroup.parentnodegroup_id;
}).map(function(card) {
return new CardViewModel({
card: card,
graphModel: graphModel,
tile: null,
resourceId: resourceId,
displayname: displayname,
handlers: handlers,
cards: data.cards,
tiles: tiles,
selection: selection,
scrollTo: scrollTo,
loading: loading,
filter: filter,
provisionalTileViewModel: provisionalTileViewModel,
cardwidgets: data.cardwidgets,
userisreviewer: data.userisreviewer
});
});

topCards.forEach(function(topCard) {
topCard.topCards = topCards;
});

var vm = {
loading: loading,
scrollTo: scrollTo,
Expand Down Expand Up @@ -130,30 +159,7 @@ define([
toggleAll(false);
},
rootExpanded: ko.observable(true),
topCards: _.filter(data.cards, function(card) {
var nodegroup = _.find(data.nodegroups, function(group) {
return group.nodegroupid === card.nodegroup_id;
});
return !nodegroup || !nodegroup.parentnodegroup_id;
}).map(function(card) {
return new CardViewModel({
card: card,
graphModel: graphModel,
tile: null,
resourceId: resourceId,
displayname: displayname,
handlers: handlers,
cards: data.cards,
tiles: tiles,
selection: selection,
scrollTo: scrollTo,
loading: loading,
filter: filter,
provisionalTileViewModel: provisionalTileViewModel,
cardwidgets: data.cardwidgets,
userisreviewer: data.userisreviewer
});
}),
topCards: topCards,
selection: selection,
selectedTile: selectedTile,
selectedCard: ko.computed(function() {
Expand Down
2 changes: 1 addition & 1 deletion arches/app/templates/views/components/plugins/workflow.htm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="workflow-step-description">
<div class="title" data-bind="text:activeStep().title"></div>
<div class="subtitle" data-bind="text:activeStep().subtitle"></div>
<div class="step">Step <span data-bind="text:activeStep()._index"></span> of <span data-bind="text:steps.length"></span>: <span data-bind="text:activeStep().description"></span></div>
<div class="step">{% trans "Step" %} <span data-bind="text:activeStep()._index+1"></span> {% trans "of" %} <span data-bind="text:steps.length"></span>: <span data-bind="text:activeStep().description"></span></div>
</div>
<div class="workflow-nav-controls right"><i class="fa fa-chevron-circle-right" data-bind="click: next"></i></div>
</div>
Expand Down

0 comments on commit b726f05

Please sign in to comment.