Subversion Repositories DevTools

Rev

Rev 5957 | Rev 6048 | 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"-->
20
<%
21
'------------ ACCESS CONTROL ------------------
22
%>
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
42
 
43
'------------ Constants Declaration -----------
44
Const Min_Refresh_Time = 10         ' Seconds
45
Const Max_Delta = 600               ' Seconds
46
Const Max_DeltaBuild = 31           ' Days
47
'------------ Variable Init -------------------
48
 
49
styleAlt1="class='body_rowg1'"
50
styleAlt2="class='body_rowg2'"
51
styleNow = styleAlt1
52
'----------------------------------------------
53
%>
54
<%
55
'------------------------------------------------------------------------------
56
'   Populate the buildStatus dictionary
57
'   Get all the required data into a hash of hashes
58
'   It will make the following processing so much easier
59
'
60
Sub getBuildStatus
61
    Dim bms
62
    query_string = "SELECT rc.RCON_ID, " &_
63
                  "       rc.RTAG_ID, " &_
64
                  "       bm.DISPLAY_NAME, " &_
65
                  "       rc.DAEMON_MODE, "&_
66
                  "       rt.RTAG_NAME, " &_
67
                  "       rt.OFFICIAL, " &_
68
                  "       rt.BUILD_AGE, " &_
69
                  "       p.PROJ_ID, " &_
70
                  "       p.PROJ_NAME, " &_
71
                  "       rl.CURRENT_PKG_ID_BEING_BUILT, "&_
72
                  "       rl.CURRENT_RUN_LEVEL, "&_
73
                  "       NVL(rl.PAUSE,0) as PAUSE, " &_
74
                  "       TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta," &_
75
                  "       TO_CHAR(rl.LAST_BUILD, 'DD-MON-YYYY') as last_build," &_
76
                  "       TRUNC (SYSDATE - rl.LAST_BUILD) as last_build_days," &_
77
                  "       pkg.PKG_NAME" &_
78
                  " FROM RELEASE_CONFIG rc, RELEASE_TAGS rt, PROJECTS p, RUN_LEVEL rl, BUILD_MACHINE_CONFIG bm, PACKAGES pkg " &_
79
                  " WHERE rt.RTAG_ID = rc.RTAG_ID " &_
80
                  "   AND rc.bmcon_id is not null" &_
81
                  "   AND rt.PROJ_ID = p.PROJ_ID " &_
5623 dpurdie 82
                  "   AND rt.OFFICIAL in ( 'N', 'R', 'C')" &_
5357 dpurdie 83
                  "   AND rl.RCON_ID = rc.RCON_ID" &_
84
                  "   AND rc.bmcon_id = bm.bmcon_id(+)" &_
85
                  "   AND pkg.PKG_ID(+) = rl.CURRENT_PKG_ID_BEING_BUILT" &_
86
                  " ORDER BY p.PROJ_NAME, rt.RTAG_NAME, rc.DAEMON_MODE, bm.DISPLAY_NAME, rc.DAEMON_MODE"
87
 
88
    Set buildStatus = CreateObject("Scripting.Dictionary")
89
    Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
90
    Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
91
        Set bms = CreateObject("Scripting.Dictionary")
92
 
93
        bms.Item("RCON_ID")                     = rsQry("RCON_ID")
94
        bms.Item("RTAG_ID")                     = rsQry("RTAG_ID")
95
        bms.Item("DISPLAY_NAME")                = rsQry("DISPLAY_NAME")
96
        bms.Item("RTAG_NAME")                   = rsQry("RTAG_NAME")
97
        bms.Item("DAEMON_MODE")                 = rsQry("DAEMON_MODE")
98
        bms.Item("OFFICIAL")                    = rsQry("OFFICIAL")
99
        bms.Item("BUILD_AGE")                   = NiceInt(rsQry("BUILD_AGE"), 31)
100
        bms.Item("PROJ_ID")                     = rsQry("PROJ_ID")
101
        bms.Item("PROJ_NAME")                   = rsQry("PROJ_NAME")
102
        bms.Item("CURRENT_PKG_ID_BEING_BUILT")  = rsQry("CURRENT_PKG_ID_BEING_BUILT")
103
        bms.Item("CURRENT_RUN_LEVEL")           = rsQry("CURRENT_RUN_LEVEL")
104
        bms.Item("PAUSE")                       = CInt(rsQry("PAUSE"))
105
        bms.Item("delta")                       = rsQry("delta")
106
        bms.Item("last_build")                  = rsQry("last_build")
107
        bms.Item("last_build_days")             = NiceInt(rsQry("last_build_days"), 100)
108
        bms.Item("PKG_NAME")                    = rsQry("PKG_NAME")
109
 
110
        ' Calculate some values
111
        bms.Item("dState") = Classify_Run_Level(bms.Item("CURRENT_RUN_LEVEL"),_
112
                                                bIndefinitelyPaused,_
113
                                                bms.Item("PAUSE"), _
114
                                                bms.Item("delta") ,_
115
                                                bms.Item("CURRENT_PKG_ID_BEING_BUILT"))
116
 
117
        bms.Item("dStateText") = Get_Run_Level(bms.Item("CURRENT_RUN_LEVEL"),_
118
                                               bIndefinitelyPaused,_
119
                                               bms.Item("PAUSE"))
120
 
121
        ' Kill package name on disabled daemons
122
        If bms.Item("PAUSE") = 2 Then bms.Item("PKG_NAME") = Null
