Subversion Repositories DevTools

Rev

Rev 6577 | Rev 6580 | 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 buildTime, lastBuild

        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 = ""

        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 + ">" + rsQry("test_count") + "</a>"""
        Response.Write ",""" + buildTime + """"
        Response.Write ",""" + lastBuild + """"
        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="noCots" type="checkbox" name="noCots" value="1"> Ignore Cots
</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&nbsp;Count</td>
                              <td valign="top" nowrap>Build&nbsp;Duration</td>
                              <td valign="top" nowrap>Build&nbsp;Date</td>
                           </tr>
                        </thead>
                  </table>
                  <table width="100%" class="embedded_table">
                  <tr class="body_col envGroup"><th colspan=4>Summary</th></tr>
                  <tr class="body_rowg"><td colspan=3>Total Packages</td><td id="pkgCount"></td></tr>
                  <tr class="body_rowg"><td colspan=3>Total Packages with Tests</td><td id="pkgTestCount"></td></tr>
                  <tr class="body_rowg"><td colspan=3>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%>
      <script type="text/javascript" charset="utf-8">
        var pkgStats = {};
        var pkgStatsScrollBody;
        var pkgStatsHeight = 0;
        var pkgStatsCurHeight = 0;

        $(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" }
                });
            insertAllData(false);

            //
            //  Filter data and insert into the table
            function insertAllData(filterCots) {
                var ii;
                pkgStats.table.clear();
                pkgStats.info = {};
                pkgStats.info.total = 0;
                pkgStats.info.withTests = 0;
                pkgStats.info.testCount = 0;

                for (ii = 0; ii < dataSet.length; ii++) {
                    var vdata = $(dataSet[ii][1]).text();
                    if( !( filterCots && ( vdata.match(/.cots$/) || vdata.match(/.tool$/))) ){
                        pkgStats.table.row.add( dataSet[ii]);
                        pkgStats.info.total ++;
                        var count = parseInt($(dataSet[ii][2]).text());
                        if ( !isNaN(count) && count > 0 ) {
                            pkgStats.info.withTests++;
                            pkgStats.info.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 = pkgStatsHeight; 
                }

                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
            $('#noCots').click(function(e){
                insertAllData(this.checked);
            });

            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>