Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
5357 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|         ADMIN Build Status Information            |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
' Good idea to set when using redirect
12
Response.Expires = 0  ' always load the page, dont store
13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/_form_window_common.asp"-->
6166 dpurdie 20
<!--#include file="common/common_daemon.asp"-->
5357 dpurdie 21
<%
22
'------------ ACCESS CONTROL ------------------
23
%>
6181 dpurdie 24
<!--#include file="_access_control_login_optional.asp"-->
5357 dpurdie 25
<!--#include file="_access_control_general.asp"-->
26
<%
27
'------------ Variable Definition -------------
28
Dim rsQry
29
Dim query_string
30
Dim styleAlt1
31
Dim styleAlt2
32
Dim styleNow
33
Dim param_refreshPeriod
34
Dim param_inactivity
35
Dim param_refreshEnabled
36
Dim bIndefinitelyPaused
37
Dim buildStatus
38
 
39
Dim bShowProblemDaemonSets    ' Indicates if problem daemons must be shown during filtering
40
Dim bShowDisabledDaemons      ' Indicates if a disabled daemon must be shown during filtering
41
Dim bShowActiveBuilds         ' Indicates if active builds must be shown during filtering
42
Dim bShowIdleBuilds           ' Indicates if idle builds must be shown during filtering
43
Dim bShowPausedBuilds         ' Indicates if paused builds must be shown during filtering
44
 
45
'------------ Constants Declaration -----------
46
Const Min_Refresh_Time = 10         ' Seconds
47
Const Max_DeltaBuild = 31           ' Days
48
'------------ Variable Init -------------------
49
 
50
styleAlt1="class='body_rowg1'"
51
styleAlt2="class='body_rowg2'"
52
styleNow = styleAlt1
53
'----------------------------------------------
54
%>
55
<%
56
'------------------------------------------------------------------------------
57
'   Populate the buildStatus dictionary
58
'   Get all the required data into a hash of hashes
59
'   It will make the following processing so much easier
60
'
61
Sub getBuildStatus
62
    Dim bms
63
    query_string = "SELECT rc.RCON_ID, " &_
64
                  "       rc.RTAG_ID, " &_
65
                  "       bm.DISPLAY_NAME, " &_
66
                  "       rc.DAEMON_MODE, "&_
67
                  "       rt.RTAG_NAME, " &_
68
                  "       rt.OFFICIAL, " &_
69
                  "       rt.BUILD_AGE, " &_
70
                  "       p.PROJ_ID, " &_
71
                  "       p.PROJ_NAME, " &_
72
                  "       rl.CURRENT_PKG_ID_BEING_BUILT, "&_
73
                  "       rl.CURRENT_RUN_LEVEL, "&_
74
                  "       NVL(rl.PAUSE,0) as PAUSE, " &_
75
                  "       TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta," &_
76
                  "       TO_CHAR(rl.LAST_BUILD, 'DD-MON-YYYY') as last_build," &_
77
                  "       TRUNC (SYSDATE - rl.LAST_BUILD) as last_build_days," &_
78
                  "       pkg.PKG_NAME" &_
79
                  " FROM RELEASE_CONFIG rc, RELEASE_TAGS rt, PROJECTS p, RUN_LEVEL rl, BUILD_MACHINE_CONFIG bm, PACKAGES pkg " &_
80
                  " WHERE rt.RTAG_ID = rc.RTAG_ID " &_
81
                  "   AND rc.bmcon_id is not null" &_
82
                  "   AND rt.PROJ_ID = p.PROJ_ID " &_
5623 dpurdie 83
                  "   AND rt.OFFICIAL in ( 'N', 'R', 'C')" &_
5357 dpurdie 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 filter state as a string
222
' Will be one of: active, idle, paused, disabled, problem, unknown
223
Function Classify_Run_Level( nLevel, indefinitePause, astate, nDelta, pkgId)
224
 
225
   If indefinitePause Then
226
      Classify_Run_Level = "problem"
227
   ElseIf astate = 1 Then                   ' if build daemon paused
