forked from Echo3ToEcho7/app-catalog
-
Notifications
You must be signed in to change notification settings - Fork 193
/
DefectsByCloserApp.html
144 lines (120 loc) · 5.88 KB
/
DefectsByCloserApp.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- Copyright (c) 2002-2011 Rally Software Development Corp. All rights reserved. -->
<html>
<head>
<meta name="Name" content="App: Defects by Closer"/>
<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">
/*
Copyright (c) 2002-2011 Rally Software Development Corp. All rights reserved.
DefectsByCloser.js
*/
function DefectsByCloser(rallyDataSource) {
var releaseDiv, tableDiv;
var releaseDropdown;
var table;
var wait = null;
// private method the builds the table of defects and associated info
function showResults(results) {
if (wait) {
wait.hide();
wait = null;
}
if (results.defects.length === 0) {
tableDiv.innerHTML = "No Closed defects associated with the selected release were found";
return;
}
var config =
{ 'columnKeys' : ['FormattedID' , 'Name', 'ClosedDate', 'Revision Number', 'ClosedBy' ] ,
'columnHeaders': ['Formatted ID', 'Name', 'Date Closed', 'Revision<br>Number', 'Closed By'] ,
'columnWidths' : ['80px', '360px', '150px', '60px', '120px' ]
};
table = new rally.sdk.ui.Table(config);
table.addRows(results.defects);
var linkConfig = null;
var defectLink = null;
var cd = null; // for defect.ClosedDate formatting
var i, j, defect;
for (i = 0; i < results.defects.length; i++) {
defect = results.defects[i];
//create link to defect
linkConfig = {item: {FormattedID: defect.FormattedID, "_ref" : defect._ref}};
defectLink = new rally.sdk.ui.basic.Link(linkConfig);
table.setCell(i, 0, defectLink.renderToHtml());
//only parse revisions of defects that have been closed
if (defect.ClosedDate !== null) {
cd = '' + defect.ClosedDate;
cd = cd.replace(/T/, " ").replace(/\.\d+Z$/, " UTC");
table.setCell(i, 2, cd);
for (j = 0; j < defect.RevisionHistory.Revisions.length; j++) {
var revision = defect.RevisionHistory.Revisions[j];
if (revision.Description.search("CLOSED DATE added") !== -1) {
table.setCell(i, 3, '' + revision.RevisionNumber);
table.setCell(i, 4, '' + revision.User._refObjectName);
break; //only show the most recent result if defect was reopened/reclosed
}
}
}
}
table.display(tableDiv);
}
//private method to query for defects when release selection changes
function runMainQuery(sender, eventArgs) {
if (table) {
table.destroy();
table = null;
}
tableDiv.innerHTML = "";
var release = releaseDropdown.getSelectedName();
var queryCriteria = '((Release.Name = "' + release + '") AND (State = "Closed"))';
var queryConfig =
{
key : "defects",
type : "Defect",
fetch : "ObjectID,FormattedID,Name,ClosedDate,RevisionHistory,Revisions,RevisionNumber,Description,User",
order : "FormattedID",
query : queryCriteria
};
wait = new rally.sdk.ui.basic.Wait({});
wait.display('wait');
rallyDataSource.findAll(queryConfig, showResults);
}
//private method to start building controls on page
//page consists of a dropdown to select the release and the table to hold the query results
function initPage() {
releaseDiv = document.getElementById('release');
tableDiv = document.getElementById('table');
var rdConfig = {label : "Select a release: ",
showLabel: true,
labelPosition: "before"
};
releaseDropdown = new rally.sdk.ui.ReleaseDropdown(rdConfig, rallyDataSource);
releaseDropdown.display(releaseDiv, runMainQuery);
}
// only public method
this.display = function() {
rally.sdk.ui.AppHeader.setHelpTopic("232");
rally.sdk.ui.AppHeader.showPageTools(true);
initPage();
};
}
</script>
<script type="text/javascript">
rally.addOnLoad(function() {
var rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
var defectsByCloser = new DefectsByCloser(rallyDataSource);
defectsByCloser.display();
});
</script>
</head>
<body>
<div id="release" style="float:left"></div>
<div id="wait" style="float:left; height: 16px; width: 24px;"></div>
<div id="table" style="clear:both;padding-top:15px"></div>
</body>
</html>