123
 
124
 
125
        ' Add to buildStatus
126
        '   This is a three level hash (Project,Release, Daemon)
127
 
128
        Dim ProjRef, RelRef, DRef
129
        ProjRef = bms.Item("PROJ_NAME")
130
        RelRef  = bms.Item("RTAG_NAME")
131
        DRef    = bms.Item("DISPLAY_NAME")
132
 
133
        If  Not buildStatus.Exists(ProjRef) Then
134
            Set buildStatus(ProjRef) = CreateObject("Scripting.Dictionary")
135
            Set buildStatus(ProjRef).Item("data") = CreateObject("Scripting.Dictionary")
136
            'buildStatus(ProjRef).Item("PROJ_ID") = bms.Item("PROJ_ID")
137
            'buildStatus(ProjRef).Item("PROJ_NAME") = bms.Item("PROJ_NAME")
138
 
139
        End If
140
 
141
        If  Not buildStatus(ProjRef).Item("data").Exists(RelRef) Then
142
            Set buildStatus(ProjRef).Item("data").Item(RelRef) = CreateObject("Scripting.Dictionary")
143
            Set buildStatus(ProjRef).Item("data").Item(RelRef).Item("data") = CreateObject("Scripting.Dictionary")
144
            'buildStatus(ProjRef).Item("data").Item(RelRef).Item("RTAG_NAME") = bms.Item("RTAG_NAME")
145
            'buildStatus(ProjRef).Item("data").Item(RelRef).Item("RTAG_ID") = bms.Item("RTAG_ID")
146
        End If
147
 
148
        Set buildStatus(ProjRef).Item("data").Item(RelRef).Item("data").Item(DRef) = bms
149
 
150
        rsQry.MoveNext
151
    Loop
152
    rsQry.Close()
153
    Set rsQry = nothing
154
 
155
    ' Iterate over each deamon set and flag some of its characteristics
156
    '   This could be done inline, as the data is processed from the SQL source
157
    Dim project,release,machine
158
    Dim eProject,eRelease,eMachine
159
    For Each project in buildStatus
160
        Set eProject = buildStatus.Item(project)
161
        For Each release in eProject.Item("data")
162
            Set eRelease = eProject.Item("data").Item(release)
163
            For Each machine in eRelease.Item("data")
164
                Set eMachine = eRelease.Item("data").Item(machine)
165
 
166
                Dim dState
167
                dState = eMachine.Item("dState")
168
 
169
                If dState = "active" Then
170
                    If bShowActiveBuilds Then eMachine.Item("bRow_displayed") = "ShowActive"
171
                ElseIf dState = "idle" Then
172
                    If bShowIdleBuilds Then eMachine.Item("bRow_displayed") = "ShowIdle"
173
                ElseIf dState = "paused" Then
174
                    If bShowPausedBuilds Then eMachine.Item("bRow_displayed") = "ShowPaused"
175
                ElseIf dState = "disabled" Then
176
                    If bShowDisabledDaemons Then eMachine.Item("bRow_displayed") = "ShowDisabled"
177
                ElseIf dState = "problem" Then
178
                    If bShowProblemDaemonSets Then eMachine.Item("bRow_displayed") = "ShowProblem"
179
                    If bShowProblemDaemonSets Then eRelease.Item("bDisplay_whole_set") = true
180
                Else
181
                    eRelease.Item("bDisplay_whole_set") = true
182
                    eMachine.Item("bRow_displayed") = "ShowUnknownState"
183
                End If
184
 
185
                If bShowProblemDaemonSets AND eMachine.Item("BUILD_AGE") > 0 Then
186
                    If (eMachine.Item("last_build_days") > eMachine.Item("BUILD_AGE")) OR (eMachine.Item("last_build_days") > param_inactivity) Then
187
                       If dState = "active" OR dState = "idle" Then
188
                          eRelease.Item("bDisplay_whole_set") = true
189
                          eRelease.Item("bShowAge") = true
190
                          eMachine.Item("bRow_displayed") = "ShowInactiveWarning"
191
                       End If
192
                    End If
193
                End If
194
 
195
                If eMachine.Exists("bRow_displayed") Then
196
                    eRelease.Item("bDisplay_some") = true
197
                End If
198
 
199
            Next
200
        Next
201
    Next
202
 
203
    ' Debug the data structure
204
    '   Requires common/DictDump.vbs to be included to work
205
    'Response.Write "<br>Pretty Dictionary Display<pre>"
206
    'Response.Write DICToutput(buildStatus)
207
 
208
End Sub
209
 
210
'--------------------------------------------------------------------------------------------------------------------------
211
' Toggle row style between the two alternative styles
212
Sub ToggleStyleNow
213
   If styleNow = styleAlt1 Then
214
      styleNow = styleAlt2
215
   Else
216
      styleNow = styleAlt1
217
   End If
218
End Sub
219
'--------------------------------------------------------------------------------------------------------------------------
220
' Convert run level into a meaningful string
221
Function Get_Run_Level( nLevel, indefinitePause, astate)
222
 
223
   If indefinitePause Then
224
      Get_Run_Level = "<span class='err_alert'>Stopped</span>"
225
   ElseIf astate = 1 Then      ' if build daemon paused
226
      Get_Run_Level = "Paused"
227
   ElseIf astate = 2 Then      ' if build daemon disabled
228
      Get_Run_Level = "Disabled"
