Subversion Repositories DevTools

Rev

Rev 6999 | 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 buildStatus
35
 
36
Dim bShowProblemDaemonSets    ' Indicates if problem daemons must be shown during filtering
37
Dim bShowDisabledDaemons      ' Indicates if a disabled daemon must be shown during filtering
38
Dim bShowActiveBuilds         ' Indicates if active builds must be shown during filtering
39
Dim bShowIdleBuilds           ' Indicates if idle builds must be shown during filtering
40
Dim bShowPausedBuilds         ' Indicates if paused builds must be shown during filtering
6999 dpurdie 41
Dim bShowAutoProject          ' Hide projects that have no active components
42
Dim bProjectToggle            ' State of the Project toggler
5357 dpurdie 43
 
44
'------------ Constants Declaration -----------
45
Const Min_Refresh_Time = 10         ' Seconds
46
Const Max_DeltaBuild = 31           ' Days
47
'------------ Variable Init -------------------
48
 
49
styleAlt1="class='body_rowg1'"
50
styleAlt2="class='body_rowg2'"
51
styleNow = styleAlt1
52
'----------------------------------------------
53
%>
54
<%
55
'------------------------------------------------------------------------------
56
'   Populate the buildStatus dictionary
57
'   Get all the required data into a hash of hashes
58
'   It will make the following processing so much easier
59
'
60
Sub getBuildStatus
61
    Dim bms
62
    query_string = "SELECT rc.RCON_ID, " &_
63
                  "       rc.RTAG_ID, " &_
64
                  "       bm.DISPLAY_NAME, " &_
65
                  "       rc.DAEMON_MODE, "&_
66
                  "       rt.RTAG_NAME, " &_
67
                  "       rt.OFFICIAL, " &_
68
                  "       rt.BUILD_AGE, " &_
69
                  "       p.PROJ_ID, " &_
70
                  "       p.PROJ_NAME, " &_
71
                  "       rl.CURRENT_PKG_ID_BEING_BUILT, "&_
72
                  "       rl.CURRENT_RUN_LEVEL, "&_
73
                  "       NVL(rl.PAUSE,0) as PAUSE, " &_
74
                  "       TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta," &_
75
                  "       TO_CHAR(rl.LAST_BUILD, 'DD-MON-YYYY') as last_build," &_
76
                  "       TRUNC (SYSDATE - rl.LAST_BUILD) as last_build_days," &_
6267 dpurdie 77
                  "       pkg.PKG_NAME, NVL(ACTIVE, 'U') as ACTIVE" &_
5357 dpurdie 78
                  " FROM RELEASE_CONFIG rc, RELEASE_TAGS rt, PROJECTS p, RUN_LEVEL rl, BUILD_MACHINE_CONFIG bm, PACKAGES pkg " &_
79
                  " WHERE rt.RTAG_ID = rc.RTAG_ID " &_
80
                  "   AND rc.bmcon_id is not null" &_
81
                  "   AND rt.PROJ_ID = p.PROJ_ID " &_
5623 dpurdie 82
                  "   AND rt.OFFICIAL in ( 'N', 'R', 'C')" &_
6873 dpurdie 83
                  "   AND rl.RCON_ID(+) = rc.RCON_ID" &_
5357 dpurdie 84
                  "   AND rc.bmcon_id = bm.bmcon_id(+)" &_
85
                  "   AND pkg.PKG_ID(+) = rl.CURRENT_PKG_ID_BEING_BUILT" &_
86
                  " ORDER BY p.PROJ_NAME, rt.RTAG_NAME, rc.DAEMON_MODE, bm.DISPLAY_NAME, rc.DAEMON_MODE"
87
 
88
    Set buildStatus = CreateObject("Scripting.Dictionary")
89
    Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
90
    Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
91
        Set bms = CreateObject("Scripting.Dictionary")
92
 
93
        bms.Item("RCON_ID")                     = rsQry("RCON_ID")
94
        bms.Item("RTAG_ID")                     = rsQry("RTAG_ID")
95
        bms.Item("DISPLAY_NAME")                = rsQry("DISPLAY_NAME")
96
        bms.Item("RTAG_NAME")                   = rsQry("RTAG_NAME")
