Subversion Repositories DevTools

Rev

Rev 6579 | Rev 6582 | 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
6580 dpurdie 63
        Dim buildId, buildTime, lastBuild, codeLines, isDeployable, viewName
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")
78
        If IsNull(buildId) Then tcount = ""
6579 dpurdie 79
 
80
        Response.Write "["
81
        Response.Write """<a href=" + prefStr + ">" + rsQry("pkg_name") + "</a>"""
82
        Response.Write ",""<a href=" + vrefStr + ">" + rsQry("pkg_version") + "</a>"""
6580 dpurdie 83
        Response.Write ",""<a href=" + crefStr + ">" & tcount & "</a>"""
84
        Response.Write ",""" + codeLines + """"
6579 dpurdie 85
        Response.Write ",""" + buildTime + """"
86
        Response.Write ",""" + lastBuild + """"
6580 dpurdie 87
        Response.Write ",""" + isDeployable + """"
88
        Response.Write ",""" + viewName + """"
6579 dpurdie 89
        Response.Write "],"  + vbCRLF
90
    rsQry.MoveNext
91
    Loop
92
    Response.Write "]"  + vbCRLF
93
    Response.Write "</script>"  + vbCRLF
94
    rsQry.close
95
    Set rsQry = nothing
96
End Sub
97
 
6576 dpurdie 98
'----------------------------------------------------
99
Sub LeftPanelContent
100
%>
6577 dpurdie 101
<fieldset class="body_rowg fset">
102
    <legend>Display</legend>
103
    <input id="noScroll" type="checkbox" name="noScroll" value="1"> No Scroll
6580 dpurdie 104
    <br><input id="noGroups" type="checkbox" name="noGroups" value="1"> No Groups
6579 dpurdie 105
    <br><input id="noCots" type="checkbox" name="noCots" value="1"> Ignore Cots
6580 dpurdie 106
    <br><input id="noDeploy" type="checkbox" name="noDeploy" value="1"> Ignore Deployable
6577 dpurdie 107
</fieldset>
108
<fieldset class="body_rowg fset">
109
    <legend>Export</legend>
110
    <input id="btnExport"  name="btn" type="submit" class="form_btn" value="Test Counts as CSV"><%=Quick_Help("h_export")%>
111
</fieldset>
6576 dpurdie 112
<%
113
End Sub
114
 
115
Sub MainPanelContent
116
%>
117
   <table class="embedded_table" style="margin-bottom:20px">
118
      <tr>
119
         <td>
120
            <!-- Box Title -->
121
            <div class="form_ttl nowrap" align="left">
122
                 Package Unit Tests
123
            </div>
124
         </td>
125
      </tr>
126
      <tr>
127
         <td>
128
            <!-- Box Content -->
129
            <div class="rounded_box">
130
               <div style="background-color: white;border-left: white solid 10px;border-right: white solid 10px;">
131
                    <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
132
                    <!--#include file="messages/_msg_inline.asp"-->
133
                    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
6577 dpurdie 134
                    <table id="packageStats" width="100%" class="embedded_table">
135
                        <thead class="envGroup">
136
                           <tr class="body_col envGroup">
137
                              <td valign="top" nowrap>Package</td>
138
                              <td valign="top" nowrap>Version</td>
6580 dpurdie 139
                              <td valign="top" nowrap>Test<br>Count</td>
140
                              <td valign="top" nowrap>Code<br>Lines</td>
141
                              <td valign="top" nowrap>Build<br>Duration</td>
142
                              <td valign="top" nowrap>Build Date</td>
143
                              <td valign="top" nowrap>Deployable</td>
144
                              <td valign="top" nowrap>View Name</td>
6577 dpurdie 145
                           </tr>
146
                        </thead>
6576 dpurdie 147
                  </table>
6579 dpurdie 148
                  <table width="100%" class="embedded_table">
6580 dpurdie 149
                  <tr class="body_col envGroup"><th colspan=5>Summary</th></tr>
150
                  <tr class="body_rowg"><td colspan=4>Total Packages</td><td id="pkgCount"></td></tr>
151
                  <tr class="body_rowg"><td colspan=4>Total Packages with Tests</td><td id="pkgTestCount"></td></tr>
152
                  <tr class="body_rowg"><td colspan=4>Total Unit Tests</td><td id="testCount"></td></tr>
6579 dpurdie 153
                  </table>
6576 dpurdie 154
               </div>
155
            </div>
156
         </td>
157
      </tr>
158
   </table>
159
<%
160
End Sub
161
%>
162
<NOSCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="common/VarDump.vbs"></NOSCRIPT> 
163
<html>
164
   <head>
165
      <title>Release Manager</title>
166
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
167
      <meta http-equiv="Pragma" content="no-cache">
168
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 169
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
170
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
171
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
6576 dpurdie 172
      <!-- DROPDOWN MENUS -->
6577 dpurdie 173
      <%bJqueryDataTables = TRUE%>
6576 dpurdie 174
      <!--#include file="_jquery_includes.asp"-->
175
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 176
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
177
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
178
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
6577 dpurdie 179
      <script language="JavaScript" type="text/JavaScript">
180
      formTips.tips.h_export       = stdTip(300, 'Export Test Count', 'Unit test counts will be copied to the users clipboard is CSV format.' +
181
                                                                  '<p>The data is to be integrated into other reports.' 
182
                                                                  );
183
      </script>
6579 dpurdie 184
      <%Call GenerateData%>
6580 dpurdie 185
      <style type="text/css">
186
          table.dataTable tbody tr.baseGroup{background:#dad7c8;}
187
          table.dataTable tbody tr.baseGroup td{border-bottom:1pt solid black;;border-top:1pt solid black;}
188
          table.dataTable tbody tr td.header{color:black;font-weight:bold;}
189
          table.dataTable tbody tr td.info{color:gray;font-weight:normal;}
190
      </style>
6577 dpurdie 191
      <script type="text/javascript" charset="utf-8">
192
        var pkgStats = {};
193
        $(document).ready(function() {
6579 dpurdie 194
 
6577 dpurdie 195
            // Create a basic DataTable
6579 dpurdie 196
            // The populate it
6577 dpurdie 197
            pkgStats.table = $('#packageStats').DataTable( {
6579 dpurdie 198
                    dom:            "lfrti",
6577 dpurdie 199
                    scrollY:        "65vh",
200
                    scrollCollapse: true,
201
                    paging:         false,
6580 dpurdie 202
                    language : { info: "Showing _TOTAL_ entries" },
203
                    columnDefs: [
204
                        { "visible": false, "targets": [6] },
205
                        { "orderData" : [7,0], targets : 0 },
206
                        { "orderData" : [7,1], targets : 1 },
207
                        { "orderData" : [7,2], targets : 2 },
208
                        { "orderData" : [7,3], targets : 3 },
209
                        { "orderData" : [7,4], targets : 4 },
210
                        { "orderData" : [7,5], targets : 5 },
211
                        { "orderData" : [7,0], targets : 7 },
212
                    ],
213
                    order: [[7,'asc']],
214
                    drawCallback: function ( settings ) {
215
                        var api = this.api();
216
 
217
                        var orderCol = api.order()[0][0];
218
                        if ( orderCol != 7 ) {
219
                            $('#noGroups').prop('checked', true);
220
                            //return;
221
                        }
222
                        $('#noGroups').prop('checked', false)
223
                        var rows = api.rows( { page: 'current' }).nodes();
224
                        var last=null;
225
                        api.column(7, {page:'current'} ).data().each( function ( group, i ) {
226
                            if ( last !== group ) {
227
                                last = group;
228
                                var gdata = pkgStats.groupinfo[group];
229
                                var gtext = new Array();
230
                                gtext.push('Packages: ' + gdata.total + '.');
231
                                gtext.push('With Tests: ' + gdata.withTests + '.');
232
                                gtext.push('Unit Tests: ' + gdata.testCount + '.');
233
                                $(rows).eq( i ).before(
234
                                    '<tr class="baseGroup"><td class="header" colspan="2">'+group+ '</td><td class="info" colspan="4">'+gtext.join(' ') + '</td></tr>'
235
                                );
236
                            }
237
                        });
238
                    }
6577 dpurdie 239
                });
6580 dpurdie 240
            pkgStats.init = pkgStats.table.init();
241
            pkgStats.noGroup = false;
242
            insertAllData();
6577 dpurdie 243
 
6579 dpurdie 244
            //
245
            //  Filter data and insert into the table
6580 dpurdie 246
            function insertAllData() {
247
                var noDeploy = $('#noDeploy').get(0).checked; 
248
                var noCots   = $('#noCots').get(0).checked; 
249
 
6579 dpurdie 250
                var ii;
251
                pkgStats.table.clear();
252
                pkgStats.info = {};
6580 dpurdie 253
                pkgStats.groupinfo = {};
6579 dpurdie 254
                pkgStats.info.total = 0;
255
                pkgStats.info.withTests = 0;
256
                pkgStats.info.testCount = 0;
257
 
258
                for (ii = 0; ii < dataSet.length; ii++) {
6580 dpurdie 259
                    if ( noCots ) {
260
                        var vdata = $(dataSet[ii][1]).text();
261
                        if ( vdata.match(/.cots$/) || vdata.match(/.tool$/) ) {
262
                            continue;
6579 dpurdie 263
                        }
264
                    }
6580 dpurdie 265
 
266
                    if ( noDeploy ) {
267
                        var dData = dataSet[ii][6];
268
                        if ( dData == 'Y' ) {
269
                            continue;
270
                        }
271
                    }
272
 
273
                    var group = dataSet[ii][7];
274
                    var gdata = pkgStats.groupinfo[group];
275
                    if ( gdata == null ) {
276
                        pkgStats.groupinfo[group] = {};
277
                        gdata = pkgStats.groupinfo[group];
278
                        gdata.total = 0;
279
                        gdata.withTests = 0;
280
                        gdata.testCount = 0;
281
                    }
282
 
283
                    pkgStats.table.row.add( dataSet[ii]);
284
                    pkgStats.info.total ++;
285
                    gdata.total++;
286
                    var count = parseInt($(dataSet[ii][2]).text());
287
                    if ( !isNaN(count) && count > 0 ) {
288
                        pkgStats.info.withTests++;
289
                        gdata.withTests++;
290
                        pkgStats.info.testCount += count;
291
                        gdata.testCount += count;
292
                    }
6579 dpurdie 293
                }
294
                pkgStats.table.draw();
295
 
296
                $('#pkgCount').text(pkgStats.info.total);
297
                $('#pkgTestCount').text(pkgStats.info.withTests);
298
                $('#testCount').text(pkgStats.info.testCount);
299
            }
300
 
6577 dpurdie 301
            // Enable / disable full table display
302
            $('#noScroll').click(function(e){
303
                if ( pkgStats.Height === undefined ) {
304
                    pkgStats.ScrollBody = $('#packageStats').closest('.dataTables_scrollBody'); 
305
                    pkgStats.Height = pkgStats.ScrollBody.height();
6580 dpurdie 306
                    pkgStats.CurHeight = pkgStats.Height; 
6577 dpurdie 307
                }
308
 
309
                if ( this.checked  ){
310
                    pkgStats.CurHeight = "100%";
311
                } else {
312
                    pkgStats.CurHeight = pkgStats.Height;
313
                }
6579 dpurdie 314
                // work on Datatables 1.10.12 ++, but not on 1.10.8, although lots else works better
6577 dpurdie 315
                pkgStats.ScrollBody.css('max-height', pkgStats.CurHeight);
6579 dpurdie 316
                pkgStats.ScrollBody.css('height', pkgStats.CurHeight);
6577 dpurdie 317
            });
318
 
6579 dpurdie 319
            // Hide / Show the the COTS packages
6580 dpurdie 320
            // Hide / Show the the Deployed packages
321
            $('#noCots,#noDeploy').click(function(e){
322
                insertAllData();
6579 dpurdie 323
            });
324
 
6580 dpurdie 325
            //  Use / Don't use base View groups
326
 
327
            $('#noGroups').click(function(e){
328
                pkgStats.noGroup = this.checked;
329
                if ( !pkgStats.noGroup ) {
330
                    pkgStats.table.order([[7,'asc']]);
331
                } else {
332
                    pkgStats.table.order([[0,'asc']]);
333
                }
334
                pkgStats.table.draw();
335
            });
336
 
337
            // Copy data to the users clipboard
6577 dpurdie 338
            function copyToClipboard(string) {
339
                var $temp = $("<input>");
340
                $("body").append($temp);
341
                $temp.val(string).select();
342
                document.execCommand("copy");
343
                $temp.remove();
344
            }
345
 
346
            // Export Data
347
            $('#btnExport').click(function(e){
348
                var csv = [];
349
 
350
                //  Insert DateStamp as YYMMDD
351
                var date = new Date();
352
                var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
353
                csv.push(tstamp);
354
 
355
                //  Insert Release ID
356
                csv.push(<%=DB_RTAG_ID%>);
357
                csv.push("<%=DB_PROJ_NAME%>::<%=DB_RTAG_NAME%>");
358
 
6579 dpurdie 359
                // Generate a CSV representation of the data in the table
360
                pkgStats.table.rows().eq(0).each( function (index) { 
361
                    var row = pkgStats.table.row(index); 
362
                    var data = row.data(); 
6577 dpurdie 363
                    csv.push($(data[0]).text(), $(data[2]).text());
364
                    });
6579 dpurdie 365
 
366
                // Generate a CSV representation of the data inthe table
367
                // pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
368
                //    var data = this.data();
369
                //    csv.push($(data[0]).text(), $(data[2]).text());
370
                //    });
6577 dpurdie 371
                var csvString = csv.join(",");
372
                //console.log(csvString);
373
                copyToClipboard(csvString);
374
                vixConfirm("Data copied to Clipboard", {
375
                    title: "Notification",
376
                    icon : "images/i_info.png", 
377
                    cancel: false, 
378
                    button: null,
379
                    timeout : 100,
380
                    position : 'center', 
381
                    modal : false,
382
                    minHeight: 10, 
383
                    hide: {
384
                            effect: 'fade',
385
                            duration: 2000
386
                          }
387
                });
388
            });
389
        });
390
      </script>
391
 
6576 dpurdie 392
   </head>
393
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
394
      <!-- HEADER -->
395
      <!--#include file="_header.asp"-->
396
      <!-- BODY ---->
397
      <table class="full_table">
398
         <tr>
399
            <td width="146px" class="panel_bg" valign="top">
400
                <%Call LeftPanelContent%>
401
            </td>
6577 dpurdie 402
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6576 dpurdie 403
                <%Call MainPanelContent%>
404
            </td>
405
         </tr>
406
         <tr>
407
            <td class="panel_bg" valign="bottom" align="center" height="350">
408
                <img src="images/release_stats.png" vspace="20" hspace="30"></td>
409
         </tr>
410
      </table>
411
      <!-- FOOTER -->
412
      <!--#include file="_footer.asp"-->
413
   </body>
414
</html>
415