Subversion Repositories DevTools

Rev

Rev 7162 | Rev 7212 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5670 dpurdie 1
<% @LANGUAGE = VBScript %>
5623 dpurdie 2
<%
3
'=====================================================
4
'
5
'  Build Status and Plan Information
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="common/daemon_instructions.asp"-->
6166 dpurdie 22
<!--#include file="common/common_daemon.asp"-->
6048 dpurdie 23
<% '------------ ACCESS CONTROL ------------------ %>
6181 dpurdie 24
<!--#include file="_access_control_login_optional.asp"-->
6070 dpurdie 25
<!--#include file="_access_control_general.asp"-->
6052 dpurdie 26
<!--#include file="_access_control_action_project.asp"-->
5623 dpurdie 27
<% '------------ Scripts -------------------------- %>
28
<%
29
'------------ Variable Definition -------------
30
Dim rsQry
31
Dim parRtagId
32
Dim query_string
33
Dim rcon_id
6786 dpurdie 34
Dim canControl
5623 dpurdie 35
'------------ Constants Declaration -----------
36
'------------ Variable Init -------------------
37
parRtagId = Request("rtag_id")
38
objPMod.PersistInQryString("rtag_id")
6786 dpurdie 39
canControl = canActionControlInProject("BuildControl")
6548 dpurdie 40
'-------------------------------------------------
41
' 
42
Sub ShowDaemonStatus
43
%>
6874 dpurdie 44
<div>
45
    <div class="panel">
46
        <div class=rounded_box_caption>
47
                <table align="center" class="full_table">
48
                   <tr>
49
                      <td nowrap class="form_ttl">DAEMON STATUS INFORMATION
50
                      </td>
51
                      <td  valign="bottom" class="body_rowg">
52
                        Last Build: <%=GetLastBuildAge(parRtagId)%> [<%=GetModifiedSeqNo(parRtagId)%>]
53
                      </td>
54
                      <td align="right" valign="bottom">
55
                        <a class="txt_linked" href="<%=scriptName%>?rtag_id=<%=parRtagId%>" title="Refresh Page">[Refresh]</a>
56
                      </td>
57
                   </tr>
58
                </table>
59
        </div>
60
        <div class='rounded_box'>
61
            <div  class=listPanel>
62
                <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
63
                <!--#include file="messages/_msg_inline.asp"-->
64
                <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
65
                <table width="100%" border="0" cellspacing="2" cellpadding="0">
66
                   <%
67
                   Dim bInactiveMachine : bInactiveMachine = false
68
                   %>
69
                   <td width="9%" valign="top"></td>
70
                   <thead>
71
                      <th>Daemon Host</th>
72
                      <th>Machine Type</th>
73
                      <th>Mode</th>
74
                      <th>Run Level</th>
75
                      <th>Current Package</th>
76
                      <th>Est Duration<%=Quick_Help("h_buildtime")%></th>
77
                      <th>Last Change<%=Quick_Help("h_lastchange")%></th>
78
                      <th>Control State</th>
79
                   </thead>
80
                   <%
81
                   ' Get Build Information for this Release
82
                   query_string = _
83
                        "SELECT rc.rcon_id, display_name, gbe_value, daemon_mode, NVL(ACTIVE, 'U') AS ACTIVE," &_
84
                        "       rl.pause, rl.current_run_level, rl.current_pkg_id_being_built, TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) AS delta," &_
85
                        "       pk.pkg_name, rl.current_pv_id, pv.build_time, TRUNC (86400*(SYSDATE - rl.LAST_BUILD)) AS build_delta" &_
86
                        " FROM release_config rc," &_
87
                        "   gbe_machtype gm," &_
88
                        "   build_machine_config bm," &_
89
                        "   run_level rl," &_
90
                        "   packages pk," &_
91
                        "   package_versions pv" &_
92
                        " WHERE rc.rtag_id     = " & parRtagId &_
93
                        "  AND gm.gbe_id        = rc.gbe_id" &_
94
                        "  AND rl.rcon_id(+)    = rc.rcon_id" &_
95
                        "  AND rc.bmcon_id      =bm.bmcon_id(+)" &_
96
                        "  AND pk.pkg_id(+)     = rl.current_pkg_id_being_built" &_
97
                        "  AND rl.current_pv_id = pv.pv_id(+)" &_
98
                        " ORDER BY bm.display_name, rc.rcon_id"
5623 dpurdie 99
 
6874 dpurdie 100
                   Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
6548 dpurdie 101
 
6874 dpurdie 102
                   Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
