Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
5357 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|         ADMIN Build Status 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"-->
6166 dpurdie 20
<!--#include file="common/common_daemon.asp"-->
6550 dpurdie 21
<% '------------ ACCESS CONTROL ------------------ %>
6181 dpurdie 22
<!--#include file="_access_control_login_optional.asp"-->
5357 dpurdie 23
<!--#include file="_access_control_general.asp"-->
24
<%
25
'------------ Variable Definition -------------
26
Dim rsQry
27
Dim query_string
28
Dim styleAlt1
29
Dim styleAlt2
30
Dim styleNow
31
Dim param_refreshPeriod
32
Dim param_inactivity
33
Dim param_refreshEnabled
34
Dim bIndefinitelyPaused
35
Dim buildStatus
36
 
37
Dim bShowProblemDaemonSets    ' Indicates if problem daemons must be shown during filtering
38
Dim bShowDisabledDaemons      ' Indicates if a disabled daemon must be shown during filtering
39
Dim bShowActiveBuilds         ' Indicates if active builds must be shown during filtering
40
Dim bShowIdleBuilds           ' Indicates if idle builds must be shown during filtering
41
Dim bShowPausedBuilds         ' Indicates if paused builds must be shown during filtering
6999 dpurdie 42
Dim bShowAutoProject          ' Hide projects that have no active components
43
Dim bProjectToggle            ' State of the Project toggler
5357 dpurdie 44
 
45
'------------ Constants Declaration -----------
46
Const Min_Refresh_Time = 10         ' Seconds
47
Const Max_DeltaBuild = 31           ' Days
48
'------------ Variable Init -------------------
49
 
50
styleAlt1="class='body_rowg1'"
51
styleAlt2="class='body_rowg2'"
52
styleNow = styleAlt1
53
'----------------------------------------------
54
%>
55
<%
56
'------------------------------------------------------------------------------
57
'   Populate the buildStatus dictionary
58
'   Get all the required data into a hash of hashes
59
'   It will make the following processing so much easier
60
'
61
Sub getBuildStatus
62
    Dim bms
63
    query_string = "SELECT rc.RCON_ID, " &_
64
                  "       rc.RTAG_ID, " &_
65
                  "       bm.DISPLAY_NAME, " &_
66
                  "       rc.DAEMON_MODE, "&_
67
                  "       rt.RTAG_NAME, " &_
68
                  "       rt.OFFICIAL, " &_
69
                  "       rt.BUILD_AGE, " &_
70
                  "       p.PROJ_ID, " &_
71
                  "       p.PROJ_NAME, " &_
72
                  "       rl.CURRENT_PKG_ID_BEING_BUILT, "&_
73
                  "       rl.CURRENT_RUN_LEVEL, "&_
74
                  "       NVL(rl.PAUSE,0) as PAUSE, " &_
75
                  "       TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta," &_
76
                  "       TO_CHAR(rl.LAST_BUILD, 'DD-MON-YYYY') as last_build," &_
77
                  "       TRUNC (SYSDATE - rl.LAST_BUILD) as last_build_days," &_
6267 dpurdie 78
                  "       pkg.PKG_NAME, NVL(ACTIVE, 'U') as ACTIVE" &_
5357 dpurdie 79
                  " FROM RELEASE_CONFIG rc, RELEASE_TAGS rt, PROJECTS p, RUN_LEVEL rl, BUILD_MACHINE_CONFIG bm, PACKAGES pkg " &_
80
                  " WHERE rt.RTAG_ID = rc.RTAG_ID " &_
81
                  "   AND rc.bmcon_id is not null" &_
82
                  "   AND rt.PROJ_ID = p.PROJ_ID " &_
5623 dpurdie 83
                  "   AND rt.OFFICIAL in ( 'N', 'R', 'C')" &_
6873 dpurdie 84
                  "   AND rl.RCON_ID(+) = rc.RCON_ID" &_
5357 dpurdie 85
                  "   AND rc.bmcon_id = bm.bmcon_id(+)" &_
86
                  "   AND pkg.PKG_ID(+) = rl.CURRENT_PKG_ID_BEING_BUILT" &_
87
                  " ORDER BY p.PROJ_NAME, rt.RTAG_NAME, rc.DAEMON_MODE, bm.DISPLAY_NAME, rc.DAEMON_MODE"
88
 
89
    Set buildStatus = CreateObject("Scripting.Dictionary")
90
    Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
91
    Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
92
        Set bms = CreateObject("Scripting.Dictionary")
93
 
94
        bms.Item("RCON_ID")                     = rsQry("RCON_ID")
95
        bms.Item("RTAG_ID")                     = rsQry("RTAG_ID")
96
        bms.Item("DISPLAY_NAME")                = rsQry("DISPLAY_NAME")
97
        bms.Item("RTAG_NAME")                   = rsQry("RTAG_NAME")
98
        bms.Item("DAEMON_MODE")                 = rsQry("DAEMON_MODE")
99
        bms.Item("OFFICIAL")                    = rsQry("OFFICIAL")
100
        bms.Item("BUILD_AGE")                   = NiceInt(rsQry("BUILD_AGE"), 31)