228
      Classify_Run_Level = "paused"
229
   ElseIf astate = 2 Then                   ' if build daemon disabled
230
      Classify_Run_Level = "disabled"
231
   ElseIf Int(nDelta) > Max_Delta Then
232
      Classify_Run_Level = "problem"
233
   ElseIf (IsNull(pkgId)) OR (pkgId = "") Then
234
      Classify_Run_Level = "idle"
235
   ElseIf astate = 0 Then                   ' if build daemon enabled
236
      If nLevel = 1 Then
237
         Classify_Run_Level = "problem"
238
      ElseIf nLevel = 2 Then
239
         Classify_Run_Level = "paused"
240
      ElseIf nLevel = 3 Then
241
         Classify_Run_Level = "active"
242
      ElseIf nLevel = 4 Then
243
         Classify_Run_Level = "idle"
244
      ElseIf nLevel = 5 Then
245
         Classify_Run_Level = "idle"
246
      ElseIf nLevel = 6 Then
247
         Classify_Run_Level = "active"
248
      Else
249
         Classify_Run_Level = "unknown"
250
      End If
251
   End If
252
End Function
253
 
254
'--------------------------------------------------------------------------------------------------------------------------
255
' Use this function to determine the state of a specified project checkbox
256
Function Is_Project_Checked( nProjId )
257
   Dim hiddenProjects_arr
258
   Dim hiddenProjects
259
   Dim str
260
 
261
   hiddenProjects = Request("HideProj")
262
   Is_Project_Checked = "checked"
263
 
264
   hiddenProjects_arr = Split(hiddenProjects, ",")
265
   For Each str in hiddenProjects_arr
266
      If str = nProjId Then
267
         Is_Project_Checked = ""
268
         Exit For
269
      End If
270
   Next
271
End Function
272
'--------------------------------------------------------------------------------------------------------------------------
273
' Use this function to set/clear the filter on/off radio button checked state
274
' Format of Filter Param : Filter=[problemBuilds}[,ActiveBuilds]
275
Function Display_Filtered(id)
276
   Dim filter
277
 
278
   Display_Filtered = ""
279
 
280
   filter  = Request("Filter")
281
   If NOT IsNull(filter) AND filter <> "" Then
282
      If InStr(filter, id) > 0 Then
283
         Display_Filtered = "checked"
284
      End If
285
   Else
286
      If id = "OFF" Then
287
         Display_Filtered = "checked"
288
      End If
289
   End If
290
End Function
291
 
292
'--------------------------------------------------------------------------------------------------------------------------
293
' Use this function to set/clear a filter option check box with the given ID
294
' If no Filter is present, then assume defaults          
295
Function Filter_Checked(id)
296
   Dim filter
297
 
298
   Filter_Checked = ""
299
 
300
   filter  = Request("Filter")
301
   If IsNull(filter) OR filter = "" Then
302
     filter="problemBuilds,activeBuilds"        ' Defaults
303
   End If
304
  If InStr(filter, id) > 0 Then
305
     Filter_Checked = "checked"
306
  End If
307
End Function
308
'--------------------------------------------------------------------------------------------------------------------------
309
' Test to see if a particular filter option is on
310
Function Filter_Is_On(id)
311
    If Filter_Checked(id) = "checked" Then
312
          Filter_Is_On = True
313
    Else
314
          Filter_Is_On = False
315
    End If
316
End Function
317
'--------------------------------------------------------------------------------------------------------------------------
318
%>
319
<%
320
'------------ RUN BEFORE PAGE RENDER ----------
321
 
322
' Default values for Auto Refresh checkbox and edit input box
323
param_refreshEnabled = False
324
param_refreshPeriod  = "0"
325
 
326
' Read the Refresh parameter which is of the form Refresh=<time-period>,ON|OFF
327
Dim param_refresh
328
param_refresh = Request("Refresh")
329
If param_refresh <> "" Then
330
   Dim pr_arr
331
   pr_arr = Split(param_refresh,",")