97
        bms.Item("DAEMON_MODE")                 = rsQry("DAEMON_MODE")
98
        bms.Item("OFFICIAL")                    = rsQry("OFFICIAL")
99
        bms.Item("BUILD_AGE")                   = NiceInt(rsQry("BUILD_AGE"), 31)
100
        bms.Item("PROJ_ID")                     = rsQry("PROJ_ID")
101
        bms.Item("PROJ_NAME")                   = rsQry("PROJ_NAME")
102
        bms.Item("CURRENT_PKG_ID_BEING_BUILT")  = rsQry("CURRENT_PKG_ID_BEING_BUILT")
103
        bms.Item("CURRENT_RUN_LEVEL")           = rsQry("CURRENT_RUN_LEVEL")
104
        bms.Item("PAUSE")                       = CInt(rsQry("PAUSE"))
105
        bms.Item("delta")                       = rsQry("delta")
106
        bms.Item("last_build")                  = rsQry("last_build")
107
        bms.Item("last_build_days")             = NiceInt(rsQry("last_build_days"), 100)
108
        bms.Item("PKG_NAME")                    = rsQry("PKG_NAME")
6267 dpurdie 109
        bms.Item("ACTIVE")                      = rsQry("ACTIVE")
5357 dpurdie 110
 
111
        ' Calculate some values
112
        bms.Item("dState") = Classify_Run_Level(bms.Item("CURRENT_RUN_LEVEL"),_
7063 dpurdie 113
                                                IndefPause,_
5357 dpurdie 114
                                                bms.Item("PAUSE"), _
115
                                                bms.Item("delta") ,_
6267 dpurdie 116
                                                bms.Item("CURRENT_PKG_ID_BEING_BUILT"),_
117
                                                bms.Item("ACTIVE"))
5357 dpurdie 118
 
119
        bms.Item("dStateText") = Get_Run_Level(bms.Item("CURRENT_RUN_LEVEL"),_
7063 dpurdie 120
                                               IndefPause,_
6267 dpurdie 121
                                               bms.Item("PAUSE"),_
122
                                               bms.Item("ACTIVE"))
5357 dpurdie 123
 
124
        ' Kill package name on disabled daemons
125
        If bms.Item("PAUSE") = 2 Then bms.Item("PKG_NAME") = Null
126
 
127
 
128
        ' Add to buildStatus
129
        '   This is a three level hash (Project,Release, Daemon)
130
 
131
        Dim ProjRef, RelRef, DRef
132
        ProjRef = bms.Item("PROJ_NAME")
133
        RelRef  = bms.Item("RTAG_NAME")
134
        DRef    = bms.Item("DISPLAY_NAME")
135
 
136
        If  Not buildStatus.Exists(ProjRef) Then
137
            Set buildStatus(ProjRef) = CreateObject("Scripting.Dictionary")
138
            Set buildStatus(ProjRef).Item("data") = CreateObject("Scripting.Dictionary")
139
            'buildStatus(ProjRef).Item("PROJ_ID") = bms.Item("PROJ_ID")
140
            'buildStatus(ProjRef).Item("PROJ_NAME") = bms.Item("PROJ_NAME")
141
 
142
        End If
143
 
144
        If  Not buildStatus(ProjRef).Item("data").Exists(RelRef) Then
145
            Set buildStatus(ProjRef).Item("data").Item(RelRef) = CreateObject("Scripting.Dictionary")
146
            Set buildStatus(ProjRef).Item("data").Item(RelRef).Item("data") = CreateObject("Scripting.Dictionary")
147
            'buildStatus(ProjRef).Item("data").Item(RelRef).Item("RTAG_NAME") = bms.Item("RTAG_NAME")
148
            'buildStatus(ProjRef).Item("data").Item(RelRef).Item("RTAG_ID") = bms.Item("RTAG_ID")
149
        End If
150
 
151
        Set buildStatus(ProjRef).Item("data").Item(RelRef).Item("data").Item(DRef) = bms
152
 
153
        rsQry.MoveNext
154
    Loop
155
    rsQry.Close()
156
    Set rsQry = nothing
157
 
158
    ' Iterate over each deamon set and flag some of its characteristics
