Subversion Repositories DevTools

Rev

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

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