229
   ElseIf astate = 0 Then     ' if build daemon enabled
230
      If nLevel = 1 Then
231
         Get_Run_Level = "Cannot Continue"
232
      ElseIf nLevel = 2 Then
233
         Get_Run_Level = "Paused"
234
      ElseIf nLevel = 3 Then
235
         Get_Run_Level = "Building"
236
      ElseIf nLevel = 4 Then
237
         Get_Run_Level = "Idle"
238
      ElseIf nLevel = 5 Then
239
         Get_Run_Level = "Waiting"
240
      ElseIf nLevel = 6 Then
241
         Get_Run_Level = "Publishing"
242
      Else
243
         Get_Run_Level = "<span class='err_alert'>Unknown!</span>"
244
      End If
245
   End If
246
End Function
247
 
248
'--------------------------------------------------------------------------------------------------------------------------
249
' Convert run level into a meaningful filter state as a string
250
' Will be one of: active, idle, paused, disabled, problem, unknown
251
Function Classify_Run_Level( nLevel, indefinitePause, astate, nDelta, pkgId)
252
 
253
   If indefinitePause Then
254
      Classify_Run_Level = "problem"
255
   ElseIf astate = 1 Then                   ' if build daemon paused
256
      Classify_Run_Level = "paused"
257
   ElseIf astate = 2 Then                   ' if build daemon disabled
258
      Classify_Run_Level = "disabled"
259
   ElseIf Int(nDelta) > Max_Delta Then
260
      Classify_Run_Level = "problem"
261
   ElseIf (IsNull(pkgId)) OR (pkgId = "") Then
262
      Classify_Run_Level = "idle"
263
   ElseIf astate = 0 Then                   ' if build daemon enabled
264
      If nLevel = 1 Then
265
         Classify_Run_Level = "problem"
266
      ElseIf nLevel = 2 Then
267
         Classify_Run_Level = "paused"
268
      ElseIf nLevel = 3 Then
269
         Classify_Run_Level = "active"
270
      ElseIf nLevel = 4 Then
271
         Classify_Run_Level = "idle"
272
      ElseIf nLevel = 5 Then
273
         Classify_Run_Level = "idle"
274
      ElseIf nLevel = 6 Then
275
         Classify_Run_Level = "active"
276
      Else
277
         Classify_Run_Level = "unknown"
278
      End If
279
   End If
280
End Function
281
 
282
'--------------------------------------------------------------------------------------------------------------------------
283
' Convert daemon mode into a meaningful string
284
Function Get_Daemon_Mode( nMode )
285
   If nMode = "M" Then
286
      Get_Daemon_Mode = "Master"
287
   ElseIf nMode = "S" Then
288
      Get_Daemon_Mode = "Slave"
289
   Else
290
      Get_Daemon_Mode = "?"
291
   End If
292
End Function
293
'--------------------------------------------------------------------------------------------------------------------------
294
' Use this function to determine the state of a specified project checkbox
295
Function Is_Project_Checked( nProjId )
296
   Dim hiddenProjects_arr
297
   Dim hiddenProjects
298
   Dim str
299
 
300
   hiddenProjects = Request("HideProj")
301
   Is_Project_Checked = "checked"
302
 
303
   hiddenProjects_arr = Split(hiddenProjects, ",")
304
   For Each str in hiddenProjects_arr
305
      If str = nProjId Then
306
         Is_Project_Checked = ""
307
         Exit For
308
      End If
309
   Next
310
End Function
311
'--------------------------------------------------------------------------------------------------------------------------
312
' Use this function to set/clear the filter on/off radio button checked state
313
' Format of Filter Param : Filter=[problemBuilds}[,ActiveBuilds]
314
Function Display_Filtered(id)
315
   Dim filter
316
 
317
   Display_Filtered = ""
318
 
319
   filter  = Request("Filter")
320
   If NOT IsNull(filter) AND filter <> "" Then
321
      If InStr(filter, id) > 0 Then
322
         Display_Filtered = "checked"
323
      End If
324
   Else
325
      If id = "OFF" Then
326
         Display_Filtered = "checked"
327
      End If
328
   End If
329
End Function
330
 
331
'--------------------------------------------------------------------------------------------------------------------------
332
' Use this function to set/clear a filter option check box with the given ID
333
' If no Filter is present, then assume defaults          
334
Function Filter_Checked(id)
335
   Dim filter
336
 
337
   Filter_Checked = ""
338
 
339
   filter  = Request("Filter")
340
   If IsNull(filter) OR filter = "" Then
341
     filter="problemBuilds,activeBuilds"        ' Defaults
342
   End If
343
  If InStr(filter, id) > 0 Then
344
     Filter_Checked = "checked"
345
  End If
346
End Function
347
'--------------------------------------------------------------------------------------------------------------------------
348
' Test to see if a particular filter option is on
349
Function Filter_Is_On(id)
350
    If Filter_Checked(id) = "checked" Then
351
          Filter_Is_On = True
352
    Else
353
          Filter_Is_On = False
354
    End If
355
End Function
356
'--------------------------------------------------------------------------------------------------------------------------
357
Function Indefinitely_Paused()
358
   Dim rsQry2
359
   Dim query_string2
360
 
361
   Indefinitely_Paused = False
362
 
363
   query_string2 = " select * from run_level_schedule rls where rls.indefinite_pause = 'P'"
364
 