159
    '   This could be done inline, as the data is processed from the SQL source
160
    Dim project,release,machine
161
    Dim eProject,eRelease,eMachine
162
    For Each project in buildStatus
163
        Set eProject = buildStatus.Item(project)
164
        For Each release in eProject.Item("data")
165
            Set eRelease = eProject.Item("data").Item(release)
166
            For Each machine in eRelease.Item("data")
167
                Set eMachine = eRelease.Item("data").Item(machine)
168
 
169
                Dim dState
170
                dState = eMachine.Item("dState")
171
 
172
                If dState = "active" Then
173
                    If bShowActiveBuilds Then eMachine.Item("bRow_displayed") = "ShowActive"
174
                ElseIf dState = "idle" Then
175
                    If bShowIdleBuilds Then eMachine.Item("bRow_displayed") = "ShowIdle"
176
                ElseIf dState = "paused" Then
177
                    If bShowPausedBuilds Then eMachine.Item("bRow_displayed") = "ShowPaused"
178
                ElseIf dState = "disabled" Then
179
                    If bShowDisabledDaemons Then eMachine.Item("bRow_displayed") = "ShowDisabled"
180
                ElseIf dState = "problem" Then
181
                    If bShowProblemDaemonSets Then eMachine.Item("bRow_displayed") = "ShowProblem"
182
                    If bShowProblemDaemonSets Then eRelease.Item("bDisplay_whole_set") = true
183
                Else
184
                    eRelease.Item("bDisplay_whole_set") = true
185
                    eMachine.Item("bRow_displayed") = "ShowUnknownState"
186
                End If
187
 
188
                If bShowProblemDaemonSets AND eMachine.Item("BUILD_AGE") > 0 Then
189
                    If (eMachine.Item("last_build_days") > eMachine.Item("BUILD_AGE")) OR (eMachine.Item("last_build_days") > param_inactivity) Then
190
                       If dState = "active" OR dState = "idle" Then
191
                          eRelease.Item("bDisplay_whole_set") = true
192
                          eRelease.Item("bShowAge") = true
193
                          eMachine.Item("bRow_displayed") = "ShowInactiveWarning"
194
                       End If
195
                    End If
196
                End If
197
 
198
                If eMachine.Exists("bRow_displayed") Then
199
                    eRelease.Item("bDisplay_some") = true
6999 dpurdie 200
                    eProject.Item("bDisplay_some") = true
5357 dpurdie 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
 
6268 dpurdie 228
   If bActive = "N" AND astate <> 2 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
' Populate display controls
359
bShowProblemDaemonSets = Filter_Is_On("problemBuilds")
360
bShowActiveBuilds      = Filter_Is_On("activeBuilds")
361
bShowDisabledDaemons   = Filter_Is_On("disabledDaemons")
362
bShowIdleBuilds        = Filter_Is_On("idleBuilds")
363
bShowPausedBuilds      = Filter_Is_On("pausedBuilds")
6999 dpurdie 364
bShowAutoProject       = Filter_Is_On("autoProjects")
5357 dpurdie 365
 
6999 dpurdie 366
bProjectToggle         = RequestBool("pAll", True)
367
 
5357 dpurdie 368
'----------------------------------------------
369
%>
370
<script language="JavaScript" type="text/javascript">
371
<!--
6999 dpurdie 372
function url_append( url, str ) {
373
    if ( str.length <= 0 )
374
        return url;
5357 dpurdie 375
 
6999 dpurdie 376
    if ( url == '' )
377
       url += '\?';
378
    else
379
       url += '\&';
380
    return url + str;
381
}
382
 
383
function url_remove( url, str) {
384
    // split it into each parameter
385
    var qs_arr = url.split(/[&?]/);
386
    var remaining = new Array();
387
    var newUrl = '';
388
    var i_qs_arr;
389
    for (i_qs_arr in qs_arr)
390
    {
391
       var qs_str = qs_arr[i_qs_arr];
392
 
393
       if (qs_str.length > 0) {
394
          if (qs_str.indexOf(str) < 0) {
395
              remaining.push(qs_str);
396
          }
397
       }
398
    }
399
    return url_append('',remaining.join('&'));
400
}
401
 
