-
Notifications
You must be signed in to change notification settings - Fork 217
/
CompletedStoriesAndDefectsApp.html
217 lines (195 loc) · 9.1 KB
/
CompletedStoriesAndDefectsApp.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
<!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>Completed Stories and Defects by Iteration</title>
<meta name="Name" content="App: Completed Stories 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 defectTable, storyTable;
var abbrev = {'User Story': 'ar', 'Defect': 'df', 'Task': 'tk', 'TestCase': 'tc'};
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>'.replace('_URL_', artUrl).replace('_TEXT_', linkText);
return link;
}
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 showStories(stories, contentDiv) {
var tableData = [];
var tblConfig;
var story, storyLink, storyInfo;
var task, taskLink, taskInfo, indentedTask;
var defect, defectLink, defectInfo, indentedDefect;
var testCase, testCaseLink, tcInfo, indentedTestCase;
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' : story.ScheduleState,
'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)
};
// the following is a change from the original to be more
// consistent in showing just the "outlier" cases
if (testCase.LastVerdict != 'Pass') {
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 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) {
if(busySpinner) {
busySpinner.hide();
busySpinner = null;
}
document.getElementById("stories_count").innerHTML = "Stories: " + results.stories.length;
if (results.stories.length > 0) {
showStories(results.stories, "stories");
}
document.getElementById("defects_count").innerHTML = "Defects: " + results.defects.length;
if (results.defects.length > 0) {
showDefects(results.defects, "defects");
}
}
function onIterationSelected() {
var targetIterationName = iterDropdown.getSelectedName();
var queryCriteria;
var storyScheduleStateCondition = '(ScheduleState = "Completed")';
queryCriteria = '((Iteration.Name = "_ITER_TARGET_") AND ' + storyScheduleStateCondition + ')';
var queryConfigs = [];
queryConfigs[0] = { type : 'hierarchicalrequirement',
key : 'stories',
fetch: 'ObjectID,FormattedID,Name,ScheduleState,State,' +
'Owner,UserName,DisplayName,Tasks,Defects,TestCases,LastVerdict',
query: queryCriteria.replace('_ITER_TARGET_', targetIterationName),
order: 'Rank desc'
};
queryConfigs[1] = { type : 'defect',
key : 'defects',
fetch: 'ObjectID,FormattedID,Name,Owner,UserName,DisplayName,ScheduleState',
query: queryCriteria.replace('_ITER_TARGET_', targetIterationName),
order: 'FormattedID'
};
busySpinner = new rally.sdk.ui.basic.Wait({});
busySpinner.display("wait");
if(storyTable) {
storyTable.destroy();
storyTable = 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">Completed Items</h4>
<div id="stories_count" style="margin-left: 10px; margin-bottom: 5px;"></div>
<div id="stories"></div>
<br><br>
<div id="defects_count" style="margin-left: 10px; margin-bottom: 5px;"></div>
<div id="defects"></div>
</body>
</html>