365
   Set rsQry2 = OraDatabase.DbCreateDynaset( query_string2, ORADYN_DEFAULT )
366
   If rsQry2.RecordCount > 0 Then
367
      Indefinitely_Paused = True
368
   End If
369
End Function
370
'--------------------------------------------------------------------------------------------------------------------------
371
Function PrettyDelta( delta, daemonState,pkgId )
372
    Dim style,nDelta
373
    style = ""
374
 
375
    If delta = "" Then delta = 0
376
    delta = Int(delta)
377
    nDelta = delta
378
 
379
    If (delta > Max_Delta) AND (IsNull(pkgId) OR pkgId = "") Then
380
      style = "style=color:Red"
381
      If (delta > 86400 ) Then
382
        Dim bdate, dd,mm,yy
383
        bdate = DateAdd("s", - delta,Now())
384
        dd = Day(bdate)
385
        mm = MonthName(Month(bdate),1)
386
        yy = Year( bdate)
387
        delta = dd & "-" & mm & "-" & yy
388
        If ( daemonState >= 2 ) Then
389
            style = ""
390
        End If
391
      ElseIf ( delta > 60*60 ) Then
392
        'Dim bdate, hh, mins, ss
393
        bdate = DateAdd("s", - delta,Now())
394
        delta = TimeValue( bdate)
395
        'delta = hh & ":" & mins & ":" & ss
396
      End If
397
    End If
398
 
399
    If style <> "" Then
400
        delta = "<span " & style & ">" & delta & "</span>"
401
    End If
402
    PrettyDelta = delta 
403
End Function
404
 
405
'--------------------------------------------------------------------------------------------------------------------------
406
 
407
%>
408
<%
409
'------------ RUN BEFORE PAGE RENDER ----------
410
 
411
' Default values for Auto Refresh checkbox and edit input box
412
param_refreshEnabled = False
413
param_refreshPeriod  = "0"
414
 
415
' Read the Refresh parameter which is of the form Refresh=<time-period>,ON|OFF
416
Dim param_refresh
417
param_refresh = Request("Refresh")
418
If param_refresh <> "" Then
419
   Dim pr_arr
420
   pr_arr = Split(param_refresh,",")
421
   param_refreshPeriod = pr_arr(0)
422
 
423
   ' Range check and end-stop the refresh period if necessary
5814 dpurdie 424
   If NiceInt(param_refreshPeriod, 0)  < Min_Refresh_Time Then
5357 dpurdie 425
      param_refreshPeriod  = CStr(Min_Refresh_Time)
426
   End If
427
 
428
   ' determine checkbox state
429
   If UBound(pr_arr) >= 1 Then
430
      If InStr(UCase(pr_arr(1)), "ON") > 0 Then
431
         param_refreshEnabled = True
432
      Else
433
         param_refreshEnabled = False
434
      End If
435
   End If
436
End If
437
 
438
' Read the Inactivity Period
439
param_inactivity = NiceInt( Request("Inactivity"), Max_DeltaBuild)
440
If param_inactivity  = 0 Then param_inactivity = Max_DeltaBuild
441
 
442
 
443
' Get indefinite pause status
444
bIndefinitelyPaused = Indefinitely_Paused()
445
 
446
' Populate display controls
447
bShowProblemDaemonSets = Filter_Is_On("problemBuilds")
448
bShowActiveBuilds      = Filter_Is_On("activeBuilds")
449
bShowDisabledDaemons   = Filter_Is_On("disabledDaemons")
450
bShowIdleBuilds        = Filter_Is_On("idleBuilds")
451
bShowPausedBuilds      = Filter_Is_On("pausedBuilds")
452
 
453
'----------------------------------------------
454
%>
455
<script language="JavaScript" type="text/javascript">
456
<!--
457
 
458
//////////////////////////////////////////////////////////////////////////////////////////////////
459
// This function rebuilds the query string so that it either adds or removes the specified project ID from
460
// the HideProj= part of it, whilst leaving the rest of the string intact. The browser location is then
461
// updated and the server made to re-render the page. This function must be used from the project checkboxes
462
// to show/hide daemon status informaton for specific projects.
463
//////////////////////////////////////////////////////////////////////////////////////////////////
464
function toggle_project( proj_id )
465
{
466
   var found = false;
467
   var new_url_query_string = '';
468
   var new_hp_list = '';
469
 
470
   // get the full query string
471
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
472
 
473
   // split it into each parameter
474
   var qs_arr = url_query_string.split('&');
475
   var i_qs_arr;
476
   for (i_qs_arr in qs_arr)
477
   {
478
      var qs_str = qs_arr[i_qs_arr];
479
 
480
      if (qs_str.length > 0)
481
      {
482
         // if we have found the HideProj parameter
483
         if (qs_str.indexOf('HideProj') >= 0)
484
         {
485
            // Split the HideProj parameter at the = symbol in order to process the comma seperated list of project IDs
486
            var qs_hp_arr;
487
            qs_hp_arr = qs_str.split('=');
488
            if (qs_hp_arr.length > 1)
489
            {
490
               // Split the comma seperated list of project IDs, and iterate through each item
491
               var hp_arr = qs_hp_arr[1].split(',');
492
               var i_hp_arr;
493
               for (i_hp_arr in hp_arr)
494
               {
495
                  var hp_str = hp_arr[i_hp_arr];
496
 
497
                  // If the item matches the specified project ID and the checkbox for that project is unchecked
498
                  if (hp_str == proj_id)
499
                  {
500
                     found = true;
501
                  }
502
                  else
503
                  {
504
                     // retain this other project ID in the list
505
                     if (new_hp_list != '')
506
                        new_hp_list += ',';
507
                     new_hp_list += hp_str;
508
                  }
509
               }
510
            }
511
         }
512
         else
513
         {
514
            // feed the existing paramter to the new query string
515
            if (new_url_query_string == '')
516
               new_url_query_string += '?';
517
            else
518
               new_url_query_string += '&';
519
            new_url_query_string += qs_str
520
         }
521
      }
522
   }
523
 
524
   // If the specified project ID was not found, then that project is not currently hidden
525
   // and must now be hidden, so add its number to the list to hide it on the next server side
526
   // page render operation
527
   if (!found)
528
   {
529
      if (new_hp_list != '')
530
         new_hp_list += ',';
531
      new_hp_list += proj_id
532
   }
533
 
534
   // Prepare the new query string
535
   if (new_url_query_string == '')
536
      new_url_query_string += '\?';
537
   else
538
      new_url_query_string += '\&';
539
 
540
   new_url_query_string += 'HideProj=';
541
   new_url_query_string += new_hp_list;
542
 
543
   // reload the page with the new query string
544
   var url = location.pathname + new_url_query_string;
545
   window.location.assign(url);
546
}
547
 