332
   param_refreshPeriod = pr_arr(0)
333
 
334
   ' Range check and end-stop the refresh period if necessary
5814 dpurdie 335
   If NiceInt(param_refreshPeriod, 0)  < Min_Refresh_Time Then
5357 dpurdie 336
      param_refreshPeriod  = CStr(Min_Refresh_Time)
337
   End If
338
 
339
   ' determine checkbox state
340
   If UBound(pr_arr) >= 1 Then
341
      If InStr(UCase(pr_arr(1)), "ON") > 0 Then
342
         param_refreshEnabled = True
343
      Else
344
         param_refreshEnabled = False
345
      End If
346
   End If
347
End If
348
 
349
' Read the Inactivity Period
350
param_inactivity = NiceInt( Request("Inactivity"), Max_DeltaBuild)
351
If param_inactivity  = 0 Then param_inactivity = Max_DeltaBuild
352
 
353
 
354
' Get indefinite pause status
355
bIndefinitelyPaused = Indefinitely_Paused()
356
 
357
' Populate display controls
358
bShowProblemDaemonSets = Filter_Is_On("problemBuilds")
359
bShowActiveBuilds      = Filter_Is_On("activeBuilds")
360
bShowDisabledDaemons   = Filter_Is_On("disabledDaemons")
361
bShowIdleBuilds        = Filter_Is_On("idleBuilds")
362
bShowPausedBuilds      = Filter_Is_On("pausedBuilds")
363
 
364
'----------------------------------------------
365
%>
366
<script language="JavaScript" type="text/javascript">
367
<!--
368
 
369
//////////////////////////////////////////////////////////////////////////////////////////////////
370
// This function rebuilds the query string so that it either adds or removes the specified project ID from
371
// the HideProj= part of it, whilst leaving the rest of the string intact. The browser location is then
372
// updated and the server made to re-render the page. This function must be used from the project checkboxes
373
// to show/hide daemon status informaton for specific projects.
374
//////////////////////////////////////////////////////////////////////////////////////////////////
375
function toggle_project( proj_id )
376
{
377
   var found = false;
378
   var new_url_query_string = '';
379
   var new_hp_list = '';
380
 
381
   // get the full query string
382
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
383
 
384
   // split it into each parameter
385
   var qs_arr = url_query_string.split('&');
386
   var i_qs_arr;
387
   for (i_qs_arr in qs_arr)
388
   {
389
      var qs_str = qs_arr[i_qs_arr];
390
 
391
      if (qs_str.length > 0)
392
      {
393
         // if we have found the HideProj parameter
394
         if (qs_str.indexOf('HideProj') >= 0)
395
         {
396
            // Split the HideProj parameter at the = symbol in order to process the comma seperated list of project IDs
397
            var qs_hp_arr;
398
            qs_hp_arr = qs_str.split('=');
399
            if (qs_hp_arr.length > 1)
400
            {
401
               // Split the comma seperated list of project IDs, and iterate through each item
402
               var hp_arr = qs_hp_arr[1].split(',');
403
               var i_hp_arr;
404
               for (i_hp_arr in hp_arr)
405
               {
406
                  var hp_str = hp_arr[i_hp_arr];
407
 
408
                  // If the item matches the specified project ID and the checkbox for that project is unchecked
409
                  if (hp_str == proj_id)
410
                  {
411
                     found = true;
412
                  }
413
                  else
414
                  {
415
                     // retain this other project ID in the list
416
                     if (new_hp_list != '')
417
                        new_hp_list += ',';
418
                     new_hp_list += hp_str;
419
                  }
420
               }
421
            }
422
         }
423
         else
424
         {
425
            // feed the existing paramter to the new query string
426
            if (new_url_query_string == '')
427
               new_url_query_string += '?';
428
            else
429
               new_url_query_string += '&';
430
            new_url_query_string += qs_str
431
         }
432
      }
433
   }
434
 
435
   // If the specified project ID was not found, then that project is not currently hidden
436
   // and must now be hidden, so add its number to the list to hide it on the next server side
437
   // page render operation
438
   if (!found)
439
   {
440
      if (new_hp_list != '')
441
         new_hp_list += ',';
442
      new_hp_list += proj_id
443
   }
444
 
445
   // Prepare the new query string
446
   if (new_url_query_string == '')
447
      new_url_query_string += '\?';
448
   else
449
      new_url_query_string += '\&';
450
 
451
   new_url_query_string += 'HideProj=';
452
   new_url_query_string += new_hp_list;
453
 
454
   // reload the page with the new query string
455
   var url = location.pathname + new_url_query_string;
456
   window.location.assign(url);
457
}
458
 
