Subversion Repositories DevTools

Rev

Rev 7168 | 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 &"]"
7212 dpurdie 282
                               If isNumeric(BuildDelta) > isNumeric(buildDuration) Then
283
                                   If CLng(BuildDelta) > CLng(buildDuration) Then
284
                                        buildDuration = BuildDelta + 30
285
                                        completionText = "&nbsp;+"
286
                                   End If
7162 dpurdie 287
                               End If
6548 dpurdie 288
                           End If
289
 
7162 dpurdie 290
                           ' If the duration is not known - guess at 300 sconds
291
                           durationText = ""
292
                           If (ISNULL(buildDuration)  OR buildDuration = 0) Then
293
                                buildDuration = 300
294
                                durationText = "&nbsp;~"
295
                          End If
6548 dpurdie 296
 
7162 dpurdie 297
                          BuildStart = DateAdd("s", buildDuration, BuildStart)
298
                          %>
299
                          <tr class=border>
300
                             <td><%=Get_Package_Name(rsQry("PKG_NAME"), parRtagId, rsQry("PV_ID"), 0, "Y")%></td>
301
                             <td><%=rsQry("PKG_VERSION")%></td>
302
                             <td><%=durationDisplay%></td>
303
                             <td><%=DisplayShortDateTimeSecs(BuildStart) & durationText  & completionText%></td>
304
                          </tr>
305
                          <%
306
                          ' Allow for 20 seconds of planning between builds
307
                          BuildStart = DateAdd("s", 20, BuildStart)
308
                       End If
6548 dpurdie 309
                      rsQry.MoveNext()
310
                   Wend
311
                   rsQry.Close()
312
                   Set rsQry = nothing
313
                   %>
314
                </table>
6874 dpurdie 315
            </div>
316
        </div>
317
    </div>
318
</div>
6548 dpurdie 319
<%
320
End Sub
321
'-------------------------------------------------
7168 dpurdie 322
Sub PlanControlPane
323
    Dim planDropChecked : planDropChecked = ""
324
    Dim planValue : planValue = 0
325
    Dim planOff : planOff = ""
326
    Dim planCautious : planCautious = ""
327
    Dim planAggressive : planAggressive = ""
328
' Get the planning control information
329
    query_string = _
330
        "SELECT PLAN_THRESHOLD, PLAN_DROP" &_
331
        " FROM release_tags rt" &_
332
        " WHERE rt.rtag_id  = " & parRtagId
333
 
334
    Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
335
 
336
    If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
337
 
338
        If rsQry("PLAN_DROP") <> "N" Then
339
            planDropChecked = " Checked"
340
        End If
341
 
342
        planValue = CInt(rsQry("PLAN_THRESHOLD"))
343
        Select Case planValue
344
        Case 0 : planOff = "Checked"
345
        Case 20 : planCautious = "Checked"
346
        Case 100  : planAggressive = "Checked"
347
        Case Else : planCautious = "Checked"
348
        End Select
349
 
350
    End If
351
    rsQry.Close()
352
    Set rsQry = nothing
6548 dpurdie 353
%>
7168 dpurdie 354
<fieldset class="body_rowg fset" <%=IIF(canControl, "", "disabled")%>>
355
    <legend class="body_scol">Plan Control</legend>
356
        <span id=planMode>
357
            <input     type="radio" name="plan"  <%=planOff%> value="0">Off
358
            <br><input type="radio" name="plan"  <%=planCautious%> value="20">Cautious
359
            <br><input type="radio" name="plan"  <%=planAggressive%> value="100">Aggressive
360
        </span>
361
        <hr>
362
        <input id=planDrop type=checkbox <%=planDropChecked%>>Drop Plan
363
</fieldset>
364
<%
365
End Sub
366
'-------------------------------------------------
367
Sub InsertJavaScript %>
368
<script language="JavaScript" type="text/JavaScript">
7212 dpurdie 369
 
370
    formTips.tips.h_buildtime       = stdTip(300, 'Est. Build Duration', 'Estimated build duration in seconds. Based simply on the last build duration for this package');
371
 
7168 dpurdie 372
    formTips.tips.h_buildplan       = stdTip(300, 'Build Plan', 'The build plan is a guess as to the order in which packages will be built.' +
373
                                                              '<p>It will be recalculated before each build.' + 
374
                                                              '<p>The plan includes test builds, new builds and resultant ripples.' 
375
                                                              );
376
    formTips.tips.h_buildDuration    = stdTip(300, 'Planned Duration', 'The build duration (seconds) of the last build of this package - if known.' +
377
                                                              '<p>This is used as a guess as to the duration of the planned build.' 
378
                                                              );