548
//////////////////////////////////////////////////////////////////////////////////////////////////
549
// This function rebuilds the query string to either hide all projects, or unhide all projects
550
// fromt he display
551
//////////////////////////////////////////////////////////////////////////////////////////////////
552
function toggle_all_projects(bAll)
553
{
554
   var new_url_query_string = '';
555
   var list_proj_ids = '';
556
 
557
   // If hiding all, then find all of the project enable/disable checkboxes, get the project ID
558
   // values from each one and accumulate them into a comma seperated list
559
   if (!bAll)
560
   {
561
      var inputs = document.getElementsByTagName('input');
562
      var i;
563
      for (i = 0; i < inputs.length; i++)
564
      {
565
         var str = inputs[i].name;
566
         if (str.indexOf("DIS_PRJ_") >= 0)
567
         {
568
            str = str.replace("DIS_PRJ_","");
569
            if (list_proj_ids != '')
570
               list_proj_ids += ',' + str;
571
            else
572
               list_proj_ids += str;
573
         }
574
      }
575
   }
576
 
577
   // get the full query string
578
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
579
 
580
   // split it into each parameter
581
   var qs_arr = url_query_string.split('&');
582
   var i_qs_arr;
583
   for (i_qs_arr in qs_arr)
584
   {
585
      var qs_str = qs_arr[i_qs_arr];
586
 
587
      if (qs_str.length > 0)
588
      {
589
         // if we have found the HideProj parameter
590
         if (qs_str.indexOf('HideProj') >= 0)
591
         {
592
            // do nothing
593
         }
594
         else
595
         {
596
            // feed the existing paramter to the new query string
597
            if (new_url_query_string == '')
598
               new_url_query_string += '?';
599
            else
600
               new_url_query_string += '&';
601
            new_url_query_string += qs_str
602
         }
603
      }
604
   }
605
 
606
   // Prepare the new query string, only adding the HideProj parameter if the function is being
607
   // used to hide all projects
608
   if (!bAll)
609
   {
610
      if (new_url_query_string == '')
611
         new_url_query_string += '\?';
612
      else
613
         new_url_query_string += '\&';
614
 
615
      new_url_query_string += 'HideProj=' + list_proj_ids;
616
   }
617
   // reload the page with the new query string
618
   var url = location.pathname + new_url_query_string;
619
   window.location.assign(url);
620
}
621
 
622
//////////////////////////////////////////////////////////////////////////////////////////////////
623
// This function rebuilds the query string so that it either adds or removes the Refresh parameter
624
//////////////////////////////////////////////////////////////////////////////////////////////////
625
function toggle_refresh()
626
{
627
   var new_url_query_string = '';
628
 
629
   // get the full query string
630
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
631
 
632
   // split it into each parameter
633
   var qs_arr = url_query_string.split('&');
634
   var i_qs_arr;
635
   for (i_qs_arr in qs_arr)
636
   {
637
      var qs_str = qs_arr[i_qs_arr];
638
 
639
      if (qs_str.length > 0)
640
      {
641
         // if we have found the Refresh parameter
642
         if (qs_str.indexOf('Refresh') >= 0)
643
         {
644
            // do nothing
645
         }
646
         else
647
         {
648
            // feed the existing paramter to the new query string
649
            if (new_url_query_string == '')
650
               new_url_query_string += '?';
651
            else
652
               new_url_query_string += '&';
653
            new_url_query_string += qs_str
654
         }
655
      }
656
   }
657
 
658
   // Prepare the new query string
659
 
660
   if (new_url_query_string == '')
661
      new_url_query_string += '\?';
662
   else
663
      new_url_query_string += '\&';
664
 
665
   new_url_query_string += 'Refresh=';
666
   if (document.getElementById('refreshPeriod').value < <%=Min_Refresh_Time%>)
667
   {
668
      document.getElementById('refreshPeriod').value = <%=Min_Refresh_Time%>;
669
      new_url_query_string += <%=Min_Refresh_Time%>;
670
   }
671
   else
672
      new_url_query_string += document.getElementById('refreshPeriod').value;
673
 
674
   if (document.getElementById('autoRefresh').checked)
675
      new_url_query_string += ',ON';
676
   else
677
      new_url_query_string += ',OFF';
678
 
679
   // reload the page with the new query string
680
   var url = location.pathname + new_url_query_string;
681
   window.location.assign(url);
682
}
683
 
