Subversion Repositories DevTools

Rev

Rev 6582 | Rev 6589 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6582 Rev 6587
Line 138... Line 138...
138
                    <table id="packageStats" width="100%" class="embedded_table">
138
                    <table id="packageStats" width="100%" class="embedded_table">
139
                        <thead class="envGroup">
139
                        <thead class="envGroup">
140
                           <tr class="body_col envGroup">
140
                           <tr class="body_col envGroup">
141
                              <td valign="top" nowrap>Package</td>
141
                              <td valign="top" nowrap>Package</td>
142
                              <td valign="top" nowrap>Version</td>
142
                              <td valign="top" nowrap>Version</td>
143
                              <td valign="top" nowrap>Test<br>Count</td>
143
                              <td valign="top" nowrap>Unit<br>Tests</td>
144
                              <td valign="top" nowrap>Code<br>Lines</td>
144
                              <td valign="top" nowrap>Lines<br>of Code</td>
145
                              <td valign="top" nowrap>Build<br>Duration</td>
145
                              <td valign="top" nowrap>Build<br>Duration</td>
146
                              <td valign="top" nowrap>Build Date</td>
146
                              <td valign="top" nowrap>Build Date</td>
147
                              <td valign="top" nowrap>Deployable</td>
147
                              <td valign="top" nowrap>Deployable</td>
148
                              <td valign="top" nowrap>View Name</td>
148
                              <td valign="top" nowrap>View Name</td>
149
                              <td valign="top" nowrap>SDK</td>
149
                              <td valign="top" nowrap>SDK</td>
Line 154... Line 154...
154
                  <table width="100%" class="embedded_table">
154
                  <table width="100%" class="embedded_table">
155
                  <tr class="body_col envGroup"><th colspan=5>Summary</th></tr>
155
                  <tr class="body_col envGroup"><th colspan=5>Summary</th></tr>
156
                  <tr class="body_rowg"><td colspan=4>Total Packages</td><td id="pkgCount"></td></tr>
156
                  <tr class="body_rowg"><td colspan=4>Total Packages</td><td id="pkgCount"></td></tr>
157
                  <tr class="body_rowg"><td colspan=4>Total Packages with Tests</td><td id="pkgTestCount"></td></tr>
157
                  <tr class="body_rowg"><td colspan=4>Total Packages with Tests</td><td id="pkgTestCount"></td></tr>
158
                  <tr class="body_rowg"><td colspan=4>Total Unit Tests</td><td id="testCount"></td></tr>
158
                  <tr class="body_rowg"><td colspan=4>Total Unit Tests</td><td id="testCount"></td></tr>
-
 
159
                  <tr class="body_rowg"><td colspan=4>Total Lines of Code</td><td id="tloc"></td></tr>
159
                  </table>
160
                  </table>
160
               </div>
161
               </div>
161
            </div>
162
            </div>
162
         </td>
163
         </td>
163
      </tr>
164
      </tr>
Line 199... Line 200...
199
          // Helper object to contain unit tests stats
200
          // Helper object to contain unit tests stats
200
        function groupStats() {
201
        function groupStats() {
201
            this.total = 0;
202
            this.total = 0;
202
            this.withTests = 0;
203
            this.withTests = 0;
203
            this.testCount = 0;
204
            this.testCount = 0;
-
 
205
            this.loc = 0;
204
        };
206
        };
205
 
207
 
