Subversion Repositories DevTools

Rev

Rev 6577 | Rev 6580 | 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
63
        Dim buildTime, lastBuild
64
 
65
        crefStr = "unit_test_log.asp?pv_id=" & rsQry("pv_id") & "&rtag_id=" & parRtagId 
66
        prefStr = "view_by_version.asp?pkg_id=" & rsQry("pkg_id")  & "&listby=1"
67
        vrefStr = "dependencies.asp?pv_id=" & rsQry("pv_id") & "&rtag_id=" & parRtagId
68
        buildTime = rsQry("build_time")
69
        If isNull(buildTime) Then buildTime = ""
70
        lastBuild = rsQry("lastBuild")
71
        If isNull(lastBuild) Then lastBuild = ""
72
 
73
        Response.Write "["
74
        Response.Write """<a href=" + prefStr + ">" + rsQry("pkg_name") + "</a>"""
75
        Response.Write ",""<a href=" + vrefStr + ">" + rsQry("pkg_version") + "</a>"""
76
        Response.Write ",""<a href=" + crefStr + ">" + rsQry("test_count") + "</a>"""
77
        Response.Write ",""" + buildTime + """"
78
        Response.Write ",""" + lastBuild + """"
79
        Response.Write "],"  + vbCRLF
80
    rsQry.MoveNext
81
    Loop
82
    Response.Write "]"  + vbCRLF
83
    Response.Write "</script>"  + vbCRLF
84
    rsQry.close
85
    Set rsQry = nothing
86
End Sub
87
 
6576 dpurdie 88
'----------------------------------------------------
89
Sub LeftPanelContent
90
%>
6577 dpurdie 91
<fieldset class="body_rowg fset">
92
    <legend>Display</legend>
93
    <input id="noScroll" type="checkbox" name="noScroll" value="1"> No Scroll
6579 dpurdie 94
    <br><input id="noCots" type="checkbox" name="noCots" value="1"> Ignore Cots
6577 dpurdie 95
</fieldset>
96
<fieldset class="body_rowg fset">
97
    <legend>Export</legend>
98
    <input id="btnExport"  name="btn" type="submit" class="form_btn" value="Test Counts as CSV"><%=Quick_Help("h_export")%>
99
</fieldset>
6576 dpurdie 100
<%
101
End Sub
102
 
103
Sub MainPanelContent
104
%>
105
   <table class="embedded_table" style="margin-bottom:20px">
106
      <tr>
107
         <td>
108
            <!-- Box Title -->
109
            <div class="form_ttl nowrap" align="left">
110
                 Package Unit Tests
111
            </div>
112
         </td>
113
      </tr>
114
      <tr>
115
         <td>
116
            <!-- Box Content -->
117
            <div class="rounded_box">
118
               <div style="background-color: white;border-left: white solid 10px;border-right: white solid 10px;">
119
                    <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
120
                    <!--#include file="messages/_msg_inline.asp"-->
121
                    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
6577 dpurdie 122
                    <table id="packageStats" width="100%" class="embedded_table">
123
                        <thead class="envGroup">
124
                           <tr class="body_col envGroup">
125
                              <td valign="top" nowrap>Package</td>
126
                              <td valign="top" nowrap>Version</td>
127
                              <td valign="top" nowrap>Test&nbsp;Count</td>
128
                              <td valign="top" nowrap>Build&nbsp;Duration</td>
129
                              <td valign="top" nowrap>Build&nbsp;Date</td>
130
                           </tr>
131
                        </thead>
6576 dpurdie 132
                  </table>
6579 dpurdie 133
                  <table width="100%" class="embedded_table">
134
                  <tr class="body_col envGroup"><th colspan=4>Summary</th></tr>
135
                  <tr class="body_rowg"><td colspan=3>Total Packages</td><td id="pkgCount"></td></tr>
136
                  <tr class="body_rowg"><td colspan=3>Total Packages with Tests</td><td id="pkgTestCount"></td></tr>
137
                  <tr class="body_rowg"><td colspan=3>Total Unit Tests</td><td id="testCount"></td></tr>
138
                  </table>
6576 dpurdie 139
               </div>
140
            </div>
141
         </td>
142
      </tr>
143
   </table>
144
<%
145
End Sub
146
%>
147
<NOSCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="common/VarDump.vbs"></NOSCRIPT> 
148
<html>
149
   <head>
150
      <title>Release Manager</title>
151
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
152
      <meta http-equiv="Pragma" content="no-cache">
153
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 154
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
155
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
156
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
6576 dpurdie 157
      <!-- DROPDOWN MENUS -->
6577 dpurdie 158
      <%bJqueryDataTables = TRUE%>
6576 dpurdie 159
      <!--#include file="_jquery_includes.asp"-->
160
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 161
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
162
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
163
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
6577 dpurdie 164
      <script language="JavaScript" type="text/JavaScript">
165
      formTips.tips.h_export       = stdTip(300, 'Export Test Count', 'Unit test counts will be copied to the users clipboard is CSV format.' +
166
                                                                  '<p>The data is to be integrated into other reports.' 
167
                                                                  );
168
      </script>
6579 dpurdie 169
      <%Call GenerateData%>
6577 dpurdie 170
      <script type="text/javascript" charset="utf-8">
171
        var pkgStats = {};
172
        var pkgStatsScrollBody;
173
        var pkgStatsHeight = 0;
174
        var pkgStatsCurHeight = 0;
175
 
176
        $(document).ready(function() {
6579 dpurdie 177
 
6577 dpurdie 178
            // Create a basic DataTable
6579 dpurdie 179
            // The populate it
6577 dpurdie 180
            pkgStats.table = $('#packageStats').DataTable( {
6579 dpurdie 181
                    dom:            "lfrti",
6577 dpurdie 182
                    scrollY:        "65vh",
183
                    scrollCollapse: true,
184
                    paging:         false,
6579 dpurdie 185
                    language : { info: "Showing _TOTAL_ entries" }
6577 dpurdie 186
                });
6579 dpurdie 187
            insertAllData(false);
6577 dpurdie 188
 
6579 dpurdie 189
            //
190
            //  Filter data and insert into the table
191
            function insertAllData(filterCots) {
192
                var ii;
193
                pkgStats.table.clear();
194
                pkgStats.info = {};
195
                pkgStats.info.total = 0;
196
                pkgStats.info.withTests = 0;
197
                pkgStats.info.testCount = 0;
198
 
199
                for (ii = 0; ii < dataSet.length; ii++) {
200
                    var vdata = $(dataSet[ii][1]).text();
201
                    if( !( filterCots && ( vdata.match(/.cots$/) || vdata.match(/.tool$/))) ){
202
                        pkgStats.table.row.add( dataSet[ii]);
203
                        pkgStats.info.total ++;
204
                        var count = parseInt($(dataSet[ii][2]).text());
205
                        if ( !isNaN(count) && count > 0 ) {
206
                            pkgStats.info.withTests++;
207
                            pkgStats.info.testCount += count;
208
                        }
209
                    }
210
                }
211
                pkgStats.table.draw();
212
 
213
                $('#pkgCount').text(pkgStats.info.total);
214
                $('#pkgTestCount').text(pkgStats.info.withTests);
215
                $('#testCount').text(pkgStats.info.testCount);
216
            }
217
 
6577 dpurdie 218
            // Enable / disable full table display
219
            $('#noScroll').click(function(e){
220
                if ( pkgStats.Height === undefined ) {
221
                    pkgStats.ScrollBody = $('#packageStats').closest('.dataTables_scrollBody'); 
222
                    pkgStats.Height = pkgStats.ScrollBody.height();
223
                    pkgStats.CurHeight = pkgStatsHeight; 
224
                }
225
 
226
                if ( this.checked  ){
227
                    pkgStats.CurHeight = "100%";
228
                } else {
229
                    pkgStats.CurHeight = pkgStats.Height;
230
                }
6579 dpurdie 231
                // work on Datatables 1.10.12 ++, but not on 1.10.8, although lots else works better
6577 dpurdie 232
                pkgStats.ScrollBody.css('max-height', pkgStats.CurHeight);
6579 dpurdie 233
                pkgStats.ScrollBody.css('height', pkgStats.CurHeight);
6577 dpurdie 234
            });
235
 
6579 dpurdie 236
            // Hide / Show the the COTS packages
237
            $('#noCots').click(function(e){
238
                insertAllData(this.checked);
239
            });
240
 
6577 dpurdie 241
            function copyToClipboard(string) {
242
                var $temp = $("<input>");
243
                $("body").append($temp);
244
                $temp.val(string).select();
245
                document.execCommand("copy");
246
                $temp.remove();
247
            }
248
 
249
            // Export Data
250
            $('#btnExport').click(function(e){
251
                var csv = [];
252
 
253
                //  Insert DateStamp as YYMMDD
254
                var date = new Date();
255
                var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
256
                csv.push(tstamp);
257
 
258
                //  Insert Release ID
259
                csv.push(<%=DB_RTAG_ID%>);
260
                csv.push("<%=DB_PROJ_NAME%>::<%=DB_RTAG_NAME%>");
261
 
6579 dpurdie 262
                // Generate a CSV representation of the data in the table
263
                pkgStats.table.rows().eq(0).each( function (index) { 
264
                    var row = pkgStats.table.row(index); 
265
                    var data = row.data(); 
6577 dpurdie 266
                    csv.push($(data[0]).text(), $(data[2]).text());
267
                    });
6579 dpurdie 268
 
269
                // Generate a CSV representation of the data inthe table
270
                // pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
271
                //    var data = this.data();
272
                //    csv.push($(data[0]).text(), $(data[2]).text());
273
                //    });
6577 dpurdie 274
                var csvString = csv.join(",");
275
                //console.log(csvString);
276
                copyToClipboard(csvString);
277
                vixConfirm("Data copied to Clipboard", {
278
                    title: "Notification",
279
                    icon : "images/i_info.png", 
280
                    cancel: false, 
281
                    button: null,
282
                    timeout : 100,
283
                    position : 'center', 
284
                    modal : false,
285
                    minHeight: 10, 
286
                    hide: {
287
                            effect: 'fade',
288
                            duration: 2000
289
                          }
290
                });
291
            });
292
        });
293
      </script>
294
 
6576 dpurdie 295
   </head>
296
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
297
      <!-- HEADER -->
298
      <!--#include file="_header.asp"-->
299
      <!-- BODY ---->
300
      <table class="full_table">
301
         <tr>
302
            <td width="146px" class="panel_bg" valign="top">
303
                <%Call LeftPanelContent%>
304
            </td>
6577 dpurdie 305
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6576 dpurdie 306
                <%Call MainPanelContent%>
307
            </td>
308
         </tr>
309
         <tr>
310
            <td class="panel_bg" valign="bottom" align="center" height="350">
311
                <img src="images/release_stats.png" vspace="20" hspace="30"></td>
312
         </tr>
313
      </table>
314
      <!-- FOOTER -->
315
      <!--#include file="_footer.asp"-->
316
   </body>
317
</html>
318