Files
ember-panda/addon/routes/action-list.js
T
2018-07-30 11:50:10 +02:00

74 lines
1.9 KiB
JavaScript

// Generated by CoffeeScript 1.12.5
import Ember from 'ember';
import PagedRemoteArray from 'ember-cli-dunlop/utils/paged-remote-array';
export var 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) {
controller.set('filters', filters);
return this._super.apply(this, arguments);
},
model: function(params) {
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'
}
})
});
}
});