379
    formTips.tips.h_buildEnd         = stdTip(300, 'Planned Completion', 'An educated guess as to the build completion time of the package.' +
380
                                                              '<p>It is based on the start time of the current build and the durations of each preceeding builds.' + 
381
                                                              '<p>If the duration of a build is not known then a time of 300 seconds will be assumed.' +
382
                                                              ' It also assumes 20 seconds to plan the next build.'
383
                                                              );
384
    formTips.tips.h_lastchange       = stdTip(300, 'Last Change', 'This is an indication of the time since the daemon interogated the database.' +
385
                                                              '<p>Short times will be shown as seconds. Longer times will be shown as a time within ' + 
386
                                                              'the last 24 hours. Longer times will be shown as a date.' 
387
                                                              );
388
    formTips.tips.h_newPlan       = stdTip(300, 'New Plan', 'New package versions added to the release have would extend the existing'  +
389
                                                          ' ripple by more than 20%.<p>The changes will not be included in the current ripple, but will' +
390
                                                          ' be processed once the ripple is complete.'
391
                                                              );
392
<%If canControl Then%>
393
    var planTime = 0;
394
    var planDrop = 0;
395
    $(document).ready(function() {
396
 
397
        //  Update the table when the Plan Control is modified
398
        $('#planMode').change(function(event){
399
            planTime = $("input[name='plan']:checked").val();
400
            updatePlanTime();
401
        });
402
 
403
        $('#planDrop').change(function(event){
404
            planDrop = $('#planDrop').is(":checked");
405
            updatePlanDrop();
406
        });
407
    });
408
 
409
    function updatePlanTime()
410
    {
411
        $.ajax({
412
            type : 'POST',
413
            url : '_json_plan_control.asp',
414
            data : {Opr : 'setThreshold', threshold : planTime,  rtag_id : <%=parRtagId%> },
415
            dataType : 'json',
416
        }).done(function (data){
417
            if(data.result) {
418
                console.log("notDone:", data);
419
                vixAlert("The action failed due to some internal error<br>Error: " + data.emsgSummary + "<br>Details:" + data.emsgDetails);
420
 
421
            }
422
        }).fail(function (data,textStatus,errorThrown){
423
            vixAlert("The action failed due to some internal error<br>Error: " + errorThrown);
424
        })
425
    }
426
 
427
    function updatePlanDrop()
428
    {
429
        $.ajax({
430
            type : 'POST',
431
            url : '_json_plan_control.asp',
432
            data : {Opr : 'setDrop', mode : planDrop,  rtag_id : <%=parRtagId%> },
433
            dataType : 'json',
434
        }).done(function (data){
435
            if(data.result) {
436
                console.log("notDone:", data);
437
                vixAlert("The action failed due to some internal error<br>Error: " + data.emsgSummary + "<br>Details:" + data.emsgDetails);
438
 
439
            }
440
        }).fail(function (data,textStatus,errorThrown){
441
            vixAlert("The action failed due to some internal error<br>Error: " + errorThrown);
442
        });
443
    }
444
<%End If%>
445
</script>
446
<%End Sub
447
'----------------------------------------------
448
%>
5623 dpurdie 449
<html>
450
   <head>
451
      <title>Release Manager</title>
452
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
453
      <meta http-equiv="Pragma" content="no-cache">
454
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 455
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
456
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
457
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 458
      <!--#include file="_jquery_includes.asp"-->
459
      <!-- TIPS -->
6676 dpurdie 460
      <script type="text/javascript" src="scripts/json2.js?ver=<%=VixVerNum%>"></script>
6579 dpurdie 461
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
462
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
5623 dpurdie 463
      <!-- DROPDOWN MENUS -->
464
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 465
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
7168 dpurdie 466
      <%Call InsertJavaScript %>
5623 dpurdie 467
   </head>
6548 dpurdie 468
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
5623 dpurdie 469
      <!-- HEADER -->
470
      <!--#include file="_header.asp"-->
471
      <!-- BODY ---->
6548 dpurdie 472
      <table class="full_table">
5623 dpurdie 473
         <tr>
6876 dpurdie 474
            <td width="146px" class="bg_panel" valign="top">
6548 dpurdie 475
                <%Call BuildMenuPane%>
7168 dpurdie 476
                <%Call PlanControlPane%>
6548 dpurdie 477
            </td>
5623 dpurdie 478
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6548 dpurdie 479
                <%Call ShowDaemonStatus%>
480
                <%Call ShowBuildPlan%>
5623 dpurdie 481
            </td>
482
         </tr>
483
         <tr>
6877 dpurdie 484
            <td class="bg_panel_btm" height="350">
6548 dpurdie 485
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
5623 dpurdie 486
         </tr>
487
      </table>
488
      <!-- FOOTER -->
489
      <!--#include file="_footer.asp"-->
490
   </body>
491
</html>
6548 dpurdie 492