Subversion Repositories DevTools

Rev

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

<% @LANGUAGE = VBScript %>
<%
'=====================================================
'
'  Build Status and Plan Information
'
'=====================================================
%>
<%
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"-->
<!--#include file="common/daemon_instructions.asp"-->
<!--#include file="common/common_daemon.asp"-->
<% '------------ ACCESS CONTROL ------------------ %>
<!--#include file="_access_control_login_optional.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_action_project.asp"-->
<% '------------ Scripts -------------------------- %>
<%
'------------ Variable Definition -------------
Dim rsQry
Dim parRtagId
Dim query_string
Dim rcon_id
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parRtagId = Request("rtag_id")
objPMod.PersistInQryString("rtag_id")
'-------------------------------------------------
' 
Sub ShowDaemonStatus
%>
<table class="embedded_table" style="margin-bottom:20px">
  <tr>
     <td>
        <table width="95%" align="center" class="embedded_table">
           <tr>
              <td nowrap class="form_ttl"><p>DAEMON STATUS INFORMATION</p>
              </td>
              <td  valign="bottom" class="body_rowg">
                Last Build: <%=GetLastBuildAge(parRtagId)%> [<%=GetModifiedSeqNo(parRtagId)%>]
              </td>
              <td align="right" valign="bottom">
                <a class="txt_linked" href="<%=scriptName%>?rtag_id=<%=parRtagId%>" title="Refresh Page">[Refresh]</a>
              </td>
           </tr>
        </table>
     </td>
  </tr>
  <tr>
   <td>
   <table class="rounded_box embedded_table">
  <tr>
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
     <td bgcolor="#FFFFFF" valign="top">
        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--#include file="messages/_msg_inline.asp"-->
        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <br>
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
           <%
           Dim bInactiveMachine : bInactiveMachine = false
           Dim indefinitelyPaused : indefinitelyPaused = Indefinitely_Paused()
           ' Insert a warning into the page if the build daemons are indefintely paused.
           If indefinitelyPaused Then %>
              <tr>
                 <span class='err_alert'>
                    <font size='2'><b>WARNING: Build Daemons are all stopped - please contact an administrator</b></font>
                 </span>
              </tr>
           <%End If
           %>
           <td width="9%" valign="top"></td>
           <tr>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Daemon Host</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Machine Type</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Mode</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Run Level</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Current Package</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Est Duration<%=Quick_Help("h_buildtime")%></td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<%=Quick_Help("h_lastchange")%></td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Control State</td>
           </tr>
           <%
           ' Get the number of release configurations for this RTAG_ID, and iterate through them
           query_string = " select rc.rcon_id, display_name, gbe_value, daemon_mode, NVL(ACTIVE, 'U') as ACTIVE" &_
                          " from release_config rc, gbe_machtype gm, build_machine_config bm"&_
                          "  where rc.rtag_id = "& parRtagId &_
                          "    and gm.gbe_id = rc.gbe_id"&_
                          "    and rc.bmcon_id=bm.bmcon_id(+)" &_
                          "  order by bm.display_name, rc.rcon_id"

           Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

           Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
              rcon_id = rsQry("rcon_id")

              Dim pkgName
              Dim pkgPvid
              Dim pkgBuildTime
              Dim currentRunLevel
              Dim daemonState
              Dim delta
              Dim pkgId
              Dim bActive : bActive = rsQry("active")
              If bActive = "N" Then bInactiveMachine = true

              ' For this release configuration, get its entry from the run_level table. This table may not
              ' have an entry so we must handle that outcome too.
              query_string = " select rl.pause, rl.current_run_level, rl.current_pkg_id_being_built, "&_
                             "        TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta" &_
                             "   from run_level rl"&_
                             "  where rl.rcon_id = "& rcon_id

              Dim rsQry2
              Set rsQry2 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

              currentRunLevel = -1
              pkgId = Null
              pkgName = NULL
              pkgPvid = NULL
              pkgBuildTime = NULL
              daemonState = 0
              delta = NULL

              If (rsQry2.RecordCount > 0) Then
                ' Get the run level from the run_level table
                currentRunLevel = rsQry2("current_run_level")
                pkgId = rsQry2("current_pkg_id_being_built")

                daemonState = rsQry2("pause")
                If IsNull(daemonState) Then daemonState = 0
                If daemonState = "2" Then pkgId = Null

                delta = rsQry2("delta")

              End If

              ' If we got an entry from the run_level table, try and use the pkg_id it contains, to obtain a
              ' package name from the packages table
              Dim rsQry3
              If NOT IsNull(pkgId) Then
                 query_string = " select pkg_name,rl.current_pv_id, pv.build_time from run_level rl, packages pk, package_versions pv"&_
                                "  where rl.rcon_id = "& rcon_id &_
                                "   and  rl.current_pkg_id_being_built = pk.pkg_id" &_
                                "   and  rl.current_pv_id = pv.pv_id"

                 Set rsQry3 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
                 If (rsQry3.RecordCount > 0) Then
                    pkgName = rsQry3("pkg_name")
                    pkgPvid = rsQry3("current_pv_id")
                    pkgBuildTime = rsQry3("build_time")
                 End If
                 rsQry3.Close()
                 Set rsQry3 = nothing
              End If

              ' --- Now render HTML for this release configuration ---
              %>
              <tr>
                 <td colspan="8" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
              </tr>
              <tr>
                 <td nowrap class="body_rowg"><%=rsQry("display_name")%></td>
                 <td nowrap class="body_rowg"><%=rsQry("gbe_value")%></td>
                 <td nowrap class="body_rowg"><%=Get_Daemon_Mode(rsQry("daemon_mode"))%></td>
                 <td nowrap class="body_rowg"><%=Get_Run_Level(currentRunLevel, indefinitelyPaused, daemonState, bActive)%></td>
                 <td nowrap class="body_rowg"><%=Get_Package_Name(pkgName,parRtagId,pkgPvid, bActive)%></td>
                 <td nowrap class="body_rowg"><%=IIF(rsQry("daemon_mode") = "M", pkgBuildTime, "")%></td>
                 <td nowrap class="body_rowg"><%=PrettyDelta(delta, daemonState,pkgName )%></td>
                 <td nowrap class="body_rowg">
                    <%
                    If (rsQry2.RecordCount > 0) AND NOT indefinitelyPaused  Then
                       If canActionControlInProject("BuildControl") Then
                          If bActive = "U" Then
                          ElseIf bActive = "N" Then
                             Call Action_Buttons ( "Daemon Unavailable" )
                          ElseIf daemonState = 0 Then
                             Call Action_Buttons ( "Daemon Pause" )
                          ElseIf daemonState = 1 Then
                             Call Action_Buttons ( "Daemon Resume" )
                          ElseIf daemonState = 2 Then
                             Call Action_Buttons ( "Daemon Start" )
                          Else
                             Call Action_Buttons ( "Daemon Resume" )
                          End If
                       Else
                          If bActive = "U" Then
                          ElseIf bActive = "N" Then
                             Call Action_Buttons ( "Daemon Unavailable" )
                          ElseIf daemonState = 0 Then
                             Call Action_Buttons ( "Daemon Pause Disabled" )
                          ElseIf daemonState = 1 Then
                             Call Action_Buttons ( "Daemon Resume Disabled" )
                          ElseIf daemonState = 2 Then
                             Call Action_Buttons ( "Daemon Start Disabled" )
                          Else
                             Call Action_Buttons ( "Daemon Resume Disabled" )
                          End If
                       End If
                    Else
                       %>Unavailable<%
                    End If
                    %>
                 </td>
              </tr>
              <%
              rsQry2.Close()
              Set rsQry2 = nothing
              rsQry.MoveNext
           Loop
           %>
           <tr>
             <td nowrap background="images/bg_table_col.gif" class="body_col" colspan=7>
             <%If CheckConfigErrors(parRtagId) OR bInactiveMachine Then%><span class="err_alert">&nbsp;Daemon configuration errors detected</span>
                <a class="txt_linked" href="release_config.asp?rtag_id=<%=parRtagId%>">
                    <img src="images/i_link.gif" hspace="2" border="0" align="absmiddle" title="Goto Configuration">
                </a>
             <%End If%>
             </td>
             <td valign="bottom" nowrap background="images/bg_table_col.gif" class="body_col">
             <%
               If (rsQry.RecordCount > 0) AND NOT indefinitelyPaused Then
                 If objAccessControl.UserLogedIn AND canActionControlInProject("BuildControl") Then
                   Call Action_Buttons ( "Daemon Control All" )
                 Else 
                   Call Action_Buttons ( "Daemon Control All Disabled" )
                 End If
               Else
                 %>&nbsp<%
               End If
             %>
             </td>
           </tr>
           <%
             rsQry.Close()
             Set rsQry = nothing
           %>
        </table>
     </td>
     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
  </tr>
  <tr>
     <input type="hidden" name="action" value="true">
     <%=objPMod.ComposeHiddenTags()%>
  </tr>
