initial github commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Component.extend
|
||||
tagName: 'span'
|
||||
organizations: []
|
||||
actions:
|
||||
apply_filters: ->
|
||||
@get('apply_filters')?()
|
||||
set_scope_organization: (organization) ->
|
||||
if organization?
|
||||
#organization.reload().then =>
|
||||
organization_id = organization?.get('id') || ''
|
||||
@set 'scope_organization', organization
|
||||
@set 'filters.workflow_action_definition_organization_id', organization_id
|
||||
@$('.select-organization .dropdown.button').addClass('orange')
|
||||
@send 'apply_filters'
|
||||
else
|
||||
@setProperties
|
||||
scope_organization: null
|
||||
scope_scenario: null
|
||||
'filters.workflow_action_definition_organization_id': ''
|
||||
@$('.select-organization .dropdown.button').removeClass('orange')
|
||||
@send 'apply_filters'
|
||||
@@ -0,0 +1,30 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'span',
|
||||
organizations: [],
|
||||
actions: {
|
||||
apply_filters: function() {
|
||||
var base;
|
||||
return typeof (base = this.get('apply_filters')) === "function" ? base() : void 0;
|
||||
},
|
||||
set_scope_organization: function(organization) {
|
||||
var organization_id;
|
||||
if (organization != null) {
|
||||
organization_id = (organization != null ? organization.get('id') : void 0) || '';
|
||||
this.set('scope_organization', organization);
|
||||
this.set('filters.workflow_action_definition_organization_id', organization_id);
|
||||
this.$('.select-organization .dropdown.button').addClass('orange');
|
||||
return this.send('apply_filters');
|
||||
} else {
|
||||
this.setProperties({
|
||||
scope_organization: null,
|
||||
scope_scenario: null,
|
||||
'filters.workflow_action_definition_organization_id': ''
|
||||
}, this.$('.select-organization .dropdown.button').removeClass('orange'));
|
||||
return this.send('apply_filters');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
import Ember from 'ember'
|
||||
{get} = Ember
|
||||
|
||||
export default Ember.Component.extend
|
||||
tagName: 'span'
|
||||
scope_project: null
|
||||
scope_scenario: null
|
||||
projects: []
|
||||
actions:
|
||||
apply_filters: ->
|
||||
@get('apply_filters')?()
|
||||
|
||||
edit_project_instance_action: (project_instance_action) ->
|
||||
@modal 'project/edit-instance-action', model: project_instance_action
|
||||
set_scope_project: (project) ->
|
||||
if project?
|
||||
project.reload().then =>
|
||||
project_id = project?.get('id') || ''
|
||||
@set 'scope_project', project
|
||||
@set 'filters.workflow_action_definition_title_cont', ''
|
||||
@set 'filters.project_id', project_id
|
||||
@$('.select-project .dropdown.button').addClass('orange')
|
||||
@send 'apply_filters'
|
||||
else
|
||||
@setProperties
|
||||
scope_project: null
|
||||
scope_scenario: null
|
||||
'filters.project_id': ''
|
||||
'filters.project_instance_project_scenario_id': ''
|
||||
@$('.select-project .dropdown.button').removeClass('orange')
|
||||
@send 'apply_filters'
|
||||
|
||||
set_scope_scenario: (project_scenario) ->
|
||||
if project_scenario
|
||||
scenario_id = get(project_scenario, 'id')
|
||||
@$('.select-project-scenario .dropdown.button').addClass('orange')
|
||||
else
|
||||
@$('.select-project-scenario .dropdown.button').removeClass('orange')
|
||||
scenario_id = ''
|
||||
@set 'filters.project_instance_project_scenario_id', scenario_id
|
||||
@set 'scope_scenario', project_scenario
|
||||
@send 'apply_filters'
|
||||
@@ -0,0 +1,60 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var get;
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
get = Ember.get;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'span',
|
||||
scope_project: null,
|
||||
scope_scenario: null,
|
||||
projects: [],
|
||||
actions: {
|
||||
apply_filters: function() {
|
||||
var base;
|
||||
return typeof (base = this.get('apply_filters')) === "function" ? base() : void 0;
|
||||
},
|
||||
edit_project_instance_action: function(project_instance_action) {
|
||||
return this.modal('project/edit-instance-action', {
|
||||
model: project_instance_action
|
||||
});
|
||||
},
|
||||
set_scope_project: function(project) {
|
||||
if (project != null) {
|
||||
return project.reload().then((function(_this) {
|
||||
return function() {
|
||||
var project_id;
|
||||
project_id = (project != null ? project.get('id') : void 0) || '';
|
||||
_this.set('scope_project', project);
|
||||
_this.set('filters.workflow_action_definition_title_cont', '');
|
||||
_this.set('filters.project_id', project_id);
|
||||
_this.$('.select-project .dropdown.button').addClass('orange');
|
||||
return _this.send('apply_filters');
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
this.setProperties({
|
||||
scope_project: null,
|
||||
scope_scenario: null,
|
||||
'filters.project_id': '',
|
||||
'filters.project_instance_project_scenario_id': ''
|
||||
}, this.$('.select-project .dropdown.button').removeClass('orange'));
|
||||
return this.send('apply_filters');
|
||||
}
|
||||
},
|
||||
set_scope_scenario: function(project_scenario) {
|
||||
var scenario_id;
|
||||
if (project_scenario) {
|
||||
scenario_id = get(project_scenario, 'id');
|
||||
this.$('.select-project-scenario .dropdown.button').addClass('orange');
|
||||
} else {
|
||||
this.$('.select-project-scenario .dropdown.button').removeClass('orange');
|
||||
scenario_id = '';
|
||||
}
|
||||
this.set('filters.project_instance_project_scenario_id', scenario_id);
|
||||
this.set('scope_scenario', project_scenario);
|
||||
return this.send('apply_filters');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import Ember from 'ember'
|
||||
import config from 'ember-get-config'
|
||||
|
||||
export default Ember.Component.extend
|
||||
tagName: 'img'
|
||||
init: ->
|
||||
src = if config.environment is 'development' or config.environment is 'test'
|
||||
"#{config.rootURL}ember-panda/assets/#{@get('path')}"
|
||||
else
|
||||
"#{config.rootURL}assets/#{@get('path')}"
|
||||
@set 'full_src', src
|
||||
@_super arguments...
|
||||
attributeBindings: ['full_src:src']
|
||||
@@ -0,0 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
import config from 'ember-get-config';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'img',
|
||||
init: function() {
|
||||
var src;
|
||||
src = config.environment === 'development' || config.environment === 'test' ? config.rootURL + "ember-panda/assets/" + (this.get('path')) : config.rootURL + "assets/" + (this.get('path'));
|
||||
this.set('full_src', src);
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
attributeBindings: ['full_src:src']
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Component.extend
|
||||
classNames: ['ui', 'small', 'buttons', 'active-project-scenario-selector-component']
|
||||
project: null
|
||||
active_project_scenario: null
|
||||
|
||||
actions:
|
||||
show_project_scenarios_grid: (project) ->
|
||||
@modal 'project/project-scenarios-show-grid',
|
||||
model: project
|
||||
edit_selected_project_scenario: ->
|
||||
return unless project_scenario = @get('active_project_scenario')
|
||||
@modal 'project/edit-project-scenario',
|
||||
model: project_scenario
|
||||
closeOnOverlay: false
|
||||
destroy_callback: =>
|
||||
@set 'active_project_scenario', null
|
||||
@@ -0,0 +1,30 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['ui', 'small', 'buttons', 'active-project-scenario-selector-component'],
|
||||
project: null,
|
||||
active_project_scenario: null,
|
||||
actions: {
|
||||
show_project_scenarios_grid: function(project) {
|
||||
return this.modal('project/project-scenarios-show-grid', {
|
||||
model: project
|
||||
});
|
||||
},
|
||||
edit_selected_project_scenario: function() {
|
||||
var project_scenario;
|
||||
if (!(project_scenario = this.get('active_project_scenario'))) {
|
||||
return;
|
||||
}
|
||||
return this.modal('project/edit-project-scenario', {
|
||||
model: project_scenario,
|
||||
closeOnOverlay: false,
|
||||
destroy_callback: (function(_this) {
|
||||
return function() {
|
||||
return _this.set('active_project_scenario', null);
|
||||
};
|
||||
})(this)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Component.extend
|
||||
classNames: ['project-instance-action-value-display']
|
||||
eventIO: null
|
||||
project_instance_action: null
|
||||
value_type: Ember.computed.alias 'project_instance_action.workflow_action_definition.value_type'
|
||||
save: ->
|
||||
|
||||
# https://stackoverflow.com/questions/26967855/handling-click-and-doubleclick-on-same-view-in-emberjs
|
||||
doubleClick: ->
|
||||
eventIO = @get 'eventIO'
|
||||
if eventIO?
|
||||
Ember.run.cancel eventIO
|
||||
@set 'eventIO', null
|
||||
|
||||
if @get('value_type') is 'boolean'
|
||||
#@toggleProperty 'project_instance_action.boolean_value'
|
||||
#@get('project_instance_action').save()
|
||||
|
||||
# always modal, otherwise implement authorizations overhere
|
||||
@modal 'project/edit-instance-action',
|
||||
model: @get('project_instance_action')
|
||||
save: @save
|
||||
close: @save
|
||||
else
|
||||
# fallback to single click behaviour
|
||||
@modal 'project/edit-instance-action',
|
||||
model: @get('project_instance_action')
|
||||
save: @save
|
||||
close: @save
|
||||
|
||||
|
||||
click: ->
|
||||
if @get('eventIO') is null
|
||||
eventIO = Ember.run.later @, ->
|
||||
@modal 'project/edit-instance-action',
|
||||
model: @get('project_instance_action')
|
||||
save: @save
|
||||
close: @save
|
||||
if @get('eventIO') isnt null
|
||||
Ember.run.cancel @get('eventIO')
|
||||
@set 'eventIO', null
|
||||
, 500
|
||||
@set 'eventIO', eventIO
|
||||
|
||||
actions:
|
||||
right_click: ->
|
||||
debugger
|
||||
false
|
||||
#edit_record: ->
|
||||
# @modal 'project/edit-instance-action', model: @get('project_instance_action')
|
||||
# false
|
||||
@@ -0,0 +1,54 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['project-instance-action-value-display'],
|
||||
eventIO: null,
|
||||
project_instance_action: null,
|
||||
value_type: Ember.computed.alias('project_instance_action.workflow_action_definition.value_type'),
|
||||
save: function() {},
|
||||
doubleClick: function() {
|
||||
var eventIO;
|
||||
eventIO = this.get('eventIO');
|
||||
if (eventIO != null) {
|
||||
Ember.run.cancel(eventIO);
|
||||
this.set('eventIO', null);
|
||||
}
|
||||
if (this.get('value_type') === 'boolean') {
|
||||
return this.modal('project/edit-instance-action', {
|
||||
model: this.get('project_instance_action'),
|
||||
save: this.save,
|
||||
close: this.save
|
||||
});
|
||||
} else {
|
||||
return this.modal('project/edit-instance-action', {
|
||||
model: this.get('project_instance_action'),
|
||||
save: this.save,
|
||||
close: this.save
|
||||
});
|
||||
}
|
||||
},
|
||||
click: function() {
|
||||
var eventIO;
|
||||
if (this.get('eventIO') === null) {
|
||||
eventIO = Ember.run.later(this, function() {
|
||||
this.modal('project/edit-instance-action', {
|
||||
model: this.get('project_instance_action'),
|
||||
save: this.save,
|
||||
close: this.save
|
||||
});
|
||||
if (this.get('eventIO') !== null) {
|
||||
Ember.run.cancel(this.get('eventIO'));
|
||||
return this.set('eventIO', null);
|
||||
}
|
||||
}, 500);
|
||||
return this.set('eventIO', eventIO);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
right_click: function() {
|
||||
debugger;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
Component = Ember.Component.extend
|
||||
tagName: 'span'
|
||||
classNames: ['ui', 'label', 'state-badge']
|
||||
classNameBindings: ['ui_class', 'having_action:with-action', 'basic:basic']
|
||||
action: null
|
||||
state: '…'
|
||||
human_state: Ember.computed 'state', ->
|
||||
return '-' unless state = @get('state')
|
||||
t("attributes.state.#{state}", default: state)
|
||||
having_action: Ember.computed.bool 'action'
|
||||
click: ->
|
||||
@action?()
|
||||
ui_class: Ember.computed 'state', ->
|
||||
switch @get('state')
|
||||
when 'overdue' then 'yellow'
|
||||
when 'completed', 'all_completed' then 'green'
|
||||
when 'rejected', 'any_rejected' then 'red'
|
||||
when 'active', 'processing' then 'blue'
|
||||
when 'inquiry' then 'pink'
|
||||
else 'grey'
|
||||
|
||||
Component.reopenClass
|
||||
positionalParams: ['state']
|
||||
|
||||
export default Component
|
||||
@@ -0,0 +1,50 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var Component;
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
Component = Ember.Component.extend({
|
||||
tagName: 'span',
|
||||
classNames: ['ui', 'label', 'state-badge'],
|
||||
classNameBindings: ['ui_class', 'having_action:with-action', 'basic:basic'],
|
||||
action: null,
|
||||
state: '…',
|
||||
human_state: Ember.computed('state', function() {
|
||||
var state;
|
||||
if (!(state = this.get('state'))) {
|
||||
return '-';
|
||||
}
|
||||
return t("attributes.state." + state, {
|
||||
"default": state
|
||||
});
|
||||
}),
|
||||
having_action: Ember.computed.bool('action'),
|
||||
click: function() {
|
||||
return typeof this.action === "function" ? this.action() : void 0;
|
||||
},
|
||||
ui_class: Ember.computed('state', function() {
|
||||
switch (this.get('state')) {
|
||||
case 'overdue':
|
||||
return 'yellow';
|
||||
case 'completed':
|
||||
case 'all_completed':
|
||||
return 'green';
|
||||
case 'rejected':
|
||||
case 'any_rejected':
|
||||
return 'red';
|
||||
case 'active':
|
||||
case 'processing':
|
||||
return 'blue';
|
||||
case 'inquiry':
|
||||
return 'pink';
|
||||
default:
|
||||
return 'grey';
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Component.reopenClass({
|
||||
positionalParams: ['state']
|
||||
});
|
||||
|
||||
export default Component;
|
||||
@@ -0,0 +1,13 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Component.extend
|
||||
classNames: ['ui-multi-select-container']
|
||||
labelProperty: 'name'
|
||||
placeholder: 'Select' # can be a text or translation string: organization.select_users.placeholder => # 'Select ${models.plural.user} (%{count})'
|
||||
options: []
|
||||
selected: []
|
||||
placeholder_text: Ember.computed 'placeholder', ->
|
||||
placeholder = @get('placeholder')
|
||||
placeholder = t(placeholder, count: @get('options.length')) if is_translation_path(placeholder)
|
||||
placeholder.htmlSafe()
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['ui-multi-select-container'],
|
||||
labelProperty: 'name',
|
||||
placeholder: 'Select',
|
||||
options: [],
|
||||
selected: [],
|
||||
placeholder_text: Ember.computed('placeholder', function() {
|
||||
var placeholder;
|
||||
placeholder = this.get('placeholder');
|
||||
if (is_translation_path(placeholder)) {
|
||||
placeholder = t(placeholder, {
|
||||
count: this.get('options.length')
|
||||
});
|
||||
}
|
||||
return placeholder.htmlSafe();
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Component.extend
|
||||
tagName: 'span'
|
||||
type: null
|
||||
classNames: ['value-type-display']
|
||||
classNameBindings: ['typeClass']
|
||||
typeClass: Ember.computed 'type', -> @get('type') || 'no-typ'
|
||||
iconClass: Ember.computed 'type', ->
|
||||
switch @get('type')
|
||||
when 'boolean' then 'checkmark box'
|
||||
when 'date' then 'calendar'
|
||||
when 'select' then 'list'
|
||||
when 'string' then 'terminal'
|
||||
when 'text' then 'sticky note outline'
|
||||
when 'number' then 'hashtag'
|
||||
when 'timestamp' then 'wait'
|
||||
else 'red warning circle'
|
||||
# &.date
|
||||
# @extend .fa-calendar
|
||||
# &.number
|
||||
# @extend .fa-hashtag
|
||||
# &.select
|
||||
# @extend .fa-list-ul
|
||||
# &.string
|
||||
# @extend .fa-terminal
|
||||
# &.text
|
||||
# @extend .fa-sticky-note-o
|
||||
# &.window_from
|
||||
# @extend .fa-clock-o
|
||||
# &.window_to
|
||||
# @extend .fa-clock-o
|
||||
# &.timestamp
|
||||
# @extend .fa-clock-o
|
||||
@@ -0,0 +1,32 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'span',
|
||||
type: null,
|
||||
classNames: ['value-type-display'],
|
||||
classNameBindings: ['typeClass'],
|
||||
typeClass: Ember.computed('type', function() {
|
||||
return this.get('type') || 'no-typ';
|
||||
}),
|
||||
iconClass: Ember.computed('type', function() {
|
||||
switch (this.get('type')) {
|
||||
case 'boolean':
|
||||
return 'checkmark box';
|
||||
case 'date':
|
||||
return 'calendar';
|
||||
case 'select':
|
||||
return 'list';
|
||||
case 'string':
|
||||
return 'terminal';
|
||||
case 'text':
|
||||
return 'sticky note outline';
|
||||
case 'number':
|
||||
return 'hashtag';
|
||||
case 'timestamp':
|
||||
return 'wait';
|
||||
default:
|
||||
return 'red warning circle';
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import Ember from 'ember'
|
||||
import config from 'ember-get-config'
|
||||
|
||||
export default Ember.Controller.extend
|
||||
session: Ember.inject.service('session')
|
||||
filters: {}
|
||||
scope_project: null
|
||||
scope_scenario: null
|
||||
scope_organization: null
|
||||
filter_query: Ember.computed 'filters.filter_calls', ->
|
||||
@get('filters')?.toProperties() || {}
|
||||
export_human_url: Ember.computed 'filters.filter_calls', ->
|
||||
model_name = 'panda/project-instance-action'
|
||||
base_url = @store.adapterFor(model_name).buildURL(model_name)
|
||||
filter_addition = $.param q: @get('filter_query')
|
||||
"#{base_url}/export_human.csv?#{filter_addition}"
|
||||
export_technical_url: Ember.computed 'filters.filter_calls', ->
|
||||
model_name = 'panda/project-instance-action'
|
||||
base_url = @store.adapterFor(model_name).buildURL(model_name)
|
||||
filter_addition = $.param q: @get('filter_query')
|
||||
"#{base_url}/export_technical.csv?#{filter_addition}"
|
||||
apply_filters: ->
|
||||
@incrementProperty 'filters.filter_calls'
|
||||
@set 'model.project_instance_actions.page', 1
|
||||
@set 'model.project_instance_actions.lastPage', null
|
||||
@get('model.project_instance_actions').setOtherParam('q', @get('filter_query'))
|
||||
false
|
||||
actions:
|
||||
refresh_list: -> @apply_filters()
|
||||
edit_project_instance_action: (project_instance_action) ->
|
||||
@modal 'project/edit-instance-action', model: project_instance_action
|
||||
|
||||
toggle_filter: (key, value, checked) ->
|
||||
new_value = []
|
||||
if checked
|
||||
new_value = new_value.concat(@get("filters.#{key}")).concat(value)
|
||||
else
|
||||
@get("filters.#{key}").forEach (present_in_filter) ->
|
||||
new_value.push present_in_filter unless present_in_filter is value
|
||||
@set "filters.#{key}", new_value
|
||||
@apply_filters()
|
||||
clear_filter: (keys...) ->
|
||||
keys.forEach (key) =>
|
||||
if Ember.isArray(@get("filters.#{key}"))
|
||||
@set "filters.#{key}", []
|
||||
else
|
||||
@set "filters.#{key}", null
|
||||
@apply_filters()
|
||||
@@ -0,0 +1,82 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var slice = [].slice;
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
import config from 'ember-get-config';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
filters: {},
|
||||
scope_project: null,
|
||||
scope_scenario: null,
|
||||
scope_organization: null,
|
||||
filter_query: Ember.computed('filters.filter_calls', function() {
|
||||
var ref;
|
||||
return ((ref = this.get('filters')) != null ? ref.toProperties() : void 0) || {};
|
||||
}),
|
||||
export_human_url: Ember.computed('filters.filter_calls', function() {
|
||||
var base_url, filter_addition, model_name;
|
||||
model_name = 'panda/project-instance-action';
|
||||
base_url = this.store.adapterFor(model_name).buildURL(model_name);
|
||||
filter_addition = $.param({
|
||||
q: this.get('filter_query')
|
||||
});
|
||||
return base_url + "/export_human.csv?" + filter_addition;
|
||||
}),
|
||||
export_technical_url: Ember.computed('filters.filter_calls', function() {
|
||||
var base_url, filter_addition, model_name;
|
||||
model_name = 'panda/project-instance-action';
|
||||
base_url = this.store.adapterFor(model_name).buildURL(model_name);
|
||||
filter_addition = $.param({
|
||||
q: this.get('filter_query')
|
||||
});
|
||||
return base_url + "/export_technical.csv?" + filter_addition;
|
||||
}),
|
||||
apply_filters: function() {
|
||||
this.incrementProperty('filters.filter_calls');
|
||||
this.set('model.project_instance_actions.page', 1);
|
||||
this.set('model.project_instance_actions.lastPage', null);
|
||||
this.get('model.project_instance_actions').setOtherParam('q', this.get('filter_query'));
|
||||
return false;
|
||||
},
|
||||
actions: {
|
||||
refresh_list: function() {
|
||||
return this.apply_filters();
|
||||
},
|
||||
edit_project_instance_action: function(project_instance_action) {
|
||||
return this.modal('project/edit-instance-action', {
|
||||
model: project_instance_action
|
||||
});
|
||||
},
|
||||
toggle_filter: function(key, value, checked) {
|
||||
var new_value;
|
||||
new_value = [];
|
||||
if (checked) {
|
||||
new_value = new_value.concat(this.get("filters." + key)).concat(value);
|
||||
} else {
|
||||
this.get("filters." + key).forEach(function(present_in_filter) {
|
||||
if (present_in_filter !== value) {
|
||||
return new_value.push(present_in_filter);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.set("filters." + key, new_value);
|
||||
return this.apply_filters();
|
||||
},
|
||||
clear_filter: function() {
|
||||
var keys;
|
||||
keys = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
||||
keys.forEach((function(_this) {
|
||||
return function(key) {
|
||||
if (Ember.isArray(_this.get("filters." + key))) {
|
||||
return _this.set("filters." + key, []);
|
||||
} else {
|
||||
return _this.set("filters." + key, null);
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
return this.apply_filters();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Mixin.create
|
||||
selected_project_scenarios: [] # null
|
||||
selected_project_scenarios_set_operation: 'union' # union or intersection
|
||||
active_workflow_action_definitions: []
|
||||
active_workflow_action_definition_ids: []
|
||||
|
||||
set_active_workflow_action_definitions: ->
|
||||
# initialize unused working workflow-action-definitions
|
||||
if @get('selected_project_scenarios.length')
|
||||
if @get('selected_project_scenarios_set_operation') is 'intersection'
|
||||
@set_active_workflow_action_definitions_using_intersection()
|
||||
else
|
||||
@set_active_workflow_action_definitions_using_union()
|
||||
else
|
||||
@set 'active_workflow_action_definitions', @get('project.workflow_action_definitions') || []
|
||||
@set 'active_workflow_action_definition_ids', @get('active_workflow_action_definitions').mapBy('id').toArray()
|
||||
|
||||
set_active_workflow_action_definitions_using_union: ->
|
||||
selected_project_scenario_workflow_action_definition_ids = []
|
||||
working_workflow_action_definitions = []
|
||||
@get('selected_project_scenarios').forEach (selected_project_scenario) ->
|
||||
selected_project_scenario.get('workflow_action_definitions').forEach (workflow_action_definition) ->
|
||||
if selected_project_scenario_workflow_action_definition_ids.indexOf(workflow_action_definition.get('id')) < 0
|
||||
selected_project_scenario_workflow_action_definition_ids.push workflow_action_definition.get('id')
|
||||
working_workflow_action_definitions.push workflow_action_definition
|
||||
@set 'active_workflow_action_definitions', working_workflow_action_definitions
|
||||
@set 'active_workflow_action_definition_ids', selected_project_scenario_workflow_action_definition_ids
|
||||
|
||||
set_active_workflow_action_definitions_using_intersection: ->
|
||||
selected_project_scenario_workflow_action_definition_ids = []
|
||||
first_run = true
|
||||
@get('selected_project_scenarios').forEach (selected_project_scenario) ->
|
||||
current_workflow_action_definition_ids = selected_project_scenario.get('workflow_action_definitions').mapBy('id').toArray()
|
||||
if first_run
|
||||
selected_project_scenario_workflow_action_definition_ids = current_workflow_action_definition_ids
|
||||
first_run = false
|
||||
return
|
||||
selected_project_scenario_workflow_action_definition_ids = selected_project_scenario_workflow_action_definition_ids.filter (id) -> id in current_workflow_action_definition_ids
|
||||
|
||||
@set 'active_workflow_action_definition_ids', selected_project_scenario_workflow_action_definition_ids
|
||||
@set 'active_workflow_action_definitions', @get('project.workflow_action_definitions').filter((r) -> r.get('id') in selected_project_scenario_workflow_action_definition_ids)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
selected_project_scenarios: [],
|
||||
selected_project_scenarios_set_operation: 'union',
|
||||
active_workflow_action_definitions: [],
|
||||
active_workflow_action_definition_ids: [],
|
||||
set_active_workflow_action_definitions: function() {
|
||||
if (this.get('selected_project_scenarios.length')) {
|
||||
if (this.get('selected_project_scenarios_set_operation') === 'intersection') {
|
||||
return this.set_active_workflow_action_definitions_using_intersection();
|
||||
} else {
|
||||
return this.set_active_workflow_action_definitions_using_union();
|
||||
}
|
||||
} else {
|
||||
this.set('active_workflow_action_definitions', this.get('project.workflow_action_definitions') || []);
|
||||
return this.set('active_workflow_action_definition_ids', this.get('active_workflow_action_definitions').mapBy('id').toArray());
|
||||
}
|
||||
},
|
||||
set_active_workflow_action_definitions_using_union: function() {
|
||||
var selected_project_scenario_workflow_action_definition_ids, working_workflow_action_definitions;
|
||||
selected_project_scenario_workflow_action_definition_ids = [];
|
||||
working_workflow_action_definitions = [];
|
||||
this.get('selected_project_scenarios').forEach(function(selected_project_scenario) {
|
||||
return selected_project_scenario.get('workflow_action_definitions').forEach(function(workflow_action_definition) {
|
||||
if (selected_project_scenario_workflow_action_definition_ids.indexOf(workflow_action_definition.get('id')) < 0) {
|
||||
selected_project_scenario_workflow_action_definition_ids.push(workflow_action_definition.get('id'));
|
||||
return working_workflow_action_definitions.push(workflow_action_definition);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.set('active_workflow_action_definitions', working_workflow_action_definitions);
|
||||
return this.set('active_workflow_action_definition_ids', selected_project_scenario_workflow_action_definition_ids);
|
||||
},
|
||||
set_active_workflow_action_definitions_using_intersection: function() {
|
||||
var first_run, selected_project_scenario_workflow_action_definition_ids;
|
||||
selected_project_scenario_workflow_action_definition_ids = [];
|
||||
first_run = true;
|
||||
this.get('selected_project_scenarios').forEach(function(selected_project_scenario) {
|
||||
var current_workflow_action_definition_ids;
|
||||
current_workflow_action_definition_ids = selected_project_scenario.get('workflow_action_definitions').mapBy('id').toArray();
|
||||
if (first_run) {
|
||||
selected_project_scenario_workflow_action_definition_ids = current_workflow_action_definition_ids;
|
||||
first_run = false;
|
||||
return;
|
||||
}
|
||||
return selected_project_scenario_workflow_action_definition_ids = selected_project_scenario_workflow_action_definition_ids.filter(function(id) {
|
||||
return indexOf.call(current_workflow_action_definition_ids, id) >= 0;
|
||||
});
|
||||
});
|
||||
this.set('active_workflow_action_definition_ids', selected_project_scenario_workflow_action_definition_ids);
|
||||
return this.set('active_workflow_action_definitions', this.get('project.workflow_action_definitions').filter(function(r) {
|
||||
var ref;
|
||||
return ref = r.get('id'), indexOf.call(selected_project_scenario_workflow_action_definition_ids, ref) >= 0;
|
||||
}));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import Ember from 'ember'
|
||||
|
||||
export default Ember.Mixin.create
|
||||
get_active_workflow_groups: (workflow_groups, project_scenarios, set_operation = 'union')->
|
||||
project_scenarios = Ember.makeArray(project_scenarios)
|
||||
workflow_groups = workflow_groups.toArray()
|
||||
# initialize unused working workflow-groups
|
||||
if project_scenarios.length
|
||||
if set_operation is 'intersection'
|
||||
@get_active_workflow_groups_using_intersection(workflow_groups, project_scenarios)
|
||||
else
|
||||
@get_active_workflow_groups_using_union(project_scenarios)
|
||||
else
|
||||
workflow_groups
|
||||
|
||||
#@set 'active_workflow_groups', workflow_groups || []
|
||||
#@set 'active_workflow_group_ids', @get('active_workflow_groups').mapBy('id').toArray()
|
||||
|
||||
get_active_workflow_groups_using_union: (project_scenarios) ->
|
||||
selected_project_scenario_workflow_group_ids = []
|
||||
working_workflow_groups = []
|
||||
project_scenarios.forEach (selected_project_scenario) ->
|
||||
selected_project_scenario.get('workflow_groups').forEach (workflow_group) ->
|
||||
if selected_project_scenario_workflow_group_ids.indexOf(workflow_group.get('id')) < 0
|
||||
selected_project_scenario_workflow_group_ids.push workflow_group.get('id')
|
||||
working_workflow_groups.push workflow_group
|
||||
#working_workflow_groups = working_workflow_groups
|
||||
#@set 'active_workflow_groups', working_workflow_groups
|
||||
#@set 'active_workflow_group_ids', selected_project_scenario_workflow_group_ids
|
||||
working_workflow_groups
|
||||
|
||||
get_active_workflow_groups_using_intersection: (workflow_groups, project_scenarios) ->
|
||||
selected_project_scenario_workflow_group_ids = []
|
||||
first_run = true
|
||||
project_scenarios.forEach (selected_project_scenario) ->
|
||||
current_workflow_group_ids = selected_project_scenario.get('workflow_groups').mapBy('id').toArray()
|
||||
if first_run
|
||||
selected_project_scenario_workflow_group_ids = current_workflow_group_ids
|
||||
first_run = false
|
||||
return
|
||||
selected_project_scenario_workflow_group_ids = selected_project_scenario_workflow_group_ids.filter (id) -> id in current_workflow_group_ids
|
||||
|
||||
#@set 'active_workflow_group_ids', selected_project_scenario_workflow_group_ids
|
||||
#@set 'active_workflow_groups', workflow_groups.filter((r) -> r.get('id') in selected_project_scenario_workflow_group_ids)
|
||||
workflow_groups.filter((r) -> r.get('id') in selected_project_scenario_workflow_group_ids)
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
get_active_workflow_groups: function(workflow_groups, project_scenarios, set_operation) {
|
||||
if (set_operation == null) {
|
||||
set_operation = 'union';
|
||||
}
|
||||
project_scenarios = Ember.makeArray(project_scenarios);
|
||||
workflow_groups = workflow_groups.toArray();
|
||||
if (project_scenarios.length) {
|
||||
if (set_operation === 'intersection') {
|
||||
return this.get_active_workflow_groups_using_intersection(workflow_groups, project_scenarios);
|
||||
} else {
|
||||
return this.get_active_workflow_groups_using_union(project_scenarios);
|
||||
}
|
||||
} else {
|
||||
return workflow_groups;
|
||||
}
|
||||
},
|
||||
get_active_workflow_groups_using_union: function(project_scenarios) {
|
||||
var selected_project_scenario_workflow_group_ids, working_workflow_groups;
|
||||
selected_project_scenario_workflow_group_ids = [];
|
||||
working_workflow_groups = [];
|
||||
project_scenarios.forEach(function(selected_project_scenario) {
|
||||
return selected_project_scenario.get('workflow_groups').forEach(function(workflow_group) {
|
||||
if (selected_project_scenario_workflow_group_ids.indexOf(workflow_group.get('id')) < 0) {
|
||||
selected_project_scenario_workflow_group_ids.push(workflow_group.get('id'));
|
||||
return working_workflow_groups.push(workflow_group);
|
||||
}
|
||||
});
|
||||
});
|
||||
return working_workflow_groups;
|
||||
},
|
||||
get_active_workflow_groups_using_intersection: function(workflow_groups, project_scenarios) {
|
||||
var first_run, selected_project_scenario_workflow_group_ids;
|
||||
selected_project_scenario_workflow_group_ids = [];
|
||||
first_run = true;
|
||||
project_scenarios.forEach(function(selected_project_scenario) {
|
||||
var current_workflow_group_ids;
|
||||
current_workflow_group_ids = selected_project_scenario.get('workflow_groups').mapBy('id').toArray();
|
||||
if (first_run) {
|
||||
selected_project_scenario_workflow_group_ids = current_workflow_group_ids;
|
||||
first_run = false;
|
||||
return;
|
||||
}
|
||||
return selected_project_scenario_workflow_group_ids = selected_project_scenario_workflow_group_ids.filter(function(id) {
|
||||
return indexOf.call(current_workflow_group_ids, id) >= 0;
|
||||
});
|
||||
});
|
||||
return workflow_groups.filter(function(r) {
|
||||
var ref;
|
||||
return ref = r.get('id'), indexOf.call(selected_project_scenario_workflow_group_ids, ref) >= 0;
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import DS from 'ember-data'
|
||||
|
||||
export default DS.Model.extend
|
||||
client_identifier: DS.attr('string')
|
||||
identifier: DS.attr('string')
|
||||
event_key: DS.attr('string')
|
||||
event_value: DS.attr('string')
|
||||
event_timestamp: DS.attr('moment')
|
||||
source: DS.attr('string')
|
||||
|
||||
project_instance_action: DS.belongsTo('panda/project-instance-action', inverse: 'events')
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
client_identifier: DS.attr('string'),
|
||||
identifier: DS.attr('string'),
|
||||
event_key: DS.attr('string'),
|
||||
event_value: DS.attr('string'),
|
||||
event_timestamp: DS.attr('moment'),
|
||||
source: DS.attr('string'),
|
||||
project_instance_action: DS.belongsTo('panda/project-instance-action', {
|
||||
inverse: 'events'
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import DS from 'ember-data'
|
||||
|
||||
export default DS.Model.extend
|
||||
project_instance_action: DS.belongsTo('panda/project-instance-action')
|
||||
base_project_instance_action: DS.belongsTo('panda/project-instance-action', inverse: 'pointing_project_instance_action_connections')
|
||||
conditional_base_value: DS.attr('string')
|
||||
connection_type: DS.attr('string')
|
||||
@@ -0,0 +1,11 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
project_instance_action: DS.belongsTo('panda/project-instance-action'),
|
||||
base_project_instance_action: DS.belongsTo('panda/project-instance-action', {
|
||||
inverse: 'pointing_project_instance_action_connections'
|
||||
}),
|
||||
conditional_base_value: DS.attr('string'),
|
||||
connection_type: DS.attr('string')
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import DS from 'ember-data'
|
||||
|
||||
export default DS.Model.extend
|
||||
conditional_base_value: DS.attr('string', defaultValue: '')
|
||||
connection_type: DS.attr('string') # attached, constraint, info
|
||||
|
||||
workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', inverse: 'workflow_action_connections')
|
||||
base_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', inverse: 'pointing_workflow_action_connections')
|
||||
@@ -0,0 +1,15 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
conditional_base_value: DS.attr('string', {
|
||||
defaultValue: ''
|
||||
}),
|
||||
connection_type: DS.attr('string'),
|
||||
workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', {
|
||||
inverse: 'workflow_action_connections'
|
||||
}),
|
||||
base_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', {
|
||||
inverse: 'pointing_workflow_action_connections'
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
import Ember from 'ember'
|
||||
import DS from 'ember-data'
|
||||
import add_business_day_computations from 'ember-panda/utils/business-day-computations'
|
||||
|
||||
export value_type_options = ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp']
|
||||
Model =
|
||||
identifier: DS.attr('string')
|
||||
title: DS.attr('string')
|
||||
name: Ember.computed.alias 'title'
|
||||
description: DS.attr('string')
|
||||
isEditing: DS.attr('boolean', defaultValue: false) #TODO: remove, is from PMBC
|
||||
done: DS.attr('boolean', defaultValue: false) #TODO: remove, is from PMBC
|
||||
position: DS.attr('number', defaultValue: 0)
|
||||
value_type: DS.attr('string', defaultValue: 'boolean') # means checkbox progress type
|
||||
value_type_select_options: DS.attr(defaultValue: -> [])
|
||||
extra_info: DS.attr('string')
|
||||
offset_type: DS.attr('string', defaultValue: 'none') # none, attached, configured
|
||||
overdue_coulance: DS.attr('number', defaultValue: 0)
|
||||
completes_group: DS.attr('boolean', defaultValue: false)
|
||||
|
||||
# Offset tree
|
||||
#action_offset_base: DS.belongsTo('workflow-action-definition', inverse: 'action_offset_dependents')
|
||||
#action_offset_dependents: DS.hasMany('workflow-action-definition', inverse: null) # do not give with api, will clear inverse if not given
|
||||
|
||||
workflow_group: DS.belongsTo('panda/workflow-group')
|
||||
project: DS.belongsTo('panda/project', inverse: 'workflow_action_definitions')
|
||||
organization: DS.belongsTo('panda/organization', inverse: 'workflow_action_definitions')
|
||||
workflow_action_constraints: DS.hasMany('panda/workflow-action-constraint', inverse: 'workflow_action_definition')
|
||||
workflow_action_offsets: DS.hasMany('panda/workflow-action-offset', inverse: 'workflow_action_definition')
|
||||
dependent_workflow_action_offsets: DS.hasMany('panda/workflow-action-offset', inverse: 'base_workflow_action_definition')
|
||||
#project_scenarios: DS.hasMany('panda/project-scenario', inverse: 'workflow_action_definitions')
|
||||
project_scenarios: DS.hasMany('panda/project-scenario', inverse: null)
|
||||
project_instance_actions: DS.hasMany('panda/project-instance-action', inverse: 'workflow_action_definition')
|
||||
confirms_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', inverse: 'confirmed_by_workflow_action_definition')
|
||||
confirmed_by_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', inverse: 'confirms_workflow_action_definition')
|
||||
|
||||
workflow_action_connections: DS.hasMany('panda/workflow-action-connection', inverse: 'workflow_action_definition')
|
||||
pointing_workflow_action_connections: DS.hasMany('panda/workflow-action-connection', inverse: 'base_workflow_action_definition')
|
||||
|
||||
absolute_position: Ember.computed 'workflow_group.position', 'position', ->
|
||||
(@get('workflow_group.position') || 99) * 100 + (@get('position') || 99 )
|
||||
|
||||
#drag_identifier: Ember.computed 'id', 'workflow_group.id', 'position', ->
|
||||
# "#{@get('id')}-#{@get('workflow_group.id')}-#{@get('position')}"
|
||||
#smart_position: Ember.computed 'done', 'position', ->
|
||||
# num = @get('position')
|
||||
# if @get('done') then num + 1000 else num
|
||||
add_business_day_computations Model, 'offset', add_attributes: true
|
||||
add_business_day_computations Model, 'batch_element_threshold', add_attributes: true #, default_unit: 'businessday'
|
||||
export default DS.Model.extend(Model)
|
||||
@@ -0,0 +1,91 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var Model;
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
import DS from 'ember-data';
|
||||
|
||||
import add_business_day_computations from 'ember-panda/utils/business-day-computations';
|
||||
|
||||
export var value_type_options = ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp'];
|
||||
|
||||
Model = {
|
||||
identifier: DS.attr('string'),
|
||||
title: DS.attr('string'),
|
||||
name: Ember.computed.alias('title'),
|
||||
description: DS.attr('string'),
|
||||
isEditing: DS.attr('boolean', {
|
||||
defaultValue: false
|
||||
}),
|
||||
done: DS.attr('boolean', {
|
||||
defaultValue: false
|
||||
}),
|
||||
position: DS.attr('number', {
|
||||
defaultValue: 0
|
||||
}),
|
||||
value_type: DS.attr('string', {
|
||||
defaultValue: 'boolean'
|
||||
}),
|
||||
value_type_select_options: DS.attr({
|
||||
defaultValue: function() {
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
extra_info: DS.attr('string'),
|
||||
offset_type: DS.attr('string', {
|
||||
defaultValue: 'none'
|
||||
}),
|
||||
overdue_coulance: DS.attr('number', {
|
||||
defaultValue: 0
|
||||
}),
|
||||
completes_group: DS.attr('boolean', {
|
||||
defaultValue: false
|
||||
}),
|
||||
workflow_group: DS.belongsTo('panda/workflow-group'),
|
||||
project: DS.belongsTo('panda/project', {
|
||||
inverse: 'workflow_action_definitions'
|
||||
}),
|
||||
organization: DS.belongsTo('panda/organization', {
|
||||
inverse: 'workflow_action_definitions'
|
||||
}),
|
||||
workflow_action_constraints: DS.hasMany('panda/workflow-action-constraint', {
|
||||
inverse: 'workflow_action_definition'
|
||||
}),
|
||||
workflow_action_offsets: DS.hasMany('panda/workflow-action-offset', {
|
||||
inverse: 'workflow_action_definition'
|
||||
}),
|
||||
dependent_workflow_action_offsets: DS.hasMany('panda/workflow-action-offset', {
|
||||
inverse: 'base_workflow_action_definition'
|
||||
}),
|
||||
project_scenarios: DS.hasMany('panda/project-scenario', {
|
||||
inverse: null
|
||||
}),
|
||||
project_instance_actions: DS.hasMany('panda/project-instance-action', {
|
||||
inverse: 'workflow_action_definition'
|
||||
}),
|
||||
confirms_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', {
|
||||
inverse: 'confirmed_by_workflow_action_definition'
|
||||
}),
|
||||
confirmed_by_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', {
|
||||
inverse: 'confirms_workflow_action_definition'
|
||||
}),
|
||||
workflow_action_connections: DS.hasMany('panda/workflow-action-connection', {
|
||||
inverse: 'workflow_action_definition'
|
||||
}),
|
||||
pointing_workflow_action_connections: DS.hasMany('panda/workflow-action-connection', {
|
||||
inverse: 'base_workflow_action_definition'
|
||||
}),
|
||||
absolute_position: Ember.computed('workflow_group.position', 'position', function() {
|
||||
return (this.get('workflow_group.position') || 99) * 100 + (this.get('position') || 99);
|
||||
})
|
||||
};
|
||||
|
||||
add_business_day_computations(Model, 'offset', {
|
||||
add_attributes: true
|
||||
});
|
||||
|
||||
add_business_day_computations(Model, 'batch_element_threshold', {
|
||||
add_attributes: true
|
||||
});
|
||||
|
||||
export default DS.Model.extend(Model);
|
||||
@@ -0,0 +1,67 @@
|
||||
import Ember from 'ember'
|
||||
import PagedRemoteArray from 'ember-cli-pagination/remote/paged-remote-array'
|
||||
export default_filter = Ember.Object.create
|
||||
filter_calls: 0
|
||||
workflow_action_definition_id_in: []
|
||||
project_instance_group_workflow_group_id: ''
|
||||
project_id: ''
|
||||
project_instance_project_scenario_id: ''
|
||||
workflow_action_definition_organization_id: ''
|
||||
offset_type_not_eq: 'attached'
|
||||
state_in: []
|
||||
target_date_gteq: null
|
||||
target_date_lteq: null
|
||||
s: 'target_date asc'
|
||||
|
||||
export default Ember.Route.extend
|
||||
queryParams:
|
||||
q:
|
||||
refreshModel: true
|
||||
setupController: (controller, model) ->
|
||||
controller.set 'filters', default_filter
|
||||
@_super arguments...
|
||||
|
||||
model: (params) ->
|
||||
#@store.findAll('epots/migration-window-planning')
|
||||
otherParams = {q: default_filter.toProperties()}
|
||||
includes = [
|
||||
'workflow_action_definition.~workflow_action_connections'
|
||||
'workflow_action_definition.~pointing_workflow_action_connections'
|
||||
'workflow_action_definition.~organization'
|
||||
'workflow_action_definition.~workflow_action_offsets'
|
||||
'project_instance_group.~project'
|
||||
'project_instance_group.~project_instance'
|
||||
'project_instance_group.~project_instance_actions'
|
||||
'project_instance_group.workflow_group'
|
||||
'project_instance.~project'
|
||||
'project_instance.project_scenario.~project'
|
||||
'project_instance.project_scenario.~workflow_groups'
|
||||
'project_instance.project_scenario.~workflow_action_definitions'
|
||||
'pointing_project_instance_action_connections.project_instance_action.~project'
|
||||
'pointing_project_instance_action_connections.project_instance_action.~project_instance'
|
||||
'pointing_project_instance_action_connections.project_instance_action.~project_instance_group'
|
||||
'pointing_project_instance_action_connections.project_instance_action.~pointing_project_instance_action_connections'
|
||||
'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~workflow_action_connections'
|
||||
'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~pointing_workflow_action_connections'
|
||||
'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~organization'
|
||||
'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~workflow_action_offsets'
|
||||
].join(',')
|
||||
#includes += ','
|
||||
#includes += [
|
||||
# 'project.users'
|
||||
#].join(',')
|
||||
includes = 'action-list'
|
||||
otherParams.include = includes
|
||||
Ember.RSVP.hash
|
||||
projects: @store.findAll('panda/project')
|
||||
organizations: @store.findAll('panda/organization')
|
||||
project_instance_actions:
|
||||
PagedRemoteArray.create
|
||||
modelName: 'panda/project-instance-action'
|
||||
store: @store
|
||||
page: params.page || 1
|
||||
perPage: params.perPage || 30
|
||||
otherParams: otherParams
|
||||
paramMapping:
|
||||
total_pages: 'total-pages'
|
||||
total_count: 'total-count'
|
||||
@@ -0,0 +1,54 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
import Ember from 'ember';
|
||||
|
||||
import PagedRemoteArray from 'ember-cli-pagination/remote/paged-remote-array';
|
||||
|
||||
export var default_filter = Ember.Object.create({
|
||||
filter_calls: 0,
|
||||
workflow_action_definition_id_in: [],
|
||||
project_instance_group_workflow_group_id: '',
|
||||
project_id: '',
|
||||
project_instance_project_scenario_id: '',
|
||||
workflow_action_definition_organization_id: '',
|
||||
offset_type_not_eq: 'attached',
|
||||
state_in: [],
|
||||
target_date_gteq: null,
|
||||
target_date_lteq: null,
|
||||
s: 'target_date asc'
|
||||
});
|
||||
|
||||
export default Ember.Route.extend({
|
||||
queryParams: {
|
||||
q: {
|
||||
refreshModel: true
|
||||
}
|
||||
},
|
||||
setupController: function(controller, model) {
|
||||
controller.set('filters', default_filter);
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
model: function(params) {
|
||||
var includes, otherParams;
|
||||
otherParams = {
|
||||
q: default_filter.toProperties()
|
||||
};
|
||||
includes = ['workflow_action_definition.~workflow_action_connections', 'workflow_action_definition.~pointing_workflow_action_connections', 'workflow_action_definition.~organization', 'workflow_action_definition.~workflow_action_offsets', 'project_instance_group.~project', 'project_instance_group.~project_instance', 'project_instance_group.~project_instance_actions', 'project_instance_group.workflow_group', 'project_instance.~project', 'project_instance.project_scenario.~project', 'project_instance.project_scenario.~workflow_groups', 'project_instance.project_scenario.~workflow_action_definitions', 'pointing_project_instance_action_connections.project_instance_action.~project', 'pointing_project_instance_action_connections.project_instance_action.~project_instance', 'pointing_project_instance_action_connections.project_instance_action.~project_instance_group', 'pointing_project_instance_action_connections.project_instance_action.~pointing_project_instance_action_connections', 'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~workflow_action_connections', 'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~pointing_workflow_action_connections', 'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~organization', 'pointing_project_instance_action_connections.project_instance_action.workflow_action_definition.~workflow_action_offsets'].join(',');
|
||||
includes = 'action-list';
|
||||
otherParams.include = includes;
|
||||
return Ember.RSVP.hash({
|
||||
projects: this.store.findAll('panda/project'),
|
||||
organizations: this.store.findAll('panda/organization'),
|
||||
project_instance_actions: PagedRemoteArray.create({
|
||||
modelName: 'panda/project-instance-action',
|
||||
store: this.store,
|
||||
page: params.page || 1,
|
||||
perPage: params.perPage || 30,
|
||||
otherParams: otherParams,
|
||||
paramMapping: {
|
||||
total_pages: 'total-pages',
|
||||
total_count: 'total-count'
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,45 @@
|
||||
$sort-background-color: #566573;
|
||||
|
||||
$button-tny: 2px;
|
||||
$primary-color: blue;
|
||||
$success-color: green;
|
||||
$warning-color: yellow;
|
||||
$alert-color: red;
|
||||
$secondary-color: grey;
|
||||
$info-color: lightblue;
|
||||
$non-default-attention-color: #f2711c;
|
||||
|
||||
@import './semantic-ui-additions';
|
||||
|
||||
//@import './mixins/animations';
|
||||
//@import './mixins/buttons';
|
||||
|
||||
@import './components/buttons';
|
||||
@import './components/format-json';
|
||||
@import './components/forms';
|
||||
//@import './components/flash-message';
|
||||
//@import './components/modal';
|
||||
@import './components/multiselect';
|
||||
@import './components/project-instance-action-value-display';
|
||||
//@import './components/page-title';
|
||||
@import './components/resources';
|
||||
@import './components/sortable';
|
||||
@import './components/select-duration';
|
||||
@import './components/state-badge';
|
||||
@import './components/tables';
|
||||
@import './components/title-box';
|
||||
|
||||
//@import './resources/login-form';
|
||||
@import './resources/businessdays';
|
||||
@import './resources/projects';
|
||||
@import './resources/project-instance';
|
||||
@import './resources/tracker-subject';
|
||||
@import './resources/workflow-action-definition';
|
||||
@import './resources/workflow-groups';
|
||||
@import './resources/workflow-group-constraints';
|
||||
@import './resources/manual';
|
||||
|
||||
// DIAGRAMS ARE SVGs
|
||||
@import './diagrams/project/workflow-action-offsets-graph';
|
||||
@import './diagrams/project/workflow-group-offset-diagram';
|
||||
@import './diagrams/project/action-execution-offset-diagram';
|
||||
@@ -0,0 +1,50 @@
|
||||
//=push-action-button($color: $primary-color)
|
||||
// +button($bg: $color, $padding: $button-tny)
|
||||
// margin-bottom: 0
|
||||
// &.right
|
||||
// margin-left: 8px
|
||||
|
||||
//.push-action
|
||||
// $push-action-padding: $button-tny
|
||||
// +push-action-button
|
||||
// .icon
|
||||
// @extend .fa
|
||||
// &.new
|
||||
// +push-action-button($primary-color)
|
||||
// .icon
|
||||
// @extend .fa-plus
|
||||
// &.edit
|
||||
// +push-action-button($warning-color)
|
||||
// .icon
|
||||
// @extend .fa-pencil
|
||||
// &.destroy
|
||||
// +push-action-button($alert-color)
|
||||
// .icon
|
||||
// @extend .fa-trash
|
||||
// &.save
|
||||
// +push-action-button($success-color)
|
||||
// .icon
|
||||
// @extend .fa-save
|
||||
// &.rollback
|
||||
// +push-action-button($secondary-color)
|
||||
// .icon
|
||||
// @extend .fa-undo
|
||||
// &.show
|
||||
// +push-action-button($info-color)
|
||||
// .icon
|
||||
// @extend .fa-eye
|
||||
// &.sort
|
||||
// +push-action-button($sort-background-color)
|
||||
// .icon
|
||||
// @extend .fa-sort
|
||||
|
||||
// &.new, &.edit, &.save, &.rollback, &.destroy, &.show, &.info
|
||||
// margin-right: rem-calc(20)
|
||||
// &:last-of-type
|
||||
// margin-right: 0
|
||||
// .push-action-content
|
||||
// padding-left: rem-calc(10)
|
||||
|
||||
.workflow-instance-workflow-group-title, .workflow-action-definition-item, .project-header
|
||||
.push-action
|
||||
margin: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
.format-json-container
|
||||
max-height: 500px
|
||||
overflow: scroll
|
||||
.json-formatter-top-node-name
|
||||
cursor: pointer
|
||||
.json-formatter-constructor-name
|
||||
// Do not show the names Object and Array
|
||||
display: none
|
||||
@@ -0,0 +1,42 @@
|
||||
.ui.input
|
||||
input[type=number]
|
||||
text-align: right
|
||||
//.form-row
|
||||
// +grid-row
|
||||
// .form-label
|
||||
// @media #{$small-only}
|
||||
// +grid-column($columns:10, $center:true)
|
||||
// @media #{$medium-only}
|
||||
// +grid-column($columns:4, $offset:1)
|
||||
// @media #{$large-up}
|
||||
// +grid-column(3)
|
||||
// &.half
|
||||
// +grid-column(6)
|
||||
// .form-field
|
||||
// @media #{$small-only}
|
||||
// +grid-column($columns:10, $center:true, $last-column:true)
|
||||
// @media #{$medium-only}
|
||||
// +grid-column($columns:4, $last-column:false)
|
||||
// @media #{$large-up}
|
||||
// +grid-column($columns: 4, $last-column:false)
|
||||
// &.full
|
||||
// @media #{$small-only}
|
||||
// +grid-column($columns:10, $center:true, $last-column:true)
|
||||
// @media #{$medium-only}
|
||||
// +grid-column($columns:7, $last-column:true)
|
||||
// @media #{$large-up}
|
||||
// +grid-column($columns: 9, $last-column:true)
|
||||
// &.half
|
||||
// +grid-column(6)
|
||||
// .error
|
||||
// color: $alert-color
|
||||
// .form-info
|
||||
// @media #{$small-only}
|
||||
// +grid-column($columns:10, $center:true)
|
||||
// @media #{$medium-only}
|
||||
// +grid-column($columns:4, $offset:1)
|
||||
// @media #{$large-up}
|
||||
// +grid-column(3)
|
||||
// .error-message
|
||||
// color: $alert-color
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
.multiselect-checkboxes
|
||||
list-style: none
|
||||
@@ -0,0 +1,3 @@
|
||||
.project-instance-action-value-display
|
||||
.value-missing
|
||||
color: #aaa
|
||||
@@ -0,0 +1,13 @@
|
||||
.resource-row
|
||||
margin-bottom: rem-calc(10)
|
||||
h2, .content
|
||||
.resource-descriptor
|
||||
padding-right: 8px
|
||||
&:after
|
||||
content: ':'
|
||||
.resource-name
|
||||
text-decoration: underline
|
||||
.resource-suffix
|
||||
font-weight: normal
|
||||
padding-left: 8px
|
||||
font-size: 0.8em
|
||||
@@ -0,0 +1,6 @@
|
||||
.select-duration
|
||||
.ui.input
|
||||
&.left.labeled
|
||||
color: green
|
||||
&+ .dropdown
|
||||
margin-left: 51px
|
||||
@@ -0,0 +1,2 @@
|
||||
.sortable-list
|
||||
list-style: none
|
||||
@@ -0,0 +1,3 @@
|
||||
.state-badge
|
||||
&.with-action
|
||||
cursor: pointer
|
||||
@@ -0,0 +1,9 @@
|
||||
tr.pointing-record
|
||||
+ .record-with-pointing-records
|
||||
td
|
||||
border-top: 3px solid #aaa
|
||||
td
|
||||
&:first-child
|
||||
border-left: 8px solid #aaa
|
||||
&:last-child
|
||||
border-right: 8px solid #aaa
|
||||
@@ -0,0 +1,71 @@
|
||||
/* Based on the bootstrap 3+ panel, of course under a different name.
|
||||
The conversion is done based on:
|
||||
http://stackoverflow.com/questions/19220027/can-you-use-panels-in-bootstrap-2-3
|
||||
.title-box
|
||||
padding: 15px
|
||||
margin-bottom: 20px
|
||||
background-color: #ffffff
|
||||
border: 1px solid #dddddd
|
||||
border-radius: 4px
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05)
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05)
|
||||
|
||||
.title-box-heading
|
||||
padding: 10px 15px
|
||||
margin: -15px -15px 15px
|
||||
font-size: 17.5px
|
||||
font-weight: 500
|
||||
background-color: #f5f5f5
|
||||
border-bottom: 1px solid #dddddd
|
||||
border-top-right-radius: 3px
|
||||
border-top-left-radius: 3px
|
||||
|
||||
.title-box-footer
|
||||
padding: 10px 15px
|
||||
margin: 15px -15px -15px
|
||||
background-color: #f5f5f5
|
||||
border-top: 1px solid #dddddd
|
||||
border-bottom-right-radius: 3px
|
||||
border-bottom-left-radius: 3px
|
||||
|
||||
.title-box-primary
|
||||
border-color: #428bca
|
||||
.title-box-heading
|
||||
color: #ffffff
|
||||
background-color: #428bca
|
||||
border-color: #428bca
|
||||
|
||||
.title-box-success
|
||||
border-color: #d6e9c6
|
||||
|
||||
.title-box-heading
|
||||
color: #468847
|
||||
background-color: #dff0d8
|
||||
border-color: #d6e9c6
|
||||
|
||||
.title-box-warning
|
||||
border-color: #fbeed5
|
||||
|
||||
.title-box-heading
|
||||
color: #c09853
|
||||
background-color: #fcf8e3
|
||||
border-color: #fbeed5
|
||||
|
||||
.title-box-danger
|
||||
border-color: #eed3d7
|
||||
|
||||
.title-box-heading
|
||||
color: #b94a48
|
||||
background-color: #f2dede
|
||||
border-color: #eed3d7
|
||||
|
||||
.title-box-info
|
||||
border-color: #bce8f1
|
||||
|
||||
.title-box-heading
|
||||
color: #3a87ad
|
||||
background-color: #d9edf7
|
||||
border-color: #bce8f1
|
||||
|
||||
//State specific additions
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
.action-execution-offset-diagram-component, .action-execution-offset-diagram-component-old2
|
||||
.noUi-tooltip
|
||||
white-space: nowrap
|
||||
.range-slider-container
|
||||
padding: 18px 30px
|
||||
.action-execution-offset-diagram-container
|
||||
.offset-line
|
||||
stroke: #adadad
|
||||
stroke-width: 1px
|
||||
.base-line
|
||||
stroke: #2185d0
|
||||
stroke-width: 3px
|
||||
.action-descriptions
|
||||
.action-description-text
|
||||
text-anchor: start
|
||||
// within .tooltipstered
|
||||
.tooltipster-base
|
||||
.edit-workflow-action-definition
|
||||
margin: -3px 0 5px 10px !important
|
||||
@@ -0,0 +1,3 @@
|
||||
.workflow-action-offsets-graph-component
|
||||
.range-slider-container
|
||||
padding: 18px 30px
|
||||
@@ -0,0 +1,31 @@
|
||||
.workflow-group-offset-diagram-component
|
||||
.noUi-tooltip
|
||||
white-space: nowrap
|
||||
.range-slider-container
|
||||
padding: 18px 30px
|
||||
|
||||
// SVG
|
||||
.workflow-group-offset-diagram-container
|
||||
.groups-crossing-left-axis
|
||||
text
|
||||
fill: black
|
||||
font-weight: bold
|
||||
.groups-crossing-right-axis
|
||||
text
|
||||
fill: black
|
||||
font-weight: bold
|
||||
text-anchor: end
|
||||
.bar
|
||||
fill: #5f89ad
|
||||
&.lead-time-none
|
||||
fill: #f2711c
|
||||
&.extra-duration
|
||||
fill: #fff
|
||||
fill-opacity: 0.2
|
||||
.offset-line
|
||||
stroke: #adadad
|
||||
stroke-width: 1px
|
||||
.base-line
|
||||
stroke: #2185d0
|
||||
stroke-width: 3px
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
.default-business-days
|
||||
.non-default-business-days
|
||||
.select-businessdays-in-week
|
||||
color: $non-default-attention-color
|
||||
.ui.header
|
||||
color: $non-default-attention-color
|
||||
@@ -0,0 +1,5 @@
|
||||
.login-form
|
||||
&.ui.grid
|
||||
margin-top: 20px
|
||||
.column
|
||||
max-width: 450px
|
||||
@@ -0,0 +1,7 @@
|
||||
.ui.grid.manual
|
||||
.nav-column
|
||||
padding-top: 2rem
|
||||
padding-left: 2rem
|
||||
.ui.sticky.fixed.top
|
||||
// allow space for top navigation
|
||||
padding-top: 50px
|
||||
@@ -0,0 +1,50 @@
|
||||
.project-instance-list-tab-container
|
||||
.project-instance-list-workflow-group-container
|
||||
display: table
|
||||
border-bottom: 1px solid #aaa
|
||||
width: 100%
|
||||
&:first-child
|
||||
border-top: 1px solid #aaa
|
||||
.project-instance-list-workflow-group-row
|
||||
display: table-row
|
||||
font-size: 1.2em
|
||||
font-weight: bold
|
||||
background-color: #ddd
|
||||
.project-instance-list-workflow-action-definition-row
|
||||
display: table-row
|
||||
.project-instance-list-workflow-group, .project-instance-list-workflow-action-definition
|
||||
display: table-cell
|
||||
width: 33%
|
||||
padding: 7px
|
||||
.project-instance-list-workflow-step-context, .project-instance-list-workflow-action-context
|
||||
display: table-cell
|
||||
padding: 7px
|
||||
//.project-instance-list-workflow-group
|
||||
//font-size: 1.2em
|
||||
//font-weight: bold
|
||||
//background-color: #ddd
|
||||
//.project-instance-list-workflow-step-context
|
||||
//line-height: 1.2em
|
||||
//padding: 7px
|
||||
//background-color: #dff
|
||||
//border-top: 1px solid #bbb
|
||||
//&:last-child
|
||||
//border-bottom: 1px solid #bbb
|
||||
//.project-instance-list-workflow-action-definition
|
||||
//border-bottom: 1px solid #bbb
|
||||
//&:first-child
|
||||
//border-top: 1px solid #bbb
|
||||
//.project-instance-list-workflow-action-context
|
||||
//border-top: 1px solid #bbb
|
||||
//&:last-child
|
||||
//border-bottom: 1px solid #bbb
|
||||
table.ui.definition.table
|
||||
tr.pointing-action
|
||||
&.constraint
|
||||
&.uncompleted
|
||||
td
|
||||
font-weight: bold
|
||||
color: #700
|
||||
i
|
||||
font-size: 1.5em
|
||||
color: #700
|
||||
@@ -0,0 +1,19 @@
|
||||
ul.project-user-select
|
||||
workflow_group-style: none
|
||||
.ui.header
|
||||
.project-scenarios-dropdown-container
|
||||
float: right
|
||||
margin-top: -3px // visual
|
||||
font-size: 0.7em
|
||||
|
||||
.project-scenarios-dropdown-container
|
||||
.ui.multiple.dropdown
|
||||
i.dropdown.icon
|
||||
margin-right: -20px
|
||||
margin-top: 5px
|
||||
.ui.button.logical-icon-button
|
||||
padding: 2px 7px 0px
|
||||
.logical-icon-image
|
||||
height: 26px
|
||||
.active-project-scenario-selector-component.ui.buttons
|
||||
margin-left: 8px
|
||||
@@ -0,0 +1,34 @@
|
||||
.tracker-subject-tracker-groups-container
|
||||
display: flex
|
||||
flex-direction: row
|
||||
flex-wrap: wrap
|
||||
align-items: flex-start
|
||||
justify-content: space-around
|
||||
|
||||
.tracker-subject-tracker-group-container
|
||||
@extend .title-box
|
||||
//float: left
|
||||
width: 412px
|
||||
.tracker-subject-tracker-group-title
|
||||
@extend .title-box-heading
|
||||
.tracker-subject-tracker-group-body
|
||||
.display-row
|
||||
&.attribute-notes
|
||||
display: none
|
||||
.display-label
|
||||
width: 65%
|
||||
.display-field
|
||||
width: 35%
|
||||
.page-actions
|
||||
//display: none
|
||||
text-align: center
|
||||
.collection-edit
|
||||
margin: 0
|
||||
padding: 5px 12px
|
||||
&.processing
|
||||
@extend .title-box-primary
|
||||
&.rejected
|
||||
@extend .title-box-danger
|
||||
&.completed
|
||||
@extend .title-box-success
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
.workflow-action-definition-item
|
||||
color: #222
|
||||
&.is-editing
|
||||
background-color: #FEF9E7
|
||||
&.done
|
||||
text-decoration: line-through
|
||||
color: #aaa
|
||||
&:hover
|
||||
color: white
|
||||
.title
|
||||
text-decoration: line-through
|
||||
input
|
||||
margin: 0
|
||||
//.workflow-action-definition-value-type-display
|
||||
// @extend .fa, .fa-lg
|
||||
// &.boolean
|
||||
// @extend .checker
|
||||
// &.date
|
||||
// @extend .fa-calendar
|
||||
// &.number
|
||||
// @extend .fa-hashtag
|
||||
// &.select
|
||||
// @extend .fa-list-ul
|
||||
// &.string
|
||||
// @extend .fa-terminal
|
||||
// &.text
|
||||
// @extend .fa-sticky-note-o
|
||||
// &.window_from
|
||||
// @extend .fa-clock-o
|
||||
// &.window_to
|
||||
// @extend .fa-clock-o
|
||||
// &.timestamp
|
||||
// @extend .fa-clock-o
|
||||
.ui.dropdown
|
||||
.workflow-action-definition-value-type-display
|
||||
padding: 0
|
||||
margin-right: 6px
|
||||
margin-left: -10px
|
||||
.ui.grid.workflow-action-definition-row
|
||||
> .column
|
||||
padding-top: 0.3rem
|
||||
padding-bottom: 0.3rem
|
||||
.right.floated.icon.buttons
|
||||
// normal setting is margin-top: -0.5rem
|
||||
margin-top: -0.2rem
|
||||
.workflow-action-definition-workflow-action-offset-container
|
||||
// below divider, pull a bit up
|
||||
margin-top: -10px
|
||||
.number-input
|
||||
width: 82px
|
||||
@@ -0,0 +1,4 @@
|
||||
.workflow-group-constraints-count
|
||||
.count
|
||||
display: inline-block
|
||||
margin-right: 8px
|
||||
@@ -0,0 +1,71 @@
|
||||
.new-workflow_action_definition-button
|
||||
display: inline-block
|
||||
margin-left: 12px
|
||||
.icon
|
||||
margin-right: 12px
|
||||
|
||||
.workflow_group-name
|
||||
padding-right: rem-calc(10)
|
||||
|
||||
.workflow-instance-workflow-groups-container
|
||||
display: flex
|
||||
flex-direction: row
|
||||
flex-wrap: wrap
|
||||
align-items: flex-start
|
||||
justify-content: space-around
|
||||
|
||||
.workflow-instance-workflow-group-container
|
||||
@extend .title-box
|
||||
//float: left
|
||||
width: 412px
|
||||
padding-bottom: 0
|
||||
.workflow-instance-workflow-group-title
|
||||
@extend .title-box-heading
|
||||
margin-bottom: 0
|
||||
.right.floated.buttons
|
||||
margin-right: -12px
|
||||
|
||||
.workflow-instance-workflow-group-body
|
||||
.display-row
|
||||
&.attribute-notes
|
||||
display: none
|
||||
.display-label
|
||||
width: 65%
|
||||
.display-field
|
||||
width: 35%
|
||||
.page-actions
|
||||
//display: none
|
||||
text-align: center
|
||||
.collection-edit
|
||||
margin: 0
|
||||
padding: 5px 12px
|
||||
.workflow-action-container
|
||||
border-bottom: 1px solid #eee
|
||||
margin-left: -15px
|
||||
margin-right: -15px
|
||||
&:last-child
|
||||
border-width: 0
|
||||
.ui.grid
|
||||
margin: 0
|
||||
&.planned
|
||||
background-color: #ddd
|
||||
&.overdue
|
||||
background-color: #f7da00
|
||||
&.processing
|
||||
background-color: #cef
|
||||
&.rejected
|
||||
background-color: #ff4848
|
||||
&.completed
|
||||
background-color: #f2ffdd
|
||||
&.processing
|
||||
@extend .title-box-primary
|
||||
&.rejected
|
||||
@extend .title-box-danger
|
||||
&.completed
|
||||
@extend .title-box-success
|
||||
&.overdue
|
||||
@extend .title-box-warning
|
||||
|
||||
.modal
|
||||
.workflow-instance-workflow-group-container
|
||||
width: 242px
|
||||
@@ -0,0 +1,29 @@
|
||||
//.ui.container
|
||||
// width: 98%
|
||||
|
||||
.ui.main
|
||||
padding-top: 40px
|
||||
|
||||
.hide
|
||||
display: none
|
||||
|
||||
|
||||
.right.floated.buttons
|
||||
margin-top: -0.5rem
|
||||
|
||||
.menu.fixed
|
||||
.header.item
|
||||
padding: 0 1rem
|
||||
background-color: #444 !important
|
||||
.grid
|
||||
margin-top: -1rem
|
||||
//margin-left: 0 # active in epots adapter
|
||||
|
||||
.ui.header
|
||||
.push-action.icon
|
||||
padding: 0.6rem
|
||||
margin-right: 0
|
||||
|
||||
.ui.segment.title-box
|
||||
padding-top: 3rem
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
= yield
|
||||
@@ -0,0 +1,14 @@
|
||||
import Ember from 'ember'
|
||||
import DS from 'ember-data'
|
||||
businessDayComputations = (target, prefix, options = {}) ->
|
||||
if options.add_attributes
|
||||
Ember.defineProperty target, "#{prefix}_value", DS.attr('number', defaultValue: 0)
|
||||
Ember.defineProperty target, "#{prefix}_unit", DS.attr('string', defaultValue: options.default_unit || 'day')
|
||||
Ember.defineProperty target, "#{prefix}_business_days", DS.attr(defaultValue: -> [ 1, 2, 3, 4, 5 ])
|
||||
#Ember.defineProperty target, "#{prefix}_business_days_index_sum", Ember.computed.sum "#{prefix}_business_days"
|
||||
#Ember.defineProperty target, "has_default_#{prefix}_business_days", Ember.computed "#{prefix}_business_days.length", "#{prefix}_business_days_index_sum", ->
|
||||
# @get("#{prefix}_business_days.length") is 5 and @get("#{prefix}_business_days_index_sum") is 15
|
||||
#Ember.defineProperty target, "#{prefix}_unit_businessday", Ember.computed.equal "#{prefix}_unit", 'businessday'
|
||||
true
|
||||
|
||||
export default businessDayComputations
|
||||
@@ -0,0 +1,28 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var businessDayComputations;
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
import DS from 'ember-data';
|
||||
|
||||
businessDayComputations = function(target, prefix, options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
if (options.add_attributes) {
|
||||
Ember.defineProperty(target, prefix + "_value", DS.attr('number', {
|
||||
defaultValue: 0
|
||||
}));
|
||||
Ember.defineProperty(target, prefix + "_unit", DS.attr('string', {
|
||||
defaultValue: options.default_unit || 'day'
|
||||
}));
|
||||
Ember.defineProperty(target, prefix + "_business_days", DS.attr({
|
||||
defaultValue: function() {
|
||||
return [1, 2, 3, 4, 5];
|
||||
}
|
||||
}));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export default businessDayComputations;
|
||||
@@ -0,0 +1,148 @@
|
||||
'use strict'
|
||||
# taken from https://github.com/kalmecak/moment-business-days
|
||||
#if (typeof require === 'function') {
|
||||
# var moment = require('moment');
|
||||
#}
|
||||
|
||||
moment.fn.isHoliday = ->
|
||||
locale = @localeData()
|
||||
if locale._holidays
|
||||
if locale._holidays.indexOf(@format(locale._holidayFormat)) >= 0
|
||||
return true
|
||||
if locale.holiday
|
||||
if locale.holiday(this)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
false
|
||||
|
||||
moment.fn.isBusinessDay = (options) ->
|
||||
locale = @localeData()
|
||||
defaultWorkingWeekdays = [ 1, 2, 3, 4, 5 ]
|
||||
workingWeekdays = options.business_days or locale._workingWeekdays or defaultWorkingWeekdays
|
||||
if @isHoliday()
|
||||
return false
|
||||
if workingWeekdays.indexOf(@day()) >= 0
|
||||
return true
|
||||
false
|
||||
|
||||
moment.fn.businessDaysIntoMonth = ->
|
||||
businessDay = if @isBusinessDay() then this else @prevBusinessDay()
|
||||
monthBusinessDays = businessDay.monthBusinessDays()
|
||||
businessDaysIntoMonth = undefined
|
||||
monthBusinessDays.map (day, index) ->
|
||||
if day.format('M/DD/YY') == businessDay.format('M/DD/YY')
|
||||
businessDaysIntoMonth = index + 1
|
||||
return
|
||||
businessDaysIntoMonth
|
||||
|
||||
moment.fn.businessDiff = (param) ->
|
||||
d1 = @clone()
|
||||
d2 = param.clone()
|
||||
start = if d1 < d2 then d1 else d2
|
||||
end = if d2 > d1 then d2 else d1
|
||||
daysBetween = 0
|
||||
if start == end
|
||||
return daysBetween
|
||||
while start < end
|
||||
if start.isBusinessDay()
|
||||
daysBetween++
|
||||
start.add 1, 'd'
|
||||
daysBetween
|
||||
|
||||
moment.fn.businessAdd = (number, options = {}) ->
|
||||
options.period ||= 'days'
|
||||
day = @clone()
|
||||
signal = if number < 0 then -1 else 1
|
||||
remaining = Math.abs(number)
|
||||
while remaining
|
||||
day.add signal, options.period
|
||||
if day.isBusinessDay(options)
|
||||
remaining--
|
||||
day
|
||||
|
||||
moment.fn.businessSubtract = (number, options = {}) ->
|
||||
@businessAdd -number, options
|
||||
|
||||
moment.fn.nextBusinessDay = ->
|
||||
iterator = 1
|
||||
limit = 7
|
||||
while iterator < limit
|
||||
if @add(1, 'd').isBusinessDay()
|
||||
break
|
||||
iterator++
|
||||
this
|
||||
|
||||
moment.fn.prevBusinessDay = ->
|
||||
iterator = 1
|
||||
limit = 7
|
||||
while iterator < limit
|
||||
if @subtract(1, 'd').isBusinessDay()
|
||||
break
|
||||
iterator++
|
||||
this
|
||||
|
||||
moment.fn.monthBusinessDays = (partialEndDate) ->
|
||||
me = @clone()
|
||||
day = me.clone().startOf('month')
|
||||
end = if partialEndDate then partialEndDate else me.clone().endOf('month')
|
||||
daysArr = []
|
||||
done = false
|
||||
while !done
|
||||
if day.isBusinessDay()
|
||||
daysArr.push day.clone()
|
||||
if end.diff(day.add(1, 'd')) < 0
|
||||
done = true
|
||||
daysArr
|
||||
|
||||
moment.fn.monthNaturalDays = (fromToday) ->
|
||||
me = @clone()
|
||||
day = if fromToday then me.clone() else me.clone().startOf('month')
|
||||
end = me.clone().endOf('month')
|
||||
daysArr = []
|
||||
done = false
|
||||
while !done
|
||||
daysArr.push day.clone()
|
||||
if end.diff(day.add(1, 'd')) < 0
|
||||
done = true
|
||||
daysArr
|
||||
|
||||
moment.fn.monthBusinessWeeks = (fromToday) ->
|
||||
me = @clone()
|
||||
day = if fromToday then me.clone() else me.clone().startOf('month')
|
||||
end = me.clone().endOf('month')
|
||||
weeksArr = []
|
||||
daysArr = []
|
||||
done = false
|
||||
while !done
|
||||
if day.day() >= 1 and day.day() < 6
|
||||
daysArr.push day.clone()
|
||||
if day.day() == 5
|
||||
weeksArr.push daysArr
|
||||
daysArr = []
|
||||
if end.diff(day.add(1, 'd')) < 0
|
||||
if daysArr.length < 5
|
||||
weeksArr.push daysArr
|
||||
done = true
|
||||
weeksArr
|
||||
|
||||
moment.fn.monthNaturalWeeks = (fromToday) ->
|
||||
me = @clone()
|
||||
day = if fromToday then me.clone() else me.clone().startOf('month')
|
||||
end = me.clone().endOf('month')
|
||||
weeksArr = []
|
||||
daysArr = []
|
||||
done = false
|
||||
while !done
|
||||
daysArr.push day.clone()
|
||||
if day.day() == 6
|
||||
weeksArr.push daysArr
|
||||
daysArr = []
|
||||
if end.diff(day.add(1, 'd')) < 0
|
||||
if daysArr.length < 7
|
||||
weeksArr.push daysArr
|
||||
done = true
|
||||
weeksArr
|
||||
|
||||
if typeof module isnt 'undefined' and module.exports
|
||||
module.exports = moment
|
||||
@@ -0,0 +1,204 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
'use strict';
|
||||
moment.fn.isHoliday = function() {
|
||||
var locale;
|
||||
locale = this.localeData();
|
||||
if (locale._holidays) {
|
||||
if (locale._holidays.indexOf(this.format(locale._holidayFormat)) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (locale.holiday) {
|
||||
if (locale.holiday(this)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
moment.fn.isBusinessDay = function(options) {
|
||||
var defaultWorkingWeekdays, locale, workingWeekdays;
|
||||
locale = this.localeData();
|
||||
defaultWorkingWeekdays = [1, 2, 3, 4, 5];
|
||||
workingWeekdays = options.business_days || locale._workingWeekdays || defaultWorkingWeekdays;
|
||||
if (this.isHoliday()) {
|
||||
return false;
|
||||
}
|
||||
if (workingWeekdays.indexOf(this.day()) >= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
moment.fn.businessDaysIntoMonth = function() {
|
||||
var businessDay, businessDaysIntoMonth, monthBusinessDays;
|
||||
businessDay = this.isBusinessDay() ? this : this.prevBusinessDay();
|
||||
monthBusinessDays = businessDay.monthBusinessDays();
|
||||
businessDaysIntoMonth = void 0;
|
||||
monthBusinessDays.map(function(day, index) {
|
||||
if (day.format('M/DD/YY') === businessDay.format('M/DD/YY')) {
|
||||
businessDaysIntoMonth = index + 1;
|
||||
}
|
||||
});
|
||||
return businessDaysIntoMonth;
|
||||
};
|
||||
|
||||
moment.fn.businessDiff = function(param) {
|
||||
var d1, d2, daysBetween, end, start;
|
||||
d1 = this.clone();
|
||||
d2 = param.clone();
|
||||
start = d1 < d2 ? d1 : d2;
|
||||
end = d2 > d1 ? d2 : d1;
|
||||
daysBetween = 0;
|
||||
if (start === end) {
|
||||
return daysBetween;
|
||||
}
|
||||
while (start < end) {
|
||||
if (start.isBusinessDay()) {
|
||||
daysBetween++;
|
||||
}
|
||||
start.add(1, 'd');
|
||||
}
|
||||
return daysBetween;
|
||||
};
|
||||
|
||||
moment.fn.businessAdd = function(number, options) {
|
||||
var day, remaining, signal;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
options.period || (options.period = 'days');
|
||||
day = this.clone();
|
||||
signal = number < 0 ? -1 : 1;
|
||||
remaining = Math.abs(number);
|
||||
while (remaining) {
|
||||
day.add(signal, options.period);
|
||||
if (day.isBusinessDay(options)) {
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
return day;
|
||||
};
|
||||
|
||||
moment.fn.businessSubtract = function(number, options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
return this.businessAdd(-number, options);
|
||||
};
|
||||
|
||||
moment.fn.nextBusinessDay = function() {
|
||||
var iterator, limit;
|
||||
iterator = 1;
|
||||
limit = 7;
|
||||
while (iterator < limit) {
|
||||
if (this.add(1, 'd').isBusinessDay()) {
|
||||
break;
|
||||
}
|
||||
iterator++;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
moment.fn.prevBusinessDay = function() {
|
||||
var iterator, limit;
|
||||
iterator = 1;
|
||||
limit = 7;
|
||||
while (iterator < limit) {
|
||||
if (this.subtract(1, 'd').isBusinessDay()) {
|
||||
break;
|
||||
}
|
||||
iterator++;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
moment.fn.monthBusinessDays = function(partialEndDate) {
|
||||
var day, daysArr, done, end, me;
|
||||
me = this.clone();
|
||||
day = me.clone().startOf('month');
|
||||
end = partialEndDate ? partialEndDate : me.clone().endOf('month');
|
||||
daysArr = [];
|
||||
done = false;
|
||||
while (!done) {
|
||||
if (day.isBusinessDay()) {
|
||||
daysArr.push(day.clone());
|
||||
}
|
||||
if (end.diff(day.add(1, 'd')) < 0) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
return daysArr;
|
||||
};
|
||||
|
||||
moment.fn.monthNaturalDays = function(fromToday) {
|
||||
var day, daysArr, done, end, me;
|
||||
me = this.clone();
|
||||
day = fromToday ? me.clone() : me.clone().startOf('month');
|
||||
end = me.clone().endOf('month');
|
||||
daysArr = [];
|
||||
done = false;
|
||||
while (!done) {
|
||||
daysArr.push(day.clone());
|
||||
if (end.diff(day.add(1, 'd')) < 0) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
return daysArr;
|
||||
};
|
||||
|
||||
moment.fn.monthBusinessWeeks = function(fromToday) {
|
||||
var day, daysArr, done, end, me, weeksArr;
|
||||
me = this.clone();
|
||||
day = fromToday ? me.clone() : me.clone().startOf('month');
|
||||
end = me.clone().endOf('month');
|
||||
weeksArr = [];
|
||||
daysArr = [];
|
||||
done = false;
|
||||
while (!done) {
|
||||
if (day.day() >= 1 && day.day() < 6) {
|
||||
daysArr.push(day.clone());
|
||||
}
|
||||
if (day.day() === 5) {
|
||||
weeksArr.push(daysArr);
|
||||
daysArr = [];
|
||||
}
|
||||
if (end.diff(day.add(1, 'd')) < 0) {
|
||||
if (daysArr.length < 5) {
|
||||
weeksArr.push(daysArr);
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
return weeksArr;
|
||||
};
|
||||
|
||||
moment.fn.monthNaturalWeeks = function(fromToday) {
|
||||
var day, daysArr, done, end, me, weeksArr;
|
||||
me = this.clone();
|
||||
day = fromToday ? me.clone() : me.clone().startOf('month');
|
||||
end = me.clone().endOf('month');
|
||||
weeksArr = [];
|
||||
daysArr = [];
|
||||
done = false;
|
||||
while (!done) {
|
||||
daysArr.push(day.clone());
|
||||
if (day.day() === 6) {
|
||||
weeksArr.push(daysArr);
|
||||
daysArr = [];
|
||||
}
|
||||
if (end.diff(day.add(1, 'd')) < 0) {
|
||||
if (daysArr.length < 7) {
|
||||
weeksArr.push(daysArr);
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
return weeksArr;
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = moment;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
export default pandaRouteSetup = (context) ->
|
||||
context.route 'project', ->
|
||||
@route 'show', path: ':project_id', ->
|
||||
@route 'dunlop'
|
||||
@route 'tracker-subjects'
|
||||
@route 'tracker-subject', path: 'tracker-subject/:tracker_subject_id'
|
||||
@route 'add-progress'
|
||||
#@route 'tracker-subject', ->
|
||||
# @route 'show'
|
||||
@route 'dunlop-generator'
|
||||
@route 'analysis'
|
||||
@route 'project-instance', ->
|
||||
@route 'show', path: ':project_instance_id', ->
|
||||
@route 'groups'
|
||||
@route 'list'
|
||||
@route 'actions'
|
||||
@route 'graphs'
|
||||
@route 'project-instance-group', ->
|
||||
@route 'show', path: ':project_instance_group_id'
|
||||
@route 'project-instance-action', ->
|
||||
@route 'show', path: ':project_instance_action_id'
|
||||
#@route 'project/views', path: 'views'
|
||||
context.route 'login'
|
||||
#@route 'organization', path: 'organizations/:organization_id'
|
||||
context.route 'action-list'
|
||||
|
||||
context.route 'organization', ->
|
||||
@route 'show', path: ':organization_id', ->
|
||||
@route 'project-actions'
|
||||
|
||||
context.route 'user', ->
|
||||
@route 'profile'
|
||||
@route 'show', path: ':user_id'
|
||||
|
||||
|
||||
context.route 'tracker-subject', ->
|
||||
@route 'show', path: ':tracker_subject_id', ->
|
||||
@route 'tracking-connections'
|
||||
@route 'tracker-group', path: 'tracker-groups/:tracker_group_id'
|
||||
@route 'project', path: 'projects/:project_id'
|
||||
#@route 'tracker-subject/tracker-group', path: 'tracker-subjects/:tracker_subject_id/tracker-groups/:tracker_group_id'
|
||||
context.route 'event'
|
||||
|
||||
context.route 'meeting-reports'
|
||||
|
||||
context.route 'manual', ->
|
||||
@route 'project', ->
|
||||
@route 'dunlop'
|
||||
@route 'tracker', ->
|
||||
@route 'tricks' # dummy/empty now, to genate the index
|
||||
true
|
||||
@@ -0,0 +1,78 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var pandaRouteSetup;
|
||||
|
||||
export default pandaRouteSetup = function(context) {
|
||||
context.route('project', function() {
|
||||
return this.route('show', {
|
||||
path: ':project_id'
|
||||
}, function() {
|
||||
this.route('dunlop');
|
||||
this.route('tracker-subjects');
|
||||
this.route('tracker-subject', {
|
||||
path: 'tracker-subject/:tracker_subject_id'
|
||||
});
|
||||
this.route('add-progress');
|
||||
this.route('dunlop-generator');
|
||||
this.route('analysis');
|
||||
this.route('project-instance', function() {
|
||||
return this.route('show', {
|
||||
path: ':project_instance_id'
|
||||
}, function() {
|
||||
this.route('groups');
|
||||
this.route('list');
|
||||
this.route('actions');
|
||||
return this.route('graphs');
|
||||
});
|
||||
});
|
||||
this.route('project-instance-group', function() {
|
||||
return this.route('show', {
|
||||
path: ':project_instance_group_id'
|
||||
});
|
||||
});
|
||||
return this.route('project-instance-action', function() {
|
||||
return this.route('show', {
|
||||
path: ':project_instance_action_id'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
context.route('login');
|
||||
context.route('action-list');
|
||||
context.route('organization', function() {
|
||||
return this.route('show', {
|
||||
path: ':organization_id'
|
||||
}, function() {
|
||||
return this.route('project-actions');
|
||||
});
|
||||
});
|
||||
context.route('user', function() {
|
||||
this.route('profile');
|
||||
return this.route('show', {
|
||||
path: ':user_id'
|
||||
});
|
||||
});
|
||||
context.route('tracker-subject', function() {
|
||||
return this.route('show', {
|
||||
path: ':tracker_subject_id'
|
||||
}, function() {
|
||||
this.route('tracking-connections');
|
||||
this.route('tracker-group', {
|
||||
path: 'tracker-groups/:tracker_group_id'
|
||||
});
|
||||
return this.route('project', {
|
||||
path: 'projects/:project_id'
|
||||
});
|
||||
});
|
||||
});
|
||||
context.route('event');
|
||||
context.route('meeting-reports');
|
||||
context.route('manual', function() {
|
||||
this.route('project', function() {
|
||||
return this.route('dunlop');
|
||||
});
|
||||
return this.route('tracker', function() {
|
||||
return this.route('tricks');
|
||||
});
|
||||
});
|
||||
return true;
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
import Ember from 'ember'
|
||||
# get_active_workflow_action_definitions(workflow_action_definitions, project_scenarios, set_operation = 'union or intersection')
|
||||
# this util takes as first arguments the workflow_action_definitions scope
|
||||
# and tries to apply filtering based on the given project_scenarios and set_operation
|
||||
|
||||
get_active_workflow_action_definitions_using_union = (project_scenarios) ->
|
||||
selected_project_scenario_workflow_action_definition_ids = []
|
||||
working_workflow_action_definitions = []
|
||||
project_scenarios.forEach (selected_project_scenario) ->
|
||||
selected_project_scenario.get('workflow_action_definitions').forEach (workflow_action_definition) ->
|
||||
if selected_project_scenario_workflow_action_definition_ids.indexOf(workflow_action_definition.get('id')) < 0
|
||||
selected_project_scenario_workflow_action_definition_ids.push workflow_action_definition.get('id')
|
||||
working_workflow_action_definitions.push workflow_action_definition
|
||||
working_workflow_action_definitions
|
||||
|
||||
get_active_workflow_action_definitions_using_intersection = (workflow_action_definitions, project_scenarios) ->
|
||||
selected_project_scenario_workflow_action_definition_ids = []
|
||||
first_run = true
|
||||
project_scenarios.forEach (selected_project_scenario) ->
|
||||
current_workflow_action_definition_ids = selected_project_scenario.get('workflow_action_definitions').mapBy('id').toArray()
|
||||
if first_run
|
||||
selected_project_scenario_workflow_action_definition_ids = current_workflow_action_definition_ids
|
||||
first_run = false
|
||||
return
|
||||
selected_project_scenario_workflow_action_definition_ids = selected_project_scenario_workflow_action_definition_ids.filter (id) -> id in current_workflow_action_definition_ids
|
||||
workflow_action_definitions.filter((r) -> r.get('id') in selected_project_scenario_workflow_action_definition_ids)
|
||||
|
||||
get_active_workflow_action_definitions = (workflow_action_definitions, project_scenarios, set_operation = 'union') ->
|
||||
project_scenarios = Ember.makeArray(project_scenarios)
|
||||
workflow_action_definitions = workflow_action_definitions.toArray()
|
||||
# initialize unused working workflow-action-definitions
|
||||
if project_scenarios.length
|
||||
if set_operation is 'intersection'
|
||||
get_active_workflow_action_definitions_using_intersection(workflow_action_definitions, project_scenarios)
|
||||
else
|
||||
get_active_workflow_action_definitions_using_union(project_scenarios)
|
||||
else
|
||||
# no filtering can be allplied, return all
|
||||
workflow_action_definitions
|
||||
|
||||
export { get_active_workflow_action_definitions_using_union }
|
||||
export { get_active_workflow_action_definitions_using_intersection }
|
||||
export { get_active_workflow_action_definitions }
|
||||
|
||||
export default get_active_workflow_action_definitions
|
||||
@@ -0,0 +1,73 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var get_active_workflow_action_definitions, get_active_workflow_action_definitions_using_intersection, get_active_workflow_action_definitions_using_union,
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
get_active_workflow_action_definitions_using_union = function(project_scenarios) {
|
||||
var selected_project_scenario_workflow_action_definition_ids, working_workflow_action_definitions;
|
||||
selected_project_scenario_workflow_action_definition_ids = [];
|
||||
working_workflow_action_definitions = [];
|
||||
project_scenarios.forEach(function(selected_project_scenario) {
|
||||
return selected_project_scenario.get('workflow_action_definitions').forEach(function(workflow_action_definition) {
|
||||
if (selected_project_scenario_workflow_action_definition_ids.indexOf(workflow_action_definition.get('id')) < 0) {
|
||||
selected_project_scenario_workflow_action_definition_ids.push(workflow_action_definition.get('id'));
|
||||
return working_workflow_action_definitions.push(workflow_action_definition);
|
||||
}
|
||||
});
|
||||
});
|
||||
return working_workflow_action_definitions;
|
||||
};
|
||||
|
||||
get_active_workflow_action_definitions_using_intersection = function(workflow_action_definitions, project_scenarios) {
|
||||
var first_run, selected_project_scenario_workflow_action_definition_ids;
|
||||
selected_project_scenario_workflow_action_definition_ids = [];
|
||||
first_run = true;
|
||||
project_scenarios.forEach(function(selected_project_scenario) {
|
||||
var current_workflow_action_definition_ids;
|
||||
current_workflow_action_definition_ids = selected_project_scenario.get('workflow_action_definitions').mapBy('id').toArray();
|
||||
if (first_run) {
|
||||
selected_project_scenario_workflow_action_definition_ids = current_workflow_action_definition_ids;
|
||||
first_run = false;
|
||||
return;
|
||||
}
|
||||
return selected_project_scenario_workflow_action_definition_ids = selected_project_scenario_workflow_action_definition_ids.filter(function(id) {
|
||||
return indexOf.call(current_workflow_action_definition_ids, id) >= 0;
|
||||
});
|
||||
});
|
||||
return workflow_action_definitions.filter(function(r) {
|
||||
var ref;
|
||||
return ref = r.get('id'), indexOf.call(selected_project_scenario_workflow_action_definition_ids, ref) >= 0;
|
||||
});
|
||||
};
|
||||
|
||||
get_active_workflow_action_definitions = function(workflow_action_definitions, project_scenarios, set_operation) {
|
||||
if (set_operation == null) {
|
||||
set_operation = 'union';
|
||||
}
|
||||
project_scenarios = Ember.makeArray(project_scenarios);
|
||||
workflow_action_definitions = workflow_action_definitions.toArray();
|
||||
if (project_scenarios.length) {
|
||||
if (set_operation === 'intersection') {
|
||||
return get_active_workflow_action_definitions_using_intersection(workflow_action_definitions, project_scenarios);
|
||||
} else {
|
||||
return get_active_workflow_action_definitions_using_union(project_scenarios);
|
||||
}
|
||||
} else {
|
||||
return workflow_action_definitions;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
get_active_workflow_action_definitions_using_union
|
||||
};
|
||||
|
||||
export {
|
||||
get_active_workflow_action_definitions_using_intersection
|
||||
};
|
||||
|
||||
export {
|
||||
get_active_workflow_action_definitions
|
||||
};
|
||||
|
||||
export default get_active_workflow_action_definitions;
|
||||
@@ -0,0 +1,45 @@
|
||||
import Ember from 'ember'
|
||||
# get_active_workflow_groups(workflow_groups, project_scenarios, set_operation = 'union or intersection')
|
||||
# this util takes as first arguments the workflow_groups scope
|
||||
# and tries to apply filtering based on the given project_scenarios and set_operation
|
||||
|
||||
get_active_workflow_groups_using_union = (project_scenarios) ->
|
||||
selected_project_scenario_workflow_group_ids = []
|
||||
working_workflow_groups = []
|
||||
project_scenarios.forEach (selected_project_scenario) ->
|
||||
selected_project_scenario.get('workflow_groups').forEach (workflow_group) ->
|
||||
if selected_project_scenario_workflow_group_ids.indexOf(workflow_group.get('id')) < 0
|
||||
selected_project_scenario_workflow_group_ids.push workflow_group.get('id')
|
||||
working_workflow_groups.push workflow_group
|
||||
working_workflow_groups
|
||||
|
||||
get_active_workflow_groups_using_intersection = (workflow_groups, project_scenarios) ->
|
||||
selected_project_scenario_workflow_group_ids = []
|
||||
first_run = true
|
||||
project_scenarios.forEach (selected_project_scenario) ->
|
||||
current_workflow_group_ids = selected_project_scenario.get('workflow_groups').mapBy('id').toArray()
|
||||
if first_run
|
||||
selected_project_scenario_workflow_group_ids = current_workflow_group_ids
|
||||
first_run = false
|
||||
return
|
||||
selected_project_scenario_workflow_group_ids = selected_project_scenario_workflow_group_ids.filter (id) -> id in current_workflow_group_ids
|
||||
workflow_groups.filter((r) -> r.get('id') in selected_project_scenario_workflow_group_ids)
|
||||
|
||||
get_active_workflow_groups = (workflow_groups, project_scenarios, set_operation = 'union') ->
|
||||
project_scenarios = Ember.makeArray(project_scenarios)
|
||||
workflow_groups = workflow_groups.toArray()
|
||||
# initialize unused working workflow-groups
|
||||
if project_scenarios.length
|
||||
if set_operation is 'intersection'
|
||||
get_active_workflow_groups_using_intersection(workflow_groups, project_scenarios)
|
||||
else
|
||||
get_active_workflow_groups_using_union(project_scenarios)
|
||||
else
|
||||
# no filtering can be allplied, return all
|
||||
workflow_groups
|
||||
|
||||
export { get_active_workflow_groups_using_union }
|
||||
export { get_active_workflow_groups_using_intersection }
|
||||
export { get_active_workflow_groups }
|
||||
|
||||
export default get_active_workflow_groups
|
||||
@@ -0,0 +1,73 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var get_active_workflow_groups, get_active_workflow_groups_using_intersection, get_active_workflow_groups_using_union,
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
get_active_workflow_groups_using_union = function(project_scenarios) {
|
||||
var selected_project_scenario_workflow_group_ids, working_workflow_groups;
|
||||
selected_project_scenario_workflow_group_ids = [];
|
||||
working_workflow_groups = [];
|
||||
project_scenarios.forEach(function(selected_project_scenario) {
|
||||
return selected_project_scenario.get('workflow_groups').forEach(function(workflow_group) {
|
||||
if (selected_project_scenario_workflow_group_ids.indexOf(workflow_group.get('id')) < 0) {
|
||||
selected_project_scenario_workflow_group_ids.push(workflow_group.get('id'));
|
||||
return working_workflow_groups.push(workflow_group);
|
||||
}
|
||||
});
|
||||
});
|
||||
return working_workflow_groups;
|
||||
};
|
||||
|
||||
get_active_workflow_groups_using_intersection = function(workflow_groups, project_scenarios) {
|
||||
var first_run, selected_project_scenario_workflow_group_ids;
|
||||
selected_project_scenario_workflow_group_ids = [];
|
||||
first_run = true;
|
||||
project_scenarios.forEach(function(selected_project_scenario) {
|
||||
var current_workflow_group_ids;
|
||||
current_workflow_group_ids = selected_project_scenario.get('workflow_groups').mapBy('id').toArray();
|
||||
if (first_run) {
|
||||
selected_project_scenario_workflow_group_ids = current_workflow_group_ids;
|
||||
first_run = false;
|
||||
return;
|
||||
}
|
||||
return selected_project_scenario_workflow_group_ids = selected_project_scenario_workflow_group_ids.filter(function(id) {
|
||||
return indexOf.call(current_workflow_group_ids, id) >= 0;
|
||||
});
|
||||
});
|
||||
return workflow_groups.filter(function(r) {
|
||||
var ref;
|
||||
return ref = r.get('id'), indexOf.call(selected_project_scenario_workflow_group_ids, ref) >= 0;
|
||||
});
|
||||
};
|
||||
|
||||
get_active_workflow_groups = function(workflow_groups, project_scenarios, set_operation) {
|
||||
if (set_operation == null) {
|
||||
set_operation = 'union';
|
||||
}
|
||||
project_scenarios = Ember.makeArray(project_scenarios);
|
||||
workflow_groups = workflow_groups.toArray();
|
||||
if (project_scenarios.length) {
|
||||
if (set_operation === 'intersection') {
|
||||
return get_active_workflow_groups_using_intersection(workflow_groups, project_scenarios);
|
||||
} else {
|
||||
return get_active_workflow_groups_using_union(project_scenarios);
|
||||
}
|
||||
} else {
|
||||
return workflow_groups;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
get_active_workflow_groups_using_union
|
||||
};
|
||||
|
||||
export {
|
||||
get_active_workflow_groups_using_intersection
|
||||
};
|
||||
|
||||
export {
|
||||
get_active_workflow_groups
|
||||
};
|
||||
|
||||
export default get_active_workflow_groups;
|
||||
@@ -0,0 +1,4 @@
|
||||
projectContract = () ->
|
||||
true
|
||||
|
||||
export default projectContract
|
||||
@@ -0,0 +1,8 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var projectContract;
|
||||
|
||||
projectContract = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
export default projectContract;
|
||||
@@ -0,0 +1,295 @@
|
||||
#projectGetWorkflowActionDefinitionOffsets = () ->
|
||||
# true
|
||||
#export default projectGetWorkflowActionDefinitionOffsets
|
||||
import Ember from 'ember'
|
||||
|
||||
RecordNode = Ember.Object.extend
|
||||
resolved: false
|
||||
title: Ember.computed 'record.title', 'value_shift', ->
|
||||
title = @get('record.title')
|
||||
title = " #{title} (#{value_shift}d)" if value_shift = @get('value_shift')
|
||||
title
|
||||
|
||||
OffsetNode = Ember.Object.extend
|
||||
record: null
|
||||
total_offset: 0
|
||||
value_shift: 0
|
||||
resulting_absolute_value: 0
|
||||
|
||||
WorkflowActionDefinitionOffsetNodes = Ember.Object.extend
|
||||
iteration_context_counter: 0
|
||||
workflow_action_definitions: []
|
||||
reference_date: null
|
||||
batch_size: 0
|
||||
active_project_scenario: null
|
||||
|
||||
forEach: ->
|
||||
@get('processed_workflow_action_definitions').forEach(arguments...)
|
||||
|
||||
filterBy: ->
|
||||
@get('processed_workflow_action_definitions').filterBy(arguments...)
|
||||
|
||||
get_resolved: ->
|
||||
@get('processed_workflow_action_definitions').filterBy('resolved')
|
||||
|
||||
init: ->
|
||||
@set 'scope_workflow_action_definition_ids', @get('workflow_action_definitions').mapBy('id').toArray()
|
||||
@set 'processed_workflow_action_definitions', []
|
||||
@set 'working_workflow_action_definitions', []
|
||||
@get_workflow_action_definition_offsets()
|
||||
|
||||
get_workflow_action_definition_offsets: ->
|
||||
base = @
|
||||
active_scenario_identifier = @get('active_project_scenario.identifier')
|
||||
scope_workflow_action_definition_ids = @get('scope_workflow_action_definition_ids')
|
||||
first_loop_actions = []
|
||||
working_workflow_action_definitions = []
|
||||
@get('workflow_action_definitions').forEach (workflow_action_definition) ->
|
||||
action_added = false
|
||||
if workflow_action_definition.get('offset_type') is 'configured'
|
||||
workflow_action_definition.get('workflow_action_offsets').forEach (workflow_action_offset) ->
|
||||
return if action_added
|
||||
return if active_scenario_identifier and workflow_action_offset.get('project_scenario.identifier') and workflow_action_offset.get('project_scenario.identifier') isnt active_scenario_identifier
|
||||
if not workflow_action_offset.get('base_workflow_action_definition.content') # x_based
|
||||
[offset_date, offset_value] = base.get_offset_for_target(workflow_action_offset, 0)
|
||||
[date, value_shift] = base.get_dynamic_offset_for_target(workflow_action_offset, offset_value)
|
||||
absolute_value = offset_value + value_shift
|
||||
record_wrapper = RecordNode.create
|
||||
record: workflow_action_definition
|
||||
record_id: workflow_action_definition.get('id')
|
||||
offset_wrappers: [
|
||||
OffsetNode.create(total_offset: absolute_value, value_shift: value_shift)
|
||||
]
|
||||
absolute_value: absolute_value
|
||||
value_shift: value_shift
|
||||
date: date
|
||||
resolve_type: 'x'
|
||||
resolved: true
|
||||
resolve_level: 0
|
||||
first_loop_actions.push record_wrapper
|
||||
action_added = true
|
||||
working_workflow_action_definitions.push workflow_action_definition unless action_added
|
||||
|
||||
@set 'processed_workflow_action_definitions', first_loop_actions
|
||||
@set 'working_workflow_action_definitions', working_workflow_action_definitions
|
||||
|
||||
@incrementProperty 'iteration_context_counter'
|
||||
#@set 'working_workflow_action_definitions', @get('workflow_action_definitions').filterBy('offset_type', 'configured')
|
||||
@run_critical_path_resolve_loop()
|
||||
resolve_level = @get('iteration_context_counter')
|
||||
@get('working_workflow_action_definitions').forEach (unresolved_workflow_action_definition) => # add unresolved records
|
||||
offset_wrappers = []
|
||||
unresolved_workflow_action_definition.get('workflow_action_offsets').forEach (action_offset) ->
|
||||
return unless action_offset.get('base_workflow_action_definition.id') in scope_workflow_action_definition_ids # do not add offsets from other scenarios
|
||||
offset_wrappers.push OffsetNode.create
|
||||
total_offset: action_offset.get('offset_value')
|
||||
record: action_offset
|
||||
@get('processed_workflow_action_definitions').push RecordNode.create
|
||||
record: unresolved_workflow_action_definition
|
||||
record_id: unresolved_workflow_action_definition.get('id')
|
||||
offset_wrappers: offset_wrappers
|
||||
resolved: false
|
||||
resolve_level: resolve_level
|
||||
resolve_type: 'unresolved'
|
||||
|
||||
get_dynamic_offset_for_target: (target, absolute_value) ->
|
||||
base_date = @get('reference_date').clone().add(absolute_value, 'day')
|
||||
empty = [base_date, 0]
|
||||
return empty unless batch_size = @get('batch_size')
|
||||
return empty unless threshold = target.get('batch_element_threshold_value')
|
||||
return empty unless threshold_exceedance = Math.floor(batch_size / (0.1 + parseInt(threshold))) # + 0.1 (delta) to exclude exact match of batch_size and threshold. First day is action day
|
||||
|
||||
period_unit = target.get('batch_element_threshold_unit')
|
||||
offset_value = target.get('offset_value')
|
||||
operation = if offset_value < 0 then 'subtract' else 'add'
|
||||
if period_unit is 'businessday'
|
||||
operation = "business#{operation.capitalize()}"
|
||||
shifted_date = base_date.clone()[operation](threshold_exceedance, business_days: target.get('batch_element_threshold_business_days'))
|
||||
else
|
||||
shifted_date = base_date.clone()[operation](threshold_exceedance, period_unit)
|
||||
value_shift = shifted_date.diff(base_date, 'day')
|
||||
[shifted_date, value_shift]
|
||||
|
||||
get_offset_for_target: (target, absolute_value) ->
|
||||
base_date = @get('reference_date').clone().add(absolute_value, 'day')
|
||||
empty = [base_date, 0]
|
||||
return empty unless offset_value = target.get('offset_value')
|
||||
period_unit = target.get('offset_unit')
|
||||
operation = if offset_value < 0 then 'subtract' else 'add'
|
||||
if period_unit is 'businessday'
|
||||
operation = "business#{operation.capitalize()}"
|
||||
shifted_date = base_date.clone()[operation](Math.abs(offset_value), business_days: target.get('offset_business_days'))
|
||||
else
|
||||
shifted_date = base_date.clone()[operation](Math.abs(offset_value), period_unit)
|
||||
value_shift = shifted_date.diff(base_date, 'day')
|
||||
#debugger if target.get('workflow_action_definition.title') is 'Initial check done'
|
||||
[shifted_date, value_shift]
|
||||
|
||||
run_critical_path_resolve_loop: ->
|
||||
working_indices_to_be_removed = []
|
||||
active_scenario_identifier = @get('active_project_scenario.identifier')
|
||||
processed_workflow_action_definitions = @get('processed_workflow_action_definitions')
|
||||
scope_workflow_action_definition_ids = @get('scope_workflow_action_definition_ids')
|
||||
get_dynamic_offset_for_target = @get('get_dynamic_offset_for_target').bind(@)
|
||||
get_offset_for_target = @get('get_offset_for_target').bind(@)
|
||||
resolve_level = @get('iteration_context_counter')
|
||||
@get('working_workflow_action_definitions').forEach (working_workflow_action_definition, working_index) ->
|
||||
return unless working_workflow_action_definition.get('offset_type') is 'configured'
|
||||
farthest_absolute_value = 0
|
||||
farthest_absolute_value_value_shift = 0
|
||||
farthest_result_total_offset = 0
|
||||
date = null # scoping
|
||||
resolved_offset_wrappers = []
|
||||
all_offsets_resolved = working_workflow_action_definition.get('workflow_action_offsets').every (workflow_action_offset) ->
|
||||
return true if active_scenario_identifier and workflow_action_offset.get('project_scenario.identifier') and workflow_action_offset.get('project_scenario.identifier') isnt active_scenario_identifier
|
||||
unless processed_base_workflow_action_definition_wrapper = processed_workflow_action_definitions.findBy 'record_id', workflow_action_offset.get('base_workflow_action_definition.id')
|
||||
if workflow_action_offset.get('base_workflow_action_definition.id') not in scope_workflow_action_definition_ids # base is not present in this scenario, do not pursue this connection
|
||||
return true
|
||||
return false
|
||||
processed_absolute_value = processed_base_workflow_action_definition_wrapper.get('absolute_value')
|
||||
[offset_date, working_offset_value] = get_offset_for_target(workflow_action_offset, processed_absolute_value)
|
||||
[date, current_connection_value_shift] = get_dynamic_offset_for_target(workflow_action_offset, processed_absolute_value + working_offset_value)
|
||||
current_connection_total_offset_value = current_connection_value_shift + working_offset_value
|
||||
current_connection_absolute_value = processed_absolute_value + current_connection_total_offset_value
|
||||
#debugger if processed_base_workflow_action_definition_wrapper.get('record.title') is 'Initial check done'
|
||||
#debugger if working_workflow_action_definition.get('title') is 'Initial check done'
|
||||
if Math.abs(current_connection_absolute_value) > Math.abs(farthest_absolute_value)
|
||||
farthest_absolute_value = current_connection_absolute_value
|
||||
farthest_absolute_value_value_shift = current_connection_value_shift
|
||||
farthest_result_total_offset = current_connection_total_offset_value
|
||||
resolved_offset_wrappers.push OffsetNode.create
|
||||
record: workflow_action_offset
|
||||
value_shift: current_connection_value_shift
|
||||
total_offset: current_connection_total_offset_value
|
||||
resulting_absolute_value: current_connection_absolute_value
|
||||
true # indicate processed_base_workflow_action_definition_wrapper found for all_offsets_resolved value
|
||||
|
||||
if all_offsets_resolved and resolved_offset_wrappers.length
|
||||
record_wrapper = RecordNode.create
|
||||
record: working_workflow_action_definition
|
||||
record_id: working_workflow_action_definition.get('id')
|
||||
offset_wrappers: resolved_offset_wrappers
|
||||
value_shift: farthest_absolute_value_value_shift
|
||||
absolute_value: farthest_absolute_value
|
||||
date: date
|
||||
resolved: true
|
||||
resolve_level: resolve_level
|
||||
resolve_type: 'critical-path'
|
||||
processed_workflow_action_definitions.push record_wrapper
|
||||
working_indices_to_be_removed.push working_index
|
||||
if working_indices_to_be_removed.length
|
||||
@get('working_workflow_action_definitions').splice(working_indices_to_be_removed.pop(), 1) while working_indices_to_be_removed.length
|
||||
@run_critical_path_resolve_loop()
|
||||
else
|
||||
@incrementProperty 'iteration_context_counter'
|
||||
@run_unresolved_tree_resolve_loop()
|
||||
|
||||
run_unresolved_tree_resolve_loop: ->
|
||||
working_indices_to_be_removed = []
|
||||
active_scenario_identifier = @get('active_project_scenario.identifier')
|
||||
processed_workflow_action_definitions = @get('processed_workflow_action_definitions')
|
||||
scope_workflow_action_definition_ids = @get('scope_workflow_action_definition_ids')
|
||||
get_offset_for_target = @get('get_offset_for_target').bind(@)
|
||||
get_dynamic_offset_for_target = @get('get_dynamic_offset_for_target').bind(@)
|
||||
resolve_level = @get('iteration_context_counter')
|
||||
@get('working_workflow_action_definitions').forEach (working_workflow_action_definition, working_index) ->
|
||||
return unless working_workflow_action_definition.get('offset_type') is 'configured'
|
||||
farthest_absolute_value = 0
|
||||
farthest_absolute_value_value_shift = 0
|
||||
farthest_result_total_offset = 0
|
||||
date = null # scoping
|
||||
resolved_offset_wrappers = []
|
||||
working_workflow_action_definition.get('workflow_action_offsets').forEach (workflow_action_offset) ->
|
||||
return if active_scenario_identifier and workflow_action_offset.get('project_scenario.identifier') and workflow_action_offset.get('project_scenario.identifier') isnt active_scenario_identifier
|
||||
return unless workflow_action_offset.get('base_workflow_action_definition.id') in scope_workflow_action_definition_ids
|
||||
return unless processed_base_workflow_action_definition_wrapper = processed_workflow_action_definitions.findBy 'record_id', workflow_action_offset.get('base_workflow_action_definition.id')
|
||||
processed_absolute_value = processed_base_workflow_action_definition_wrapper.get('absolute_value')
|
||||
[offset_date, working_offset_value] = get_offset_for_target(workflow_action_offset, processed_absolute_value)
|
||||
[date, current_connection_value_shift] = get_dynamic_offset_for_target(workflow_action_offset, processed_absolute_value + working_offset_value)
|
||||
current_connection_total_offset_value = current_connection_value_shift + working_offset_value
|
||||
current_connection_absolute_value = processed_absolute_value + current_connection_total_offset_value
|
||||
#debugger if processed_base_workflow_action_definition_wrapper.get('record.title') is 'Initial check done'
|
||||
#debugger if working_workflow_action_definition.get('title') is 'Initial check done'
|
||||
if Math.abs(current_connection_absolute_value) > Math.abs(farthest_absolute_value)
|
||||
farthest_absolute_value = current_connection_absolute_value
|
||||
farthest_absolute_value_value_shift = current_connection_value_shift
|
||||
farthest_result_total_offset = current_connection_total_offset_value
|
||||
resolved_offset_wrappers.push OffsetNode.create
|
||||
record: workflow_action_offset
|
||||
value_shift: current_connection_value_shift
|
||||
total_offset: current_connection_total_offset_value
|
||||
resulting_absolute_value: current_connection_absolute_value
|
||||
if resolved_offset_wrappers.length
|
||||
record_wrapper = RecordNode.create
|
||||
record: working_workflow_action_definition
|
||||
record_id: working_workflow_action_definition.get('id')
|
||||
offset_wrappers: resolved_offset_wrappers # .clone()?
|
||||
value_shift: farthest_absolute_value_value_shift
|
||||
absolute_value: farthest_absolute_value
|
||||
date: date
|
||||
resolved: true
|
||||
resolve_level: resolve_level
|
||||
resolve_type: 'with-non-rooted-offsets'
|
||||
processed_workflow_action_definitions.push record_wrapper
|
||||
working_indices_to_be_removed.push working_index
|
||||
|
||||
if working_indices_to_be_removed.length
|
||||
@get('working_workflow_action_definitions').splice(working_indices_to_be_removed.pop(), 1) while working_indices_to_be_removed.length
|
||||
@run_critical_path_resolve_loop()
|
||||
else
|
||||
@run_offset_forwarding_loop()
|
||||
|
||||
run_offset_forwarding_loop: ->
|
||||
working_indices_to_be_removed = []
|
||||
active_scenario_identifier = @get('active_project_scenario.identifier')
|
||||
processed_workflow_action_definitions = @get('processed_workflow_action_definitions')
|
||||
scope_workflow_action_definition_ids = @get('scope_workflow_action_definition_ids')
|
||||
get_offset_for_target = @get('get_offset_for_target').bind(@)
|
||||
get_dynamic_offset_for_target = @get('get_dynamic_offset_for_target').bind(@)
|
||||
resolve_level = @get('iteration_context_counter')
|
||||
@get('working_workflow_action_definitions').forEach (working_workflow_action_definition, working_index) ->
|
||||
farthest_absolute_value = 0
|
||||
farthest_absolute_value_value_shift = 0
|
||||
farthest_result_total_offset = 0
|
||||
date = null # scoping
|
||||
resolved_offset_wrappers = []
|
||||
working_workflow_action_definition.get('dependent_workflow_action_offsets').forEach (workflow_action_offset) ->
|
||||
return if active_scenario_identifier and workflow_action_offset.get('project_scenario.identifier') and workflow_action_offset.get('project_scenario.identifier') isnt active_scenario_identifier
|
||||
return unless workflow_action_offset.get('workflow_action_definition.id') in scope_workflow_action_definition_ids
|
||||
return unless processed_base_workflow_action_definition_wrapper = processed_workflow_action_definitions.findBy 'record_id', workflow_action_offset.get('workflow_action_definition.id')
|
||||
#return if workflow_action_offset.get('workflow_action_definition.offset_type') is 'none' # do not resolve on none offset typed nodes
|
||||
processed_absolute_value = processed_base_workflow_action_definition_wrapper.get('absolute_value')
|
||||
[offset_date, working_offset_value] = get_offset_for_target(workflow_action_offset, processed_absolute_value)
|
||||
[date, current_connection_value_shift] = get_dynamic_offset_for_target(workflow_action_offset, processed_absolute_value + working_offset_value)
|
||||
current_connection_total_offset_value = current_connection_value_shift + working_offset_value
|
||||
#NOTE MINUS!!!!!!!!!!!!!!!!!!!!!
|
||||
current_connection_absolute_value = processed_absolute_value - current_connection_total_offset_value
|
||||
#debugger if processed_base_workflow_action_definition_wrapper.get('record.title') is 'Initial check done'
|
||||
#debugger if working_workflow_action_definition.get('title') is 'Initial check done'
|
||||
if Math.abs(current_connection_absolute_value) > Math.abs(farthest_absolute_value)
|
||||
farthest_absolute_value = current_connection_absolute_value
|
||||
farthest_absolute_value_value_shift = current_connection_value_shift
|
||||
farthest_result_total_offset = current_connection_total_offset_value
|
||||
resolved_offset_wrappers.push OffsetNode.create
|
||||
record: workflow_action_offset
|
||||
value_shift: current_connection_value_shift
|
||||
total_offset: current_connection_total_offset_value
|
||||
resulting_absolute_value: current_connection_absolute_value
|
||||
if resolved_offset_wrappers.length
|
||||
record_wrapper = RecordNode.create
|
||||
record: working_workflow_action_definition
|
||||
record_id: working_workflow_action_definition.get('id')
|
||||
offset_wrappers: resolved_offset_wrappers # .clone()?
|
||||
value_shift: farthest_absolute_value_value_shift
|
||||
absolute_value: farthest_absolute_value
|
||||
date: date
|
||||
resolved: true
|
||||
resolve_level: resolve_level
|
||||
resolve_type: 'offset-lookup-inversion'
|
||||
processed_workflow_action_definitions.push record_wrapper
|
||||
working_indices_to_be_removed.push working_index
|
||||
|
||||
if working_indices_to_be_removed.length
|
||||
@get('working_workflow_action_definitions').splice(working_indices_to_be_removed.pop(), 1) while working_indices_to_be_removed.length
|
||||
@run_critical_path_resolve_loop()
|
||||
export default WorkflowActionDefinitionOffsetNodes
|
||||
@@ -0,0 +1,389 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var OffsetNode, RecordNode, WorkflowActionDefinitionOffsetNodes,
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
RecordNode = Ember.Object.extend({
|
||||
resolved: false,
|
||||
title: Ember.computed('record.title', 'value_shift', function() {
|
||||
var title, value_shift;
|
||||
title = this.get('record.title');
|
||||
if (value_shift = this.get('value_shift')) {
|
||||
title = " " + title + " (" + value_shift + "d)";
|
||||
}
|
||||
return title;
|
||||
})
|
||||
});
|
||||
|
||||
OffsetNode = Ember.Object.extend({
|
||||
record: null,
|
||||
total_offset: 0,
|
||||
value_shift: 0,
|
||||
resulting_absolute_value: 0
|
||||
});
|
||||
|
||||
WorkflowActionDefinitionOffsetNodes = Ember.Object.extend({
|
||||
iteration_context_counter: 0,
|
||||
workflow_action_definitions: [],
|
||||
reference_date: null,
|
||||
batch_size: 0,
|
||||
active_project_scenario: null,
|
||||
forEach: function() {
|
||||
var ref;
|
||||
return (ref = this.get('processed_workflow_action_definitions')).forEach.apply(ref, arguments);
|
||||
},
|
||||
filterBy: function() {
|
||||
var ref;
|
||||
return (ref = this.get('processed_workflow_action_definitions')).filterBy.apply(ref, arguments);
|
||||
},
|
||||
get_resolved: function() {
|
||||
return this.get('processed_workflow_action_definitions').filterBy('resolved');
|
||||
},
|
||||
init: function() {
|
||||
this.set('scope_workflow_action_definition_ids', this.get('workflow_action_definitions').mapBy('id').toArray());
|
||||
this.set('processed_workflow_action_definitions', []);
|
||||
this.set('working_workflow_action_definitions', []);
|
||||
return this.get_workflow_action_definition_offsets();
|
||||
},
|
||||
get_workflow_action_definition_offsets: function() {
|
||||
var active_scenario_identifier, base, first_loop_actions, resolve_level, scope_workflow_action_definition_ids, working_workflow_action_definitions;
|
||||
base = this;
|
||||
active_scenario_identifier = this.get('active_project_scenario.identifier');
|
||||
scope_workflow_action_definition_ids = this.get('scope_workflow_action_definition_ids');
|
||||
first_loop_actions = [];
|
||||
working_workflow_action_definitions = [];
|
||||
this.get('workflow_action_definitions').forEach(function(workflow_action_definition) {
|
||||
var action_added;
|
||||
action_added = false;
|
||||
if (workflow_action_definition.get('offset_type') === 'configured') {
|
||||
workflow_action_definition.get('workflow_action_offsets').forEach(function(workflow_action_offset) {
|
||||
var absolute_value, date, offset_date, offset_value, record_wrapper, ref, ref1, value_shift;
|
||||
if (action_added) {
|
||||
return;
|
||||
}
|
||||
if (active_scenario_identifier && workflow_action_offset.get('project_scenario.identifier') && workflow_action_offset.get('project_scenario.identifier') !== active_scenario_identifier) {
|
||||
return;
|
||||
}
|
||||
if (!workflow_action_offset.get('base_workflow_action_definition.content')) {
|
||||
ref = base.get_offset_for_target(workflow_action_offset, 0), offset_date = ref[0], offset_value = ref[1];
|
||||
ref1 = base.get_dynamic_offset_for_target(workflow_action_offset, offset_value), date = ref1[0], value_shift = ref1[1];
|
||||
absolute_value = offset_value + value_shift;
|
||||
record_wrapper = RecordNode.create({
|
||||
record: workflow_action_definition,
|
||||
record_id: workflow_action_definition.get('id'),
|
||||
offset_wrappers: [
|
||||
OffsetNode.create({
|
||||
total_offset: absolute_value,
|
||||
value_shift: value_shift
|
||||
})
|
||||
],
|
||||
absolute_value: absolute_value,
|
||||
value_shift: value_shift,
|
||||
date: date,
|
||||
resolve_type: 'x',
|
||||
resolved: true,
|
||||
resolve_level: 0
|
||||
});
|
||||
first_loop_actions.push(record_wrapper);
|
||||
return action_added = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!action_added) {
|
||||
return working_workflow_action_definitions.push(workflow_action_definition);
|
||||
}
|
||||
});
|
||||
this.set('processed_workflow_action_definitions', first_loop_actions);
|
||||
this.set('working_workflow_action_definitions', working_workflow_action_definitions);
|
||||
this.incrementProperty('iteration_context_counter');
|
||||
this.run_critical_path_resolve_loop();
|
||||
resolve_level = this.get('iteration_context_counter');
|
||||
return this.get('working_workflow_action_definitions').forEach((function(_this) {
|
||||
return function(unresolved_workflow_action_definition) {
|
||||
var offset_wrappers;
|
||||
offset_wrappers = [];
|
||||
unresolved_workflow_action_definition.get('workflow_action_offsets').forEach(function(action_offset) {
|
||||
var ref;
|
||||
if (ref = action_offset.get('base_workflow_action_definition.id'), indexOf.call(scope_workflow_action_definition_ids, ref) < 0) {
|
||||
return;
|
||||
}
|
||||
return offset_wrappers.push(OffsetNode.create({
|
||||
total_offset: action_offset.get('offset_value'),
|
||||
record: action_offset
|
||||
}));
|
||||
});
|
||||
return _this.get('processed_workflow_action_definitions').push(RecordNode.create({
|
||||
record: unresolved_workflow_action_definition,
|
||||
record_id: unresolved_workflow_action_definition.get('id'),
|
||||
offset_wrappers: offset_wrappers,
|
||||
resolved: false,
|
||||
resolve_level: resolve_level,
|
||||
resolve_type: 'unresolved'
|
||||
}));
|
||||
};
|
||||
})(this));
|
||||
},
|
||||
get_dynamic_offset_for_target: function(target, absolute_value) {
|
||||
var base_date, batch_size, empty, offset_value, operation, period_unit, shifted_date, threshold, threshold_exceedance, value_shift;
|
||||
base_date = this.get('reference_date').clone().add(absolute_value, 'day');
|
||||
empty = [base_date, 0];
|
||||
if (!(batch_size = this.get('batch_size'))) {
|
||||
return empty;
|
||||
}
|
||||
if (!(threshold = target.get('batch_element_threshold_value'))) {
|
||||
return empty;
|
||||
}
|
||||
if (!(threshold_exceedance = Math.floor(batch_size / (0.1 + parseInt(threshold))))) {
|
||||
return empty;
|
||||
}
|
||||
period_unit = target.get('batch_element_threshold_unit');
|
||||
offset_value = target.get('offset_value');
|
||||
operation = offset_value < 0 ? 'subtract' : 'add';
|
||||
if (period_unit === 'businessday') {
|
||||
operation = "business" + (operation.capitalize());
|
||||
shifted_date = base_date.clone()[operation](threshold_exceedance, {
|
||||
business_days: target.get('batch_element_threshold_business_days')
|
||||
});
|
||||
} else {
|
||||
shifted_date = base_date.clone()[operation](threshold_exceedance, period_unit);
|
||||
}
|
||||
value_shift = shifted_date.diff(base_date, 'day');
|
||||
return [shifted_date, value_shift];
|
||||
},
|
||||
get_offset_for_target: function(target, absolute_value) {
|
||||
var base_date, empty, offset_value, operation, period_unit, shifted_date, value_shift;
|
||||
base_date = this.get('reference_date').clone().add(absolute_value, 'day');
|
||||
empty = [base_date, 0];
|
||||
if (!(offset_value = target.get('offset_value'))) {
|
||||
return empty;
|
||||
}
|
||||
period_unit = target.get('offset_unit');
|
||||
operation = offset_value < 0 ? 'subtract' : 'add';
|
||||
if (period_unit === 'businessday') {
|
||||
operation = "business" + (operation.capitalize());
|
||||
shifted_date = base_date.clone()[operation](Math.abs(offset_value), {
|
||||
business_days: target.get('offset_business_days')
|
||||
});
|
||||
} else {
|
||||
shifted_date = base_date.clone()[operation](Math.abs(offset_value), period_unit);
|
||||
}
|
||||
value_shift = shifted_date.diff(base_date, 'day');
|
||||
return [shifted_date, value_shift];
|
||||
},
|
||||
run_critical_path_resolve_loop: function() {
|
||||
var active_scenario_identifier, get_dynamic_offset_for_target, get_offset_for_target, processed_workflow_action_definitions, resolve_level, scope_workflow_action_definition_ids, working_indices_to_be_removed;
|
||||
working_indices_to_be_removed = [];
|
||||
active_scenario_identifier = this.get('active_project_scenario.identifier');
|
||||
processed_workflow_action_definitions = this.get('processed_workflow_action_definitions');
|
||||
scope_workflow_action_definition_ids = this.get('scope_workflow_action_definition_ids');
|
||||
get_dynamic_offset_for_target = this.get('get_dynamic_offset_for_target').bind(this);
|
||||
get_offset_for_target = this.get('get_offset_for_target').bind(this);
|
||||
resolve_level = this.get('iteration_context_counter');
|
||||
this.get('working_workflow_action_definitions').forEach(function(working_workflow_action_definition, working_index) {
|
||||
var all_offsets_resolved, date, farthest_absolute_value, farthest_absolute_value_value_shift, farthest_result_total_offset, record_wrapper, resolved_offset_wrappers;
|
||||
if (working_workflow_action_definition.get('offset_type') !== 'configured') {
|
||||
return;
|
||||
}
|
||||
farthest_absolute_value = 0;
|
||||
farthest_absolute_value_value_shift = 0;
|
||||
farthest_result_total_offset = 0;
|
||||
date = null;
|
||||
resolved_offset_wrappers = [];
|
||||
all_offsets_resolved = working_workflow_action_definition.get('workflow_action_offsets').every(function(workflow_action_offset) {
|
||||
var current_connection_absolute_value, current_connection_total_offset_value, current_connection_value_shift, offset_date, processed_absolute_value, processed_base_workflow_action_definition_wrapper, ref, ref1, ref2, working_offset_value;
|
||||
if (active_scenario_identifier && workflow_action_offset.get('project_scenario.identifier') && workflow_action_offset.get('project_scenario.identifier') !== active_scenario_identifier) {
|
||||
return true;
|
||||
}
|
||||
if (!(processed_base_workflow_action_definition_wrapper = processed_workflow_action_definitions.findBy('record_id', workflow_action_offset.get('base_workflow_action_definition.id')))) {
|
||||
if (ref = workflow_action_offset.get('base_workflow_action_definition.id'), indexOf.call(scope_workflow_action_definition_ids, ref) < 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
processed_absolute_value = processed_base_workflow_action_definition_wrapper.get('absolute_value');
|
||||
ref1 = get_offset_for_target(workflow_action_offset, processed_absolute_value), offset_date = ref1[0], working_offset_value = ref1[1];
|
||||
ref2 = get_dynamic_offset_for_target(workflow_action_offset, processed_absolute_value + working_offset_value), date = ref2[0], current_connection_value_shift = ref2[1];
|
||||
current_connection_total_offset_value = current_connection_value_shift + working_offset_value;
|
||||
current_connection_absolute_value = processed_absolute_value + current_connection_total_offset_value;
|
||||
if (Math.abs(current_connection_absolute_value) > Math.abs(farthest_absolute_value)) {
|
||||
farthest_absolute_value = current_connection_absolute_value;
|
||||
farthest_absolute_value_value_shift = current_connection_value_shift;
|
||||
farthest_result_total_offset = current_connection_total_offset_value;
|
||||
}
|
||||
resolved_offset_wrappers.push(OffsetNode.create({
|
||||
record: workflow_action_offset,
|
||||
value_shift: current_connection_value_shift,
|
||||
total_offset: current_connection_total_offset_value,
|
||||
resulting_absolute_value: current_connection_absolute_value
|
||||
}));
|
||||
return true;
|
||||
});
|
||||
if (all_offsets_resolved && resolved_offset_wrappers.length) {
|
||||
record_wrapper = RecordNode.create({
|
||||
record: working_workflow_action_definition,
|
||||
record_id: working_workflow_action_definition.get('id'),
|
||||
offset_wrappers: resolved_offset_wrappers,
|
||||
value_shift: farthest_absolute_value_value_shift,
|
||||
absolute_value: farthest_absolute_value,
|
||||
date: date,
|
||||
resolved: true,
|
||||
resolve_level: resolve_level,
|
||||
resolve_type: 'critical-path'
|
||||
});
|
||||
processed_workflow_action_definitions.push(record_wrapper);
|
||||
return working_indices_to_be_removed.push(working_index);
|
||||
}
|
||||
});
|
||||
if (working_indices_to_be_removed.length) {
|
||||
while (working_indices_to_be_removed.length) {
|
||||
this.get('working_workflow_action_definitions').splice(working_indices_to_be_removed.pop(), 1);
|
||||
}
|
||||
return this.run_critical_path_resolve_loop();
|
||||
} else {
|
||||
this.incrementProperty('iteration_context_counter');
|
||||
return this.run_unresolved_tree_resolve_loop();
|
||||
}
|
||||
},
|
||||
run_unresolved_tree_resolve_loop: function() {
|
||||
var active_scenario_identifier, get_dynamic_offset_for_target, get_offset_for_target, processed_workflow_action_definitions, resolve_level, scope_workflow_action_definition_ids, working_indices_to_be_removed;
|
||||
working_indices_to_be_removed = [];
|
||||
active_scenario_identifier = this.get('active_project_scenario.identifier');
|
||||
processed_workflow_action_definitions = this.get('processed_workflow_action_definitions');
|
||||
scope_workflow_action_definition_ids = this.get('scope_workflow_action_definition_ids');
|
||||
get_offset_for_target = this.get('get_offset_for_target').bind(this);
|
||||
get_dynamic_offset_for_target = this.get('get_dynamic_offset_for_target').bind(this);
|
||||
resolve_level = this.get('iteration_context_counter');
|
||||
this.get('working_workflow_action_definitions').forEach(function(working_workflow_action_definition, working_index) {
|
||||
var date, farthest_absolute_value, farthest_absolute_value_value_shift, farthest_result_total_offset, record_wrapper, resolved_offset_wrappers;
|
||||
if (working_workflow_action_definition.get('offset_type') !== 'configured') {
|
||||
return;
|
||||
}
|
||||
farthest_absolute_value = 0;
|
||||
farthest_absolute_value_value_shift = 0;
|
||||
farthest_result_total_offset = 0;
|
||||
date = null;
|
||||
resolved_offset_wrappers = [];
|
||||
working_workflow_action_definition.get('workflow_action_offsets').forEach(function(workflow_action_offset) {
|
||||
var current_connection_absolute_value, current_connection_total_offset_value, current_connection_value_shift, offset_date, processed_absolute_value, processed_base_workflow_action_definition_wrapper, ref, ref1, ref2, working_offset_value;
|
||||
if (active_scenario_identifier && workflow_action_offset.get('project_scenario.identifier') && workflow_action_offset.get('project_scenario.identifier') !== active_scenario_identifier) {
|
||||
return;
|
||||
}
|
||||
if (ref = workflow_action_offset.get('base_workflow_action_definition.id'), indexOf.call(scope_workflow_action_definition_ids, ref) < 0) {
|
||||
return;
|
||||
}
|
||||
if (!(processed_base_workflow_action_definition_wrapper = processed_workflow_action_definitions.findBy('record_id', workflow_action_offset.get('base_workflow_action_definition.id')))) {
|
||||
return;
|
||||
}
|
||||
processed_absolute_value = processed_base_workflow_action_definition_wrapper.get('absolute_value');
|
||||
ref1 = get_offset_for_target(workflow_action_offset, processed_absolute_value), offset_date = ref1[0], working_offset_value = ref1[1];
|
||||
ref2 = get_dynamic_offset_for_target(workflow_action_offset, processed_absolute_value + working_offset_value), date = ref2[0], current_connection_value_shift = ref2[1];
|
||||
current_connection_total_offset_value = current_connection_value_shift + working_offset_value;
|
||||
current_connection_absolute_value = processed_absolute_value + current_connection_total_offset_value;
|
||||
if (Math.abs(current_connection_absolute_value) > Math.abs(farthest_absolute_value)) {
|
||||
farthest_absolute_value = current_connection_absolute_value;
|
||||
farthest_absolute_value_value_shift = current_connection_value_shift;
|
||||
farthest_result_total_offset = current_connection_total_offset_value;
|
||||
}
|
||||
return resolved_offset_wrappers.push(OffsetNode.create({
|
||||
record: workflow_action_offset,
|
||||
value_shift: current_connection_value_shift,
|
||||
total_offset: current_connection_total_offset_value,
|
||||
resulting_absolute_value: current_connection_absolute_value
|
||||
}));
|
||||
});
|
||||
if (resolved_offset_wrappers.length) {
|
||||
record_wrapper = RecordNode.create({
|
||||
record: working_workflow_action_definition,
|
||||
record_id: working_workflow_action_definition.get('id'),
|
||||
offset_wrappers: resolved_offset_wrappers,
|
||||
value_shift: farthest_absolute_value_value_shift,
|
||||
absolute_value: farthest_absolute_value,
|
||||
date: date,
|
||||
resolved: true,
|
||||
resolve_level: resolve_level,
|
||||
resolve_type: 'with-non-rooted-offsets'
|
||||
});
|
||||
processed_workflow_action_definitions.push(record_wrapper);
|
||||
return working_indices_to_be_removed.push(working_index);
|
||||
}
|
||||
});
|
||||
if (working_indices_to_be_removed.length) {
|
||||
while (working_indices_to_be_removed.length) {
|
||||
this.get('working_workflow_action_definitions').splice(working_indices_to_be_removed.pop(), 1);
|
||||
}
|
||||
return this.run_critical_path_resolve_loop();
|
||||
} else {
|
||||
return this.run_offset_forwarding_loop();
|
||||
}
|
||||
},
|
||||
run_offset_forwarding_loop: function() {
|
||||
var active_scenario_identifier, get_dynamic_offset_for_target, get_offset_for_target, processed_workflow_action_definitions, resolve_level, scope_workflow_action_definition_ids, working_indices_to_be_removed;
|
||||
working_indices_to_be_removed = [];
|
||||
active_scenario_identifier = this.get('active_project_scenario.identifier');
|
||||
processed_workflow_action_definitions = this.get('processed_workflow_action_definitions');
|
||||
scope_workflow_action_definition_ids = this.get('scope_workflow_action_definition_ids');
|
||||
get_offset_for_target = this.get('get_offset_for_target').bind(this);
|
||||
get_dynamic_offset_for_target = this.get('get_dynamic_offset_for_target').bind(this);
|
||||
resolve_level = this.get('iteration_context_counter');
|
||||
this.get('working_workflow_action_definitions').forEach(function(working_workflow_action_definition, working_index) {
|
||||
var date, farthest_absolute_value, farthest_absolute_value_value_shift, farthest_result_total_offset, record_wrapper, resolved_offset_wrappers;
|
||||
farthest_absolute_value = 0;
|
||||
farthest_absolute_value_value_shift = 0;
|
||||
farthest_result_total_offset = 0;
|
||||
date = null;
|
||||
resolved_offset_wrappers = [];
|
||||
working_workflow_action_definition.get('dependent_workflow_action_offsets').forEach(function(workflow_action_offset) {
|
||||
var current_connection_absolute_value, current_connection_total_offset_value, current_connection_value_shift, offset_date, processed_absolute_value, processed_base_workflow_action_definition_wrapper, ref, ref1, ref2, working_offset_value;
|
||||
if (active_scenario_identifier && workflow_action_offset.get('project_scenario.identifier') && workflow_action_offset.get('project_scenario.identifier') !== active_scenario_identifier) {
|
||||
return;
|
||||
}
|
||||
if (ref = workflow_action_offset.get('workflow_action_definition.id'), indexOf.call(scope_workflow_action_definition_ids, ref) < 0) {
|
||||
return;
|
||||
}
|
||||
if (!(processed_base_workflow_action_definition_wrapper = processed_workflow_action_definitions.findBy('record_id', workflow_action_offset.get('workflow_action_definition.id')))) {
|
||||
return;
|
||||
}
|
||||
processed_absolute_value = processed_base_workflow_action_definition_wrapper.get('absolute_value');
|
||||
ref1 = get_offset_for_target(workflow_action_offset, processed_absolute_value), offset_date = ref1[0], working_offset_value = ref1[1];
|
||||
ref2 = get_dynamic_offset_for_target(workflow_action_offset, processed_absolute_value + working_offset_value), date = ref2[0], current_connection_value_shift = ref2[1];
|
||||
current_connection_total_offset_value = current_connection_value_shift + working_offset_value;
|
||||
current_connection_absolute_value = processed_absolute_value - current_connection_total_offset_value;
|
||||
if (Math.abs(current_connection_absolute_value) > Math.abs(farthest_absolute_value)) {
|
||||
farthest_absolute_value = current_connection_absolute_value;
|
||||
farthest_absolute_value_value_shift = current_connection_value_shift;
|
||||
farthest_result_total_offset = current_connection_total_offset_value;
|
||||
}
|
||||
return resolved_offset_wrappers.push(OffsetNode.create({
|
||||
record: workflow_action_offset,
|
||||
value_shift: current_connection_value_shift,
|
||||
total_offset: current_connection_total_offset_value,
|
||||
resulting_absolute_value: current_connection_absolute_value
|
||||
}));
|
||||
});
|
||||
if (resolved_offset_wrappers.length) {
|
||||
record_wrapper = RecordNode.create({
|
||||
record: working_workflow_action_definition,
|
||||
record_id: working_workflow_action_definition.get('id'),
|
||||
offset_wrappers: resolved_offset_wrappers,
|
||||
value_shift: farthest_absolute_value_value_shift,
|
||||
absolute_value: farthest_absolute_value,
|
||||
date: date,
|
||||
resolved: true,
|
||||
resolve_level: resolve_level,
|
||||
resolve_type: 'offset-lookup-inversion'
|
||||
});
|
||||
processed_workflow_action_definitions.push(record_wrapper);
|
||||
return working_indices_to_be_removed.push(working_index);
|
||||
}
|
||||
});
|
||||
if (working_indices_to_be_removed.length) {
|
||||
while (working_indices_to_be_removed.length) {
|
||||
this.get('working_workflow_action_definitions').splice(working_indices_to_be_removed.pop(), 1);
|
||||
}
|
||||
return this.run_critical_path_resolve_loop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default WorkflowActionDefinitionOffsetNodes;
|
||||
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators'
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors'
|
||||
|
||||
validations =
|
||||
name: validatePresence presence: true, message: (key, type) ->
|
||||
buildMessage t("attributes.workflow_action_definition.#{key}"), type: type
|
||||
export default validations
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var validations;
|
||||
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators';
|
||||
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors';
|
||||
|
||||
validations = {
|
||||
name: validatePresence({
|
||||
presence: true,
|
||||
message: function(key, type) {
|
||||
return buildMessage(t("attributes.workflow_action_definition." + key), {
|
||||
type: type
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
export default validations;
|
||||
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators'
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors'
|
||||
|
||||
validations =
|
||||
client_identifier: validatePresence presence: true, message: (key, type) ->
|
||||
buildMessage t("attributes.project_instance.#{key}"), type: type
|
||||
export default validations
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var validations;
|
||||
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators';
|
||||
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors';
|
||||
|
||||
validations = {
|
||||
client_identifier: validatePresence({
|
||||
presence: true,
|
||||
message: function(key, type) {
|
||||
return buildMessage(t("attributes.project_instance." + key), {
|
||||
type: type
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
export default validations;
|
||||
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators'
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors'
|
||||
|
||||
validations =
|
||||
name: validatePresence presence: true, message: (key, type) ->
|
||||
buildMessage t("attributes.workflow_action_definition.#{key}"), type: type
|
||||
export default validations
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var validations;
|
||||
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators';
|
||||
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors';
|
||||
|
||||
validations = {
|
||||
name: validatePresence({
|
||||
presence: true,
|
||||
message: function(key, type) {
|
||||
return buildMessage(t("attributes.workflow_action_definition." + key), {
|
||||
type: type
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
export default validations;
|
||||
@@ -0,0 +1,14 @@
|
||||
import {
|
||||
validatePresence,
|
||||
validateFormat
|
||||
} from 'ember-changeset-validations/validators'
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors'
|
||||
|
||||
validations =
|
||||
nickname: validatePresence presence: true, message: (key, type) ->
|
||||
buildMessage t("attributes.user.#{key}"), type: type
|
||||
email: validateFormat type: 'email', message: (key, type) ->
|
||||
buildMessage t("attributes.user.#{key}"), type: type
|
||||
|
||||
export default validations
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var validations;
|
||||
|
||||
import {
|
||||
validatePresence,
|
||||
validateFormat
|
||||
} from 'ember-changeset-validations/validators';
|
||||
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors';
|
||||
|
||||
validations = {
|
||||
nickname: validatePresence({
|
||||
presence: true,
|
||||
message: function(key, type) {
|
||||
return buildMessage(t("attributes.user." + key), {
|
||||
type: type
|
||||
});
|
||||
}
|
||||
}),
|
||||
email: validateFormat({
|
||||
type: 'email',
|
||||
message: function(key, type) {
|
||||
return buildMessage(t("attributes.user." + key), {
|
||||
type: type
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
export default validations;
|
||||
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators'
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors'
|
||||
|
||||
validations =
|
||||
title: validatePresence presence: true, message: (key, type) ->
|
||||
buildMessage t("attributes.workflow_action_definition.#{key}"), type: type
|
||||
export default validations
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Generated by CoffeeScript 1.12.5
|
||||
var validations;
|
||||
|
||||
import {
|
||||
validatePresence
|
||||
} from 'ember-changeset-validations/validators';
|
||||
|
||||
import buildMessage from 'ember-changeset-validations/utils/validation-errors';
|
||||
|
||||
validations = {
|
||||
title: validatePresence({
|
||||
presence: true,
|
||||
message: function(key, type) {
|
||||
return buildMessage(t("attributes.workflow_action_definition." + key), {
|
||||
type: type
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
export default validations;
|
||||
Reference in New Issue
Block a user