Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|          Edit/View Build Configuration            |
'|                                                   |
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_form_window_common.asp"-->
<!--#include file="_action_buttons.asp"-->
<!--#include file="class/classActionButtonControl.asp"-->
<% '------------ ACCESS CONTROL ------------------ %>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_action_project.asp"-->
<%
'------------ Variable Definition -------------
Dim parRtagId
Dim pkgCount : pkgCount= 0
Dim pkgTestCount : pkgTestCount= 0
Dim testCount: testCount = 0
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parRtagId = Request("rtag_id")
objPMod.PersistInQryString("rtag_id")
'----------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
'
'   Generate table data as JSON
'   Could generate via AJAX call too, but for the amount of data in the table
'
Sub GenerateData
    Dim rsQry

    OraDatabase.Parameters.Add "RTAG_ID", parRtagId, ORAPARM_INPUT, ORATYPE_NUMBER
    Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("release_stats.sql"), 0 )
        OraDatabase.Parameters.Remove "RTAG_ID"

    Response.Write "<script type=""text/javascript"" charset=""utf-8"">" + vbCRLF
    Response.Write "var dataSet = [" + vbCRLF

    Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
        pkgCount = pkgCount + 1
        Dim tcount : tcount = NiceInt(rsQry("test_count"), 0)
        If tcount > 0 Then
            pkgTestCount = pkgTestCount + 1
            testCount = testCount + tcount 
        End If

        Dim vrefStr, prefStr, crefStr
        Dim buildId, buildTime, lastBuild, codeLines, isDeployable, viewName

        buildId = rsQry("build_id")
        crefStr = "unit_test_log.asp?pv_id=" & rsQry("pv_id") & "&rtag_id=" & parRtagId 
        prefStr = "view_by_version.asp?pkg_id=" & rsQry("pkg_id")  & "&listby=1"
        vrefStr = "dependencies.asp?pv_id=" & rsQry("pv_id") & "&rtag_id=" & parRtagId
        buildTime = rsQry("build_time")
        If isNull(buildTime) Then buildTime = ""
        lastBuild = rsQry("lastBuild")
        If isNull(lastBuild) Then lastBuild = ""
        codeLines = rsQry("code_lines")
        If isNull(codeLines) Then codeLines = ""
        isDeployable = rsQry("is_deployable")
        If isNull(isDeployable) Then isDeployable = "N"
        viewName = rsQry("view_name")
        If IsNull(buildId) Then tcount = ""

        Response.Write "["
        Response.Write """<a href=" + prefStr + ">" + rsQry("pkg_name") + "</a>"""
        Response.Write ",""<a href=" + vrefStr + ">" + rsQry("pkg_version") + "</a>"""
        Response.Write ",""<a href=" + crefStr + ">" & tcount & "</a>"""
        Response.Write ",""" + codeLines + """"
        Response.Write ",""" + buildTime + """"
        Response.Write ",""" + lastBuild + """"
        Response.Write ",""" + isDeployable + """"
        Response.Write ",""" + viewName + """"
        Response.Write "],"  + vbCRLF
    rsQry.MoveNext
    Loop
    Response.Write "]"  + vbCRLF
    Response.Write "</script>"  + vbCRLF
    rsQry.close
    Set rsQry = nothing
End Sub

'----------------------------------------------------
Sub LeftPanelContent
%>
<fieldset class="body_rowg fset">
    <legend>Display</legend>
    <input id="noScroll" type="checkbox" name="noScroll" value="1"> No Scroll
    <br><input id="noGroups" type="checkbox" name="noGroups" value="1"> No Groups
    <br><input id="noCots" type="checkbox" name="noCots" value="1"> Ignore Cots
    <br><input id="noDeploy" type="checkbox" name="noDeploy" value="1"> Ignore Deployable
</fieldset>
<fieldset class="body_rowg fset">
    <legend>Export</legend>
    <input id="btnExport"  name="btn" type="submit" class="form_btn" value="Test Counts as CSV"><%=Quick_Help("h_export")%>
</fieldset>
<%
End Sub

Sub MainPanelContent
%>
   <table class="embedded_table" style="margin-bottom:20px">
      <tr>
         <td>
            <!-- Box Title -->
            <div class="form_ttl nowrap" align="left">
                 Package Unit Tests
            </div>
         </td>
      </tr>
      <tr>
         <td>
            <!-- Box Content -->
            <div class="rounded_box">
               <div style="background-color: white;border-left: white solid 10px;border-right: white solid 10px;">
                    <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                    <!--#include file="messages/_msg_inline.asp"-->
                    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                    <table id="packageStats" width="100%" class="embedded_table">
                        <thead class="envGroup">
                           <tr class="body_col envGroup">
                              <td valign="top" nowrap>Package</td>
                              <td valign="top" nowrap>Version</td>
                              <td valign="top" nowrap>Test<br>Count</td>
                              <td valign="top" nowrap>Code<br>Lines</td>
                              <td valign="top" nowrap>Build<br>Duration</td>
                              <td valign="top" nowrap>Build Date</td>
                              <td valign="top" nowrap>Deployable</td>
                              <td valign="top" nowrap>View Name</td>
                           </tr>
                        </thead>
                  </table>
                  <table width="100%" class="embedded_table">
                  <tr class="body_col envGroup"><th colspan=5>Summary</th></tr>
                  <tr class="body_rowg"><td colspan=4>Total Packages</td><td id="pkgCount"></td></tr>
                  <tr class="body_rowg"><td colspan=4>Total Packages with Tests</td><td id="pkgTestCount"></td></tr>
                  <tr class="body_rowg"><td colspan=4>Total Unit Tests</td><td id="testCount"></td></tr>
                  </table>
               </div>
            </div>
         </td>
      </tr>
   </table>
<%
End Sub
%>
<NOSCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="common/VarDump.vbs"></NOSCRIPT> 
<html>
   <head>
      <title>Release Manager</title>
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
      <meta http-equiv="Pragma" content="no-cache">
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
      <!-- DROPDOWN MENUS -->
      <%bJqueryDataTables = TRUE%>
      <!--#include file="_jquery_includes.asp"-->
      <!--#include file="_menu_def.asp"-->
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
      <script language="JavaScript" type="text/JavaScript">
      formTips.tips.h_export       = stdTip(300, 'Export Test Count', 'Unit test counts will be copied to the users clipboard is CSV format.' +
                                                                  '<p>The data is to be integrated into other reports.' 
                                                                  );
      </script>
      <%Call GenerateData%>
      <style type="text/css">
          table.dataTable tbody tr.baseGroup{background:#dad7c8;}
          table.dataTable tbody tr.baseGroup td{border-bottom:1pt solid black;;border-top:1pt solid black;}
          table.dataTable tbody tr td.header{color:black;font-weight:bold;}
          table.dataTable tbody tr td.info{color:gray;font-weight:normal;}
      </style>
      <script type="text/javascript" charset="utf-8">
        var pkgStats = {};
        $(document).ready(function() {

            // Create a basic DataTable
            // The populate it
            pkgStats.table = $('#packageStats').DataTable( {
                    dom:            "lfrti",
                    scrollY:        "65vh",
                    scrollCollapse: true,
                    paging:         false,
                    language : { info: "Showing _TOTAL_ entries" },
                    columnDefs: [
                        { "visible": false, "targets": [6] },
                        { "orderData" : [7,0], targets : 0 },
                        { "orderData" : [7,1], targets : 1 },
                        { "orderData" : [7,2], targets : 2 },
                        { "orderData" : [7,3], targets : 3 },
                        { "orderData" : [7,4], targets : 4 },
                        { "orderData" : [7,5], targets : 5 },
                        { "orderData" : [7,0], targets : 7 },
                    ],
                    order: [[7,'asc']],
                    drawCallback: function ( settings ) {
                        var api = this.api();

                        var orderCol = api.order()[0][0];
                        if ( orderCol != 7 ) {
                            $('#noGroups').prop('checked', true);
                            //return;
                        }
                        $('#noGroups').prop('checked', false)
                        var rows = api.rows( { page: 'current' }).nodes();
                        var last=null;
                        api.column(7, {page:'current'} ).data().each( function ( group, i ) {
                            if ( last !== group ) {
                                last = group;
                                var gdata = pkgStats.groupinfo[group];
                                var gtext = new Array();
                                gtext.push('Packages: ' + gdata.total + '.');
                                gtext.push('With Tests: ' + gdata.withTests + '.');
                                gtext.push('Unit Tests: ' + gdata.testCount + '.');
                                $(rows).eq( i ).before(
                                    '<tr class="baseGroup"><td class="header" colspan="2">'+group+ '</td><td class="info" colspan="4">'+gtext.join(' ') + '</td></tr>'
                                );
                            }
                        });
                    }
                });
            pkgStats.init = pkgStats.table.init();
            pkgStats.noGroup = false;
            insertAllData();

            //
            //  Filter data and insert into the table
            function insertAllData() {
                var noDeploy = $('#noDeploy').get(0).checked; 
                var noCots   = $('#noCots').get(0).checked; 

                var ii;
                pkgStats.table.clear();
                pkgStats.info = {};
                pkgStats.groupinfo = {};
                pkgStats.info.total = 0;
                pkgStats.info.withTests = 0;
                pkgStats.info.testCount = 0;

                for (ii = 0; ii < dataSet.length; ii++) {
                    if ( noCots ) {
                        var vdata = $(dataSet[ii][1]).text();
                        if ( vdata.match(/.cots$/) || vdata.match(/.tool$/) ) {
                            continue;
                        }
                    }

                    if ( noDeploy ) {
                        var dData = dataSet[ii][6];
                        if ( dData == 'Y' ) {
                            continue;
                        }
                    }

                    var group = dataSet[ii][7];
                    var gdata = pkgStats.groupinfo[group];
                    if ( gdata == null ) {
                        pkgStats.groupinfo[group] = {};
                        gdata = pkgStats.groupinfo[group];
                        gdata.total = 0;
                        gdata.withTests = 0;
                        gdata.testCount = 0;
                    }
                    
                    pkgStats.table.row.add( dataSet[ii]);
                    pkgStats.info.total ++;
                    gdata.total++;
                    var count = parseInt($(dataSet[ii][2]).text());
                    if ( !isNaN(count) && count > 0 ) {
                        pkgStats.info.withTests++;
                        gdata.withTests++;
                        pkgStats.info.testCount += count;
                        gdata.testCount += count;
                    }
                }
                pkgStats.table.draw();

                $('#pkgCount').text(pkgStats.info.total);
                $('#pkgTestCount').text(pkgStats.info.withTests);
                $('#testCount').text(pkgStats.info.testCount);
            }

            // Enable / disable full table display
            $('#noScroll').click(function(e){
                if ( pkgStats.Height === undefined ) {
                    pkgStats.ScrollBody = $('#packageStats').closest('.dataTables_scrollBody'); 
                    pkgStats.Height = pkgStats.ScrollBody.height();
                    pkgStats.CurHeight = pkgStats.Height; 
                }

                if ( this.checked  ){
                    pkgStats.CurHeight = "100%";
                } else {
                    pkgStats.CurHeight = pkgStats.Height;
                }
                // work on Datatables 1.10.12 ++, but not on 1.10.8, although lots else works better
                pkgStats.ScrollBody.css('max-height', pkgStats.CurHeight);
                pkgStats.ScrollBody.css('height', pkgStats.CurHeight);
            });

            // Hide / Show the the COTS packages
            // Hide / Show the the Deployed packages
            $('#noCots,#noDeploy').click(function(e){
                insertAllData();
            });

            //  Use / Don't use base View groups

            $('#noGroups').click(function(e){
                pkgStats.noGroup = this.checked;
                if ( !pkgStats.noGroup ) {
                    pkgStats.table.order([[7,'asc']]);
                } else {
                    pkgStats.table.order([[0,'asc']]);
                }
                pkgStats.table.draw();
            });

            // Copy data to the users clipboard
            function copyToClipboard(string) {
                var $temp = $("<input>");
                $("body").append($temp);
                $temp.val(string).select();
                document.execCommand("copy");
                $temp.remove();
            }

            // Export Data
            $('#btnExport').click(function(e){
                var csv = [];

                //  Insert DateStamp as YYMMDD
                var date = new Date();
                var tstamp = (date.getFullYear() * 10000) + ((date.getMonth() + 1) * 100) + date.getDate()
                csv.push(tstamp);

                //  Insert Release ID
                csv.push(<%=DB_RTAG_ID%>);
                csv.push("<%=DB_PROJ_NAME%>::<%=DB_RTAG_NAME%>");

                // Generate a CSV representation of the data in the table
                pkgStats.table.rows().eq(0).each( function (index) { 
                    var row = pkgStats.table.row(index); 
                    var data = row.data(); 
                    csv.push($(data[0]).text(), $(data[2]).text());
                    });

                // Generate a CSV representation of the data inthe table
                // pkgStats.table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
                //    var data = this.data();
                //    csv.push($(data[0]).text(), $(data[2]).text());
                //    });
                var csvString = csv.join(",");
                //console.log(csvString);
                copyToClipboard(csvString);
                vixConfirm("Data copied to Clipboard", {
                    title: "Notification",
                    icon : "images/i_info.png", 
                    cancel: false, 
                    button: null,
                    timeout : 100,
                    position : 'center', 
                    modal : false,
                    minHeight: 10, 
                    hide: {
                            effect: 'fade',
                            duration: 2000
                          }
                });
            });
        });
      </script>

   </head>
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
      <!-- HEADER -->
      <!--#include file="_header.asp"-->
      <!-- BODY ---->
      <table class="full_table">
         <tr>
            <td width="146px" class="panel_bg" valign="top">
                <%Call LeftPanelContent%>
            </td>
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
                <%Call MainPanelContent%>
            </td>
         </tr>
         <tr>
            <td class="panel_bg" valign="bottom" align="center" height="350">
                <img src="images/release_stats.png" vspace="20" hspace="30"></td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>