Subversion Repositories DevTools

Rev

Rev 6580 | Rev 6587 | 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>
6580 dpurdie 143
                              <td valign="top" nowrap>Test<br>Count</td>
144
                              <td valign="top" nowrap>Code<br>Lines</td>
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>
6579 dpurdie 159
                  </table>
6576 dpurdie 160
               </div>
161
            </div>
162
         </td>
163
      </tr>
164
   </table>
165
<%
166
End Sub
167
%>
168
<NOSCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="common/VarDump.vbs"></NOSCRIPT> 
169
<html>
170
   <head>
171
      <title>Release Manager</title>
172
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
173
      <meta http-equiv="Pragma" content="no-cache">
174
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 175
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
176
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
177
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
6576 dpurdie 178
      <!-- DROPDOWN MENUS -->
6577 dpurdie 179
      <%bJqueryDataTables = TRUE%>
6576 dpurdie 180
      <!--#include file="_jquery_includes.asp"-->
181
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 182
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
183
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
184
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
6577 dpurdie 185
      <script language="JavaScript" type="text/JavaScript">
186
      formTips.tips.h_export       = stdTip(300, 'Export Test Count', 'Unit test counts will be copied to the users clipboard is CSV format.' +
187
                                                                  '<p>The data is to be integrated into other reports.' 
188
                                                                  );
189
      </script>
6579 dpurdie 190
      <%Call GenerateData%>
6580 dpurdie 191
      <style type="text/css">
