Subversion Repositories DevTools

Rev

Rev 6166 | Rev 6267 | 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.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_action_project.asp"-->
<% '------------ Scripts -------------------------- %>
<%
'------------ Variable Definition -------------
Dim objSortHelper
Dim rsQry
Dim parRtagId
Dim query_string
Dim rcon_id
Dim rsQry2
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parRtagId = Request("rtag_id")
objPMod.PersistInQryString("rtag_id")

'----------------------------------------------
%>
<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 width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td width="146px" class="panel_bg" valign="top"><%Call BuildMenuPane%></td>
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
               <table width="10" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="1%"></td>
                     <td width="100%">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                              <td nowrap class="form_ttl"><p>&nbsp;</p>
                                 <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>
                              </td>
                           </tr>
                        </table>
                     </td>
                     <td width="1%"></td>
                  </tr>
                  <tr>
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
                  </tr>
                  <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 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">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 * 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 currentRunLevel
                              Dim daemonState
                              Dim delta
                              Dim pkgId

                              ' 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

                              Set rsQry2 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

                              currentRunLevel = -1
                              pkgId = Null
                              pkgName = NULL
                              pkgPvid = 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 from run_level rl, packages pk"&_
                                                "  where rl.rcon_id = "& rcon_id &_
                                                "   and  rl.current_pkg_id_being_built = pk.pkg_id"

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

                              ' --- Now render HTML for this release configuration ---
                              %>
                              <tr>
                                 <td colspan="7" 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)%></td>
                                 <td nowrap class="body_rowg"><%=Get_Package_Name(pkgName,parRtagId,pkgPvid)%></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 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 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=6>
                             <%If CheckConfigErrors(parRtagId) 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()%>
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif"></td>
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
                  </tr>
               </table>

               <!-- Planned Builds Display -->
               <%
               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
               %>
               <table width="10" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="1%"></td>
                     <td width="100%">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                              <td nowrap class="form_ttl"><p>&nbsp;</p>
                                 <p>DAEMON BUILD PLAN<%=Quick_Help("h_buildplan")%></p>
                              </td>
                              <td  valign="bottom" class="body_rowg">
                                Now: <%=DisplayShortDateTimeSecs(BuildNow)%>
                              </td>
                              <td align="right" valign="bottom"></td>
                           </tr>
                        </table>
                     </td>
                     <td width="1%"></td>
                  </tr>
                  <tr>
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
                  </tr>
                  <tr>
                     <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 )
                           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>

                                 <td align="left" valign="top" class="body_txt">
                                    <%=Get_Package_Name(rsQry("PKG_NAME"), parRtagId, rsQry("PV_ID"))%>
                                 </td>
                                 <td align="left" valign="top" class="body_txt">
                                    <%=rsQry("PKG_VERSION")%>
                                 </td>
                                 <td align="left" valign="top" class="body_txt">
                                    <%=durationDisplay%>
                                 </td>
                                 <td align="left" valign="top" class="body_txt">
                                    <%=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>
                  </tr>
                  <tr>
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif"></td>
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
                  </tr>
               </table>

            </td>
            <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
         </tr>
         <tr>
            <td valign="bottom" align="center" background="images/bg_home_orange.gif">
                <img src="images/img_gear.gif" width="86" height="99" vspace="20" hspace="30">
            </td>
            <td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="350">
            </td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>