103
                      Dim pkgName
104
                      Dim pkgPvid
105
                      Dim pkgBuildTime
106
                      Dim currentRunLevel
107
                      Dim daemonState
108
                      Dim delta
109
                      Dim PkgBuildDelta
110
                      Dim pkgId
111
                      Dim bActive
112
                      Dim estDuration
113
                      Dim daemonMode 
114
                      Dim lastChange
6548 dpurdie 115
 
6874 dpurdie 116
                      rcon_id = rsQry("rcon_id")
117
                      ' = rsQry("display_name")
118
                      ' = rsQry("gbe_value")
119
                      daemonMode = rsQry("daemon_mode")
120
                      bActive = rsQry("ACTIVE")
121
                      daemonState = rsQry("pause")
122
                      currentRunLevel = rsQry("current_run_level")
123
                      pkgId = rsQry("current_pkg_id_being_built")
124
                      delta = rsQry("delta")
125
                      pkgName = rsQry("pkg_name")
126
                      pkgPvid = rsQry("current_pv_id")
127
                      pkgBuildTime = rsQry("build_time")
128
                      PkgBuildDelta = rsQry("build_delta")
129
                      lastChange = NULL
130
                      bInactiveMachine = FALSE
131
                      estDuration = NULL
6548 dpurdie 132
 
6874 dpurdie 133
                      If bActive = "N" Then bInactiveMachine = true
134
                      If IsNull(daemonState) Then daemonState = 0
135
                      If daemonState = "2" Then pkgId = Null
136
                      If IsNull(currentRunLevel) Then currentRunLevel = -1
137
                      If daemonMode = "M" AND not IsNull(pkgName) Then estDuration = pkgBuildTime & "[" & PkgBuildDelta & "]"
138
                      If bActive <> "U" Then lastChange = PrettyDelta(delta, daemonState,pkgName )
6548 dpurdie 139
 
6874 dpurdie 140
                      ' --- Now render HTML for this release configuration ---
141
                      %>
142
                      <tr class=border>
143
                         <td><%=rsQry("display_name")%></td>
144
                         <td><%=rsQry("gbe_value")%></td>
145
                         <td><%=Get_Daemon_Mode(daemonMode)%></td>
7063 dpurdie 146
                         <td><%=Get_Run_Level(currentRunLevel, IndefPause, daemonState, bActive)%></td>
6874 dpurdie 147
                         <td><%=Get_Package_Name(pkgName,parRtagId,pkgPvid, daemonState, bActive)%></td>
148
                         <td><%=estDuration%></td>
149
                         <td><%=lastChange%></td>
150
                         <td>
151
                            <%
7063 dpurdie 152
                            If NOT IndefPause  Then
6874 dpurdie 153
                                If bActive = "U" Then
154
                                ElseIf bActive = "N" Then
155
                                    Call Action_Buttons ( "Daemon Unavailable" )
156
                                ElseIf daemonState = 0 Then
157
                                    Call Action_Buttons_State ( "Daemon Pause", canControl )
158
                                ElseIf daemonState = 1 Then
159
                                    Call Action_Buttons_State ( "Daemon Resume", canControl )
160
                                ElseIf daemonState = 2 Then
161
                                    Call Action_Buttons_State ( "Daemon Start", canControl )
162
                                Else
163
                                    Call Action_Buttons_State ( "Daemon Resume", canControl )
164
                              End If
165
                            Else
166
                               %>Unavailable<%
167
                            End If
168
                            %>
169
                         </td>
170
                      </tr>
171
                      <%
172
                      rsQry.MoveNext
173
                   Loop
174
                   %>
175
                   <tr class=foot>
176
                     <td colspan=7>
177
                     <%If CheckConfigErrors(parRtagId) OR bInactiveMachine Then%><span class="err_alert">&nbsp;Daemon configuration errors detected</span>
178
                        <a class="txt_linked" href="release_config.asp?rtag_id=<%=parRtagId%>">
179
                            <img src="images/i_link.gif" hspace="2" border="0" align="absmiddle" title="Goto Configuration">
180
                        </a>
181
                     <%End If%>
182
                     </td>
183
                     <td>
184
                     <%
7063 dpurdie 185
                       If (rsQry.RecordCount > 0) AND NOT IndefPause Then
6874 dpurdie 186
                           Call Action_Buttons_State ( "Daemon Control All", objAccessControl.UserLogedIn AND canControl )
187
                       Else
188
                         %>&nbsp<%
189
                       End If
190
                     %>
191
                     </td>