206
        var pkgStats = {
208
        var pkgStats = {
207
            // Ref to the current table
209
            // Ref to the current table
208
            table : null ,
210
            table : null ,
Line 218... Line 220...
218
            groupinfo : null,
220
            groupinfo : null,
219
 
221
 
220
            // Part of config - with groups
222
            // Part of config - with groups
221
            withGroups : [
223
            withGroups : [
222
                    { "visible": false, "targets": [6,7,8] },
224
                    { "visible": false, "targets": [6,7,8] },
-
 
225
                    { "className" : 'nowrap', targets: [1,2,3,4,5] },
223
                    { "orderData" : [7,0], targets : 0 },
226
                    { "orderData" : [7,0], targets : 0 },
224
                    { "orderData" : [7,1], targets : 1 },
227
                    { "orderData" : [7,1], targets : 1 },
225
                    { "orderData" : [7,2], targets : 2 },
228
                    { "orderData" : [7,2], targets : 2 },
226
                    { "orderData" : [7,3], targets : 3 },
229
                    { "orderData" : [7,3], targets : 3 },
227
                    { "orderData" : [7,4], targets : 4 },
230
                    { "orderData" : [7,4], targets : 4 },
Line 230... Line 233...
230
                ],
233
                ],
231
 
234
 
232
            // Part of config - with out groups
235
            // Part of config - with out groups
233
            withNoGroups : [
236
            withNoGroups : [
234
                    { "visible": false, "targets": [6,7,8] },
237
                    { "visible": false, "targets": [6,7,8] },
-
 
238
                    { "className" : 'nowrap', targets: [1,2,3,4,5] },
235
                ],
239
                ],
236
 
240
 
237
            // Basic table config
241
            // Basic table config
238
            tableConfig : {
242
            tableConfig : {
239
                //  Vix Usage
243
                //  Vix Usage
Line 267... Line 271...
267
                            var gdata = groupinfo[group];
271
                            var gdata = groupinfo[group];
268
                            var gtext = new Array();
272
                            var gtext = new Array();
269
                            gtext.push('Packages: ' + gdata.total + '.');
273
                            gtext.push('Packages: ' + gdata.total + '.');
270
                            gtext.push('With Tests: ' + gdata.withTests + '.');
274
                            gtext.push('With Tests: ' + gdata.withTests + '.');
271
                            gtext.push('Unit Tests: ' + gdata.testCount + '.');
275
                            gtext.push('Unit Tests: ' + gdata.testCount + '.');
-
 
276
                            gtext.push('LoC: ' + gdata.loc + '.');
272
                            $(rows).eq( i ).before(
277
                            $(rows).eq( i ).before(
273
                                '<tr class="baseGroup"><td class="header" colspan="2">'+group+ '</td><td class="info" colspan="4">'+gtext.join(' ') + '</td></tr>'
278
                                '<tr class="baseGroup"><td class="header" colspan="2">'+group+ '</td><td class="info nowrap" colspan="4">'+gtext.join(' ') + '</td></tr>'
274
                            );
279
                            );
275
                        }
280
                        }
276
                    });
281
                    });
-
 
282
                    parentRef.setHeight();
277
                }
283
                }
278
            },
284
            },
279
 
285
 
280
            // Create a basic DataTable
286
            // Create a basic DataTable
281
            //  Then populate it
287
            //  Then populate it
Line 294... Line 300...
294
 
300
 
295
                 this.noGroup = $('#noGroups').get(0).checked;
301
                 this.noGroup = $('#noGroups').get(0).checked;
296
                 this.tableConfig.columnDefs = this.noGroup ? this.withNoGroups : this.withGroups;
302
                 this.tableConfig.columnDefs = this.noGroup ? this.withNoGroups : this.withGroups;
297
 
303
 
298
                 var that = this;
304
                 var that = this;
-
 
305
                 var tableConfig = Object.assign({}, this.tableConfig);
299
                 this.tableConfig.parentRef = function(){return that;};
306
                 tableConfig.parentRef = function(){return that;};
300
                 this.table = $('#packageStats').DataTable(this.tableConfig);
307
                 this.table = $('#packageStats').DataTable(tableConfig);
301
                 this.insertAllData();
308
                 this.insertAllData();
302
            },
309
            },
303
 
310
 
304
            //
311
            //
305
            //  Filter data and insert into the table
312
            //  Filter data and insert into the table
Line 344... Line 351...
344
                    
351
                    
345
                    this.table.row.add( dataSet[ii]);
352
                    this.table.row.add( dataSet[ii]);
346
                    this.info.total ++;
353
                    this.info.total ++;
347
                    gdata.total++;
354
                    gdata.total++;
348
                    var count = parseInt($(dataSet[ii][2]).text());
355
                    var count = parseInt($(dataSet[ii][2]).text());
-
 
356
                    var loc = parseInt(dataSet[ii][3]);
349
                    if ( !isNaN(count) && count > 0 ) {
357
                    if ( !isNaN(count) && count > 0 ) {
350
                        this.info.withTests++;
358
                        this.info.withTests++;
351
                        gdata.withTests++;
359
                        gdata.withTests++;
352
                        this.info.testCount += count;
360
                        this.info.testCount += count;
353
                        gdata.testCount += count;
361
                        gdata.testCount += count;
354
                    }
362
                    }
-
 
363
                    if ( !isNaN(loc) && loc > 0 ) {
-
 
364
                        this.info.loc += loc;
-
 
365
                        gdata.loc += loc;
-
 
366
                    }
355
                }
367
                }
356
                this.table.draw();
368
                this.table.draw();
357
                this.setHeight();
-
 
358
 
369
 
359
                $('#pkgCount').text(this.info.total);
370
                $('#pkgCount').text(this.info.total);
360
                $('#pkgTestCount').text(this.info.withTests);
371
                $('#pkgTestCount').text(this.info.withTests);
361
                $('#testCount').text(this.info.testCount);
372
                $('#testCount').text(this.info.testCount);
-
 
373
                $('#tloc').text(this.info.loc);
362
            },
374
            },
363
 