</table>
</td>
</table>
<%
End Sub
'-------------------------------------------------
' 
Sub ShowBuildPlan
%>
<!-- Planned Builds Display -->
<table class="embedded_table" style="margin-bottom:20px;min-width:470px">
<%
Set rsQry = OraDatabase.DbCreateDynaset( "SELECT TRUNC (86400*(SYSDATE - rl.LAST_BUILD)) as delta, rl.LAST_BUILD as BuildStart, rl.current_pv_id, SYSDATE" &_
                                        " FROM release_config rc,  run_level rl " &_
                                        " WHERE rc.rtag_id   = " & parRtagId &_
                                        " AND rc.daemon_mode = 'M' AND rl.rcon_id = rc.rcon_id", ORADYN_DEFAULT )
Dim BuildStart
Dim BuildDelta
Dim BuildPvId
Dim BuildNow
If (rsQry.RecordCount > 0) Then
    BuildStart = rsQry("BuildStart")
    BuildDelta = rsQry("delta")
    BuildPvId  = rsQry("current_pv_id")
    BuildNow  = rsQry("SYSDATE")
End If
rsQry.Close()
Set rsQry = nothing
%>
  <tr>
     <td>
        <table width="95%" class="embedded_table" align="center">
           <tr>
              <td nowrap class="form_ttl">DAEMON BUILD PLAN<%=Quick_Help("h_buildplan")%>
              </td>
              <td  valign="bottom" align="right" class="body_txt_gray nowrap">
                Now: <%=DisplayShortDateTimeSecs(BuildNow)%> AWST
              </td>
           </tr>
        </table>
     </td>
  </tr>
  <tr>
    <td>
        <table  class="rounded_box embedded_table" width="100%">
             <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" ></td>
             <td bgcolor="#FFFFFF" valign="top">
                <table width="100%" border="0" cellspacing="2" cellpadding="0">

                   <tr>
                      <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Package</td>
                      <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Version</td>
                      <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Duration<%=Quick_Help("h_buildDuration")%></td>
                      <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Build Completion<%=Quick_Help("h_buildEnd")%></td>
                   </tr>
                   <%
                   Dim PkgVersion, buildDuration, durationDisplay, durationText, completionText
                   Set rsQry = OraDatabase.DbCreateDynaset( "SELECT p.PKG_NAME," &_
                                                            "  pv.PKG_VERSION, pv.BUILD_TIME," &_
                                                            "  bp.PV_ID" &_
                                                            " FROM build_plan bp," &_
                                                            "  packages p," &_
                                                            "  package_versions pv" &_
                                                            " WHERE bp.PV_ID = pv.pv_id" &_
                                                            " AND RTAG_ID = " & parRtagId &_
                                                            " AND pv.PKG_ID  = p.pkg_id" &_
                                                            " ORDER BY build_order" , ORADYN_DEFAULT )
                   If rsQry.RecordCount = 0 Then
                       %>
                       <tr>
                        <td nowrap colspan="4" align="center" class="body_txt">No packages to be built </td>
                       </tr>
                       <%
                   End If
                   While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
                       completionText = ""
                       buildDuration = rsQry("BUILD_TIME")
                       durationDisplay = buildDuration

                       ' If the current package build it taking longer than expected , then bump the build times
                       ' and allow another 30 seconds.
                       If BuildPvId = rsQry("PV_ID") Then
                           completionText = "&nbsp;<"
                           durationDisplay = durationDisplay & " ["& BuildDelta &"]"
                           If BuildDelta > buildDuration Then
                                buildDuration = BuildDelta + 30
                                completionText = "&nbsp;+"
                           End If
                       End If

                       ' If the duration is not known - guess at 300 sconds
                       durationText = ""
                       If ISNULL(buildDuration)  OR buildDuration = 0 Then
                            buildDuration = 300
                            durationText = "&nbsp;~"
                      End If

                      BuildStart = DateAdd("s", buildDuration, BuildStart)
                      %>
                      <tr align="left" valign="top" class="body_txt">
                         <td><%=Get_Package_Name(rsQry("PKG_NAME"), parRtagId, rsQry("PV_ID"), "Y")%></td>
                         <td><%=rsQry("PKG_VERSION")%></td>
                         <td><%=durationDisplay%></td>
                         <td><%=DisplayShortDateTimeSecs(BuildStart) & durationText  & completionText%></td>
                      </tr>
                      <tr>
                         <td colspan="6" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                      </tr>
                      <%
                      ' Allow for 20 seconds of planning between builds
                      BuildStart = DateAdd("s", 20, BuildStart)
                      rsQry.MoveNext()
                   Wend
                   rsQry.Close()
                   Set rsQry = nothing
                   %>
                </table>
            </td>
            <td background="images/lbox_bgside_white.gif">&nbsp;</td>
        </table>
    </td>
  </tr>