192
                   </tr>
193
                   <%
194
                     rsQry.Close()
195
                     Set rsQry = nothing
196
                   %>
197
                </table>
198
            </div>
199
        </div>
200
    </div>
201
</div>
6548 dpurdie 202
<%
203
End Sub
204
'-------------------------------------------------
205
' 
206
Sub ShowBuildPlan
207
Set rsQry = OraDatabase.DbCreateDynaset( "SELECT TRUNC (86400*(SYSDATE - rl.LAST_BUILD)) as delta, rl.LAST_BUILD as BuildStart, rl.current_pv_id, SYSDATE" &_
208
                                        " FROM release_config rc,  run_level rl " &_
209
                                        " WHERE rc.rtag_id   = " & parRtagId &_
6873 dpurdie 210
                                        " AND rc.daemon_mode = 'M' AND rl.rcon_id(+) = rc.rcon_id", ORADYN_DEFAULT )
6548 dpurdie 211
Dim BuildStart
212
Dim BuildDelta
213
Dim BuildPvId
214
Dim BuildNow
7162 dpurdie 215
Dim bFirstPlan : bFirstPlan = TRUE
6548 dpurdie 216
If (rsQry.RecordCount > 0) Then
217
    BuildStart = rsQry("BuildStart")
218
    BuildDelta = rsQry("delta")
219
    BuildPvId  = rsQry("current_pv_id")
220
    BuildNow  = rsQry("SYSDATE")
221
End If
222
rsQry.Close()
223
Set rsQry = nothing
224
%>
6874 dpurdie 225
<!-- Planned Builds Display -->
226
<div>
227
<div class=panel>
228
        <div class=rounded_box_caption>
229
                <table align="center" class="full_table">
6548 dpurdie 230
                   <tr>
6874 dpurdie 231
                      <td nowrap class="form_ttl">DAEMON BUILD PLAN<%=Quick_Help("h_buildplan")%></td>
232
                      <td class="body_rowg" align="right" valign="bottom">Now: <%=DisplayShortDateTimeSecs(BuildNow)%> AWST</td>
6548 dpurdie 233
                   </tr>
6874 dpurdie 234
                </table>
235
        </div>
236
        <div class="rounded_box">
237
            <div class='listPanel'>
238
                <table class='embedded_table'>
239
                   <thead>
240
                      <th>Package</th>
241
                      <th>Version</th>
242
                      <th>Duration<%=Quick_Help("h_buildDuration")%></th>
243
                      <th>Build Completion<%=Quick_Help("h_buildEnd")%></th>
244
                   </thead>
6548 dpurdie 245
                   <%
246
                   Dim PkgVersion, buildDuration, durationDisplay, durationText, completionText
247
                   Set rsQry = OraDatabase.DbCreateDynaset( "SELECT p.PKG_NAME," &_
248
                                                            "  pv.PKG_VERSION, pv.BUILD_TIME," &_
249
                                                            "  bp.PV_ID" &_
250
                                                            " FROM build_plan bp," &_
251
                                                            "  packages p," &_
252
                                                            "  package_versions pv" &_
253
                                                            " WHERE bp.PV_ID = pv.pv_id" &_
254
                                                            " AND RTAG_ID = " & parRtagId &_
255
                                                            " AND pv.PKG_ID  = p.pkg_id" &_
256
                                                            " ORDER BY build_order" , ORADYN_DEFAULT )
6549 dpurdie 257
                   If rsQry.RecordCount = 0 Then
258
                       %>
259
                       <tr>
260
                        <td nowrap colspan="4" align="center" class="body_txt">No packages to be built </td>
261
                       </tr>
262
                       <%
263
                   End If
6548 dpurdie 264
                   While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
265
                       completionText = ""
266
                       buildDuration = rsQry("BUILD_TIME")
267
                       durationDisplay = buildDuration
268
 
7162 dpurdie 269
                       If rsQry("PV_ID") = 0 Then
270
                            bFirstPlan = FALSE
271
                       %>
272
                           <tr class=border>
273
                            <td colspan4>New Plan<%=Quick_Help("h_newPlan")%></td>
274
                          </tr>
275
                       <%
276
                       Else
277
                           ' If the current package build it taking longer than expected , then bump the build times
278
                           ' and allow another 30 seconds.
279
                           If BuildPvId = rsQry("PV_ID") AND bFirstPlan Then
280
                               completionText = "&nbsp;<"
281
                               durationDisplay = durationDisplay & " ["& BuildDelta &"]"