101
        bms.Item("PROJ_ID")                     = rsQry("PROJ_ID")
102
        bms.Item("PROJ_NAME")                   = rsQry("PROJ_NAME")
103
        bms.Item("CURRENT_PKG_ID_BEING_BUILT")  = rsQry("CURRENT_PKG_ID_BEING_BUILT")
104
        bms.Item("CURRENT_RUN_LEVEL")           = rsQry("CURRENT_RUN_LEVEL")
105
        bms.Item("PAUSE")                       = CInt(rsQry("PAUSE"))
106
        bms.Item("delta")                       = rsQry("delta")
107
        bms.Item("last_build")                  = rsQry("last_build")
108
        bms.Item("last_build_days")             = NiceInt(rsQry("last_build_days"), 100)
109
        bms.Item("PKG_NAME")                    = rsQry("PKG_NAME")
6267 dpurdie 110
        bms.Item("ACTIVE")                      = rsQry("ACTIVE")
5357 dpurdie 111
 
112
        ' Calculate some values
113
        bms.Item("dState") = Classify_Run_Level(bms.Item("CURRENT_RUN_LEVEL"),_
114
                                                bIndefinitelyPaused,_
115
                                                bms.Item("PAUSE"), _
116
                                                bms.Item("delta") ,_
6267 dpurdie 117
                                                bms.Item("CURRENT_PKG_ID_BEING_BUILT"),_
118
                                                bms.Item("ACTIVE"))
5357 dpurdie 119
 
120
        bms.Item("dStateText") = Get_Run_Level(bms.Item("CURRENT_RUN_LEVEL"),_
121
                                               bIndefinitelyPaused,_
6267 dpurdie 122
                                               bms.Item("PAUSE"),_
123
                                               bms.Item("ACTIVE"))
5357 dpurdie 124
 
125
        ' Kill package name on disabled daemons
126
        If bms.Item("PAUSE") = 2 Then bms.Item("PKG_NAME") = Null
127
 
128
 
129
        ' Add to buildStatus
130
        '   This is a three level hash (Project,Release, Daemon)
131
 
132
        Dim ProjRef, RelRef, DRef
133
        ProjRef = bms.Item("PROJ_NAME")
134
        RelRef  = bms.Item("RTAG_NAME")
135
        DRef    = bms.Item("DISPLAY_NAME")
136
 
137
        If  Not buildStatus.Exists(ProjRef) Then
138
            Set buildStatus(ProjRef) = CreateObject("Scripting.Dictionary")
139
            Set buildStatus(ProjRef).Item("data") = CreateObject("Scripting.Dictionary")
140
            'buildStatus(ProjRef).Item("PROJ_ID") = bms.Item("PROJ_ID")
141
            'buildStatus(ProjRef).Item("PROJ_NAME") = bms.Item("PROJ_NAME")
142
 
143
        End If
144
 
145
        If  Not buildStatus(ProjRef).Item("data").Exists(RelRef) Then
146
            Set buildStatus(ProjRef).Item("data").Item(RelRef) = CreateObject("Scripting.Dictionary")
147
            Set buildStatus(ProjRef).Item("data").Item(RelRef).Item("data") = CreateObject("Scripting.Dictionary")
148
            'buildStatus(ProjRef).Item("data").Item(RelRef).Item("RTAG_NAME") = bms.Item("RTAG_NAME")
149
            'buildStatus(ProjRef).Item("data").Item(RelRef).Item("RTAG_ID") = bms.Item("RTAG_ID")
150
        End If
151
 
152
        Set buildStatus(ProjRef).Item("data").Item(RelRef).Item("data").Item(DRef) = bms
153
 
154
        rsQry.MoveNext
155
    Loop
156
    rsQry.Close()
157
    Set rsQry = nothing
158
 
159
    ' Iterate over each deamon set and flag some of its characteristics
160
    '   This could be done inline, as the data is processed from the SQL source
161
    Dim project,release,machine
162
    Dim eProject,eRelease,eMachine
163
    For Each project in buildStatus
164
        Set eProject = buildStatus.Item(project)
165
        For Each release in eProject.Item("data")
166
            Set eRelease = eProject.Item("data").Item(release)
167
            For Each machine in eRelease.Item("data")
168
                Set eMachine = eRelease.Item("data").Item(machine)
169
 
170
                Dim dState
171
                dState = eMachine.Item("dState")
172
 
173
                If dState = "active" Then
174
                    If bShowActiveBuilds Then eMachine.Item("bRow_displayed") = "ShowActive"
175
                ElseIf dState = "idle" Then
176
                    If bShowIdleBuilds Then eMachine.Item("bRow_displayed") = "ShowIdle"
177
                ElseIf dState = "paused" Then
178
                    If bShowPausedBuilds Then eMachine.Item("bRow_displayed") = "ShowPaused"
179
                ElseIf dState = "disabled" Then
180
                    If bShowDisabledDaemons Then eMachine.Item("bRow_displayed") = "ShowDisabled"
181
                ElseIf dState = "problem" Then