5357 dpurdie 402
//////////////////////////////////////////////////////////////////////////////////////////////////
6999 dpurdie 403
// This function rebuilds the query string so as to update the list of 'hidden' projects
5357 dpurdie 404
//////////////////////////////////////////////////////////////////////////////////////////////////
6999 dpurdie 405
function toggle_project()
5357 dpurdie 406
{
6999 dpurdie 407
    // Determine all non-cheked project boxes.
408
   var inputs = document.getElementsByTagName('input');
409
   var i;
410
   var list = new Array();
411
   for (i = 0; i < inputs.length; i++) {
412
      var str = inputs[i].name;
413
      if ( ! inputs[i].checked ){
414
          if (str.indexOf("DIS_PRJ_") >= 0) {
415
              list.push(str.replace("DIS_PRJ_",""));
416
          }
5357 dpurdie 417
      }
418
   }
419
 
6999 dpurdie 420
    // get the full query string
421
    var url_query_string = window.location.search.substr(1);
5357 dpurdie 422
 
6999 dpurdie 423
    // Remove bits we are going to process
424
    url_query_string = url_remove(url_query_string, 'HideProj');
5357 dpurdie 425
 
6999 dpurdie 426
    // Prepare the new query string, only adding the HideProj parameter if the function is being
427
    // used to hide all projects
428
     if ( list.length > 0) {
429
         url_query_string = url_append(url_query_string, 'HideProj=' + list.join(','));
430
     }
5357 dpurdie 431
 
6999 dpurdie 432
    // reload the page with the new query string
433
    var url = location.pathname + url_query_string;
434
    window.location.assign(url);
5357 dpurdie 435
}
436
 
437
//////////////////////////////////////////////////////////////////////////////////////////////////
438
// This function rebuilds the query string to either hide all projects, or unhide all projects
6999 dpurdie 439
// from the display
5357 dpurdie 440
//////////////////////////////////////////////////////////////////////////////////////////////////
6999 dpurdie 441
function toggle_all_projects(el)
5357 dpurdie 442
{
6999 dpurdie 443
   var bAll = (el.checked);
5357 dpurdie 444
 
445
   // If hiding all, then find all of the project enable/disable checkboxes, get the project ID
446
   // values from each one and accumulate them into a comma seperated list
447
   if (!bAll)
448
   {
449
      var inputs = document.getElementsByTagName('input');
450
      var i;
6999 dpurdie 451
      var list = new Array();
452
      for (i = 0; i < inputs.length; i++) {
5357 dpurdie 453
         var str = inputs[i].name;
6999 dpurdie 454
         if (str.indexOf("DIS_PRJ_") >= 0) {
455
             list.push(str.replace("DIS_PRJ_",""));
5357 dpurdie 456
         }
457
      }
458
   }
459
 
460
   // get the full query string
6999 dpurdie 461
   var url_query_string = window.location.search.substr(1);
5357 dpurdie 462
 
6999 dpurdie 463
   // Remove bits we are going to process
464
   url_query_string = url_remove(url_query_string, 'HideProj');
465
   url_query_string = url_remove(url_query_string, 'pAll=');
5357 dpurdie 466
 
6999 dpurdie 467
   if ( !bAll) {
468
       url_query_string = url_append(url_query_string, 'pAll=0');
5357 dpurdie 469
   }
470
 
471
   // Prepare the new query string, only adding the HideProj parameter if the function is being
472
   // used to hide all projects
6999 dpurdie 473
    if (!bAll) {
474
        if ( list.length > 0) {
475
            url_query_string = url_append(url_query_string, 'HideProj=' + list.join(','));
476
        }
477
    }
5357 dpurdie 478
 
479
   // reload the page with the new query string
6999 dpurdie 480
   var url = location.pathname + url_query_string;
5357 dpurdie 481
   window.location.assign(url);
482
}
483
 