</table>
<%
End Sub
'-------------------------------------------------
'
%>
<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" type="text/css">
      <link rel="stylesheet" href="images/navigation.css" type="text/css">
      <script language="JavaScript" src="images/common.js"></script>
      <!--#include file="_jquery_includes.asp"-->
      <!-- TIPS -->
      <script type="text/javascript" src="scripts/json2.js"></script>
      <script language="JavaScript" src="images/tipster.js"></script>
      <script language="JavaScript" src="images/_help_tips.js"></script>
      <script language="JavaScript" type="text/JavaScript">
      formTips.tips.h_buildplan       = stdTip(300, 'Build Plan', 'The build plan is a guess as to the order in which packages will be built.' +
                                                                  '<p>It will be recalculated before each build.' + 
                                                                  '<p>The plan includes test builds, new builds and resultant ripples.' 
                                                                  );
      formTips.tips.h_buildDuration    = stdTip(300, 'Planned Duration', 'The build duration (seconds) of the last build of this package - if known.' +
                                                                  '<p>This is used as a guess as to the duration of the planned build.' 
                                                                  );
      formTips.tips.h_buildEnd         = stdTip(300, 'Planned Completion', 'An educated guess as to the build completion time of the package.' +
                                                                  '<p>It is based on the start time of the current build and the durations of each preceeding builds.' + 
                                                                  '<p>If the duration of a build is not known then a time of 300 seconds will be assumed.' +
                                                                  ' It also assumes 20 seconds to plan the next build.'
                                                                  );
      formTips.tips.h_lastchange       = stdTip(300, 'Last Change', 'This is an indication of the time since the daemon interogated the database.' +
                                                                  '<p>Short times will be shown as seconds. Longer times will be shown as a time within ' + 
                                                                  'the last 24 hours. Longer times will be shown as a date.' 
                                                                  );
      </script>
      <!-- DROPDOWN MENUS -->
      <!--#include file="_menu_def.asp"-->
      <script language="JavaScript1.2" src="images/popup_menu.js"></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 BuildMenuPane%>
            </td>
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
                <%Call ShowDaemonStatus%>
                <%Call ShowBuildPlan%>
            </td>
         </tr>
         <tr>
            <td class="panel_bg" valign="bottom" align="center" height="350">
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>