Subversion Repositories DevTools

Rev

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