484
//////////////////////////////////////////////////////////////////////////////////////////////////
485
// This function rebuilds the query string so that it either adds or removes the Refresh parameter
486
//////////////////////////////////////////////////////////////////////////////////////////////////
487
function toggle_refresh()
488
{
489
   // get the full query string
6999 dpurdie 490
   var url_query_string = window.location.search.substr(1);
491
   url_query_string = url_remove(url_query_string, 'Refresh');
5357 dpurdie 492
 
493
   // Prepare the new query string
6999 dpurdie 494
   var refreshData = 'Refresh=';
495
   if (document.getElementById('refreshPeriod').value < <%=Min_Refresh_Time%>) {
5357 dpurdie 496
      document.getElementById('refreshPeriod').value = <%=Min_Refresh_Time%>;
6999 dpurdie 497
      refreshData += <%=Min_Refresh_Time%>;
5357 dpurdie 498
   }
499
   else
6999 dpurdie 500
      refreshData += document.getElementById('refreshPeriod').value;
5357 dpurdie 501
 
502
   if (document.getElementById('autoRefresh').checked)
6999 dpurdie 503
      refreshData += ',ON';
5357 dpurdie 504
   else
6999 dpurdie 505
      refreshData += ',OFF';
5357 dpurdie 506
 
6999 dpurdie 507
   url_query_string = url_append(url_query_string, refreshData);
508
 
5357 dpurdie 509
   // reload the page with the new query string
6999 dpurdie 510
   var url = location.pathname + url_query_string;
5357 dpurdie 511
   window.location.assign(url);
512
}
513
 
514
 
515
//////////////////////////////////////////////////////////////////////////////////////////////////
516
// This function rebuilds the query string to Update the Inactivity parameter
517
//////////////////////////////////////////////////////////////////////////////////////////////////
518
function toggle_inactivity()
519
{
520
   // get the full query string
6999 dpurdie 521
   var url_query_string = window.location.search.substr(1);
522
   url_query_string = url_remove(url_query_string, 'Inactivity');
5357 dpurdie 523
 
6999 dpurdie 524
   // Prepare the new query string
5357 dpurdie 525
   var value = document.getElementById('inactivity').value;
6999 dpurdie 526
   if  (value && (value != <%=Max_DeltaBuild%>)) {
527
       url_query_string = url_append(url_query_string, 'Inactivity=' + value);
5357 dpurdie 528
    }
529
 
530
   // reload the page with the new query string
6999 dpurdie 531
   var url = location.pathname + url_query_string;
5357 dpurdie 532
   window.location.assign(url);
533
}
534
 
535
 
536
//////////////////////////////////////////////////////////////////////////////////////////////////
537
// Rebuild the query string and reload the page based on the current setting of the filter
538
// radio buttons
539
//////////////////////////////////////////////////////////////////////////////////////////////////
540
function update_Display_Filter()
541
{
542
   // get the full query string
6999 dpurdie 543
   var url_query_string = window.location.search.substr(1);
544
   url_query_string = url_remove(url_query_string, 'Filter');
5357 dpurdie 545
 
546
   // Prepare the new query string
6999 dpurdie 547
   var active = new Array();
548
   var items = new Array ("activeBuilds","disabledDaemons","idleBuilds","pausedBuilds","problemBuilds","autoProjects");
549
   for (var item in items) {
550
       if (document.getElementById(items[item]).checked) {
551
           active.push(items[item]);
5357 dpurdie 552
          joiner = ',';
553
       }
554
   }
6999 dpurdie 555
   var filterSet = active.join(',') ;
5357 dpurdie 556
 
6999 dpurdie 557
   if (filterSet.length > 0) {
558
       url_query_string = url_append(url_query_string, 'Filter=' + filterSet);
5357 dpurdie 559
   }
560
 
561
   // reload the page with the new query string
6999 dpurdie 562
   var url = location.pathname + url_query_string;
5357 dpurdie 563
   window.location.assign(url);
564
}
565
 
566
//-->
567
</script>
6550 dpurdie 568
<%
569
'------------------------------------------------------------------------------
570
Sub SidePanelContent
571
%>
572
<!-- Monitoring Options Selection Box ---->
573
 <fieldset style="padding:3px">
574
    <legend class="body_scol">Display Options</legend>
575
     <fieldset class="body_rowg">
576
        <legend class="body_scol">Auto Refresh</legend>
577
             <div class=nowrap>
578
             <input name="autoRefresh" id="autoRefresh" type="checkbox" <%If param_refreshEnabled Then%>checked<%End If%> value="1" onclick='toggle_refresh()'>
