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 {
|
||||
|
||||
@@ -24,6 +24,7 @@ export default Ember.Route.extend
|
||||
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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,8 @@ import Ember from 'ember'
|
||||
import {create_date_sort} from 'ember-cli-dunlop/utils/date-sort'
|
||||
date_sort = create_date_sort('date')
|
||||
export default Ember.Controller.extend
|
||||
queryParams: ['state']
|
||||
organizations: ( -> @store.peekAll('panda/organization')).property()
|
||||
queryParams: ['state', 'organization_id']
|
||||
#filter: Ember.Object.create
|
||||
# workflow_action_definition_id_in: []
|
||||
# project_instance_group_workflow_group_id_in: []
|
||||
|
||||
@@ -2,6 +2,7 @@ import Ember from 'ember'
|
||||
import PagedRemoteArray from 'ember-cli-dunlop/utils/paged-remote-array'
|
||||
export filters = Ember.Object.create
|
||||
workflow_action_definition_id_in: []
|
||||
workflow_action_definition_organization_id_eq: ''
|
||||
project_instance_group_workflow_group_id: ''
|
||||
state_in: []
|
||||
target_date_gteq: null
|
||||
@@ -12,6 +13,7 @@ export default Ember.Route.extend
|
||||
modelName: 'panda/project-instance-action'
|
||||
queryParams:
|
||||
state: {refreshModel: true}
|
||||
organization_id: {refreshModel: true}
|
||||
page: {refreshModel: true}
|
||||
perPage: {refreshModel: true}
|
||||
setupController: (controller, model) ->
|
||||
@@ -21,13 +23,14 @@ export default Ember.Route.extend
|
||||
|
||||
model: (params) ->
|
||||
project = @modelFor 'project.show'
|
||||
filters.project_id = project.id
|
||||
includes = 'action-list'
|
||||
filters.state_in = [params.state] if params.state
|
||||
filters.set('project_id', project.id)
|
||||
filters.set('state_in', params.state.split(',')) if params.state
|
||||
filters.set('workflow_action_definition_organization_id_eq', params.organization_id) if params.organization_id
|
||||
PagedRemoteArray.create
|
||||
modelName: @modelName
|
||||
store: @store
|
||||
filters: filters
|
||||
page: params.page || 1
|
||||
perPage: params.perPage || 30
|
||||
otherParams: {includes: includes}
|
||||
otherParams:
|
||||
include: 'action-list'
|
||||
|
||||
@@ -18,8 +18,8 @@ export default Ember.Route.extend
|
||||
|
||||
model: (params) ->
|
||||
project = @modelFor 'project.show'
|
||||
filters.project_id = project.id
|
||||
filters.state_in = [params.state] if params.state
|
||||
filters.set('project_id', project.id)
|
||||
filters.set('state_in', params.state.split(',')) if params.state
|
||||
PagedRemoteArray.create
|
||||
modelName: @modelName
|
||||
store: @store
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
if statistics
|
||||
ui-checkbox class='toggle' label=(t 'user.statistics1.project_specific.label') checked=project_specific onChange=(action (mut project_specific))
|
||||
'
|
||||
if project_specific
|
||||
each-in statistics as |project_name stats|
|
||||
.ui.header= project_name
|
||||
= each stats as |stat|
|
||||
if (can 'read' 'model' 'panda/project-instance')
|
||||
= link-to 'project.show.project-instance-action' stat.project_id (query-params state=stat.state organization_id=record.id)
|
||||
= state-badge stat.state
|
||||
'
|
||||
span.between-brackets= stat.count
|
||||
else
|
||||
= state-badge stat.state
|
||||
'
|
||||
span.between-brackets= stat.count
|
||||
else
|
||||
/.ui.header= t 'user.statistics1.global.title'
|
||||
each-in statistics as |state count|
|
||||
if (can 'read' 'model' 'panda/project-instance')
|
||||
= link-to 'action-list' (query-params state=state organization_id=record.id)
|
||||
= state-badge state
|
||||
'
|
||||
span.between-brackets= count
|
||||
else
|
||||
= state-badge state
|
||||
'
|
||||
span.between-brackets= count
|
||||
|
||||
@@ -3,16 +3,29 @@ if user.email
|
||||
span.ui.segment.pull-right= user.nickname
|
||||
if statistics
|
||||
ui-checkbox class='toggle' label=(t 'user.statistics1.project_specific.label') checked=project_specific onChange=(action (mut project_specific))
|
||||
'
|
||||
if project_specific
|
||||
each-in statistics as |project_name stats|
|
||||
.ui.header= project_name
|
||||
= each stats as |stat|
|
||||
if (can 'read' 'model' 'panda/project-instance')
|
||||
= link-to 'project.show.project-instance-action' stat.project_id (query-params state=stat.state)
|
||||
= state-badge stat.state
|
||||
'
|
||||
span.between-brackets= stat.count
|
||||
else
|
||||
= state-badge stat.state
|
||||
'
|
||||
span.between-brackets= stat.count
|
||||
else
|
||||
/.ui.header= t 'user.statistics1.global.title'
|
||||
each-in statistics as |state count|
|
||||
if (can 'read' 'model' 'panda/project-instance')
|
||||
= link-to 'action-list' (query-params state=state)
|
||||
= state-badge state
|
||||
'
|
||||
span.between-brackets= count
|
||||
else
|
||||
= state-badge state
|
||||
'
|
||||
span.between-brackets= count
|
||||
|
||||
@@ -21,6 +21,7 @@ d-breadcrumbs as |breadcrumb|
|
||||
table.ui.bottom.attached.stiped.table
|
||||
thead
|
||||
tr
|
||||
th= t 'models.organization'
|
||||
th= t 'models.project_instance_group'
|
||||
th= t 'models.workflow_action_definition'
|
||||
th= t 'models.project_instance'
|
||||
@@ -35,6 +36,7 @@ table.ui.bottom.attached.stiped.table
|
||||
th= t 'attributes.project_instance_action.target_date'
|
||||
th= t 'attributes.project_instance_action.value'
|
||||
table-filters content=model filters=filters as |filter|
|
||||
= filter.dropdown-select key='workflow_action_definition_organization_id_eq' options=organizations labelPath='name'
|
||||
= filter.dropdown-select key='project_instance_group_workflow_group_id' options=project.sorted_workflow_groups labelPath='name'
|
||||
/ ui-dropdown class='right basic labeled icon' action='nothing'
|
||||
i.dropdown.icon
|
||||
@@ -84,6 +86,7 @@ table.ui.bottom.attached.stiped.table
|
||||
tbody
|
||||
each filtered_project_instance_actions as |project_instance_action|
|
||||
tr
|
||||
td= project_instance_action.workflow_action_definition.organization.name
|
||||
td
|
||||
if project_instance_action.project_instance_group.id
|
||||
= link-to 'project.show.project-instance-group.show' project_instance_action.project_instance.project.id project_instance_action.project_instance_group.id
|
||||
|
||||
Reference in New Issue
Block a user