Skip to content

Commit

Permalink
resolved merge conflicts from latest master, re #27
Browse files Browse the repository at this point in the history
  • Loading branch information
whatisgalen committed Jun 12, 2019
2 parents bd91f13 + 3ac7c7e commit 12aecb1
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -1,63 +1,135 @@
define([
'knockout',
'viewmodels/workflow',
'viewmodels/workflow-step',
'views/components/workflows/new-tile-step',
'views/components/workflows/set-tile-value',
'views/components/workflows/get-tile-value',
'views/components/workflows/set-reference-numbers'
'viewmodels/workflow-step'
], function(ko, Workflow, Step) {
return ko.components.register('add-consultation', {
viewModel: function(params) {

var self = this;

params.steps = [
{
title: 'Assign Address',
name: 'assignaddress',
description: 'Assign an address to your application area. Use the address as the default name',
component: 'get-tile-value',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: 'e857704a-53d8-11e9-b05a-dca90488358a',
component: 'views/components/workflows/get-tile-value',
componentname: 'get-tile-value',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: '9dc86b0c-6c48-11e9-8cbe-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-envelope'
icon: 'fa-envelope',
nameheading: 'Consultation Name',
namelabel: 'Make the Consultation Name the same as the Consultation Address'
},
{
title: 'Assign Name',
name: 'setname',
description: 'Assign a name to your application area',
component: 'set-tile-value',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: 'c5f909b5-53c7-11e9-a3ac-dca90488358a',
component: 'views/components/workflows/set-tile-value',
componentname: 'set-tile-value',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: 'e6f0688a-53f1-11e9-93a2-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-tag'
},
{
title: 'Add Ref Numbers',
description: 'step to add ref numbers using new wkflow step',
component: 'set-reference-numbers',
title: 'Related Application Area',
description: 'Identify the Development Area for this Consultation',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: 'daf936f5-540a-11e9-8a83-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-code-fork'
},
{
title: 'Application Details',
description: 'Summary of the Application and Consultation Type',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: '04723f59-53f2-11e9-b091-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-list-alt'
},
{
title: 'Reference Numbers',
description: 'Application Reference Numbers',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: '3c79d87a-53f2-11e9-a14e-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-hashtag'
},
{
title: 'Application Proposal',
description: 'Summary of the Application that will be reviewed under this Consultation',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: 'f34ebbd4-53f3-11e9-b649-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-clipboard'
},
{
title: 'Contacts',
description: 'Identify the key people/organizations associated with this consultation',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '08359c2e-53f0-11e9-b212-dca90488358a',
nodegroupid: '17c07f07-53f5-11e9-9c94-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-users'
}
];

Workflow.apply(this, [params]);

this.next = function(){
var previousStep;
var activeStep = self.activeStep();
if (activeStep && activeStep.complete() && activeStep._index < self.steps.length - 1) {
this.updateUrl(activeStep, 'forward')
self.previousStep = activeStep;
self.activeStep(self.steps[activeStep._index+1]);
self.activeStep().resourceid = self.previousStep.resourceid
this.updateState = function(val) {
var activeStep = val;
var previousStep = self.previousStep();
if (previousStep) {
self.state.steps[ko.unwrap(previousStep.name)] = previousStep.stateProperties();
self.state.activestep = val._index;
self.state.previousstep = previousStep._index;
self.updateUrl();
}
};
if (ko.unwrap(activeStep.name) === 'assignaddress') {
activeStep.requirements = self.state.steps.assignaddress;
}
if (ko.unwrap(activeStep.name) === 'setname') {
if (self.state.steps['assignaddress']) {
var tiledata = self.state.steps['assignaddress'].tile
var tilevals = _.map(tiledata, function(v, k) {return v})
var nodeval = tilevals[0] + "," + tilevals[1] + " " + tilevals[2];
activeStep.requirements = self.state.steps.setname || {};
activeStep.requirements.applyOutputToTarget = self.state.steps['assignaddress'].applyOutputToTarget;
activeStep.requirements.targetnode = 'e6f0688a-53f1-11e9-93a2-dca90488358a';
activeStep.requirements.targetnodegroup = ko.unwrap(activeStep.nodegroupid);
activeStep.requirements.value = nodeval;
}
}
self.previousStep(val);
}

self.activeStep.subscribe(this.updateState);

self.ready(true);
},
template: { require: 'text!templates/views/components/plugins/add-consultation.htm' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,25 @@ define([
params.steps = [
{
title: 'Assign Address',
name: 'assignaddress',
description: 'Assign an address to your application area. Use the address as the default name',
component: 'get-tile-value',
component: 'views/components/workflows/get-tile-value',
componentname: 'get-tile-value',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: 'e857704a-53d8-11e9-b05a-dca90488358a',
resourceid: null,
tileid: null,
parenttileid: null,
icon: 'fa-envelope'
icon: 'fa-envelope',
nameheading: 'Application Area Name',
namelabel: 'Make the Area Name the same as the Area Address'
},
{
title: 'Assign Name',
name: 'setname',
description: 'Assign a name to your application area',
component: 'set-tile-value',
component: 'views/components/workflows/set-tile-value',
componentname: 'set-tile-value',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: 'c5f909b5-53c7-11e9-a3ac-dca90488358a',
resourceid: null,
Expand All @@ -35,7 +41,8 @@ define([
{
title: 'Area Map',
description: 'Draw (or select from the Development Area Overlay) the extent of...',
component: 'new-tile-step',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: 'eafced66-53d8-11e9-a4e2-dca90488358a',
resourceid: null,
Expand All @@ -46,7 +53,8 @@ define([
{
title: 'Area Description',
description: 'Describe the Application Area',
component: 'new-tile-step',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: '63cdcf0f-53da-11e9-8340-dca90488358a',
resourceid: null,
Expand All @@ -57,7 +65,8 @@ define([
{
title: 'Area Designations',
description: 'Select the Application Area designations',
component: 'new-tile-step',
component: 'views/components/workflows/new-tile-step',
componentname: 'new-tile-step',
graphid: '336d34e3-53c3-11e9-ba5f-dca90488358a',
nodegroupid: 'e19fe3a1-6d22-11e9-98bf-dca90488358a',
resourceid: null,
Expand All @@ -69,16 +78,37 @@ define([

Workflow.apply(this, [params]);

this.next = function(){
var previousStep;
var activeStep = self.activeStep();
if (activeStep && activeStep.complete() && activeStep._index < self.steps.length - 1) {
this.updateUrl(activeStep, 'forward')
self.previousStep = activeStep;
self.activeStep(self.steps[activeStep._index+1]);
self.activeStep().resourceid = self.previousStep.resourceid
this.updateState = function(val) {
var activeStep = val;
var previousStep = self.previousStep();
if (previousStep) {
self.state.steps[ko.unwrap(previousStep.name)] = previousStep.stateProperties();
self.state.activestep = val._index;
self.state.previousstep = previousStep._index;
self.updateUrl();
}
};
if (ko.unwrap(activeStep.name) === 'assignaddress') {
activeStep.requirements = self.state.steps.assignaddress;
}
if (ko.unwrap(activeStep.name) === 'setname') {
if (self.state.steps['assignaddress']) {
var tiledata = self.state.steps['assignaddress'].tile
var tilevals = _.map(tiledata, function(v, k) {return v})
var nodeval = tilevals[0] + "," + tilevals[1] + " " + tilevals[2];
activeStep.requirements = self.state.steps.setname || {};
activeStep.requirements.applyOutputToTarget = self.state.steps['assignaddress'].applyOutputToTarget;
activeStep.requirements.targetnode = '1b95fb70-53ef-11e9-9001-dca90488358a';
activeStep.requirements.targetnodegroup = ko.unwrap(activeStep.nodegroupid);
activeStep.requirements.value = nodeval;
}
}
self.previousStep(val);
}

self.activeStep.subscribe(this.updateState);



self.ready(true);
},
template: { require: 'text!templates/views/components/plugins/application-area.htm' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,27 @@ define([
function viewModel(params) {
var self = this;
params.applyOutputToTarget = ko.observable(true);

if (!params.resourceid() && params.requirements){
params.resourceid(params.requirements.resourceid);
params.tileid(params.requirements.tileid);
}

NewTileStep.apply(this, [params]);

this.nameheading = params.nameheading;
this.namelabel = params.namelabel;
this.applyOutputToTarget = params.applyOutputToTarget;
params.tile = self.tile;

self.tile.subscribe(function(a){console.log(a)});
params.getForwardUrlParams = ko.pureComputed(function(){
var value = '';
if (ko.unwrap(self.tile)) {
_.each(koMapping.toJS(self.tile().data), function(v, k) {
if(v) {
value += ' ' + v
}
});
}
forwardParams = {
applyOutputToTarget: params.applyOutputToTarget,
graphid: params.graphid,
icon: params.icon,
iconClass: params.iconClass,
loading: params.loading,
nodegroupid: params.nodegroupid,
parenttileid: params.parenttileid,
resourceid: params.resourceid,
targetnode: '1b95fb70-53ef-11e9-9001-dca90488358a',
targetnodegroup: 'c5f909b5-53c7-11e9-a3ac-dca90488358a',
value: value
}
return koMapping.toJS(forwardParams);
});
params.stateProperties = function(){
return {
resourceid: ko.unwrap(params.resourceid),
tile: !!(params.tile) ? koMapping.toJS(params.tile().data) : undefined,
tileid: !!(params.tile) ? ko.unwrap(params.tile().tileid): undefined,
applyOutputToTarget: ko.unwrap(this.applyOutputToTarget)
}
};
};


Expand All @@ -46,5 +39,6 @@ define([
require: 'text!templates/views/components/workflows/get-tile-value.htm'
}
});

return viewModel;
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,35 @@ define([
'jquery',
'arches',
'knockout',
'knockout-mapping',
'views/components/workflows/new-tile-step'
], function(_, $, arches, ko, NewTileStep) {
], function(_, $, arches, ko, koMapping, NewTileStep) {

function viewModel(params) {

if (!params.resourceid() && params.requirements){
params.resourceid(params.requirements.resourceid);
params.tileid(params.requirements.tileid);
}

NewTileStep.apply(this, [params]);
var self = this;
var urlparams = params.parseUrlParams()
self.requirements = params.requirements;
params.tile = self.tile;

params.stateProperties = function(){
return {
resourceid: ko.unwrap(params.resourceid),
tile: !!(params.tile) ? koMapping.toJS(params.tile().data) : undefined,
tileid: !!(params.tile) ? ko.unwrap(params.tile().tileid): undefined
}
};

self.tile.subscribe(function(val) {
if(val) {
if(urlparams) {
if (urlparams.applyOutputToTarget) {
val.data[urlparams.targetnode](urlparams.value);
if(self.requirements) {
if (self.requirements.applyOutputToTarget) {
val.data[self.requirements.targetnode](self.requirements.value);
}
}
}
Expand Down
Loading

0 comments on commit 12aecb1

Please sign in to comment.