579
                 <input class="body_txt" style="width:3em" name="refreshPeriod" id="refreshPeriod" type="input" maxlength="3" value="<%=param_refreshPeriod%>" onchange='toggle_refresh()' > Seconds
580
             </div>
581
     </fieldset>
582
     <fieldset class="body_rowg">
583
        <legend class="body_scol">Filter</legend>
584
            <div>
585
                 <input name="activeBuilds" id="activeBuilds" type="checkbox" <%=Filter_Checked("activeBuilds")%> value="activeBuilds" onclick='update_Display_Filter()'>Active
586
            </div>
587
            <div>
588
                 <input name="idleBuilds" id="idleBuilds" type="checkbox" <%=Filter_Checked("idleBuilds")%> value="idleBuilds" onclick='update_Display_Filter()'>Idle
589
            </div>
590
            <div>
591
                 <input name="pausedBuilds" id="pausedBuilds" type="checkbox" <%=Filter_Checked("pausedBuilds")%> value="paused" onclick='update_Display_Filter()'>Paused
592
            </div>
593
            <div>
594
                 <input name="disabledDaemons"  id="disabledDaemons"  type="checkbox" <%=Filter_Checked("disabledDaemons")%>  value="disabledDaemons"  onclick='update_Display_Filter()'>Disabled
595
            </div>
596
            <div class=nowrap>
597
                 <input name="problemBuilds"  id="problemBuilds"  type="checkbox" <%=Filter_Checked("problemBuilds")%>  value="problemBuilds"  onclick='update_Display_Filter()'>Problem&nbsp;Daemon&nbsp;Sets
598
            </div>
6999 dpurdie 599
            <div class=nowrap>
600
                 <input name="autoProjects"  id="autoProjects"  type="checkbox" <%=Filter_Checked("autoProjects")%>  value="autoProjects"  onclick='update_Display_Filter()'>Auto Hide Projects
601
            </div>
602
 
6550 dpurdie 603
     </fieldset>
604
     <fieldset class="body_rowg">
605
        <legend  class="body_scol">Inactivity</legend>
606
        <input class="body_txt" style="width:3em" name="inactivity" id="inactivity" type="input" maxlength="3" value="<%=param_inactivity%>" onchange='toggle_inactivity()' > Days
607
     </fieldset>
608
</fieldset>
609
<%
610
End Sub
611
'------------------------------------------------------------------------------
612
Sub DisplayProjectHeader(bProjectHeaderDone, eMachine, strProject_checked)
613
    If NOT bProjectHeaderDone Then%>
614
        <tr>
615
           <td colspan='8'><img src='images/spacer.gif' width='1' height='5'></td>
616
        </tr>
617
        <tr>
618
           <td colspan='8' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='5'></td>
619
        </tr>
620
        <tr>
621
            <td nowrap class="body_rowg">
6999 dpurdie 622
                <input name='DIS_PRJ_<%=eMachine("PROJ_ID")%>' id='DIS_PRJ_<%=eMachine("PROJ_ID")%>' type='checkbox' value=1 <%=strProject_checked%> onclick=toggle_project()>
6550 dpurdie 623
                <a href='rtree.asp?proj_id=<%=eMachine("PROJ_ID")%>'><%=eMachine("PROJ_NAME")%>
624
            </td>
625
        <%
626
    End If
627
End Sub
628
'------------------------------------------------------------------------------
629
Sub ShowDaemonStatus
630
%>
631
<table width="10" class="embedded_table" style="margin-bottom:10px">
632
  <tr>
633
     <td width="100%">
634
        <table width="100%" class="embedded_table">
635
           <tr>
636
              <td nowrap class="form_ttl">BUILD DAEMON STATUS INFORMATION</td>
637
           </tr>
638
        </table>
639
     </td>
640
  </tr>
641
  <tr>
642
    <td>
643
        <table class="rounded_box embedded_table" width="100%" >
644
          <tr>
645
             <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
646
             <td bgcolor="#FFFFFF" valign="top">
647
                <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
648
                <!--#include file="messages/_msg_inline.asp"-->
649
                <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
650
                <br>