684
 
685
//////////////////////////////////////////////////////////////////////////////////////////////////
686
// This function rebuilds the query string to Update the Inactivity parameter
687
//////////////////////////////////////////////////////////////////////////////////////////////////
688
function toggle_inactivity()
689
{
690
   var new_url_query_string = '';
691
 
692
   // get the full query string
693
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
694
 
695
   // split it into each parameter, then remove the Inactivity parameter
696
   var qs_arr = url_query_string.split('&');
697
   var qs_join = '?'
698
   var i_qs_arr;
699
   for (i_qs_arr in qs_arr)
700
   {
701
      var qs_str = qs_arr[i_qs_arr];
702
      if (qs_str.length > 0)
703
      {
704
         if (qs_str.indexOf('Inactivity') < 0)
705
         {
706
            // feed the existing paramter to the new query string
707
            new_url_query_string += qs_join + qs_str
708
            qs_join = '&'
709
         }
710
      }
711
   }
712
 
713
   var value = document.getElementById('inactivity').value;
714
   if  (value && (value != <%=Max_DeltaBuild%>))
715
   {
716
       // Prepare the new query string
717
        new_url_query_string += qs_join + 'Inactivity=' + value;
718
    }
719
 
720
   // reload the page with the new query string
721
   var url = location.pathname + new_url_query_string;
722
   window.location.assign(url);
723
}
724
 
725
 
726
//////////////////////////////////////////////////////////////////////////////////////////////////
727
// Rebuild the query string and reload the page based on the current setting of the filter
728
// radio buttons
729
//////////////////////////////////////////////////////////////////////////////////////////////////
730
function update_Display_Filter()
731
{
732
   var new_url_query_string = '';
733
 
734
   // get the full query string
735
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
736
 
737
   // split it into each parameter
738
   var qs_arr = url_query_string.split('&');
739
   var i_qs_arr;
740
   for (i_qs_arr in qs_arr)
741
   {
742
      var qs_str = qs_arr[i_qs_arr];
743
 
744
      if (qs_str.length > 0)
745
      {
746
         // if we have found the Display parameter
747
         if (qs_str.indexOf('Filter') >= 0)
748
         {
749
            // do nothing
750
         }
751
         else
752
         {
753
            // feed the existing paramter to the new query string
754
            if (new_url_query_string == '')
755
               new_url_query_string += '?';
756
            else
757
               new_url_query_string += '&';
758
            new_url_query_string += qs_str
759
         }
760
      }
761
   }
762
 
763
   // Prepare the new query string
764
   var qJoiner;
765
   if (new_url_query_string == '')
766
      qJoiner = '\?';
767
   else
768
      qJoiner = '\&';
769
 
770
   var joiner = '';
771
   var filterSet = '';
772
   var items = new Array ("activeBuilds","disabledDaemons","idleBuilds","pausedBuilds","problemBuilds");
773
   for (var item in items)
774
   {
775
       if (document.getElementById(items[item]).checked)
776
       {
777
          filterSet += joiner + items[item];
778
          joiner = ',';
779
       }
780
   }
781
 
782
   if (filterSet.length > 0)
783
   {
784
       new_url_query_string += qJoiner + 'Filter=' + filterSet;
785
   }
786
 
787
   // reload the page with the new query string
788
   var url = location.pathname + new_url_query_string;
789
   window.location.assign(url);
790
}
791
 
792
//-->
793
</script>
794
 
795
<html>
796
   <head>
797
      <title>Release Manager</title>
798
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
799
      <meta http-equiv="Pragma" content="no-cache">
800
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
801
      <%If param_refreshEnabled AND param_RefreshPeriod <> 0 Then%>
802
         <META HTTP-EQUIV=REFRESH CONTENT=<%=param_RefreshPeriod%>>
803
      <%End If%>
804
      <link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
805
      <link rel="stylesheet" href="images/navigation.css" type="text/css">
806
      <script language="JavaScript" src="images/common.js"></script>
5983 dpurdie 807
      <!--#include file="_jquery_includes.asp"-->
5357 dpurdie 808
      <!-- DROPDOWN MENUS -->
809
      <!--#include file="_menu_def.asp"-->
810
      <script language="JavaScript1.2" src="images/popup_menu.js"></script>
811
   </head>
812
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
813
      <!-- MENU LAYERS -------------------------------------->
814
      <div id="popmenu" class="menuskin" onmouseover="clearhidemenu();highlightmenu(event,'on')" onmouseout="highlightmenu(event,'off');dynamichide(event)"></div>
815
      <!-- TIPS LAYERS -------------------------------------->
816
      <div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
817
      <!----------------------------------------------------->
818
      <!-- HEADER -->
819
      <!--#include file="_header.asp"-->
820
      <% getBuildStatus() %>
821
      <!-- BODY ---->
822
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
823
         <tr>
5814 dpurdie 824
            <td width="1" background="images/bg_home_orange.gif" valign="top">
825
                <!-- Monitoring Options Selection Box ---->
826
                 <fieldset style="padding:3px">
827
                    <legend class="body_scol">Display Options</legend>