459
//////////////////////////////////////////////////////////////////////////////////////////////////
460
// This function rebuilds the query string to either hide all projects, or unhide all projects
461
// fromt he display
462
//////////////////////////////////////////////////////////////////////////////////////////////////
463
function toggle_all_projects(bAll)
464
{
465
   var new_url_query_string = '';
466
   var list_proj_ids = '';
467
 
468
   // If hiding all, then find all of the project enable/disable checkboxes, get the project ID
469
   // values from each one and accumulate them into a comma seperated list
470
   if (!bAll)
471
   {
472
      var inputs = document.getElementsByTagName('input');
473
      var i;
474
      for (i = 0; i < inputs.length; i++)
475
      {
476
         var str = inputs[i].name;
477
         if (str.indexOf("DIS_PRJ_") >= 0)
478
         {
479
            str = str.replace("DIS_PRJ_","");
480
            if (list_proj_ids != '')
481
               list_proj_ids += ',' + str;
482
            else
483
               list_proj_ids += str;
484
         }
485
      }
486
   }
487
 
488
   // get the full query string
489
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
490
 
491
   // split it into each parameter
492
   var qs_arr = url_query_string.split('&');
493
   var i_qs_arr;
494
   for (i_qs_arr in qs_arr)
495
   {
496
      var qs_str = qs_arr[i_qs_arr];
497
 
498
      if (qs_str.length > 0)
499
      {
500
         // if we have found the HideProj parameter
501
         if (qs_str.indexOf('HideProj') >= 0)
502
         {
503
            // do nothing
504
         }
505
         else
506
         {
507
            // feed the existing paramter to the new query string
508
            if (new_url_query_string == '')
509
               new_url_query_string += '?';
510
            else
511
               new_url_query_string += '&';
512
            new_url_query_string += qs_str
513
         }
514
      }
515
   }
516
 
517
   // Prepare the new query string, only adding the HideProj parameter if the function is being
518
   // used to hide all projects
519
   if (!bAll)
520
   {
521
      if (new_url_query_string == '')
522
         new_url_query_string += '\?';
523
      else
524
         new_url_query_string += '\&';
525
 
526
      new_url_query_string += 'HideProj=' + list_proj_ids;
527
   }
528
   // reload the page with the new query string
529
   var url = location.pathname + new_url_query_string;
530
   window.location.assign(url);
531
}
532
 
533
//////////////////////////////////////////////////////////////////////////////////////////////////
534
// This function rebuilds the query string so that it either adds or removes the Refresh parameter
535
//////////////////////////////////////////////////////////////////////////////////////////////////
536
function toggle_refresh()
537
{
538
   var new_url_query_string = '';
539
 
540
   // get the full query string
541
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
542
 
543
   // split it into each parameter
544
   var qs_arr = url_query_string.split('&');
545
   var i_qs_arr;
546
   for (i_qs_arr in qs_arr)
547
   {
548
      var qs_str = qs_arr[i_qs_arr];
549
 
550
      if (qs_str.length > 0)
551
      {
552
         // if we have found the Refresh parameter
553
         if (qs_str.indexOf('Refresh') >= 0)
554
         {
555
            // do nothing
556
         }
557
         else
558
         {
559
            // feed the existing paramter to the new query string
560
            if (new_url_query_string == '')
561
               new_url_query_string += '?';
562
            else
563
               new_url_query_string += '&';
564
            new_url_query_string += qs_str
565
         }
566
      }
567
   }
568
 
569
   // Prepare the new query string
570
 
571
   if (new_url_query_string == '')
572
      new_url_query_string += '\?';
573
   else
574
      new_url_query_string += '\&';
575
 
576
   new_url_query_string += 'Refresh=';
577
   if (document.getElementById('refreshPeriod').value < <%=Min_Refresh_Time%>)
578
   {
579
      document.getElementById('refreshPeriod').value = <%=Min_Refresh_Time%>;
580
      new_url_query_string += <%=Min_Refresh_Time%>;
581
   }
582
   else
583
      new_url_query_string += document.getElementById('refreshPeriod').value;
584
 
585
   if (document.getElementById('autoRefresh').checked)
586
      new_url_query_string += ',ON';
587
   else
588
      new_url_query_string += ',OFF';
589
 
590
   // reload the page with the new query string
591
   var url = location.pathname + new_url_query_string;
592
   window.location.assign(url);
593
}
594
 
