forked from RallyApps/app-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenStoriesTasksDefectsApp.html
281 lines (247 loc) · 11.6 KB
/
OpenStoriesTasksDefectsApp.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- Copyright (c) 2010 Rally Software Development Corp. All rights reserved -->
<html>
<head>
<title>Open Stories, Tasks and Defects by Iteration</title>
<meta name="Name" content="App: Open Stories, Tasks and Defects by Iteration"/>
<meta name="Version" content="2012.01.14"/>
<meta name="Vendor" content="Rally Software"/>
<script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.29"></script>
<script type="text/javascript">
var busySpinner;
var iterDropdown;
var rallyDataSource;
var taskTable, defectTable, storyTable;
var abbrev = {'User Story': 'ar', 'Defect': 'df', 'Task': 'tk', 'TestCase': 'tc'};
function indentedItem(content, color) {
var indentationDiv = '<div style="margin-left: 20px;">' + content + '</div>';
return indentationDiv;
}
function ownerIfKnown(arti) {
var owner = "";
if (arti.Owner) {
if (arti.Owner.DisplayName) {
owner = arti.Owner.DisplayName;
}
else if (arti.Owner.UserName) {
owner = arti.Owner.UserName;
}
}
return owner;
}
function artifactLink(artifactName, artifact) {
var artUrl = "__SERVER_URL__/detail/_ABBREV_/_OID_";
artUrl = artUrl.replace('_ABBREV_', abbrev[artifactName]);
artUrl = artUrl.replace('_OID_', artifact.ObjectID);
var linkText = artifact.FormattedID + " " + artifact.Name;
var link = '<a href="_URL_" target="_blank">_TEXT_</a>';
link = link.replace('_URL_', artUrl);
link = link.replace('_TEXT_', linkText);
return link;
}
function showStories(stories, contentDiv) {
var story, storyLink, storyInfo;
var task, taskLink, taskInfo, indentedTask;
var defect, defectLink, defectInfo, indentedDefect;
var testCase, testCaseLink, tcInfo, indentedTestCase;
var tableData = [];
var tblConfig;
for (var i = 0; i < stories.length; i++) {
story = stories[i];
storyLink = artifactLink('User Story', story);
storyInfo = { 'itemLink' : '<div style="font-weight: bold;">' + storyLink + '</div>',
'status' : '<b>' + story.ScheduleState + '</b>',
'userName' : ownerIfKnown(story)
};
tableData.push(storyInfo);
for (var t = 0; t < story.Tasks.length; t++) {
task = story.Tasks[t];
taskLink = artifactLink('Task', task);
indentedTask = indentedItem(taskLink);
taskInfo = { 'itemLink' : indentedTask,
'status' : task.State,
'userName' : ownerIfKnown(task)
};
if (task.State != 'Completed' && task.State != 'Accepted') {
tableData.push(taskInfo);
}
}
for (var d = 0; d < story.Defects.length; d++) {
defect = story.Defects[d];
defectLink = artifactLink('Defect', defect);
indentedDefect = indentedItem(defectLink);
defectInfo = { 'itemLink' : indentedDefect,
'status' : defect.ScheduleState,
'userName' : ownerIfKnown(defect)
};
var schedState = defect.ScheduleState;
if (schedState != 'Completed' && schedState != 'Accepted') {
tableData.push(defectInfo);
}
}
for (var tc = 0; tc < story.TestCases.length; tc++) {
testCase = story.TestCases[tc];
testCaseLink = artifactLink('TestCase', testCase);
indentedTestCase = indentedItem(testCaseLink);
tcInfo = { 'itemLink' : indentedTestCase,
'status' : testCase.LastVerdict,
'userName' : ownerIfKnown(testCase)
};
// consider testing on testCase.LastVerdict != 'Pass' to decide whether to show in table
tableData.push(tcInfo);
}
}
tblConfig = { 'columnKeys' : ['itemLink', 'status', 'userName'],
'columnHeaders' : ['Artifact', 'Status', 'Owner' ],
'columnWidths' : ['400px', '100px', '100px' ],
'sortingEnabled' : false
};
storyTable = new rally.sdk.ui.Table(tblConfig);
storyTable.addRows(tableData);
storyTable.display(contentDiv);
}
function showTasks(tasks, contentDiv) {
var tableData = [];
var tblConfig;
var task, taskLink, taskInfo;
for (var t = 0; t < tasks.length; t++) {
task = tasks[t];
taskLink = artifactLink('Task', task);
taskInfo = { 'taskLink' : taskLink,
'status' : task.State,
'userName' : ownerIfKnown(task)
};
tableData.push(taskInfo);
}
tblConfig = { 'columnKeys' : ['taskLink', 'status', 'userName'],
'columnHeaders' : ['Task', 'Status', 'Owner' ],
'columnWidths' : ['400px', '100px', '100px' ],
'sortingEnabled' : false
};
taskTable = new rally.sdk.ui.Table(tblConfig);
taskTable.addRows(tableData);
taskTable.display(contentDiv);
}
function showDefects(defects, contentDiv) {
var tableData = [];
var tblConfig;
var defect, defectLink, defectInfo;
for (var d = 0; d < defects.length; d++) {
defect = defects[d];
defectLink = artifactLink('Defect', defect);
defectInfo = { 'defectLink' : defectLink,
'status' : defect.ScheduleState,
'userName' : ownerIfKnown(defect)
};
tableData.push(defectInfo);
}
tblConfig = { 'columnKeys' : ['defectLink', 'status', 'userName'],
'columnHeaders' : ['Defect', 'Status', 'Owner' ],
'columnWidths' : ['400px', '100px', '100px' ],
'sortingEnabled' : false
};
defectTable = new rally.sdk.ui.Table(tblConfig);
defectTable.addRows(tableData);
defectTable.display(contentDiv);
}
function showResults(results) {
document.getElementById("UserNameHeader").innerHTML = "Open Items for __USER_NAME__";
document.getElementById("stories_count").innerHTML = "";
document.getElementById("tasks_count").innerHTML = "";
document.getElementById("defects_count").innerHTML = "";
if(busySpinner) {
busySpinner.hide();
busySpinner = null;
}
var ownedStories = results.stories;
document.getElementById("stories_count").innerHTML = "Stories: " + ownedStories.length;
if (ownedStories.length > 0) {
showStories(ownedStories, "stories");
}
var ownedTasks = results.tasks;
document.getElementById("tasks_count").innerHTML = "Tasks: " + ownedTasks.length;
if (ownedTasks.length > 0) {
showTasks(ownedTasks, "tasks");
}
var ownedDefects = results.defects;
document.getElementById("defects_count").innerHTML = "Defects: " + ownedDefects.length;
if (ownedDefects.length > 0) {
showDefects(ownedDefects, "defects");
}
}
function onIterationSelected() {
var targetIterationName = iterDropdown.getSelectedName();
var iterCond = '(Iteration.Name = "_ITER_TARGET_")'.replace('_ITER_TARGET_', targetIterationName);
var ownerCondition = '(Owner.UserName = "__USER_NAME__")';
var scheduleStateCondition = '((ScheduleState != "Completed") AND (ScheduleState != "Accepted"))';
var taskStateCondition = '(State != "Completed")';
var storyCriteria = '(' + iterCond + ' AND ' +
'(' + ownerCondition + ' AND ' + scheduleStateCondition + '))';
var taskCriteria = '(' + iterCond + ' AND ' +
'(' + ownerCondition + ' AND ' + taskStateCondition + '))';
var defectCriteria = '(' + iterCond + ' AND ' +
'(' + ownerCondition + ' AND ' + scheduleStateCondition + '))';
var queryConfigs = [];
queryConfigs[0] = { type : 'hierarchicalrequirement',
key : 'stories',
fetch: 'ObjectID,FormattedID,Name,ScheduleState,State,' +
'Owner,UserName,DisplayName,Tasks,Defects,TestCases,LastVerdict',
query: storyCriteria,
order: 'Rank desc'
};
queryConfigs[1] = { type : 'task',
key : 'tasks',
fetch: 'ObjectID,FormattedID,Name,Owner,UserName,DisplayName,State',
query: taskCriteria,
order: 'FormattedID'
};
queryConfigs[2] = { type : 'defect',
key : 'defects',
fetch: 'ObjectID,FormattedID,Name,Owner,UserName,DisplayName,ScheduleState',
query: defectCriteria,
order: 'FormattedID'
};
busySpinner = new rally.sdk.ui.basic.Wait({});
busySpinner.display("wait");
if(storyTable) {
storyTable.destroy();
storyTable = null;
}
if(taskTable) {
taskTable.destroy();
taskTable = null;
}
if(defectTable) {
defectTable.destroy();
defectTable = null;
}
rallyDataSource.findAll(queryConfigs, showResults);
}
</script>
<script type="text/javascript">
function initPage() {
rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
var iterConfig = {label: "Select Iteration "};
iterDropdown = new rally.sdk.ui.IterationDropdown(iterConfig, rallyDataSource);
iterDropdown.display("iterations", onIterationSelected);
}
rally.addOnLoad(initPage);
</script>
</head>
<body style="font-size: 10pt;">
<div id="iterations" style="float:left"></div>
<div id="wait" style="float:left; height: 16px; width: 24px;"></div>
<h4 id="UserNameHeader" style="clear:both;padding-top:15px">Open Items</h4>
<div id="stories_count" style="margin-left: 10px; margin-bottom: 5px;"></div>
<div id="stories"></div>
<br><br>
<div id="tasks_count" style="margin-left: 10px; margin-bottom: 5px;"></div>
<div id="tasks"></div>
<br><br>
<div id="defects_count" style="margin-left: 10px; margin-bottom: 5px;"></div>
<div id="defects"></div>
</body>
</html>