182
                    If bShowProblemDaemonSets Then eMachine.Item("bRow_displayed") = "ShowProblem"
183
                    If bShowProblemDaemonSets Then eRelease.Item("bDisplay_whole_set") = true
184
                Else
185
                    eRelease.Item("bDisplay_whole_set") = true
186
                    eMachine.Item("bRow_displayed") = "ShowUnknownState"
187
                End If
188
 
189
                If bShowProblemDaemonSets AND eMachine.Item("BUILD_AGE") > 0 Then
190
                    If (eMachine.Item("last_build_days") > eMachine.Item("BUILD_AGE")) OR (eMachine.Item("last_build_days") > param_inactivity) Then
191
                       If dState = "active" OR dState = "idle" Then
192
                          eRelease.Item("bDisplay_whole_set") = true
193
                          eRelease.Item("bShowAge") = true
194
                          eMachine.Item("bRow_displayed") = "ShowInactiveWarning"
195
                       End If
196
                    End If
197
                End If
198
 
199
                If eMachine.Exists("bRow_displayed") Then
200
                    eRelease.Item("bDisplay_some") = true
6999 dpurdie 201
                    eProject.Item("bDisplay_some") = true
5357 dpurdie 202
                End If
203
 
204
            Next
205
        Next
206
    Next
207
 
208
    ' Debug the data structure
209
    '   Requires common/DictDump.vbs to be included to work
210
    'Response.Write "<br>Pretty Dictionary Display<pre>"
211
    'Response.Write DICToutput(buildStatus)
212
 
213
End Sub
214
 
215
'--------------------------------------------------------------------------------------------------------------------------
216
' Toggle row style between the two alternative styles
217
Sub ToggleStyleNow
218
   If styleNow = styleAlt1 Then
219
      styleNow = styleAlt2
220
   Else
221
      styleNow = styleAlt1
222
   End If
223
End Sub
224
'--------------------------------------------------------------------------------------------------------------------------
225
' Convert run level into a meaningful filter state as a string
226
' Will be one of: active, idle, paused, disabled, problem, unknown
6267 dpurdie 227
Function Classify_Run_Level( nLevel, indefinitePause, astate, nDelta, pkgId, bActive)
5357 dpurdie 228
 
6268 dpurdie 229
   If bActive = "N" AND astate <> 2 Then
5357 dpurdie 230
      Classify_Run_Level = "problem"
6267 dpurdie 231
   ElseIf indefinitePause Then
232
      Classify_Run_Level = "problem"
5357 dpurdie 233
   ElseIf astate = 1 Then                   ' if build daemon paused
234
      Classify_Run_Level = "paused"
235
   ElseIf astate = 2 Then                   ' if build daemon disabled
236
      Classify_Run_Level = "disabled"
237
   ElseIf Int(nDelta) > Max_Delta Then
238
      Classify_Run_Level = "problem"
239
   ElseIf (IsNull(pkgId)) OR (pkgId = "") Then
240
      Classify_Run_Level = "idle"
241
   ElseIf astate = 0 Then                   ' if build daemon enabled
242
      If nLevel = 1 Then
243
         Classify_Run_Level = "problem"
244
      ElseIf nLevel = 2 Then
245
         Classify_Run_Level = "paused"
246
      ElseIf nLevel = 3 Then
247
         Classify_Run_Level = "active"
248
      ElseIf nLevel = 4 Then
249
         Classify_Run_Level = "idle"
250
      ElseIf nLevel = 5 Then
251
         Classify_Run_Level = "idle"
252
      ElseIf nLevel = 6 Then
253
         Classify_Run_Level = "active"
254
      Else
255
         Classify_Run_Level = "unknown"
256
      End If
257
   End If
258
End Function
259
 
260
'--------------------------------------------------------------------------------------------------------------------------
261
' Use this function to determine the state of a specified project checkbox
262
Function Is_Project_Checked( nProjId )
263
   Dim hiddenProjects_arr
264
   Dim hiddenProjects
265
   Dim str
266
 
267
   hiddenProjects = Request("HideProj")
268
   Is_Project_Checked = "checked"
269
 
270
   hiddenProjects_arr = Split(hiddenProjects, ",")
271
   For Each str in hiddenProjects_arr
272
      If str = nProjId Then
273
         Is_Project_Checked = ""
274
         Exit For
275
      End If
276
   Next
277
End Function
278
'--------------------------------------------------------------------------------------------------------------------------
279
' Use this function to set/clear the filter on/off radio button checked state
280
' Format of Filter Param : Filter=[problemBuilds}[,ActiveBuilds]
281
Function Display_Filtered(id)
282
   Dim filter
283
 
284
   Display_Filtered = ""
285
 
286
   filter  = Request("Filter")
287
   If NOT IsNull(filter) AND filter <> "" Then
288
      If InStr(filter, id) > 0 Then
289
         Display_Filtered = "checked"
290
      End If
291
   Else
292
      If id = "OFF" Then
293
         Display_Filtered = "checked"
294
      End If
295
   End If
296
End Function
297
 