828
                     <fieldset class="body_rowg">
829
                        <legend class="body_scol">Auto Refresh</legend>
830
                             <div class=nowrap>
831
                             <input name="autoRefresh" id="autoRefresh" type="checkbox" <%If param_refreshEnabled Then%>checked<%End If%> value="1" onclick='toggle_refresh()'>
832
                                 <input class="body_txt" style="width:3em" name="refreshPeriod" id="refreshPeriod" type="input" maxlength="3" value="<%=param_refreshPeriod%>" onchange='toggle_refresh()' > Seconds
833
                             </div>
834
                     </fieldset>
835
                     <fieldset class="body_rowg">
836
                        <legend class="body_scol">Filter</legend>
837
                            <div>
838
                                 <input name="activeBuilds" id="activeBuilds" type="checkbox" <%=Filter_Checked("activeBuilds")%> value="activeBuilds" onclick='update_Display_Filter()'>Active
839
                            </div>
840
                            <div>
841
                                 <input name="idleBuilds" id="idleBuilds" type="checkbox" <%=Filter_Checked("idleBuilds")%> value="idleBuilds" onclick='update_Display_Filter()'>Idle
842
                            </div>
843
                            <div>
844
                                 <input name="pausedBuilds" id="pausedBuilds" type="checkbox" <%=Filter_Checked("pausedBuilds")%> value="paused" onclick='update_Display_Filter()'>Paused
845
                            </div>
846
                            <div>
847
                                 <input name="disabledDaemons"  id="disabledDaemons"  type="checkbox" <%=Filter_Checked("disabledDaemons")%>  value="disabledDaemons"  onclick='update_Display_Filter()'>Disabled
848
                            </div>
849
                            <div class=nowrap>
850
                                 <input name="problemBuilds"  id="problemBuilds"  type="checkbox" <%=Filter_Checked("problemBuilds")%>  value="problemBuilds"  onclick='update_Display_Filter()'>Problem&nbsp;Daemon&nbsp;Sets
851
                            </div>
852
                     </fieldset>
853
                     <fieldset class="body_rowg">
854
                        <legend  class="body_scol">Inactivity</legend>
855
                                 <input class="body_txt" style="width:3em" name="inactivity" id="inactivity" type="input" maxlength="3" value="<%=param_inactivity%>" onchange='toggle_inactivity()' > Days
856
                     </fieldset>
857
                </fieldset>
858
            </td>
5357 dpurdie 859
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
860
 
861
               <table width="10" border="0" cellspacing="0" cellpadding="0">
862
                  <tr>
863
                     <td width="1%"></td>
864
                     <td width="100%">
865
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
866
                           <tr>
5814 dpurdie 867
                              <td nowrap class="form_ttl">
5357 dpurdie 868
                                 <p>BUILD DAEMON STATUS INFORMATION</p>
869
                              </td>
870
                              <td align="right" valign="bottom"></td>
871
                           </tr>
872
 
873
                           <%If bIndefinitelyPaused Then%>
874
                              <tr>
875
                                 <td>
876
                                    <span class='err_alert'>
877
                                       <font size='2'><b>WARNING: Indefinite Pause, Build Daemons are all stopped - please contact an administrator</b></font>
878
                                    </span>
879
                                 </td>
880
                              </tr>
881
                           <%End If%>
882
                        </table>
883
                     </td>
884
                     <td width="1%"></td>
885
                  </tr>
886
                  <tr>
887
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
888
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
889
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
890
                  </tr>
891
                  <tr>
892
                     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
893
                     <td bgcolor="#FFFFFF" valign="top">
894
                        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
895
                        <!--#include file="messages/_msg_inline.asp"-->
896
                        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
897
                        <br>
898
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
899
                           <td width="9%" valign="top"></td>
900
                           <tr>
901
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Project
902
                                 <input name="NOPRJ" id="NOPRJ" type="Button" value="All" onclick="toggle_all_projects(1)">
903
                                 <input name="NOPRJ" id="NOPRJ" type="Button" value="None" onclick="toggle_all_projects(0)">
904
                              </td>
905
                              <!-- Status Table Header -->
906
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release</td>
907
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release<br>Mode</td>
908
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Mode</td>
909
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Host</td>
910
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>State</td>
911
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Building<br>Package</td>
912
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<br>Delta (secs)</td>
913
                           </tr>
914
 
915
                           <!-- Status Table Body -->
916
                           <%
917
                            Dim bProject_changed          ' Signals a row change due to a different project
918
                            Dim strProject_checked        ' Can be "" or "checked". Determines appearance of project enable checkbox
919
                            Dim bRelease_changed          ' signals a row change due to a different release
920
                            Dim bReleaseHeaderDone        ' indicates whether the release name has been rendered yet
921
                            Dim bProjectHeaderDone        ' Project Header done
922
                            Dim bShowAge                  ' Display age warning
923
                            Dim bToggleStyle              ' Data shown so toggle style
924
                            Dim bShowReleaseSep           ' Show Release Seperator
925
 
926
                            '   Iterate over all projects, releases and machines
927
                            '
928
                            Dim project,release,machine
929
                            Dim eProject,eRelease,eMachine
930
                            For Each project in buildStatus
931
                                ' Start of a new Project
932
                                Set eProject = buildStatus.Item(project)
933
                                bProjectHeaderDone = false
934
                                bProject_changed = true
935
                                bShowReleaseSep = False
936
 