282
                               If CLng(BuildDelta) > CLng(buildDuration) Then
283
                                    buildDuration = BuildDelta + 30
284
                                    completionText = "&nbsp;+"
285
                               End If
6548 dpurdie 286
                           End If
287
 
7162 dpurdie 288
                           ' If the duration is not known - guess at 300 sconds
289
                           durationText = ""
290
                           If (ISNULL(buildDuration)  OR buildDuration = 0) Then
291
                                buildDuration = 300
292
                                durationText = "&nbsp;~"
293
                          End If
6548 dpurdie 294
 
7162 dpurdie 295
                          BuildStart = DateAdd("s", buildDuration, BuildStart)
296
                          %>
297
                          <tr class=border>
298
                             <td><%=Get_Package_Name(rsQry("PKG_NAME"), parRtagId, rsQry("PV_ID"), 0, "Y")%></td>
299
                             <td><%=rsQry("PKG_VERSION")%></td>
300
                             <td><%=durationDisplay%></td>
301
                             <td><%=DisplayShortDateTimeSecs(BuildStart) & durationText  & completionText%></td>
302
                          </tr>
303
                          <%
304
                          ' Allow for 20 seconds of planning between builds
305
                          BuildStart = DateAdd("s", 20, BuildStart)
306
                       End If
6548 dpurdie 307
                      rsQry.MoveNext()
308
                   Wend
309
                   rsQry.Close()
310
                   Set rsQry = nothing
311
                   %>
312
                </table>
6874 dpurdie 313
            </div>
314
        </div>
315
    </div>
316
</div>
6548 dpurdie 317
<%
318
End Sub
319
'-------------------------------------------------
7168 dpurdie 320
Sub PlanControlPane
321
    Dim planDropChecked : planDropChecked = ""
322
    Dim planValue : planValue = 0
323
    Dim planOff : planOff = ""
324
    Dim planCautious : planCautious = ""
325
    Dim planAggressive : planAggressive = ""
326
' Get the planning control information
327
    query_string = _
328
        "SELECT PLAN_THRESHOLD, PLAN_DROP" &_
329
        " FROM release_tags rt" &_
330
        " WHERE rt.rtag_id  = " & parRtagId
331
 
332
    Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
333
 
334
    If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
335
 
336
        If rsQry("PLAN_DROP") <> "N" Then
337
            planDropChecked = " Checked"
338
        End If
339
 
340
        planValue = CInt(rsQry("PLAN_THRESHOLD"))
341
        Select Case planValue
342
        Case 0 : planOff = "Checked"
343
        Case 20 : planCautious = "Checked"
344
        Case 100  : planAggressive = "Checked"
345
        Case Else : planCautious = "Checked"
346
        End Select
347
 
348
    End If
349
    rsQry.Close()
350
    Set rsQry = nothing
6548 dpurdie 351
%>
7168 dpurdie 352
<fieldset class="body_rowg fset" <%=IIF(canControl, "", "disabled")%>>
353
    <legend class="body_scol">Plan Control</legend>
354
        <span id=planMode>
355
            <input     type="radio" name="plan"  <%=planOff%> value="0">Off
356
            <br><input type="radio" name="plan"  <%=planCautious%> value="20">Cautious
357
            <br><input type="radio" name="plan"  <%=planAggressive%> value="100">Aggressive
358
        </span>
359
        <hr>
360
        <input id=planDrop type=checkbox <%=planDropChecked%>>Drop Plan
361
</fieldset>
362
<%
363
End Sub
364
'-------------------------------------------------
365
Sub InsertJavaScript %>
366
<script language="JavaScript" type="text/JavaScript">
367
    formTips.tips.h_buildplan       = stdTip(300, 'Build Plan', 'The build plan is a guess as to the order in which packages will be built.' +
368
                                                              '<p>It will be recalculated before each build.' + 
369
                                                              '<p>The plan includes test builds, new builds and resultant ripples.' 
370
                                                              );
371
    formTips.tips.h_buildDuration    = stdTip(300, 'Planned Duration', 'The build duration (seconds) of the last build of this package - if known.' +
372
                                                              '<p>This is used as a guess as to the duration of the planned build.' 
373
                                                              );
374
    formTips.tips.h_buildEnd         = stdTip(300, 'Planned Completion', 'An educated guess as to the build completion time of the package.' +
375
                                                              '<p>It is based on the start time of the current build and the durations of each preceeding builds.' + 
376
                                                              '<p>If the duration of a build is not known then a time of 300 seconds will be assumed.' +
377
                                                              ' It also assumes 20 seconds to plan the next build.'
378
                                                              );