298
'--------------------------------------------------------------------------------------------------------------------------
299
' Use this function to set/clear a filter option check box with the given ID
300
' If no Filter is present, then assume defaults          
301
Function Filter_Checked(id)
302
   Dim filter
303
 
304
   Filter_Checked = ""
305
 
306
   filter  = Request("Filter")
307
   If IsNull(filter) OR filter = "" Then
308
     filter="problemBuilds,activeBuilds"        ' Defaults
309
   End If
310
  If InStr(filter, id) > 0 Then
311
     Filter_Checked = "checked"
312
  End If
313
End Function
314
'--------------------------------------------------------------------------------------------------------------------------
315
' Test to see if a particular filter option is on
316
Function Filter_Is_On(id)
317
    If Filter_Checked(id) = "checked" Then
318
          Filter_Is_On = True
319
    Else
320
          Filter_Is_On = False
321
    End If
322
End Function
323
'--------------------------------------------------------------------------------------------------------------------------
324
%>
325
<%
326
'------------ RUN BEFORE PAGE RENDER ----------
327
 
328
' Default values for Auto Refresh checkbox and edit input box
329
param_refreshEnabled = False
330
param_refreshPeriod  = "0"
331
 
332
' Read the Refresh parameter which is of the form Refresh=<time-period>,ON|OFF
333
Dim param_refresh
334
param_refresh = Request("Refresh")
335
If param_refresh <> "" Then
336
   Dim pr_arr
337
   pr_arr = Split(param_refresh,",")
338
   param_refreshPeriod = pr_arr(0)
339
 
340
   ' Range check and end-stop the refresh period if necessary
5814 dpurdie 341
   If NiceInt(param_refreshPeriod, 0)  < Min_Refresh_Time Then
5357 dpurdie 342
      param_refreshPeriod  = CStr(Min_Refresh_Time)
343
   End If
344
 
345
   ' determine checkbox state
346
   If UBound(pr_arr) >= 1 Then
347
      If InStr(UCase(pr_arr(1)), "ON") > 0 Then
348
         param_refreshEnabled = True
349
      Else
350
         param_refreshEnabled = False
351
      End If
352
   End If
353
End If
354
 
355
' Read the Inactivity Period
356
param_inactivity = NiceInt( Request("Inactivity"), Max_DeltaBuild)
357
If param_inactivity  = 0 Then param_inactivity = Max_DeltaBuild
358
 
359
 
360
' Get indefinite pause status
361
bIndefinitelyPaused = Indefinitely_Paused()
362
 
363
' Populate display controls
364
bShowProblemDaemonSets = Filter_Is_On("problemBuilds")
365
bShowActiveBuilds      = Filter_Is_On("activeBuilds")
366
bShowDisabledDaemons   = Filter_Is_On("disabledDaemons")
367
bShowIdleBuilds        = Filter_Is_On("idleBuilds")
368
bShowPausedBuilds      = Filter_Is_On("pausedBuilds")
6999 dpurdie 369
bShowAutoProject       = Filter_Is_On("autoProjects")
5357 dpurdie 370
 
6999 dpurdie 371
bProjectToggle         = RequestBool("pAll", True)
372
 
5357 dpurdie 373
'----------------------------------------------
374
%>
375
<script language="JavaScript" type="text/javascript">
376
<!--
6999 dpurdie 377
function url_append( url, str ) {
378
    if ( str.length <= 0 )
379
        return url;
5357 dpurdie 380
 
6999 dpurdie 381
    if ( url == '' )
382
       url += '\?';
383
    else
384
       url += '\&';
385
    return url + str;
386
}
387
 
388
function url_remove( url, str) {
389
    // split it into each parameter
390
    var qs_arr = url.split(/[&?]/);
391
    var remaining = new Array();
392
    var newUrl = '';
393
    var i_qs_arr;
394
    for (i_qs_arr in qs_arr)
395
    {
396
       var qs_str = qs_arr[i_qs_arr];
397
 
398
       if (qs_str.length > 0) {
399
          if (qs_str.indexOf(str) < 0) {
400
              remaining.push(qs_str);
401
          }
402
       }
403
    }
404
    return url_append('',remaining.join('&'));
405
}
406
 
5357 dpurdie 407
//////////////////////////////////////////////////////////////////////////////////////////////////
6999 dpurdie 408
// This function rebuilds the query string so as to update the list of 'hidden' projects
5357 dpurdie 409
//////////////////////////////////////////////////////////////////////////////////////////////////
6999 dpurdie 410
function toggle_project()
5357 dpurdie 411
{
6999 dpurdie 412
    // Determine all non-cheked project boxes.
413
   var inputs = document.getElementsByTagName('input');
414
   var i;
415
   var list = new Array();
416
   for (i = 0; i < inputs.length; i++) {
417
      var str = inputs[i].name;
418
      if ( ! inputs[i].checked ){
419
          if (str.indexOf("DIS_PRJ_") >= 0) {
420
              list.push(str.replace("DIS_PRJ_",""));
421
          }
5357 dpurdie 422
      }
423
   }
424
 
6999 dpurdie 425
    // get the full query string
426
    var url_query_string = window.location.search.substr(1);
5357 dpurdie 427
 
6999 dpurdie 428
    // Remove bits we are going to process
429
    url_query_string = url_remove(url_query_string, 'HideProj');
5357 dpurdie 430
 
6999 dpurdie 431
    // Prepare the new query string, only adding the HideProj parameter if the function is being
432
    // used to hide all projects
433
     if ( list.length > 0) {
434
         url_query_string = url_append(url_query_string, 'HideProj=' + list.join(','));
435
     }
5357 dpurdie 436
 
6999 dpurdie 437
    // reload the page with the new query string
438
    var url = location.pathname + url_query_string;
439
    window.location.assign(url);
5357 dpurdie 440
}
441
 
