87 lines
2.3 KiB
JavaScript
87 lines
2.3 KiB
JavaScript
// Generated by CoffeeScript 1.12.5
|
|
var get;
|
|
|
|
import Ember from 'ember';
|
|
|
|
import PagedRemoteArray from 'ember-cli-dunlop/utils/paged-remote-array';
|
|
|
|
get = Ember.get;
|
|
|
|
export var default_filters = Ember.Object.create({
|
|
filter_calls: 0,
|
|
workflow_action_definition_identifier_in: [],
|
|
project_instance_group_workflow_group_id: '',
|
|
project_id: '',
|
|
project_instance_project_scenario_id: '',
|
|
workflow_action_definition_organization_id: '',
|
|
workflow_action_definition_title_cont: '',
|
|
project_instance_client_identifier_cont: '',
|
|
target_date_not_null: 1,
|
|
state_in: [],
|
|
target_date_gteq: null,
|
|
target_date_lteq: null,
|
|
s: 'target_date asc'
|
|
});
|
|
|
|
export default Ember.Route.extend({
|
|
queryParams: {
|
|
state: {
|
|
refreshModel: true
|
|
},
|
|
project: {
|
|
refreshModel: true
|
|
},
|
|
action: {
|
|
refreshModel: true
|
|
},
|
|
page: {
|
|
refreshModel: true
|
|
},
|
|
perPage: {
|
|
refreshModel: true
|
|
},
|
|
organization_id: {
|
|
refreshModel: true
|
|
}
|
|
},
|
|
modelName: 'panda/project-instance-action',
|
|
setupController: function(controller, model) {
|
|
controller.set('filters', model.project_instance_actions.get('filters'));
|
|
return this._super.apply(this, arguments);
|
|
},
|
|
model: function(params) {
|
|
var filters, scope_key, user_default;
|
|
scope_key = 'panda/action-list';
|
|
if (user_default = this.store.peekAll('dunlop/user-filter').find(function(r) {
|
|
return r.get('scope_key') === scope_key && r.get('is_default');
|
|
})) {
|
|
filters = Ember.Object.create(user_default.get('filters'));
|
|
} else {
|
|
filters = default_filters;
|
|
}
|
|
if (params.state) {
|
|
filters.set('state_in', params.state.split(','));
|
|
}
|
|
if (params.action) {
|
|
filters.set('workflow_action_definition_identifier_in', params.action.split(','));
|
|
}
|
|
if (params.organization_id) {
|
|
filters.set('workflow_action_definition_organization_id', params.organization_id);
|
|
}
|
|
return Ember.RSVP.hash({
|
|
projects: this.store.findAll('panda/project'),
|
|
organizations: this.store.findAll('panda/organization'),
|
|
project_instance_actions: PagedRemoteArray.create({
|
|
modelName: this.modelName,
|
|
store: this.store,
|
|
filters: filters,
|
|
page: params.page || 1,
|
|
perPage: params.perPage || 30,
|
|
otherParams: {
|
|
include: 'action-list'
|
|
}
|
|
})
|
|
});
|
|
}
|
|
});
|