595
 
596
//////////////////////////////////////////////////////////////////////////////////////////////////
597
// This function rebuilds the query string to Update the Inactivity parameter
598
//////////////////////////////////////////////////////////////////////////////////////////////////
599
function toggle_inactivity()
600
{
601
   var new_url_query_string = '';
602
 
603
   // get the full query string
604
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
605
 
606
   // split it into each parameter, then remove the Inactivity parameter
607
   var qs_arr = url_query_string.split('&');
608
   var qs_join = '?'
609
   var i_qs_arr;
610
   for (i_qs_arr in qs_arr)
611
   {
612
      var qs_str = qs_arr[i_qs_arr];
613
      if (qs_str.length > 0)
614
      {
615
         if (qs_str.indexOf('Inactivity') < 0)
616
         {
617
            // feed the existing paramter to the new query string
618
            new_url_query_string += qs_join + qs_str
619
            qs_join = '&'
620
         }
621
      }
622
   }
623
 
624
   var value = document.getElementById('inactivity').value;
625
   if  (value && (value != <%=Max_DeltaBuild%>))
626
   {
627
       // Prepare the new query string
628
        new_url_query_string += qs_join + 'Inactivity=' + value;
629
    }
630
 
631
   // reload the page with the new query string
632
   var url = location.pathname + new_url_query_string;
633
   window.location.assign(url);
634
}
635
 
636
 
637
//////////////////////////////////////////////////////////////////////////////////////////////////
638
// Rebuild the query string and reload the page based on the current setting of the filter
639
// radio buttons
640
//////////////////////////////////////////////////////////////////////////////////////////////////
641
function update_Display_Filter()
642
{
643
   var new_url_query_string = '';
644
 
645
   // get the full query string
646
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';
647
 
648
   // split it into each parameter
649
   var qs_arr = url_query_string.split('&');
650
   var i_qs_arr;
651
   for (i_qs_arr in qs_arr)
652
   {
653
      var qs_str = qs_arr[i_qs_arr];
654
 
655
      if (qs_str.length > 0)
656
      {
657
         // if we have found the Display parameter
658
         if (qs_str.indexOf('Filter') >= 0)
659
         {
660
            // do nothing
661
         }
662
         else
663
         {
664
            // feed the existing paramter to the new query string
665
            if (new_url_query_string == '')
666
               new_url_query_string += '?';
667
            else
668
               new_url_query_string += '&';
669
            new_url_query_string += qs_str
670
         }
671
      }
672
   }
673
 
674
   // Prepare the new query string
675
   var qJoiner;
676
   if (new_url_query_string == '')
677
      qJoiner = '\?';
678
   else
679
      qJoiner = '\&';
680
 
681
   var joiner = '';
682
   var filterSet = '';
683
   var items = new Array ("activeBuilds","disabledDaemons","idleBuilds","pausedBuilds","problemBuilds");
684
   for (var item in items)
685
   {
686
       if (document.getElementById(items[item]).checked)
687
       {
688
          filterSet += joiner + items[item];
689
          joiner = ',';
690
       }
691
   }
692
 
693
   if (filterSet.length > 0)
694
   {
695
       new_url_query_string += qJoiner + 'Filter=' + filterSet;
696
   }
697
 
698
   // reload the page with the new query string
699
   var url = location.pathname + new_url_query_string;
700
   window.location.assign(url);
701
}
702
 