442
//////////////////////////////////////////////////////////////////////////////////////////////////
443
// This function rebuilds the query string to either hide all projects, or unhide all projects
6999 dpurdie 444
// from the display
5357 dpurdie 445
//////////////////////////////////////////////////////////////////////////////////////////////////
6999 dpurdie 446
function toggle_all_projects(el)
5357 dpurdie 447
{
6999 dpurdie 448
   var bAll = (el.checked);
5357 dpurdie 449
 
450
   // If hiding all, then find all of the project enable/disable checkboxes, get the project ID
451
   // values from each one and accumulate them into a comma seperated list
452
   if (!bAll)
453
   {
454
      var inputs = document.getElementsByTagName('input');
455
      var i;
6999 dpurdie 456
      var list = new Array();
457
      for (i = 0; i < inputs.length; i++) {
5357 dpurdie 458
         var str = inputs[i].name;
6999 dpurdie 459
         if (str.indexOf("DIS_PRJ_") >= 0) {
460
             list.push(str.replace("DIS_PRJ_",""));
5357 dpurdie 461
         }
462
      }
463
   }
464
 
465
   // get the full query string
6999 dpurdie 466
   var url_query_string = window.location.search.substr(1);
5357 dpurdie 467
 
6999 dpurdie 468
   // Remove bits we are going to process
469
   url_query_string = url_remove(url_query_string, 'HideProj');
470
   url_query_string = url_remove(url_query_string, 'pAll=');
5357 dpurdie 471
 
6999 dpurdie 472
   if ( !bAll) {
473
       url_query_string = url_append(url_query_string, 'pAll=0');
5357 dpurdie 474
   }
475
 
476
   // Prepare the new query string, only adding the HideProj parameter if the function is being
477
   // used to hide all projects
6999 dpurdie 478
    if (!bAll) {
479
        if ( list.length > 0) {
480
            url_query_string = url_append(url_query_string, 'HideProj=' + list.join(','));
481
        }
482
    }
5357 dpurdie 483
 
484
   // reload the page with the new query string
6999 dpurdie 485
   var url = location.pathname + url_query_string;
5357 dpurdie 486
   window.location.assign(url);
487
}
488
 
489
//////////////////////////////////////////////////////////////////////////////////////////////////
490
// This function rebuilds the query string so that it either adds or removes the Refresh parameter
491
//////////////////////////////////////////////////////////////////////////////////////////////////
492
function toggle_refresh()
493
{
494
   // get the full query string
6999 dpurdie 495
   var url_query_string = window.location.search.substr(1);
496
   url_query_string = url_remove(url_query_string, 'Refresh');
5357 dpurdie 497
 
498
   // Prepare the new query string
6999 dpurdie 499
   var refreshData = 'Refresh=';
500
   if (document.getElementById('refreshPeriod').value < <%=Min_Refresh_Time%>) {
5357 dpurdie 501
      document.getElementById('refreshPeriod').value = <%=Min_Refresh_Time%>;
6999 dpurdie 502
      refreshData += <%=Min_Refresh_Time%>;
5357 dpurdie 503
   }
504
   else
6999 dpurdie 505
      refreshData += document.getElementById('refreshPeriod').value;
5357 dpurdie 506
 
507
   if (document.getElementById('autoRefresh').checked)
6999 dpurdie 508
      refreshData += ',ON';
5357 dpurdie 509
   else
6999 dpurdie 510
      refreshData += ',OFF';
5357 dpurdie 511
 
6999 dpurdie 512
   url_query_string = url_append(url_query_string, refreshData);
513
 
5357 dpurdie 514
   // reload the page with the new query string
6999 dpurdie 515
   var url = location.pathname + url_query_string;
5357 dpurdie 516
   window.location.assign(url);
517
}
518
 
519
 
520
//////////////////////////////////////////////////////////////////////////////////////////////////
521
// This function rebuilds the query string to Update the Inactivity parameter
522
//////////////////////////////////////////////////////////////////////////////////////////////////
523
function toggle_inactivity()
524
{
525
   // get the full query string
6999 dpurdie 526
   var url_query_string = window.location.search.substr(1);
527
   url_query_string = url_remove(url_query_string, 'Inactivity');
5357 dpurdie 528
 
6999 dpurdie 529
   // Prepare the new query string
5357 dpurdie 530
   var value = document.getElementById('inactivity').value;
6999 dpurdie 531
   if  (value && (value != <%=Max_DeltaBuild%>)) {
532
       url_query_string = url_append(url_query_string, 'Inactivity=' + value);
5357 dpurdie 533
    }
534
 
535
   // reload the page with the new query string
6999 dpurdie 536
   var url = location.pathname + url_query_string;
5357 dpurdie 537
   window.location.assign(url);
538
}
539
 
