User statistics updates
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user