375
 
364
            setHeight : function () {
376
            setHeight : function () {
365
                 var noScroll = $('#noScroll').get(0).checked;
377
                 var noScroll = $('#noScroll').get(0).checked;
366
                 if ( noScroll ) {
378
                 if ( noScroll ) {
Line 389... Line 401...
389
        // Hide / Show the packages from SDKs
401
        // Hide / Show the packages from SDKs
390
        $('#noCots,#noDeploy,#noSdk').click(function(e){
402
        $('#noCots,#noDeploy,#noSdk').click(function(e){
391
            pkgStats.insertAllData();
403
            pkgStats.insertAllData();
392
        });
404
        });
393
 
405
 
394
        // Copy data to the users clipboard
406
        // Copy multi-line data to the users clipboard
395
        function copyToClipboard(string) {
407
        function copyToClipboard(string) {
396
            var $temp = $("<input>");
408
            var $temp = $("<textarea>");
397
            $("body").append($temp);
409
            $("body").append($temp);
398
            $temp.val(string).select();
410
            $temp.val(string).select();
399
            document.execCommand("copy");
411
            document.execCommand("copy");
400
            $temp.remove();
412
            $temp.remove();
401
        };
413
        };
402
 
414
 
403
        // Export Data
415
        // Export Data
404
        $('#btnExport').click(function(e){
416
        $('#btnExport').click(function(e){
405
            var csv = [];
417
            var csv = [];
406
 
-
 
407
            //  Insert DateStamp as YYMMDD
418
            var lines = [];
408
            var date = new Date();
419
            var date = new Date();
409
            var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
420
            var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
410
            csv.push(tstamp);
-
 
411
 
421
 
-
 
422
            function createHeader() {
-
 
423
                //  Insert DateStamp as YYMMDD
-
 
424
                csv.push(tstamp);
-
 
425
 
412
            //  Insert Release ID
426
                //  Insert Release ID
413
            csv.push(<%=DB_RTAG_ID%>);
427
                csv.push(<%=DB_RTAG_ID%>);
414
            csv.push("<%=DB_PROJ_NAME%>::<%=DB_RTAG_NAME%>");
428
                csv.push("<%=DB_PROJ_NAME%>::<%=DB_RTAG_NAME%>");
-
 
429
            }
-
 
430
 
-
 
431
            function addInfo(info) {
-
 
432
                csv.push(info.total);
-
 
433
                csv.push(info.withTests);
-
 
434
                csv.push(info.testCount);
-
 
435
                csv.push(info.loc);
-
 
436
            }
-
 
437
 
-
 
438
            function saveCsv() {
-
 
439
                if ( csv.length ) {
-
 
440
                    lines.push(csv.join(","));
-
 
441
                    csv = [];
-
 
442
                }
-
 
443
            }
415
 
444
 
416
            // Generate a CSV representation of the data in the table
445
            // Generate a CSV representation of the data in the table
-
 
446
            // Support two forms - grouped and un grouped
-
 
447
            //
-
 
448
            if (pkgStats.noGroup) {
-
 
449
                // Ungrouped - all packages
-
 
450
                createHeader();
-
 
451
                addInfo(pkgStats.info);
417
            pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
452
                pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
418
                var data = this.data();
453
                    var data = this.data();
-
 
454
                    csv.push('ALL');
419
                csv.push($(data[0]).text(), $(data[2]).text());
455
                    csv.push($(data[0]).text(), $(data[2]).text(), data[3] );
420
            });
456
                });
-
 
457
                saveCsv();
-
 
458
            } else {
-
 
459
                // Grouped by package
-
 
460
                var lastGroup = null;
-
 
461
                pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
-
 
462
                    var data = this.data();
-
 
463
                    var group = data[7];
-
 
464
                    if ( group != lastGroup ) {
-
 
465
                        lastGroup = group;
-
 
466
                        saveCsv();
-
 
467
                        createHeader();
421
            var csvString = csv.join(",");
468
                        csv.push(group);
-
 
469
                        addInfo(pkgStats.groupinfo[group]);
-
 
470
                    }
-
 
471
                    csv.push($(data[0]).text(), $(data[2]).text(), data[3] );
-
 
472
                });
422
            //console.log(csvString);
473
                saveCsv();
-
 
474
            }
423
            copyToClipboard(csvString);
475
            copyToClipboard(lines.join('\r\n'));
-
 
476
 
424
            vixConfirm("Data copied to Clipboard", {
477
            vixConfirm("Data copied to Clipboard", {
425
                title: "Notification",
478
                title: "Notification",
426
                icon : "images/i_info.png", 
479
                icon : "images/i_info.png", 
427
                cancel: false, 
480
                cancel: false, 
428
                button: null,
481
                button: null,