192
          table.dataTable tbody tr.baseGroup{background:#dad7c8;}
193
          table.dataTable tbody tr.baseGroup td{border-bottom:1pt solid black;;border-top:1pt solid black;}
194
          table.dataTable tbody tr td.header{color:black;font-weight:bold;}
195
          table.dataTable tbody tr td.info{color:gray;font-weight:normal;}
196
      </style>
6577 dpurdie 197
      <script type="text/javascript" charset="utf-8">
6579 dpurdie 198
 
6582 dpurdie 199
          // Helper object to contain unit tests stats
200
        function groupStats() {
201
            this.total = 0;
202
            this.withTests = 0;
203
            this.testCount = 0;
204
        };
6580 dpurdie 205
 
6582 dpurdie 206
        var pkgStats = {
207
            // Ref to the current table
208
            table : null ,
209
 
210
            // A copy of the original table body
211
            html : null,
212
 
213
            // Display package groups
214
            noGroup : false,
215
 
216
            // Counters for all and for each groups
217
            info : null,
218
            groupinfo : null,
219
 
220
            // Part of config - with groups
221
            withGroups : [
222
                    { "visible": false, "targets": [6,7,8] },
223
                    { "orderData" : [7,0], targets : 0 },
224
                    { "orderData" : [7,1], targets : 1 },
225
                    { "orderData" : [7,2], targets : 2 },
226
                    { "orderData" : [7,3], targets : 3 },
227
                    { "orderData" : [7,4], targets : 4 },
228
                    { "orderData" : [7,5], targets : 5 },
229
                    { "orderData" : [7,0], targets : 7 },
230
                ],
231
 
232
            // Part of config - with out groups
233
            withNoGroups : [
234
                    { "visible": false, "targets": [6,7,8] },
235
                ],
236
 
237
            // Basic table config
238
            tableConfig : {
239
                //  Vix Usage
240
                //  Used so that the internal functions can access the rest of the pkgStats data
241
                //  Will be filled in with a function to return the data
242
                parentRef : null,
243
 
244
                // Standard config
245
                //    scrollY and columnDefs will be provided before table is created
246
                dom:            "lfrti",
247
                scrollY:        "65vh",
248
                scrollCollapse: true,
249
                paging:         false,
250
                language : { info: "Showing _TOTAL_ entries" },
251
                columnDefs: null,
252
                order: [[0,'asc']],
253
                drawCallback: function ( settings ) {
254
                    var api = this.api();
255
                    var parentRef = api.init().parentRef();
256
                    if (parentRef.noGroup) {
257
                        return;
6580 dpurdie 258
                    }
6577 dpurdie 259
 
6582 dpurdie 260
                    var groupinfo = parentRef.groupinfo;
261
                    $('#noGroups').prop('checked', false)
262
                    var rows = api.rows( { page: 'current' }).nodes();
263
                    var last=null;
264
                    api.column(7, {page:'current'} ).data().each( function ( group, i ) {
265
                        if ( last !== group ) {
266
                            last = group;
267
                            var gdata = groupinfo[group];
268
                            var gtext = new Array();
269
                            gtext.push('Packages: ' + gdata.total + '.');
270
                            gtext.push('With Tests: ' + gdata.withTests + '.');
271
                            gtext.push('Unit Tests: ' + gdata.testCount + '.');
272
                            $(rows).eq( i ).before(
273
                                '<tr class="baseGroup"><td class="header" colspan="2">'+group+ '</td><td class="info" colspan="4">'+gtext.join(' ') + '</td></tr>'
274
                            );
275
                        }
276
                    });
277
                }
278
            },
279
 
280
            // Create a basic DataTable
281
            //  Then populate it
282
            createPkgStatsTable : function(){
283
                 // Save or restore the original HTML of the table
284
                 if ( !this.html ) {
285
                     this.html = $('#packageStatsHolder').html();
286
                 } else {
287
                     //  Basically need to kill of the multi column ordering, but I can't do it programatically
288
                     //  Destroy / rebuild the table
289
                     //  The destoy() function in the 1.10.8 crashes when used with 'false'
290
                     //  Using 'true' removes the html of the table - so we save it and put it back
291
                     this.table.destroy(true);
292
                     $('#packageStatsHolder').html(this.html);
293
                 }
294
 
295
                 this.noGroup = $('#noGroups').get(0).checked;
296
                 this.tableConfig.columnDefs = this.noGroup ? this.withNoGroups : this.withGroups;
297
 
298
                 var that = this;
299
                 this.tableConfig.parentRef = function(){return that;};
300
                 this.table = $('#packageStats').DataTable(this.tableConfig);
301
                 this.insertAllData();
302
            },
303
 
6579 dpurdie 304
            //
305
            //  Filter data and insert into the table
6582 dpurdie 306
            insertAllData : function () {
6580 dpurdie 307
                var noDeploy = $('#noDeploy').get(0).checked; 
6582 dpurdie 308
                var noCots   = $('#noCots').get(0).checked;
309
                var noSdk    = $('#noSdk').get(0).checked;
6580 dpurdie 310
 
6579 dpurdie 311
                var ii;
6582 dpurdie 312
                this.table.clear();
313
                this.info = new groupStats();
314
                this.groupinfo = {};
6579 dpurdie 315
 
316
                for (ii = 0; ii < dataSet.length; ii++) {
6580 dpurdie 317
                    if ( noCots ) {
318
                        var vdata = $(dataSet[ii][1]).text();
319
                        if ( vdata.match(/.cots$/) || vdata.match(/.tool$/) ) {
320
                            continue;
6579 dpurdie 321
                        }
322
                    }
6580 dpurdie 323
 
324
                    if ( noDeploy ) {
325
                        var dData = dataSet[ii][6];
326
                        if ( dData == 'Y' ) {
327
                            continue;
328
                        }
329
                    }
330
 
6582 dpurdie 331
                    if ( noSdk ) {
332
                        var dData = dataSet[ii][8];
333
                        if ( dData == 'Y' ) {
334
                            continue;
335
                        }
336
                    }
337
 
6580 dpurdie 338
                    var group = dataSet[ii][7];
6582 dpurdie 339
                    var gdata = this.groupinfo[group];
340
                    if ( !gdata ) {
341
                        this.groupinfo[group] = new groupStats();
342
                        gdata = this.groupinfo[group];
6580 dpurdie 343
                    }
344
 
6582 dpurdie 345
                    this.table.row.add( dataSet[ii]);
346
                    this.info.total ++;
6580 dpurdie 347
                    gdata.total++;
348
                    var count = parseInt($(dataSet[ii][2]).text());
349
                    if ( !isNaN(count) && count > 0 ) {
6582 dpurdie 350
                        this.info.withTests++;
6580 dpurdie 351
                        gdata.withTests++;
6582 dpurdie 352
                        this.info.testCount += count;
6580 dpurdie 353
                        gdata.testCount += count;
354
                    }
6579 dpurdie 355
                }
6582 dpurdie 356
                this.table.draw();
357
                this.setHeight();
6579 dpurdie 358
 
6582 dpurdie 359
                $('#pkgCount').text(this.info.total);
360
                $('#pkgTestCount').text(this.info.withTests);
361
                $('#testCount').text(this.info.testCount);
362
            },
6579 dpurdie 363
 
6582 dpurdie 364
            setHeight : function () {
365
                 var noScroll = $('#noScroll').get(0).checked;
366
                 if ( noScroll ) {
367
                     var ScrollBody = $('#packageStats').closest('.dataTables_scrollBody');
368
                     // work on Datatables 1.10.12 ++, but not on 1.10.8, although lots else works better
369
                     ScrollBody.css('max-height', "100%");
370
                     ScrollBody.css('height', "100%");
371
                 }
372
            },
6577 dpurdie 373
 
6582 dpurdie 374
        };
6577 dpurdie 375
 
6582 dpurdie 376
        $(document).ready(function() {
6579 dpurdie 377
 
6582 dpurdie 378
        // Instantiate the table
379
        pkgStats.createPkgStatsTable();
6580 dpurdie 380
 
6582 dpurdie 381
        // Enable / Disable full table display
382
        // Use / Don't use base View groups
383
        $('#noScroll,#noGroups').click(function(e){
384
            pkgStats.createPkgStatsTable();
385
        });
6580 dpurdie 386
 
6582 dpurdie 387
        // Hide / Show the the COTS packages
388
        // Hide / Show the the Deployed packages
389
        // Hide / Show the packages from SDKs
390
        $('#noCots,#noDeploy,#noSdk').click(function(e){
391
            pkgStats.insertAllData();
392
        });
6577 dpurdie 393
 
6582 dpurdie 394
        // Copy data to the users clipboard
395
        function copyToClipboard(string) {
396
            var $temp = $("<input>");
397
            $("body").append($temp);
398
            $temp.val(string).select();
399
            document.execCommand("copy");
400
            $temp.remove();
401
        };
6577 dpurdie 402
 
6582 dpurdie 403
        // Export Data
404
        $('#btnExport').click(function(e){
405
            var csv = [];
6577 dpurdie 406
 
6582 dpurdie 407
            //  Insert DateStamp as YYMMDD
408
            var date = new Date();
409
            var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
410
            csv.push(tstamp);
6577 dpurdie 411
 
6582 dpurdie 412
            //  Insert Release ID
413
            csv.push(<%=DB_RTAG_ID%>);
414
            csv.push("<%=DB_PROJ_NAME%>::<%=DB_RTAG_NAME%>");
6579 dpurdie 415
 
6582 dpurdie 416
            // Generate a CSV representation of the data in the table
417
            pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
418
                var data = this.data();
419
                csv.push($(data[0]).text(), $(data[2]).text());
420
            });
421
            var csvString = csv.join(",");
422
            //console.log(csvString);
423
            copyToClipboard(csvString);
424
            vixConfirm("Data copied to Clipboard", {
425
                title: "Notification",
426
                icon : "images/i_info.png", 
427
                cancel: false, 
428
                button: null,
429
                timeout : 100,
430
                position : 'center', 
431
                modal : false,
432
                minHeight: 10, 
433
                hide: { effect: 'fade', duration: 2000 }
6577 dpurdie 434
                });
435
            });
436
        });
6582 dpurdie 437
  </script>
6577 dpurdie 438
 
6576 dpurdie 439
   </head>
440
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
441
      <!-- HEADER -->
442
      <!--#include file="_header.asp"-->
443
      <!-- BODY ---->
444
      <table class="full_table">
445
         <tr>
446
            <td width="146px" class="panel_bg" valign="top">
447
                <%Call LeftPanelContent%>
448
            </td>
6577 dpurdie 449
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6576 dpurdie 450
                <%Call MainPanelContent%>
451
            </td>
452
         </tr>
453
         <tr>
454
            <td class="panel_bg" valign="bottom" align="center" height="350">
455
                <img src="images/release_stats.png" vspace="20" hspace="30"></td>
456
         </tr>
457
      </table>
458
      <!-- FOOTER -->
459
      <!--#include file="_footer.asp"-->
460
   </body>
461
</html>
462