540
 
541
//////////////////////////////////////////////////////////////////////////////////////////////////
542
// Rebuild the query string and reload the page based on the current setting of the filter
543
// radio buttons
544
//////////////////////////////////////////////////////////////////////////////////////////////////
545
function update_Display_Filter()
546
{
547
   // get the full query string
6999 dpurdie 548
   var url_query_string = window.location.search.substr(1);
549
   url_query_string = url_remove(url_query_string, 'Filter');
5357 dpurdie 550
 
551
   // Prepare the new query string
6999 dpurdie 552
   var active = new Array();
553
   var items = new Array ("activeBuilds","disabledDaemons","idleBuilds","pausedBuilds","problemBuilds","autoProjects");
554
   for (var item in items) {
555
       if (document.getElementById(items[item]).checked) {
556
           active.push(items[item]);
5357 dpurdie 557
          joiner = ',';
558
       }
559
   }
6999 dpurdie 560
   var filterSet = active.join(',') ;
5357 dpurdie 561
 
6999 dpurdie 562
   if (filterSet.length > 0) {
563
       url_query_string = url_append(url_query_string, 'Filter=' + filterSet);
5357 dpurdie 564
   }
565
 
566
   // reload the page with the new query string
6999 dpurdie 567
   var url = location.pathname + url_query_string;
5357 dpurdie 568
   window.location.assign(url);
569
}
570
 
571
//-->
572
</script>
6550 dpurdie 573
<%
574
'------------------------------------------------------------------------------
575
Sub SidePanelContent
576
%>
577
<!-- Monitoring Options Selection Box ---->
578
 <fieldset style="padding:3px">
579
    <legend class="body_scol">Display Options</legend>
580
     <fieldset class="body_rowg">
581
        <legend class="body_scol">Auto Refresh</legend>
582
             <div class=nowrap>
583
             <input name="autoRefresh" id="autoRefresh" type="checkbox" <%If param_refreshEnabled Then%>checked<%End If%> value="1" onclick='toggle_refresh()'>
584
                 <input class="body_txt" style="width:3em" name="refreshPeriod" id="refreshPeriod" type="input" maxlength="3" value="<%=param_refreshPeriod%>" onchange='toggle_refresh()' > Seconds
585
             </div>
586
     </fieldset>
587
     <fieldset class="body_rowg">
588
        <legend class="body_scol">Filter</legend>
589
            <div>
590
                 <input name="activeBuilds" id="activeBuilds" type="checkbox" <%=Filter_Checked("activeBuilds")%> value="activeBuilds" onclick='update_Display_Filter()'>Active
591
            </div>
592
            <div>
593
                 <input name="idleBuilds" id="idleBuilds" type="checkbox" <%=Filter_Checked("idleBuilds")%> value="idleBuilds" onclick='update_Display_Filter()'>Idle
594
            </div>
595
            <div>
596
                 <input name="pausedBuilds" id="pausedBuilds" type="checkbox" <%=Filter_Checked("pausedBuilds")%> value="paused" onclick='update_Display_Filter()'>Paused
597
            </div>
598
            <div>
599
                 <input name="disabledDaemons"  id="disabledDaemons"  type="checkbox" <%=Filter_Checked("disabledDaemons")%>  value="disabledDaemons"  onclick='update_Display_Filter()'>Disabled
600
            </div>
601
            <div class=nowrap>
602
                 <input name="problemBuilds"  id="problemBuilds"  type="checkbox" <%=Filter_Checked("problemBuilds")%>  value="problemBuilds"  onclick='update_Display_Filter()'>Problem&nbsp;Daemon&nbsp;Sets
603
            </div>
6999 dpurdie 604
            <div class=nowrap>
605
                 <input name="autoProjects"  id="autoProjects"  type="checkbox" <%=Filter_Checked("autoProjects")%>  value="autoProjects"  onclick='update_Display_Filter()'>Auto Hide Projects
606
            </div>
607
 
6550 dpurdie 608
     </fieldset>
609
     <fieldset class="body_rowg">
610
        <legend  class="body_scol">Inactivity</legend>
611
        <input class="body_txt" style="width:3em" name="inactivity" id="inactivity" type="input" maxlength="3" value="<%=param_inactivity%>" onchange='toggle_inactivity()' > Days
612
     </fieldset>
613
</fieldset>
614
<%
615
End Sub
616
'------------------------------------------------------------------------------
617
Sub DisplayProjectHeader(bProjectHeaderDone, eMachine, strProject_checked)
618
    If NOT bProjectHeaderDone Then%>
619
        <tr>
620
           <td colspan='8'><img src='images/spacer.gif' width='1' height='5'></td>
621
        </tr>
622
        <tr>
623
           <td colspan='8' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='5'></td>
624
        </tr>