379
    formTips.tips.h_lastchange       = stdTip(300, 'Last Change', 'This is an indication of the time since the daemon interogated the database.' +
380
                                                              '<p>Short times will be shown as seconds. Longer times will be shown as a time within ' + 
381
                                                              'the last 24 hours. Longer times will be shown as a date.' 
382
                                                              );
383
    formTips.tips.h_newPlan       = stdTip(300, 'New Plan', 'New package versions added to the release have would extend the existing'  +
384
                                                          ' ripple by more than 20%.<p>The changes will not be included in the current ripple, but will' +
385
                                                          ' be processed once the ripple is complete.'
386
                                                              );
387
<%If canControl Then%>
388
    var planTime = 0;
389
    var planDrop = 0;
390
    $(document).ready(function() {
391
 
392
        //  Update the table when the Plan Control is modified
393
        $('#planMode').change(function(event){
394
            planTime = $("input[name='plan']:checked").val();
395
            updatePlanTime();
396
        });
397
 
398
        $('#planDrop').change(function(event){
399
            planDrop = $('#planDrop').is(":checked");
400
            updatePlanDrop();
401
        });
402
    });
403
 
404
    function updatePlanTime()
405
    {
406
        $.ajax({
407
            type : 'POST',
408
            url : '_json_plan_control.asp',
409
            data : {Opr : 'setThreshold', threshold : planTime,  rtag_id : <%=parRtagId%> },
410
            dataType : 'json',
411
        }).done(function (data){
412
            if(data.result) {
413
                console.log("notDone:", data);
414
                vixAlert("The action failed due to some internal error<br>Error: " + data.emsgSummary + "<br>Details:" + data.emsgDetails);
415
 
416
            }
417
        }).fail(function (data,textStatus,errorThrown){
418
            vixAlert("The action failed due to some internal error<br>Error: " + errorThrown);
419
        })
420
    }
421
 
422
    function updatePlanDrop()
423
    {
424
        $.ajax({
425
            type : 'POST',
426
            url : '_json_plan_control.asp',
427
            data : {Opr : 'setDrop', mode : planDrop,  rtag_id : <%=parRtagId%> },
428
            dataType : 'json',
429
        }).done(function (data){
430
            if(data.result) {
431
                console.log("notDone:", data);
432
                vixAlert("The action failed due to some internal error<br>Error: " + data.emsgSummary + "<br>Details:" + data.emsgDetails);
433
 
434
            }
435
        }).fail(function (data,textStatus,errorThrown){
436
            vixAlert("The action failed due to some internal error<br>Error: " + errorThrown);
437
        });
438
    }
439
<%End If%>
440
</script>
441
<%End Sub
442
'----------------------------------------------
443
%>
5623 dpurdie 444
<html>
445
   <head>
446
      <title>Release Manager</title>
447
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
448
      <meta http-equiv="Pragma" content="no-cache">
449
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 450
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
451
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
452
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 453
      <!--#include file="_jquery_includes.asp"-->
454
      <!-- TIPS -->
6676 dpurdie 455
      <script type="text/javascript" src="scripts/json2.js?ver=<%=VixVerNum%>"></script>
6579 dpurdie 456
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
457
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 458
      <!-- DROPDOWN MENUS -->
459
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 460
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
7168 dpurdie 461
      <%Call InsertJavaScript %>
5623 dpurdie 462
   </head>
6548 dpurdie 463
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
5623 dpurdie 464
      <!-- HEADER -->
465
      <!--#include file="_header.asp"-->
466
      <!-- BODY ---->
6548 dpurdie 467
      <table class="full_table">
5623 dpurdie 468
         <tr>
6876 dpurdie 469
            <td width="146px" class="bg_panel" valign="top">
6548 dpurdie 470
                <%Call BuildMenuPane%>
7168 dpurdie 471
                <%Call PlanControlPane%>
6548 dpurdie 472
            </td>
5623 dpurdie 473
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6548 dpurdie 474
                <%Call ShowDaemonStatus%>
475
                <%Call ShowBuildPlan%>
5623 dpurdie 476
            </td>
477
         </tr>
478
         <tr>
6877 dpurdie 479
            <td class="bg_panel_btm" height="350">
6548 dpurdie 480
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
5623 dpurdie 481
         </tr>
482
      </table>
483
      <!-- FOOTER -->
484
      <!--#include file="_footer.asp"-->
485
   </body>
486
</html>
6548 dpurdie 487