forked from RallyApps/app-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SystemRequirementValidationDocumentApp.html
362 lines (305 loc) · 15.2 KB
/
SystemRequirementValidationDocumentApp.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Copyright (c) 2011 Rally Software Development Corp. All rights reserved -->
<html>
<head>
<title>System Requirement Validation Document</title>
<meta name="Name" content="App: System Requirement Validation Document"/>
<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">
function SystemRequirementValidationDocument() {
var chooser, chooseButton, dataSource, stepsTables = {};
var testCaseWorkProducts = {};
this.display = function() {
rally.sdk.ui.AppHeader.showPageTools(true);
rally.sdk.ui.AppHeader.removePageTool("popOut");
rally.sdk.ui.AppHeader.setHelpTopic("255");
dataSource = new rally.sdk.data.RallyDataSource(
'__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
dataSource.find({
key:"srs",
type:"HierarchicalRequirement",
query: "( Tags.Name = SRS )",
fetch:"Name"
}, dojo.hitch(this, this._showChooserOrInstructions));
};
this._showChooserOrInstructions = function(results) {
if (results.srs.length > 0) {
dojo.byId("signAndDate").innerHTML =
'Signature _________________________<br/>' +
'Date Printed ' + dojo.date.locale.format(new Date(), 'MM/DD/yyyy');
if (!chooseButton) {
chooseButton = new rally.sdk.ui.basic.Button({text:'Choose a System Requirement'});
chooseButton.display('chooseButton', function() {
chooser.display();
});
}
var chooserConfig = {
fetch:"FormattedID,Name,Description",
query:'Tags.Name = SRS',
title: 'System Requirement Chooser'
};
chooser = new rally.sdk.ui.Chooser(chooserConfig, dataSource);
chooser.addEventListener('onClose', dojo.hitch(this, this._displayChosenSRS));
chooser.display();
} else {
var instructionsDiv = document.createElement("div");
dojo.addClass(instructionsDiv, "instructions");
var instructions = document.createElement("span");
dojo.addClass(instructions, "quote");
instructions.innerHTML = "<p><b>No SRSs Found.</b></p><p>This app keys off of special tags. To get started, you'll need to let Rally know which user stories represent your System Requirements by tagging them 'SRS'.</p><p >The System Requirement Validation Document App shows how functional and nonfunctional requirements are implemented by generating a printable report.</p>";
instructionsDiv.appendChild(instructions);
var learnMoreLinkElement = document.createElement("a");
dojo.attr(learnMoreLinkElement, "href", "https://help.rallydev.com/system-requirement-validation-document-0");
dojo.attr(learnMoreLinkElement, "target", "new");
learnMoreLinkElement.innerHTML = "Learn more about how to use the System Requirements Validation Document";
instructions.appendChild(learnMoreLinkElement);
var exampleImage = document.createElement("img");
dojo.attr(exampleImage, "src", "/apps/resources/SystemRequirementValidationDocument/example.png");
dojo.addClass(exampleImage, "exampleImage");
instructionsDiv.appendChild(exampleImage);
dojo.byId("display").appendChild(instructionsDiv);
}
};
this._displayChosenSRS = function(chooser, args) {
dataSource.findAll([
{
key:"srs",
type:"HierarchicalRequirement",
query: "( ObjectID = " + rally.sdk.util.Ref.getOidFromRef(args.selectedItem._ref) + ")",
order:"Name",
fetch:"Children,Name,TestCases,WorkProduct,LastRun,FormattedID,Parent,Steps,TestCaseStep,Description,AcceptedDate,StepIndex,Input,ExpectedResult"
},
{
key: "childTestCasesWorkProducts",
placeholder: '${srs/Children.Children.TestCases?fetch=WorkProduct,FormattedID,Name,Description,LastRun,Steps,StepIndex,Input,ExpectedResult,TestCaseStep}'
},
{
key:"testCasesWorkProducts",
placeholder: '${srs/Children.TestCases?fetch=WorkProduct,FormattedID,Name,Description,LastRun,Steps,StepIndex,Input,ExpectedResult,TestCaseStep}'
}
], dojo.hitch(this, this._showStory));
};
this._formatDate = function(dateString) {
var dateObject = rally.sdk.util.DateTime.fromIsoString(dateString);
return rally.sdk.util.DateTime.format(dateObject, "dd MMM yyyy");
};
this._provideTextForNoData = function(field, text, formatAsDate) {
var content;
if (field === null || dojo.trim(field) === "" || dojo.trim(field) === "<br />") {
content = text;
} else {
if (formatAsDate) {
content = this._formatDate(field);
} else {
content = field;
}
}
return content;
};
this._buildStepsTable = function(steps, div) {
var stepsTableDiv = document.createElement("div");
stepsTableDiv.id = div + "Div";
dojo.byId(div).appendChild(stepsTableDiv);
if (steps.length > 0) {
var tableConfig = {
'columnKeys' : ['StepIndex', 'Input', 'ExpectedResult'],
'columnHeaders': ['Step', 'Input', 'Expected Result'],
'width' : '500px'
};
var table = new rally.sdk.ui.Table(tableConfig);
table.addRows(steps);
table.display(stepsTableDiv.id);
stepsTables[stepsTableDiv.id] = {table: table, tableId: stepsTableDiv.id};
} else {
stepsTableDiv.innerHTML = "No Steps";
}
};
this._buildParentSRS = function(story) {
var parentOfSRS = "";
if (story.Parent) {
parentLink = new rally.sdk.ui.basic.Link({item: story.Parent}).renderToHtml();
parentOfSRS = parentLink + ' ' + story.Parent.Name;
}
var storyLink = new rally.sdk.ui.basic.Link({item: story}).renderToHtml();
dojo.byId('display').innerHTML =
'<table class="srsTable">' +
'<tr><td colspan="2" class="header">Product Requirement</td></tr>' +
'<tr><th>Market Requirement:</th><td>' + parentOfSRS + '</td></tr>' +
'<tr><th>System Requirement:</th><td>' + storyLink + ' ' + story.Name + '</td></tr>' +
'<tr><th>Acceptance Date:</th><td>' + this._provideTextForNoData(story.AcceptedDate, "Not Accepted Yet", true) + '</td></tr>' +
'</table>';
};
this._buildSRSs = function(story) {
var link = new rally.sdk.ui.basic.Link({item: story}).renderToHtml();
var srsDescriptionMarkup =
'<table class="srsTable">' +
'<tr><td colspan="2" class="header">System Requirement Description</td></tr>' +
'<tr><th>Specification:</th><td>' + link + ' ' + story.Name + '</td></tr>' +
'<tr><th>Description:</th><td>' + this._provideTextForNoData(story.Description, "None", false) + '</td></tr>' +
'<tr><th>Functional Stories:</th><td class="functionalLinks">';
if (story.Children.length > 0) {
dojo.forEach(story.Children, dojo.hitch(this, function(story) {
var link2 = new rally.sdk.ui.basic.Link({item: story}).renderToHtml();
srsDescriptionMarkup += link2 + ' ' + story.Name + ' (' + story.TestCases.length + ' Test Cases)<br/>';
}));
} else {
srsDescriptionMarkup += 'No Stories';
}
srsDescriptionMarkup += '</td></tr></table>';
dojo.byId('display').innerHTML = dojo.byId('display').innerHTML + srsDescriptionMarkup;
};
this._buildSRSTestCases = function(story, testCases) {
if (testCases.length > 0) {
dojo.forEach(testCases, dojo.hitch(this, function(testCase, x) {
var div = 'stepsCell' + x;
var testCaseDiv = document.createElement("div");
var testCaseLink = new rally.sdk.ui.basic.Link({item: testCase}).renderToHtml();
var workProduct = testCaseWorkProducts[testCase.FormattedID];
var parentLink, parentName;
if (workProduct === undefined) {
parentName = story.Name;
parentLink = new rally.sdk.ui.basic.Link({item: story}).renderToHtml();
} else {
parentName = workProduct.Name;
parentLink = new rally.sdk.ui.basic.Link({item: workProduct}).renderToHtml();
}
dojo.addClass(testCaseDiv, "testCase");
document.getElementById("display").appendChild(testCaseDiv);
testCaseDiv.innerHTML =
'<table class="srsTable">' +
'<tr><td colspan="2" class="header">Test Case</td></tr>' +
'<tr><th>Test Case:</th><td>' + testCaseLink + ' ' + testCase.Name + '</td></tr>' +
'<tr><th>Story:</th><td>' + parentLink + ' ' + parentName + '</td></tr>' +
'<tr><th>Test Case Description:</th><td>' + this._provideTextForNoData(testCase.Description, "None", false) + '</td></tr>' +
'<tr><th>Last Run:</th><td>' + this._provideTextForNoData(testCase.LastRun, "Never", true) + '</td></tr>' +
'<tr><th>Steps:</th><td id="' + div + '" class="stepsCell"></td></tr></table>';
this._buildStepsTable(testCase.Steps, div);
}));
}
};
this._showStory = function(results) {
rally.forEach(stepsTables, function(tableObj) {
delete tableObj.tableId;
tableObj.table.destroy();
});
stepsTables = {};
var story = results.srs[0];
var testCases = results.srs[0].TestCases;
testCases = testCases.concat(results.testCasesWorkProducts);
testCases = testCases.concat(results.childTestCasesWorkProducts);
dojo.forEach(testCases, function(testCase) {
testCaseWorkProducts[testCase.FormattedID] = testCase.WorkProduct;
});
this._buildParentSRS(story);
this._buildSRSs(story);
if (testCases.length > 0) {
this._buildSRSTestCases(story, testCases);
}
};
}
</script>
<style type="text/css">
#inputs {
margin-bottom: 10px;
}
#signAndDate {
font-size: 12px;
line-height: 18px;
margin-top: 50px;
}
.blankCell {
background-color: #fff;
}
.onlyPrint {
display: none;
}
.srsTable {
border: 1px solid #ffffff;
font-size: 12px;
}
.srsTable .header {
background-image: url("/slm/images/editor_section.gif");
background-repeat: no-repeat;
color: #464646;
font-weight: bold;
height: 23px;
padding: 0px 5px;
}
.srsTable th {
background-color: #eeeeee;
color: #666666;
font-weight: normal;
padding: 5px 10px 5px 0px;
text-align: right;
vertical-align: top;
width: 150px;
}
.srsTable td {
padding-top: 3px;
}
.srsTable .stepsCell th {
text-align: left;
}
.functionalLinks a {
line-height: 14pt;
}
.instructions {
max-width: 1000px;
font-size: 14px;
color: #333333;
}
.instructions .quote {
font-size: 14px;
color: #333333;
float: left;
}
.instructions p {
width: 400px;
font-size: 12px;
}
.instructionsTitle {
font-weight: bold;
}
.exampleImage {
float: left;
margin: 10px;
/* for IE */
filter: alpha(opacity = 70);
/* CSS3 standard */
opacity: 0.7;
}
@media print {
body {
width: 8.5in;
height: 10.5in;
}
.noPrint {
display: none;
}
#appHeaderright {
display: none;
}
.onlyPrint {
display: block;
}
}
</style>
<script type="text/javascript">
function onLoad() {
var validationDocument = new SystemRequirementValidationDocument();
validationDocument.display();
}
rally.addOnLoad(onLoad);
</script>
</head>
<body>
<div id="chooseButton" class="noPrint"></div>
<div id="display"></div>
<div id="signAndDate" class="onlyPrint"></div>
</body>
</html>