625
        <tr>
626
            <td nowrap class="body_rowg">
6999 dpurdie 627
                <input name='DIS_PRJ_<%=eMachine("PROJ_ID")%>' id='DIS_PRJ_<%=eMachine("PROJ_ID")%>' type='checkbox' value=1 <%=strProject_checked%> onclick=toggle_project()>
6550 dpurdie 628
                <a href='rtree.asp?proj_id=<%=eMachine("PROJ_ID")%>'><%=eMachine("PROJ_NAME")%>
629
            </td>
630
        <%
631
    End If
632
End Sub
633
'------------------------------------------------------------------------------
634
Sub ShowDaemonStatus
635
%>
636
<table width="10" class="embedded_table" style="margin-bottom:10px">
637
  <tr>
638
     <td width="100%">
639
        <table width="100%" class="embedded_table">
640
           <tr>
641
              <td nowrap class="form_ttl">BUILD DAEMON STATUS INFORMATION</td>
642
           </tr>
643
           <%If bIndefinitelyPaused Then%>
644
              <tr>
645
                 <td>
646
                    <span class='err_alert'>
647
                       <font size='2'><b>WARNING: Indefinite Pause, Build Daemons are all stopped - please contact an administrator</b></font>
648
                    </span>
649
                 </td>
650
              </tr>
651
           <%End If%>
652
        </table>
653
     </td>
654
  </tr>
655
  <tr>
656
    <td>
657
        <table class="rounded_box embedded_table" width="100%" >
658
          <tr>
659
             <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
660
             <td bgcolor="#FFFFFF" valign="top">
661
                <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
662
                <!--#include file="messages/_msg_inline.asp"-->
663
                <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
664
                <br>
665
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
6999 dpurdie 666
                   <!-- Status Table Header -->
667
                   <thead>
668
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col tleft">
669
                        <input type="checkbox" <%=IIF(bProjectToggle, "checked", "")%> title='Show/Hide all active releases' onclick=toggle_all_projects(this)>Project</th>
670
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release</th>
671
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release<br>Mode</th>
672
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Mode</th>
673
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Host</th>
674
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>State</th>
675
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Building<br>Package</th>
676
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<br>Delta (secs)</th>
677
                   </thead>
5357 dpurdie 678
 
6550 dpurdie 679
                   <!-- Status Table Body -->
680
                   <%
681
                    Dim bProject_changed          ' Signals a row change due to a different project
682
                    Dim strProject_checked        ' Can be "" or "checked". Determines appearance of project enable checkbox
683
                    Dim bRelease_changed          ' signals a row change due to a different release
684
                    Dim bReleaseHeaderDone        ' indicates whether the release name has been rendered yet
685
                    Dim bProjectHeaderDone        ' Project Header done
686
                    Dim bShowAge                  ' Display age warning
687
                    Dim bToggleStyle              ' Data shown so toggle style
688
                    Dim bShowReleaseSep           ' Show Release Seperator
6999 dpurdie 689
                    Dim bShowProject              ' Show this project
6550 dpurdie 690
 
691
                    '   Iterate over all projects, releases and machines
692
                    '
693
                    Dim project,release,machine
694
                    Dim eProject,eRelease,eMachine
695
                    For Each project in buildStatus
696
                        ' Start of a new Project
697
                        Set eProject = buildStatus.Item(project)
698
                        bProjectHeaderDone = false
699
                        bProject_changed = true
700
                        bShowReleaseSep = False
6999 dpurdie 701
                        bShowProject = True
702
                        If bShowAutoProject AND NOT eProject.Item("bDisplay_some") Then
703
                            bShowProject = False
704
                        End If
705
                        If bShowProject Then
706
                            For Each release in eProject.Item("data")
707
                                '   Start of a new Release
708
                                Set eRelease = eProject.Item("data").Item(release)
709
                                bReleaseHeaderDone = False
710
                                bRelease_changed = true
711
                                bShowAge = eRelease("bShowAge")
712
                                If  bToggleStyle Then Call ToggleStyleNow
713
                                bToggleStyle = false
6550 dpurdie 714
 
6999 dpurdie 715
                                For Each machine in eRelease.Item("data")
716
                                    '   Start of a new Machine
717
                                    Set eMachine = eRelease.Item("data").Item(machine)
718
                                    strProject_checked = Is_Project_Checked(eMachine("PROJ_ID"))
6550 dpurdie 719
 
6999 dpurdie 720
                                    ' Consider displaying the body of this machine entry
721
                                    If strProject_checked = "checked" Then
722
                                        If eRelease.Exists("bDisplay_whole_set") OR eMachine.Exists("bRow_displayed") Then
723
                                            bToggleStyle = true
6550 dpurdie 724
 
6999 dpurdie 725
                                            ' Display Project and Release Header - Once, or a filler
726
                                            If NOT bReleaseHeaderDone Then
727
                                                bReleaseHeaderDone = True
6550 dpurdie 728
 
6999 dpurdie 729
                                                ' Display Project Header - ONCE. The <tr> is open
730
                                                Call DisplayProjectHeader(bProjectHeaderDone,eMachine, strProject_checked)