703
//-->
704
</script>
705
 
706
<html>
707
   <head>
708
      <title>Release Manager</title>
709
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
710
      <meta http-equiv="Pragma" content="no-cache">
711
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
712
      <%If param_refreshEnabled AND param_RefreshPeriod <> 0 Then%>
713
         <META HTTP-EQUIV=REFRESH CONTENT=<%=param_RefreshPeriod%>>
714
      <%End If%>
715
      <link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
716
      <link rel="stylesheet" href="images/navigation.css" type="text/css">
717
      <script language="JavaScript" src="images/common.js"></script>
5983 dpurdie 718
      <!--#include file="_jquery_includes.asp"-->
5357 dpurdie 719
      <!-- DROPDOWN MENUS -->
720
      <!--#include file="_menu_def.asp"-->
721
      <script language="JavaScript1.2" src="images/popup_menu.js"></script>
722
   </head>
723
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
724
      <!-- HEADER -->
725
      <!--#include file="_header.asp"-->
726
      <% getBuildStatus() %>
727
      <!-- BODY ---->
728
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
729
         <tr>
5814 dpurdie 730
            <td width="1" background="images/bg_home_orange.gif" valign="top">
731
                <!-- Monitoring Options Selection Box ---->
732
                 <fieldset style="padding:3px">
733
                    <legend class="body_scol">Display Options</legend>
734
                     <fieldset class="body_rowg">
735
                        <legend class="body_scol">Auto Refresh</legend>
736
                             <div class=nowrap>
737
                             <input name="autoRefresh" id="autoRefresh" type="checkbox" <%If param_refreshEnabled Then%>checked<%End If%> value="1" onclick='toggle_refresh()'>
738
                                 <input class="body_txt" style="width:3em" name="refreshPeriod" id="refreshPeriod" type="input" maxlength="3" value="<%=param_refreshPeriod%>" onchange='toggle_refresh()' > Seconds
739
                             </div>
740
                     </fieldset>
741
                     <fieldset class="body_rowg">
742
                        <legend class="body_scol">Filter</legend>
743
                            <div>
744
                                 <input name="activeBuilds" id="activeBuilds" type="checkbox" <%=Filter_Checked("activeBuilds")%> value="activeBuilds" onclick='update_Display_Filter()'>Active
745
                            </div>
746
                            <div>
747
                                 <input name="idleBuilds" id="idleBuilds" type="checkbox" <%=Filter_Checked("idleBuilds")%> value="idleBuilds" onclick='update_Display_Filter()'>Idle
748
                            </div>
749
                            <div>
750
                                 <input name="pausedBuilds" id="pausedBuilds" type="checkbox" <%=Filter_Checked("pausedBuilds")%> value="paused" onclick='update_Display_Filter()'>Paused
751
                            </div>
752
                            <div>
753
                                 <input name="disabledDaemons"  id="disabledDaemons"  type="checkbox" <%=Filter_Checked("disabledDaemons")%>  value="disabledDaemons"  onclick='update_Display_Filter()'>Disabled
754
                            </div>
755
                            <div class=nowrap>
756
                                 <input name="problemBuilds"  id="problemBuilds"  type="checkbox" <%=Filter_Checked("problemBuilds")%>  value="problemBuilds"  onclick='update_Display_Filter()'>Problem&nbsp;Daemon&nbsp;Sets
757
                            </div>
758
                     </fieldset>
759
                     <fieldset class="body_rowg">
760
                        <legend  class="body_scol">Inactivity</legend>
761
                                 <input class="body_txt" style="width:3em" name="inactivity" id="inactivity" type="input" maxlength="3" value="<%=param_inactivity%>" onchange='toggle_inactivity()' > Days