651
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
6999 dpurdie 652
                   <!-- Status Table Header -->
653
                   <thead>
654
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col tleft">
655
                        <input type="checkbox" <%=IIF(bProjectToggle, "checked", "")%> title='Show/Hide all active releases' onclick=toggle_all_projects(this)>Project</th>
656
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release</th>
657
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release<br>Mode</th>
658
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Mode</th>
659
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Host</th>
660
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>State</th>
661
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Building<br>Package</th>
662
                      <th valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<br>Delta (secs)</th>
663
                   </thead>
5357 dpurdie 664
 
6550 dpurdie 665
                   <!-- Status Table Body -->
666
                   <%
667
                    Dim bProject_changed          ' Signals a row change due to a different project
668
                    Dim strProject_checked        ' Can be "" or "checked". Determines appearance of project enable checkbox
669
                    Dim bRelease_changed          ' signals a row change due to a different release
670
                    Dim bReleaseHeaderDone        ' indicates whether the release name has been rendered yet
671
                    Dim bProjectHeaderDone        ' Project Header done
672
                    Dim bShowAge                  ' Display age warning
673
                    Dim bToggleStyle              ' Data shown so toggle style
674
                    Dim bShowReleaseSep           ' Show Release Seperator
6999 dpurdie 675
                    Dim bShowProject              ' Show this project
6550 dpurdie 676
 
677
                    '   Iterate over all projects, releases and machines
678
                    '
679
                    Dim project,release,machine
680
                    Dim eProject,eRelease,eMachine
681
                    For Each project in buildStatus
682
                        ' Start of a new Project
683
                        Set eProject = buildStatus.Item(project)
684
                        bProjectHeaderDone = false
685
                        bProject_changed = true
686
                        bShowReleaseSep = False
6999 dpurdie 687
                        bShowProject = True
688
                        If bShowAutoProject AND NOT eProject.Item("bDisplay_some") Then
689
                            bShowProject = False
690
                        End If
691
                        If bShowProject Then
692
                            For Each release in eProject.Item("data")
693
                                '   Start of a new Release
694
                                Set eRelease = eProject.Item("data").Item(release)
695
                                bReleaseHeaderDone = False
696
                                bRelease_changed = true
697
                                bShowAge = eRelease("bShowAge")
698
                                If  bToggleStyle Then Call ToggleStyleNow
699
                                bToggleStyle = false
6550 dpurdie 700
 
6999 dpurdie 701
                                For Each machine in eRelease.Item("data")
702
                                    '   Start of a new Machine
703
                                    Set eMachine = eRelease.Item("data").Item(machine)
704
                                    strProject_checked = Is_Project_Checked(eMachine("PROJ_ID"))
6550 dpurdie 705
 
6999 dpurdie 706
                                    ' Consider displaying the body of this machine entry
707
                                    If strProject_checked = "checked" Then
708
                                        If eRelease.Exists("bDisplay_whole_set") OR eMachine.Exists("bRow_displayed") Then
709
                                            bToggleStyle = true
6550 dpurdie 710
 
6999 dpurdie 711
                                            ' Display Project and Release Header - Once, or a filler
712
                                            If NOT bReleaseHeaderDone Then
713
                                                bReleaseHeaderDone = True
6550 dpurdie 714
 
6999 dpurdie 715
                                                ' Display Project Header - ONCE. The <tr> is open
716
                                                Call DisplayProjectHeader(bProjectHeaderDone,eMachine, strProject_checked)
717
                                                bProjectHeaderDone = TRUE
6550 dpurdie 718
 
719
 
6999 dpurdie 720
                                                ' Display Release seperator, if this is not the first release in the project
721
                                                If bShowReleaseSep Then
722
                                                    %>
723
                                                        <tr>
724
                                                            <td></td>
725
                                                            <td colspan='7' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='1'></td>
726
                                                        </tr>
727
                                                        <tr>
728
                                                            <td></td>
729
                                                    <%
730
                                                End If
731
                                                ' Display the Release Header, with a marker to show aged releases
6550 dpurdie 732
                                                %>
6999 dpurdie 733
                                                <td nowrap <%=styleNow%>>
