Subversion Repositories DevTools

Rev

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