937
                                For Each release in eProject.Item("data")
938
                                    '   Start of a new Release
939
                                    Set eRelease = eProject.Item("data").Item(release)
940
                                    bReleaseHeaderDone = False
941
                                    bRelease_changed = true
942
                                    bShowAge = eRelease("bShowAge")
943
                                    If  bToggleStyle Then Call ToggleStyleNow
944
                                    bToggleStyle = false
945
 
946
                                    For Each machine in eRelease.Item("data")
947
                                        '   Start of a new Machine
948
                                        Set eMachine = eRelease.Item("data").Item(machine)
949
                                        strProject_checked = Is_Project_Checked(eMachine("PROJ_ID"))
950
 
951
                                        ' Display Project Header - ONCE
952
                                        If NOT bProjectHeaderDone Then%>
953
                                            <tr>
954
                                               <td colspan='8'><img src='images/spacer.gif' width='1' height='5'></td>
955
                                            </tr>
956
                                            <tr>
957
                                               <td colspan='8' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='5'></td>
958
                                            </tr>
959
                                            <tr>
960
                                                <td nowrap class="body_rowg">
961
                                                    <input name='DIS_PRJ_<%=eMachine("PROJ_ID")%>' id='DIS_PRJ_<%=eMachine("PROJ_ID")%>' type='checkbox' value=1 <%=strProject_checked%> onclick=toggle_project(<%=eMachine("PROJ_ID")%>)>
962
                                                    <a href='rtree.asp?proj_id=<%=eMachine("PROJ_ID")%>'><%=eMachine("PROJ_NAME")%>
963
                                                </td>
964
                                            <%
965
                                        End If
966
 
967
                                        ' Consider displaying the body of this machine entry
968
                                        If strProject_checked = "checked" Then
969
                                            If eRelease.Exists("bDisplay_whole_set") OR eMachine.Exists("bRow_displayed") Then
970
                                                bToggleStyle = true
971
 
972
                                                '   Empty cell, if the project header has been displayed
973
                                                If bProjectHeaderDone Then
974
                                                    %><td nowrap class="body_rowg"></td><%
975
                                                End If
976
 
977
                                                ' Display Release Header - Once, or a filler
978
                                                If NOT bReleaseHeaderDone Then
979
                                                    bReleaseHeaderDone = True
980
 
981
                                                    ' Display Release seperator, if this is not the first release in the project
982
                                                    If bShowReleaseSep Then
983
                                                        %>
984
                                                            <tr>
985
                                                                <td></td>
986
                                                                <td colspan='7' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='1'></td>
987
                                                            </tr>
988
                                                            <tr>
989
                                                                <td></td>
990
                                                        <%
991
                                                    End If
992
                                                    ' Display the Release Header, with a marker to show aged releases
993
                                                    %>
994
                                                    <td nowrap <%=styleNow%>>
995
                                                        <a href='build_status.asp?rtag_id=<%=eMachine("RTAG_ID")%>' title='Last Build:<%=eMachine("last_build")%>'><%=eMachine("RTAG_NAME")%></a>
996
                                                    <%
997
                                                    If bShowAge Then
998
                                                    %>
999
                                                        <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;'>
1000
                                                    <%
1001
                                                    End If
1002
                                                    %></td><%
1003
                                                Else
1004
                                                    %><td nowrap <%=styleNow%>></td><%
1005
                                                End If
1006
                                                bShowReleaseSep = true
1007
                                                %>
1008
                                                <td nowrap <%=styleNow%>><%=Get_Official(eMachine("OFFICIAL"))%></td>
1009
                                                <td nowrap <%=styleNow%>><%=Get_Daemon_Mode(eMachine("DAEMON_MODE"))%></td>
1010
                                                <td nowrap <%=styleNow%>><%=eMachine("DISPLAY_NAME")%></td>
1011
                                                <td nowrap <%=styleNow%>><%=eMachine("dStateText")%></td>
1012
                                                <td nowrap <%=styleNow%>><%=eMachine("PKG_NAME")%></td>
1013
                                                <td nowrap <%=styleNow%>><%=PrettyDelta(eMachine("delta"),eMachine("PAUSE"),eMachine("PKG_NAME") )%></td>
1014
                                                <%
1015
                                            End If
1016
                                            %></tr><%
1017
                                        End If
1018
 
1019
                                        ' End of Display
1020
                                        bRelease_changed = false
1021
                                        bProject_changed = false
1022
                                        bProjectHeaderDone = true
1023
                                    Next
1024
                                Next
1025
                            Next
1026
                           %>
1027
                        </table>
1028
                     <!-- Status Table Footer -->
1029
                     </td>
1030
                     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
1031
                  </tr>
1032
                  <tr>
1033
                     <input type="hidden" name="action" value="true">
1034
                     <%=objPMod.ComposeHiddenTags()%>
1035
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
1036
                     <td background="images/lbox_bg_blue.gif"></td>
1037
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
1038
                  </tr>
1039
               </table>
1040
            </td>
1041
            <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
1042
         </tr>
1043
         <tr>
1044
            <td valign="bottom" align="center" background="images/bg_home_orange.gif"><img src="images/img_gear.gif" width="86" height="99" vspace="20" hspace="30"></td>
1045
            <td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="350"></td>
1046
         </tr>
1047
      </table>
1048
      <!-- FOOTER -->
1049
      <!--#include file="_footer.asp"-->
1050
   </body>
1051
</html>