Subversion Repositories DevTools

Rev

Rev 6587 | Rev 6594 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6576 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|          Edit/View Build Configuration            |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
' Good idea to set when using redirect
12
Response.Expires = 0   ' always load the page, dont store
13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/_form_window_common.asp"-->
20
<!--#include file="_action_buttons.asp"-->
21
<!--#include file="class/classActionButtonControl.asp"-->
22
<% '------------ ACCESS CONTROL ------------------ %>
23
<!--#include file="_access_control_login.asp"-->
24
<!--#include file="_access_control_general.asp"-->
25
<!--#include file="_access_control_action_project.asp"-->
26
<%
27
'------------ Variable Definition -------------
28
Dim parRtagId
6579 dpurdie 29
Dim pkgCount : pkgCount= 0
30
Dim pkgTestCount : pkgTestCount= 0
31
Dim testCount: testCount = 0
6576 dpurdie 32
'------------ Constants Declaration -----------
33
'------------ Variable Init -------------------
34
parRtagId = Request("rtag_id")
35
objPMod.PersistInQryString("rtag_id")
36
'----------------------------------------------
37
%>
38
<%
39
'------------ RUN BEFORE PAGE RENDER ----------
6579 dpurdie 40
'
41
'   Generate table data as JSON
42
'   Could generate via AJAX call too, but for the amount of data in the table
43
'
44
Sub GenerateData
45
    Dim rsQry
46
 
47
    OraDatabase.Parameters.Add "RTAG_ID", parRtagId, ORAPARM_INPUT, ORATYPE_NUMBER
48
    Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("release_stats.sql"), 0 )
49
	OraDatabase.Parameters.Remove "RTAG_ID"
50
 
51
    Response.Write "<script type=""text/javascript"" charset=""utf-8"">" + vbCRLF
52
    Response.Write "var dataSet = [" + vbCRLF
53
 
54
    Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
55
        pkgCount = pkgCount + 1
56
        Dim tcount : tcount = NiceInt(rsQry("test_count"), 0)
57
        If tcount > 0 Then
58
            pkgTestCount = pkgTestCount + 1
59
            testCount = testCount + tcount 
60
        End If
61
 
62
        Dim vrefStr, prefStr, crefStr
6582 dpurdie 63
        Dim buildId, buildTime, lastBuild, codeLines, isDeployable, viewName, isSdk
6579 dpurdie 64
 
6580 dpurdie 65
        buildId = rsQry("build_id")
6579 dpurdie 66
        crefStr = "unit_test_log.asp?pv_id=" & rsQry("pv_id") & "&rtag_id=" & parRtagId 
67
        prefStr = "view_by_version.asp?pkg_id=" & rsQry("pkg_id")  & "&listby=1"
68
        vrefStr = "dependencies.asp?pv_id=" & rsQry("pv_id") & "&rtag_id=" & parRtagId
69
        buildTime = rsQry("build_time")
70
        If isNull(buildTime) Then buildTime = ""
71
        lastBuild = rsQry("lastBuild")
72
        If isNull(lastBuild) Then lastBuild = ""
6580 dpurdie 73
        codeLines = rsQry("code_lines")
74
        If isNull(codeLines) Then codeLines = ""
75
        isDeployable = rsQry("is_deployable")
76
        If isNull(isDeployable) Then isDeployable = "N"
77
        viewName = rsQry("view_name")
6582 dpurdie 78
        isSdk = rsQry("isSdk") 
6580 dpurdie 79
        If IsNull(buildId) Then tcount = ""
6579 dpurdie 80
 
81
        Response.Write "["
82
        Response.Write """<a href=" + prefStr + ">" + rsQry("pkg_name") + "</a>"""
83
        Response.Write ",""<a href=" + vrefStr + ">" + rsQry("pkg_version") + "</a>"""
6580 dpurdie 84
        Response.Write ",""<a href=" + crefStr + ">" & tcount & "</a>"""
