-
Notifications
You must be signed in to change notification settings - Fork 53
/
RelationCounters.js
92 lines (84 loc) · 4.33 KB
/
RelationCounters.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
tau.mashups
.addDependency('Underscore')
.addDependency('tau/configurator')
.addDependency('tau/models/board.customize.units/const.entity.types.names')
.addDependency('tau/models/board.customize.units/const.card.sizes')
.addMashup(function (_, globalConfigurator, et, sz) {
var units = [
{
id: 'custom_open_total_work_items',
classId: 'tau-board-unit_type_open_total_work_items',
name: 'Open/Total Work Items',
hideIf: function (data) {
return !data.total && !data.open;
},
types: [
et.FEATURE, et.EPIC, et.STORY, et.TASK, et.BUG, et.REQUEST, et.IMPEDIMENT,
et.RESPONSIBLE_TEAM, et.TEAM, et.PROJECT, et.ITERATION, et.TEAM_ITERATION, et.RELEASE,
et.TEST_CASE, et.TEST_PLAN, et.TEST_PLAN_RUN, et.BUILD, et.PROGRAM
],
sizes: [sz.XS, sz.S, sz.M, sz.L, sz.XL, sz.LIST],
template: [
'<div class="tau-board-unit__value-open"><%! this.data.open||"0" %>/<%! this.data.total||"0" %></div>'
],
listSettings: {
title: [
'Open: <%! this.data.open||"0" %>, Total: <%! this.data.total||"0" %>'
]
},
model: 'total:OutboundAssignables.Where(RelationType.Name=="Link").count()+' +
'SlaveRelations.Where(RelationType.Name=="Link" and slave.entityType.name="Project").count(),' +
'open:OutboundAssignables.Where(RelationType.Name=="Link" and EntityState.IsFinal!=true).count()+' +
'SlaveRelations.Where(RelationType.Name=="Link" and slave.as<Project>.EntityState.IsFinal!=true).count()',
sampleData: {open: 5, total: 10}
},
{
id: 'custom_relation_not_links',
classId: 'tau-board-unit_type_relations-counter-in-out',
name: "Dependencies",
types: [
et.FEATURE, et.EPIC, et.STORY, et.TASK, et.BUG, et.REQUEST, et.IMPEDIMENT,
et.RESPONSIBLE_TEAM, et.TEAM, et.PROJECT, et.ITERATION, et.TEAM_ITERATION, et.RELEASE,
et.TEST_CASE, et.TEST_PLAN, et.TEST_PLAN_RUN, et.BUILD, et.PROGRAM
],
sizes: [sz.XS, sz.S, sz.M, sz.L, sz.XL, sz.LIST],
template: {
markup: [
'<div class="tau-board-unit__value">',
'<div class="tau-board-unit__value-in <%=this.data.hasInboundBlockers?"tau-board-unit__value-blocker":"" %>"><%= this.data.inbound %></div>',
'<div class="tau-board-unit__value-out <%=this.data.hasOutboundBlockers?"tau-board-unit__value-blocker":"" %>"><%= this.data.outbound %></div>',
'</div>'
]
},
sampleData: {
inbound: 10,
outbound: 20,
hasInboundBlockers: true
},
hideIf: function (data) {
return !data.inbound && !data.outbound;
},
listSettings: {
title: [
'In: <%! this.data.inbound||"0" %>, out: <%! this.data.outbound||"0" %>'
]
},
model:
'inbound:masterRelations.Where(RelationType.Name !="Link").Count,' +
'outbound:slaveRelations.Where(RelationType.Name !="Link").Count,' +
'hasInboundBlockers:masterRelations.Where(RelationType.Name=="Blocker").Count>0,' +
'hasOutboundBlockers:slaveRelations.Where(RelationType.Name=="Blocker").Count>0'
}
];
function addUnits(configurator) {
var registry = configurator.getUnitsRegistry();
_.extend(registry.units, registry.register(units));
}
var appConfigurator;
globalConfigurator.getGlobalBus().on('configurator.ready', function (e, configurator) {
if (!appConfigurator && configurator._id && configurator._id.match(/board/)) {
appConfigurator = configurator;
addUnits(appConfigurator);
}
});
});