734
                                                    <a href='build_status.asp?rtag_id=<%=eMachine("RTAG_ID")%>' title='Last Build:<%=eMachine("last_build")%>'><%=eMachine("RTAG_NAME")%></a>
6550 dpurdie 735
                                                <%
6999 dpurdie 736
                                                If bShowAge Then
737
                                                %>
738
                                                    <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;'>
739
                                                <%
740
                                                End If
741
                                                %></td><%
742
                                            Else%>
743
                                                <td nowrap class="body_rowg"></td>
744
                                                <td nowrap <%=styleNow%>></td>
745
                                            <%
6550 dpurdie 746
                                            End If
6999 dpurdie 747
                                            bShowReleaseSep = true
6550 dpurdie 748
                                            %>
6999 dpurdie 749
                                            <td nowrap <%=styleNow%>><%=Get_Official(eMachine("OFFICIAL"))%></td>
750
                                            <td nowrap <%=styleNow%>><%=Get_Daemon_Mode(eMachine("DAEMON_MODE"))%></td>
751
                                            <td nowrap <%=styleNow%>><%=eMachine("DISPLAY_NAME")%></td>
752
                                            <td nowrap <%=styleNow%>><%=eMachine("dStateText")%></td>
753
                                            <td nowrap <%=styleNow%>><%=eMachine("PKG_NAME")%></td>
754
                                            <td nowrap <%=styleNow%>><%=PrettyDelta(eMachine("delta"),eMachine("PAUSE"),eMachine("PKG_NAME") )%></td>
6550 dpurdie 755
                                            <%
756
                                        End If
6999 dpurdie 757
                                        %></tr><%
6550 dpurdie 758
                                    End If
759
 
6999 dpurdie 760
                                    ' End of Display
761
                                    bRelease_changed = false
762
                                    bProject_changed = false
763
                                Next
6550 dpurdie 764
                            Next
6999 dpurdie 765
                            Call DisplayProjectHeader(bProjectHeaderDone,eMachine, strProject_checked)
766
                        End If
6550 dpurdie 767
                        Next
768
                   %>
769
                  <tr>
770
                    <td>
771
                        <input type="hidden" name="action" value="true">
772
                        <%=objPMod.ComposeHiddenTags()%>
773
                    </td>
774
                  </tr>
775
                </table>
776
             </td>
777
             <td background="images/lbox_bgside_white.gif">&nbsp;</td>
778
           </tr>
779
        </table>
780
      </td>
781
  </tr>
782
</table>
783
<%
784
End Sub
785
%>
5357 dpurdie 786
<html>
787
   <head>
788
      <title>Release Manager</title>
789
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
790
      <meta http-equiv="Pragma" content="no-cache">
791
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
792
      <%If param_refreshEnabled AND param_RefreshPeriod <> 0 Then%>
793
         <META HTTP-EQUIV=REFRESH CONTENT=<%=param_RefreshPeriod%>>
794
      <%End If%>
6579 dpurdie 795
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
796
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
797
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
5983 dpurdie 798
      <!--#include file="_jquery_includes.asp"-->
5357 dpurdie 799
      <!-- DROPDOWN MENUS -->
800
      <!--#include file="_menu_def.asp"-->
6579 dpurdie 801
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
5357 dpurdie 802
   </head>
6550 dpurdie 803
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
5357 dpurdie 804
      <!-- HEADER -->
805
      <!--#include file="_header.asp"-->
806
      <% getBuildStatus() %>
807
      <!-- BODY ---->
6550 dpurdie 808
      <table class="full_table">
5357 dpurdie 809
         <tr>
6876 dpurdie 810
            <td width="146px" class="bg_panel" valign="top">
6550 dpurdie 811
                <%Call SidePanelContent%>
5814 dpurdie 812
            </td>
5357 dpurdie 813
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
6550 dpurdie 814
                <%Call ShowDaemonStatus%>
5357 dpurdie 815
            </td>
816
         </tr>
817
         <tr>
6877 dpurdie 818
            <td class="bg_panel_btm" height="350">
6550 dpurdie 819
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
5357 dpurdie 820
         </tr>
821
      </table>
822
      <!-- FOOTER -->
823
      <!--#include file="_footer.asp"-->
824
   </body>
825
</html>