85
        Response.Write ",""" + codeLines + """"
6579 dpurdie 86
        Response.Write ",""" + buildTime + """"
87
        Response.Write ",""" + lastBuild + """"
6580 dpurdie 88
        Response.Write ",""" + isDeployable + """"
89
        Response.Write ",""" + viewName + """"
6582 dpurdie 90
        Response.Write ",""" + isSdk + """"
6579 dpurdie 91
        Response.Write "],"  + vbCRLF
92
    rsQry.MoveNext
93
    Loop
94
    Response.Write "]"  + vbCRLF
95
    Response.Write "</script>"  + vbCRLF
96
    rsQry.close
97
    Set rsQry = nothing
98
End Sub
99
 
6576 dpurdie 100
'----------------------------------------------------
101
Sub LeftPanelContent
102
%>
6577 dpurdie 103
<fieldset class="body_rowg fset">
104
    <legend>Display</legend>
105
    <input id="noScroll" type="checkbox" name="noScroll" value="1"> No Scroll
6580 dpurdie 106
    <br><input id="noGroups" type="checkbox" name="noGroups" value="1"> No Groups
6579 dpurdie 107
    <br><input id="noCots" type="checkbox" name="noCots" value="1"> Ignore Cots
6580 dpurdie 108
    <br><input id="noDeploy" type="checkbox" name="noDeploy" value="1"> Ignore Deployable
6582 dpurdie 109
    <br><input id="noSdk" type="checkbox" name="noSdk" value="1"> Ignore SDKs
6577 dpurdie 110
</fieldset>
111
<fieldset class="body_rowg fset">
112
    <legend>Export</legend>
113
    <input id="btnExport"  name="btn" type="submit" class="form_btn" value="Test Counts as CSV"><%=Quick_Help("h_export")%>
114
</fieldset>
6576 dpurdie 115
<%
116
End Sub
117
 
118
Sub MainPanelContent
119
%>
120
   <table class="embedded_table" style="margin-bottom:20px">
121
      <tr>
122
         <td>
123
            <!-- Box Title -->
124
            <div class="form_ttl nowrap" align="left">
125
                 Package Unit Tests
126
            </div>
127
         </td>
128
      </tr>
129
      <tr>
130
         <td>
131
            <!-- Box Content -->
132
            <div class="rounded_box">
133
               <div style="background-color: white;border-left: white solid 10px;border-right: white solid 10px;">
134
                    <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
135
                    <!--#include file="messages/_msg_inline.asp"-->
136
                    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
6582 dpurdie 137
                    <div id="packageStatsHolder">
6577 dpurdie 138
                    <table id="packageStats" width="100%" class="embedded_table">
139
                        <thead class="envGroup">
140
                           <tr class="body_col envGroup">
141
                              <td valign="top" nowrap>Package</td>
142
                              <td valign="top" nowrap>Version</td>
6587 dpurdie 143
                              <td valign="top" nowrap>Unit<br>Tests</td>
144
                              <td valign="top" nowrap>Lines<br>of Code</td>
6580 dpurdie 145
                              <td valign="top" nowrap>Build<br>Duration</td>
146
                              <td valign="top" nowrap>Build Date</td>
147
                              <td valign="top" nowrap>Deployable</td>
148
                              <td valign="top" nowrap>View Name</td>
6582 dpurdie 149
                              <td valign="top" nowrap>SDK</td>
6577 dpurdie 150
                           </tr>
151
                        </thead>
6576 dpurdie 152
                  </table>
6582 dpurdie 153
                  </div>
6579 dpurdie 154
                  <table width="100%" class="embedded_table">
6580 dpurdie 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>
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>
6587 dpurdie 159
                  <tr class="body_rowg"><td colspan=4>Total Lines of Code</td><td id="tloc"></td></tr>
6579 dpurdie 160
                  </table>
6576 dpurdie 161
               </div>
162
            </div>
163
         </td>
164
      </tr>
165
   </table>
166
<%
167
End Sub
168
%>
169
<NOSCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="common/VarDump.vbs"></NOSCRIPT> 
170
<html>
171
   <head>
172
      <title>Release Manager</title>
173
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
174
      <meta http-equiv="Pragma" content="no-cache">
175
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 176
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
177
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
178
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
6576 dpurdie 179
      <!-- DROPDOWN MENUS -->
6577 dpurdie 180
      <%bJqueryDataTables = TRUE%>
6576 dpurdie 181
      <!--#include file="_jquery_includes.asp"-->
182
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 183
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
184
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
185
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
6577 dpurdie 186
      <script language="JavaScript" type="text/JavaScript">
187
      formTips.tips.h_export       = stdTip(300, 'Export Test Count', 'Unit test counts will be copied to the users clipboard is CSV format.' +
188
                                                                  '<p>The data is to be integrated into other reports.' 
189
                                                                  );
190
      </script>
6579 dpurdie 191
      <%Call GenerateData%>
6580 dpurdie 192
      <style type="text/css">
193
          table.dataTable tbody tr.baseGroup{background:#dad7c8;}
194
          table.dataTable tbody tr.baseGroup td{border-bottom:1pt solid black;;border-top:1pt solid black;}
195
          table.dataTable tbody tr td.header{color:black;font-weight:bold;}
196
          table.dataTable tbody tr td.info{color:gray;font-weight:normal;}
197
      </style>
6577 dpurdie 198
      <script type="text/javascript" charset="utf-8">
6579 dpurdie 199
 
6582 dpurdie 200
          // Helper object to contain unit tests stats
201
        function groupStats() {
202
            this.total = 0;
203
            this.withTests = 0;
204
            this.testCount = 0;
6587 dpurdie 205
            this.loc = 0;
6582 dpurdie 206
        };
6580 dpurdie 207
 
6582 dpurdie 208
        var pkgStats = {
209
            // Ref to the current table
210
            table : null ,
211
 
212
            // A copy of the original table body
213
            html : null,
214
 
215
            // Display package groups
216
            noGroup : false,
217
 
218
            // Counters for all and for each groups
219
            info : null,
220
            groupinfo : null,
221
 
222
            // Part of config - with groups
223
            withGroups : [
224
                    { "visible": false, "targets": [6,7,8] },
6587 dpurdie 225
                    { "className" : 'nowrap', targets: [1,2,3,4,5] },
6582 dpurdie 226
                    { "orderData" : [7,0], targets : 0 },
227
                    { "orderData" : [7,1], targets : 1 },
228
                    { "orderData" : [7,2], targets : 2 },
229
                    { "orderData" : [7,3], targets : 3 },
230
                    { "orderData" : [7,4], targets : 4 },
231
                    { "orderData" : [7,5], targets : 5 },
232
                    { "orderData" : [7,0], targets : 7 },
233
                ],
234
 
235
            // Part of config - with out groups
236
            withNoGroups : [
237
                    { "visible": false, "targets": [6,7,8] },
6587 dpurdie 238
                    { "className" : 'nowrap', targets: [1,2,3,4,5] },
6582 dpurdie 239
                ],
240
 
241
            // Basic table config
242
            tableConfig : {
243
                //  Vix Usage
244
                //  Used so that the internal functions can access the rest of the pkgStats data
245
                //  Will be filled in with a function to return the data
246
                parentRef : null,
247
 
248
                // Standard config
249
                //    scrollY and columnDefs will be provided before table is created
250
                dom:            "lfrti",
251
                scrollY:        "65vh",
252
                scrollCollapse: true,
253
                paging:         false,
254
                language : { info: "Showing _TOTAL_ entries" },
255
                columnDefs: null,
256
                order: [[0,'asc']],
257
                drawCallback: function ( settings ) {
258
                    var api = this.api();
259
                    var parentRef = api.init().parentRef();
260
                    if (parentRef.noGroup) {
261
                        return;
6580 dpurdie 262
                    }
6577 dpurdie 263
 
6582 dpurdie 264
                    var groupinfo = parentRef.groupinfo;
265
                    $('#noGroups').prop('checked', false)
266
                    var rows = api.rows( { page: 'current' }).nodes();
267
                    var last=null;
268
                    api.column(7, {page:'current'} ).data().each( function ( group, i ) {
269
                        if ( last !== group ) {
270
                            last = group;
271
                            var gdata = groupinfo[group];
272
                            var gtext = new Array();
273
                            gtext.push('Packages: ' + gdata.total + '.');
274
                            gtext.push('With Tests: ' + gdata.withTests + '.');
275
                            gtext.push('Unit Tests: ' + gdata.testCount + '.');
6587 dpurdie 276
                            gtext.push('LoC: ' + gdata.loc + '.');
6582 dpurdie 277
                            $(rows).eq( i ).before(
6587 dpurdie 278
                                '<tr class="baseGroup"><td class="header" colspan="2">'+group+ '</td><td class="info nowrap" colspan="4">'+gtext.join(' ') + '</td></tr>'
6582 dpurdie 279
                            );
280
                        }
281
                    });
6587 dpurdie 282
                    parentRef.setHeight();
6582 dpurdie 283
                }
284
            },
285
 
286
            // Create a basic DataTable
287
            //  Then populate it
288
            createPkgStatsTable : function(){
289
                 // Save or restore the original HTML of the table
290
                 if ( !this.html ) {
291
                     this.html = $('#packageStatsHolder').html();
292
                 } else {
293
                     //  Basically need to kill of the multi column ordering, but I can't do it programatically
294
                     //  Destroy / rebuild the table
295
                     //  The destoy() function in the 1.10.8 crashes when used with 'false'
296
                     //  Using 'true' removes the html of the table - so we save it and put it back
297
                     this.table.destroy(true);
298
                     $('#packageStatsHolder').html(this.html);
299
                 }
300
 
301
                 this.noGroup = $('#noGroups').get(0).checked;
302
                 this.tableConfig.columnDefs = this.noGroup ? this.withNoGroups : this.withGroups;
303
 
304
                 var that = this;
6587 dpurdie 305
                 var tableConfig = Object.assign({}, this.tableConfig);
306
                 tableConfig.parentRef = function(){return that;};
307
                 this.table = $('#packageStats').DataTable(tableConfig);
6582 dpurdie 308
                 this.insertAllData();
309
            },
310
 
6579 dpurdie 311
            //
312
            //  Filter data and insert into the table
6582 dpurdie 313
            insertAllData : function () {
6580 dpurdie 314
                var noDeploy = $('#noDeploy').get(0).checked; 
6582 dpurdie 315
                var noCots   = $('#noCots').get(0).checked;
316
                var noSdk    = $('#noSdk').get(0).checked;
6580 dpurdie 317
 
6579 dpurdie 318
                var ii;
6582 dpurdie 319
                this.table.clear();
320
                this.info = new groupStats();
321
                this.groupinfo = {};
6579 dpurdie 322
 
323
                for (ii = 0; ii < dataSet.length; ii++) {
6580 dpurdie 324
                    if ( noCots ) {
325
                        var vdata = $(dataSet[ii][1]).text();
326
                        if ( vdata.match(/.cots$/) || vdata.match(/.tool$/) ) {
327
                            continue;
6579 dpurdie 328
                        }
329
                    }
6580 dpurdie 330
 
331
                    if ( noDeploy ) {
332
                        var dData = dataSet[ii][6];
333
                        if ( dData == 'Y' ) {
334
                            continue;
335
                        }
336
                    }
337
 
6582 dpurdie 338
                    if ( noSdk ) {
339
                        var dData = dataSet[ii][8];
340
                        if ( dData == 'Y' ) {
341
                            continue;
342
                        }
343
                    }
344
 
6580 dpurdie 345
                    var group = dataSet[ii][7];
6582 dpurdie 346
                    var gdata = this.groupinfo[group];
347
                    if ( !gdata ) {
348
                        this.groupinfo[group] = new groupStats();
349
                        gdata = this.groupinfo[group];
6580 dpurdie 350
                    }
351
 
6582 dpurdie 352
                    this.table.row.add( dataSet[ii]);
353
                    this.info.total ++;
6580 dpurdie 354
                    gdata.total++;
355
                    var count = parseInt($(dataSet[ii][2]).text());
6587 dpurdie 356
                    var loc = parseInt(dataSet[ii][3]);
6580 dpurdie 357
                    if ( !isNaN(count) && count > 0 ) {
6582 dpurdie 358
                        this.info.withTests++;
6580 dpurdie 359
                        gdata.withTests++;
6582 dpurdie 360
                        this.info.testCount += count;
6580 dpurdie 361
                        gdata.testCount += count;
362
                    }
6587 dpurdie 363
                    if ( !isNaN(loc) && loc > 0 ) {
364
                        this.info.loc += loc;
365
                        gdata.loc += loc;
366
                    }
6579 dpurdie 367
                }
6582 dpurdie 368
                this.table.draw();
6579 dpurdie 369
 
6582 dpurdie 370
                $('#pkgCount').text(this.info.total);
371
                $('#pkgTestCount').text(this.info.withTests);
372
                $('#testCount').text(this.info.testCount);
6587 dpurdie 373
                $('#tloc').text(this.info.loc);
6582 dpurdie 374
            },
6579 dpurdie 375
 
6582 dpurdie 376
            setHeight : function () {
377
                 var noScroll = $('#noScroll').get(0).checked;
378
                 if ( noScroll ) {
379
                     var ScrollBody = $('#packageStats').closest('.dataTables_scrollBody');
380
                     // work on Datatables 1.10.12 ++, but not on 1.10.8, although lots else works better
381
                     ScrollBody.css('max-height', "100%");
382
                     ScrollBody.css('height', "100%");
383
                 }
384
            },
6577 dpurdie 385
 
6582 dpurdie 386
        };
6577 dpurdie 387
 
6582 dpurdie 388
        $(document).ready(function() {
6579 dpurdie 389
 
6582 dpurdie 390
        // Instantiate the table
391
        pkgStats.createPkgStatsTable();
6580 dpurdie 392
 
6582 dpurdie 393
        // Enable / Disable full table display
394
        // Use / Don't use base View groups
395
        $('#noScroll,#noGroups').click(function(e){
396
            pkgStats.createPkgStatsTable();
397
        });
6580 dpurdie 398
 
6582 dpurdie 399
        // Hide / Show the the COTS packages
400
        // Hide / Show the the Deployed packages
401
        // Hide / Show the packages from SDKs
402
        $('#noCots,#noDeploy,#noSdk').click(function(e){
403
            pkgStats.insertAllData();
404
        });
6577 dpurdie 405
 
6587 dpurdie 406
        // Copy multi-line data to the users clipboard
6582 dpurdie 407
        function copyToClipboard(string) {
6587 dpurdie 408
            var $temp = $("<textarea>");
6582 dpurdie 409
            $("body").append($temp);
410
            $temp.val(string).select();
411
            document.execCommand("copy");
412
            $temp.remove();
413
        };
6577 dpurdie 414
 
6582 dpurdie 415
        // Export Data
416
        $('#btnExport').click(function(e){
417
            var csv = [];
6587 dpurdie 418
            var lines = [];
6582 dpurdie 419
            var date = new Date();
420
            var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
6577 dpurdie 421
 
6587 dpurdie 422
            function createHeader() {
423
                //  Insert DateStamp as YYMMDD
424
                csv.push(tstamp);
6579 dpurdie 425
 
6587 dpurdie 426
                //  Insert Release ID
427
                csv.push(<%=DB_RTAG_ID%>);
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
            }
444
 
6582 dpurdie 445
            // Generate a CSV representation of the data in the table
6587 dpurdie 446
            // Support two forms - grouped and un grouped
447
            //
448
            if (pkgStats.noGroup) {
449
                // Ungrouped - all packages
450
                createHeader();
451
                addInfo(pkgStats.info);
452
                pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
453
                    var data = this.data();
454
                    csv.push('ALL');
455
                    csv.push($(data[0]).text(), $(data[2]).text(), data[3] );
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();
468
                        csv.push(group);
469
                        addInfo(pkgStats.groupinfo[group]);
470
                    }
471
                    csv.push($(data[0]).text(), $(data[2]).text(), data[3] );
472
                });
473
                saveCsv();
474
            }
6589 dpurdie 475
            vixTextToClipBoard(lines.join('\r\n'),{note:'CSV Data copied to clipboard'});
6577 dpurdie 476
            });
477
        });
6582 dpurdie 478
  </script>
6577 dpurdie 479
 
6576 dpurdie 480
   </head>
481
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
482
      <!-- HEADER -->
483
      <!--#include file="_header.asp"-->
484
      <!-- BODY ---->
485
      <table class="full_table">
486
         <tr>
487
            <td width="146px" class="panel_bg" valign="top">
488
                <%Call LeftPanelContent%>
489
            </td>
6577 dpurdie 490
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6576 dpurdie 491
                <%Call MainPanelContent%>
492
            </td>
493
         </tr>
494
         <tr>
495
            <td class="panel_bg" valign="bottom" align="center" height="350">
496
                <img src="images/release_stats.png" vspace="20" hspace="30"></td>
497
         </tr>
498
      </table>
499
      <!-- FOOTER -->
500
      <!--#include file="_footer.asp"-->
501
   </body>
502
</html>
503