731
                                                bProjectHeaderDone = TRUE
6550 dpurdie 732
 
733
 
6999 dpurdie 734
                                                ' Display Release seperator, if this is not the first release in the project
735
                                                If bShowReleaseSep Then
736
                                                    %>
737
                                                        <tr>
738
                                                            <td></td>
739
                                                            <td colspan='7' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='1'></td>
740
                                                        </tr>
741
                                                        <tr>
742
                                                            <td></td>
743
                                                    <%
744
                                                End If
745
                                                ' Display the Release Header, with a marker to show aged releases
6550 dpurdie 746
                                                %>
6999 dpurdie 747
                                                <td nowrap <%=styleNow%>>
748
                                                    <a href='build_status.asp?rtag_id=<%=eMachine("RTAG_ID")%>' title='Last Build:<%=eMachine("last_build")%>'><%=eMachine("RTAG_NAME")%></a>
6550 dpurdie 749
                                                <%
6999 dpurdie 750
                                                If bShowAge Then
751
                                                %>
752
                                                    <img src='images/s_warning.gif' width='14' height='13' border='0' title='No Build in this release since <%=eMachine("last_build")%>. [<%=eMachine("last_build_days")%> Days]' style='vertical-align: bottom;'>
753
                                                <%
754
                                                End If
755
                                                %></td><%
756
                                            Else%>
757
                                                <td nowrap class="body_rowg"></td>
758
                                                <td nowrap <%=styleNow%>></td>
759
                                            <%
6550 dpurdie 760
                                            End If
6999 dpurdie 761
                                            bShowReleaseSep = true
6550 dpurdie 762
                                            %>
6999 dpurdie 763
                                            <td nowrap <%=styleNow%>><%=Get_Official(eMachine("OFFICIAL"))%></td>
764
                                            <td nowrap <%=styleNow%>><%=Get_Daemon_Mode(eMachine("DAEMON_MODE"))%></td>
765
                                            <td nowrap <%=styleNow%>><%=eMachine("DISPLAY_NAME")%></td>
766
                                            <td nowrap <%=styleNow%>><%=eMachine("dStateText")%></td>
767
                                            <td nowrap <%=styleNow%>><%=eMachine("PKG_NAME")%></td>
768
                                            <td nowrap <%=styleNow%>><%=PrettyDelta(eMachine("delta"),eMachine("PAUSE"),eMachine("PKG_NAME") )%></td>
6550 dpurdie 769
                                            <%
770
                                        End If
6999 dpurdie 771
                                        %></tr><%
6550 dpurdie 772
                                    End If
773
 
6999 dpurdie 774
                                    ' End of Display
775
                                    bRelease_changed = false
776
                                    bProject_changed = false
777
                                Next
6550 dpurdie 778
                            Next
6999 dpurdie 779
                            Call DisplayProjectHeader(bProjectHeaderDone,eMachine, strProject_checked)
780
                        End If
6550 dpurdie 781
                        Next
782
                   %>
783
                  <tr>
784
                    <td>
785
                        <input type="hidden" name="action" value="true">
786
                        <%=objPMod.ComposeHiddenTags()%>
787
                    </td>
788
                  </tr>
789
                </table>
790
             </td>
791
             <td background="images/lbox_bgside_white.gif">&nbsp;</td>
792
           </tr>
793
        </table>
794
      </td>
795
  </tr>
796
</table>
797
<%
798
End Sub
799
%>
5357 dpurdie 800
<html>
801
   <head>
802
      <title>Release Manager</title>
803
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
804
      <meta http-equiv="Pragma" content="no-cache">
805
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
806
      <%If param_refreshEnabled AND param_RefreshPeriod <> 0 Then%>
807
         <META HTTP-EQUIV=REFRESH CONTENT=<%=param_RefreshPeriod%>>
808
      <%End If%>
6579 dpurdie 809
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
810
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
811
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
5983 dpurdie 812
      <!--#include file="_jquery_includes.asp"-->
5357 dpurdie 813
      <!-- DROPDOWN MENUS -->
814
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 815
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
5357 dpurdie 816
   </head>
6550 dpurdie 817
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
5357 dpurdie 818
      <!-- HEADER -->
819
      <!--#include file="_header.asp"-->
820
      <% getBuildStatus() %>
821
      <!-- BODY ---->
6550 dpurdie 822
      <table class="full_table">
5357 dpurdie 823
         <tr>
6876 dpurdie 824
            <td width="146px" class="bg_panel" valign="top">
6550 dpurdie 825
                <%Call SidePanelContent%>
5814 dpurdie 826
            </td>
5357 dpurdie 827
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6550 dpurdie 828
                <%Call ShowDaemonStatus%>
5357 dpurdie 829
            </td>
830
         </tr>
831
         <tr>
6877 dpurdie 832
            <td class="bg_panel_btm" height="350">
6550 dpurdie 833
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
5357 dpurdie 834
         </tr>
835
      </table>
836
      <!-- FOOTER -->
837
      <!--#include file="_footer.asp"-->
838
   </body>
839
</html>