User statistics updates

This commit is contained in:
2018-07-30 11:50:10 +02:00
parent 833c10ea7f
commit d304bbeb5e
15 changed files with 103 additions and 38 deletions
@@ -29,3 +29,9 @@ export default Ember.Component.extend
'filters.workflow_action_definition_organization_id': ''
@$('.select-organization .dropdown.button').removeClass('orange')
@send 'apply_filters'
didRender: ->
if organization_id = @get('filters.workflow_action_definition_organization_id')
if organization = @get('relevant_organizations').findBy('id', organization_id)
@set 'scope_organization', organization
@$('.select-organization .dropdown.button').addClass('orange')
@@ -46,5 +46,14 @@ export default Ember.Component.extend({
return this.send('apply_filters');
}
}
},
didRender: function() {
var organization, organization_id;
if (organization_id = this.get('filters.workflow_action_definition_organization_id')) {
if (organization = this.get('relevant_organizations').findBy('id', organization_id)) {
this.set('scope_organization', organization);
return this.$('.select-organization .dropdown.button').addClass('orange');
}
}
}
});
@@ -5,6 +5,7 @@ export default Ember.Component.extend
record: null # parameter
project_specific: false # parameter
session: Ember.inject.service('session')
classNames: ['project-aggregate-statistics', 'project-aggregate-organization-statistics']
statistics: Ember.computed 'statistics_data.isFulfilled', 'project_specific', ->
d = @get('statistics_data')
return {} unless d.isFulfilled
@@ -21,7 +22,7 @@ export default Ember.Component.extend
project_name = project.get('name')
target[project_name] = []
states.forEach (state) ->
target[project_name].push(state: state, count: stats[state] || 0)
target[project_name].push(state: state, count: stats[state] || 0, project_id: project_id)
else
for state, count of stats
target[state] += count
+3 -1
View File
@@ -7,6 +7,7 @@ export default Ember.Component.extend({
record: null,
project_specific: false,
session: Ember.inject.service('session'),
classNames: ['project-aggregate-statistics', 'project-aggregate-organization-statistics'],
statistics: Ember.computed('statistics_data.isFulfilled', 'project_specific', function() {
var count, d, global_name, project, project_id, project_name, project_specific, ref, state, states, stats, target;
d = this.get('statistics_data');
@@ -32,7 +33,8 @@ export default Ember.Component.extend({
states.forEach(function(state) {
return target[project_name].push({
state: state,
count: stats[state] || 0
count: stats[state] || 0,
project_id: project_id
});
});
} else {
@@ -5,11 +5,13 @@ export default Ember.Component.extend
user: null # parameter
project_specific: false # parameter
session: Ember.inject.service('session')
classNames: ['project-aggregate-statistics', 'project-aggregate-user-statistics']
statistics: Ember.computed 'statistics_data.isFulfilled', 'project_specific', ->
d = @get('statistics_data')
return {} unless d.isFulfilled
target = {}
states = ['pending', 'planned', 'active', 'overdue', 'inquiry', 'rejected', 'completed']
#states = ['pending', 'planned', 'active', 'overdue', 'inquiry', 'rejected', 'completed']
states = @get('globals.project_instance_action.states')
project_specific = @get('project_specific')
unless project_specific
global_name = t('user.statistics1.global.title')
@@ -21,7 +23,7 @@ export default Ember.Component.extend
project_name = project.get('name')
target[project_name] = []
states.forEach (state) ->
target[project_name].push(state: state, count: stats[state] || 0)
target[project_name].push(state: state, count: stats[state] || 0, project_id: project_id)
else
for state, count of stats
target[state] += count
+4 -2
View File
@@ -7,6 +7,7 @@ export default Ember.Component.extend({
user: null,
project_specific: false,
session: Ember.inject.service('session'),
classNames: ['project-aggregate-statistics', 'project-aggregate-user-statistics'],
statistics: Ember.computed('statistics_data.isFulfilled', 'project_specific', function() {
var count, d, global_name, project, project_id, project_name, project_specific, ref, state, states, stats, target;
d = this.get('statistics_data');
@@ -14,7 +15,7 @@ export default Ember.Component.extend({
return {};
}
target = {};
states = ['pending', 'planned', 'active', 'overdue', 'inquiry', 'rejected', 'completed'];
states = this.get('globals.project_instance_action.states');
project_specific = this.get('project_specific');
if (!project_specific) {
global_name = t('user.statistics1.global.title');
@@ -32,7 +33,8 @@ export default Ember.Component.extend({
states.forEach(function(state) {
return target[project_name].push({
state: state,
count: stats[state] || 0
count: stats[state] || 0,
project_id: project_id
});
});
} else {
+9 -8
View File
@@ -19,11 +19,12 @@ export filters = Ember.Object.create
export default Ember.Route.extend
queryParams:
state: {refreshModel: true}
project: {refreshModel: true}
action: {refreshModel: true}
page: {refreshModel: true}
perPage: {refreshModel: true}
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: (controller) ->
controller.set 'filters', filters
@@ -53,8 +54,9 @@ export default Ember.Route.extend
# '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'
#]
filters.state_in = [params.state] if params.state
filters.workflow_action_definition_identifier_in = [params.action] if params.action
filters.set('state_in', params.state.split(',')) if params.state
filters.set('workflow_action_definition_identifier_in', params.action.split(',')) if params.action
filters.set('workflow_action_definition_organization_id', params.organization_id) if params.organization_id
Ember.RSVP.hash
projects: @store.findAll('panda/project')
organizations: @store.findAll('panda/organization')
@@ -66,5 +68,4 @@ export default Ember.Route.extend
page: params.page || 1
perPage: params.perPage || 30
otherParams:
#include: includes.join(',')
include: 'action-list'
+8 -2
View File
@@ -35,6 +35,9 @@ export default Ember.Route.extend({
},
perPage: {
refreshModel: true
},
organization_id: {
refreshModel: true
}
},
modelName: 'panda/project-instance-action',
@@ -44,10 +47,13 @@ export default Ember.Route.extend({
},
model: function(params) {
if (params.state) {
filters.state_in = [params.state];
filters.set('state_in', params.state.split(','));
}
if (params.action) {
filters.workflow_action_definition_identifier_in = [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'),
@@ -1,3 +1,6 @@
.state-badge
&.with-action
cursor: pointer
.project-aggregate-statistics
.ui.label.state-badge
margin-right: 4px