762
                     </fieldset>
763
                </fieldset>
764
            </td>
5357 dpurdie 765
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
766
 
767
               <table width="10" border="0" cellspacing="0" cellpadding="0">
768
                  <tr>
769
                     <td width="1%"></td>
770
                     <td width="100%">
771
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
772
                           <tr>
5814 dpurdie 773
                              <td nowrap class="form_ttl">
5357 dpurdie 774
                                 <p>BUILD DAEMON STATUS INFORMATION</p>
775
                              </td>
776
                              <td align="right" valign="bottom"></td>
777
                           </tr>
778
 
779
                           <%If bIndefinitelyPaused Then%>
780
                              <tr>
781
                                 <td>
782
                                    <span class='err_alert'>
783
                                       <font size='2'><b>WARNING: Indefinite Pause, Build Daemons are all stopped - please contact an administrator</b></font>
784
                                    </span>
785
                                 </td>
786
                              </tr>
787
                           <%End If%>
788
                        </table>
789
                     </td>
790
                     <td width="1%"></td>
791
                  </tr>
792
                  <tr>
793
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
794
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
795
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
796
                  </tr>
797
                  <tr>
798
                     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
799
                     <td bgcolor="#FFFFFF" valign="top">
800
                        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
801
                        <!--#include file="messages/_msg_inline.asp"-->
802
                        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
803
                        <br>
804
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
805
                           <td width="9%" valign="top"></td>
806
                           <tr>
807
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Project
808
                                 <input name="NOPRJ" id="NOPRJ" type="Button" value="All" onclick="toggle_all_projects(1)">
809
                                 <input name="NOPRJ" id="NOPRJ" type="Button" value="None" onclick="toggle_all_projects(0)">
810
                              </td>
811
                              <!-- Status Table Header -->
812
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release</td>
813
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release<br>Mode</td>
814
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Mode</td>
815
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Host</td>
816
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>State</td>
817
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Building<br>Package</td>
818
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<br>Delta (secs)</td>
819
                           </tr>
820
 
821
                           <!-- Status Table Body -->
822
                           <%
823
                            Dim bProject_changed          ' Signals a row change due to a different project
824
                            Dim strProject_checked        ' Can be "" or "checked". Determines appearance of project enable checkbox
825
                            Dim bRelease_changed          ' signals a row change due to a different release
826
                            Dim bReleaseHeaderDone        ' indicates whether the release name has been rendered yet
827
                            Dim bProjectHeaderDone        ' Project Header done
828
                            Dim bShowAge                  ' Display age warning
829
                            Dim bToggleStyle              ' Data shown so toggle style
830
                            Dim bShowReleaseSep           ' Show Release Seperator
831
 
832
                            '   Iterate over all projects, releases and machines
833
                            '
834
                            Dim project,release,machine
835
                            Dim eProject,eRelease,eMachine
836
                            For Each project in buildStatus
837
                                ' Start of a new Project
838
                                Set eProject = buildStatus.Item(project)
839
                                bProjectHeaderDone = false
840
                                bProject_changed = true
841
                                bShowReleaseSep = False
842
 
843
                                For Each release in eProject.Item("data")
844
                                    '   Start of a new Release
845
                                    Set eRelease = eProject.Item("data").Item(release)
846
                                    bReleaseHeaderDone = False
847
                                    bRelease_changed = true
848
                                    bShowAge = eRelease("bShowAge")
849
                                    If  bToggleStyle Then Call ToggleStyleNow
850
                                    bToggleStyle = false
851
 
852
                                    For Each machine in eRelease.Item("data")
853
                                        '   Start of a new Machine
854
                                        Set eMachine = eRelease.Item("data").Item(machine)
855
                                        strProject_checked = Is_Project_Checked(eMachine("PROJ_ID"))
856
 
857
                                        ' Display Project Header - ONCE
858
                                        If NOT bProjectHeaderDone Then%>
859
                                            <tr>
860
                                               <td colspan='8'><img src='images/spacer.gif' width='1' height='5'></td>
861
                                            </tr>
862
                                            <tr>
863
                                               <td colspan='8' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='5'></td>
864
                                            </tr>
865
                                            <tr>
866
                                                <td nowrap class="body_rowg">
867
                                                    <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")%>)>
868
                                                    <a href='rtree.asp?proj_id=<%=eMachine("PROJ_ID")%>'><%=eMachine("PROJ_NAME")%>
869
                                                </td>
870
                                            <%
871
                                        End If
872
 
873
                                        ' Consider displaying the body of this machine entry
874
                                        If strProject_checked = "checked" Then
875
                                            If eRelease.Exists("bDisplay_whole_set") OR eMachine.Exists("bRow_displayed") Then
876
                                                bToggleStyle = true
877
 
878
                                                '   Empty cell, if the project header has been displayed
879
                                                If bProjectHeaderDone Then
880
                                                    %><td nowrap class="body_rowg"></td><%
881
                                                End If
882
 
883
                                                ' Display Release Header - Once, or a filler
884
                                                If NOT bReleaseHeaderDone Then
885
                                                    bReleaseHeaderDone = True
886
 
887
                                                    ' Display Release seperator, if this is not the first release in the project
888
                                                    If bShowReleaseSep Then
889
                                                        %>
890
                                                            <tr>
891
                                                                <td></td>
892
                                                                <td colspan='7' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='1'></td>
893
                                                            </tr>
894
                                                            <tr>
895
                                                                <td></td>
896
                                                        <%
897
                                                    End If
898
                                                    ' Display the Release Header, with a marker to show aged releases
899
                                                    %>
900
                                                    <td nowrap <%=styleNow%>>
901
                                                        <a href='build_status.asp?rtag_id=<%=eMachine("RTAG_ID")%>' title='Last Build:<%=eMachine("last_build")%>'><%=eMachine("RTAG_NAME")%></a>
902
                                                    <%
903
                                                    If bShowAge Then
904
                                                    %>
905
                                                        <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;'>
906
                                                    <%
907
                                                    End If
908
                                                    %></td><%
909
                                                Else
910
                                                    %><td nowrap <%=styleNow%>></td><%
911
                                                End If
912
                                                bShowReleaseSep = true
913
                                                %>
914
                                                <td nowrap <%=styleNow%>><%=Get_Official(eMachine("OFFICIAL"))%></td>
915
                                                <td nowrap <%=styleNow%>><%=Get_Daemon_Mode(eMachine("DAEMON_MODE"))%></td>
916
                                                <td nowrap <%=styleNow%>><%=eMachine("DISPLAY_NAME")%></td>
917
                                                <td nowrap <%=styleNow%>><%=eMachine("dStateText")%></td>
918
                                                <td nowrap <%=styleNow%>><%=eMachine("PKG_NAME")%></td>
919
                                                <td nowrap <%=styleNow%>><%=PrettyDelta(eMachine("delta"),eMachine("PAUSE"),eMachine("PKG_NAME") )%></td>
920
                                                <%
921
                                            End If
922
                                            %></tr><%
923
                                        End If
924
 
925
                                        ' End of Display
926
                                        bRelease_changed = false
927
                                        bProject_changed = false
928
                                        bProjectHeaderDone = true
929
                                    Next
930
                                Next
931
                            Next
932
                           %>
933
                        </table>
934
                     <!-- Status Table Footer -->
935
                     </td>
936
                     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
937
                  </tr>
938
                  <tr>
939
                     <input type="hidden" name="action" value="true">
940
                     <%=objPMod.ComposeHiddenTags()%>
941
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
942
                     <td background="images/lbox_bg_blue.gif"></td>
943
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
944
                  </tr>
945
               </table>
946
            </td>
947
            <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
948
         </tr>
949
         <tr>
950
            <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>
951
            <td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="350"></td>
952
         </tr>
953
      </table>
954
      <!-- FOOTER -->
955
      <!--#include file="_footer.asp"-->
956
   </body>
957
</html>