Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
147 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|                 ADMIN Page                        |
6
'|                 Daemon Instructions               |
7
'|                                                   |
8
'=====================================================
9
%>
10
<%
11
Option explicit
12
' Good idea to set when using redirect
13
Response.Expires = 0   ' always load the page, dont store
14
%>
15
<!--#include file="common/conf.asp"-->
16
<!--#include file="common/globals.asp"-->
17
<!--#include file="common/formating.asp"-->
18
<!--#include file="common/qstr.asp"-->
19
<!--#include file="common/common_subs.asp"-->
20
<!--#include file="sec/Crypt.asp"-->
21
<!--#include file="common/_form_window_common.asp"-->
22
<!--#include file="_action_buttons.asp"-->
23
 
24
<!--#include file="class/classActionButtonControl.asp"-->
25
<!--#include file="common/daemon_instructions.asp"-->
26
 
27
<%
28
'------------ ACCESS CONTROL ------------------
29
%>
30
<!--#include file="_access_control_general.asp"-->
31
<!--#include file="_access_control_login.asp"-->
32
<%
33
'------------ Variable Definition -------------
34
Dim objBtnControl
149 ghuddy 35
Dim parSortOrder
147 ghuddy 36
'------------ Constants Declaration -----------
37
'------------ Variable Init -------------------
38
Set objBtnControl = New ActionButtonControl
149 ghuddy 39
parSortOrder = Request("sort")
40
If IsNull(parSortOrder) OR parSortOrder = "" Then
41
   parSortOrder = "0"
42
End If
147 ghuddy 43
'----------------------------------------------
44
%>
45
<%
46
'--------------------------------------------------------------------------------------------
47
' Cleans up the daemon instructions table to remove old data that might have become stranded
48
' due to crashed daemons or failing build machines.
49
'--------------------------------------------------------------------------------------------
50
Sub CleanupOldData()
51
   On Error Resume Next
52
   objEH.TryORA ( OraSession )
53
   OraDatabase.ExecuteSQL _
54
   "BEGIN PK_BUILDAPI.cleanup_stranded_daemon_insts; END;"
55
   objEH.CatchORA ( OraSession )
56
End Sub
57
 
58
 
59
%>
60
 
61
<%
62
' Clean up old data
63
CleanupOldData
64
 
65
' Page Access Condition
66
%>
67
<script language="JavaScript" type="text/javascript">
68
<!--
69
 
70
// This function is designed to be called when a user resets the in-progress value from YES back to NO
71
function reset_in_progress(instId)
72
{
73
   var proceed = false;
74
   var s;
75
   s  = '_ResetDaemonInstruction.asp';
76
   s += '?inst_id=' + instId;
77
 
78
   proceed = confirm('Are you sure you want to reset this instructions in-progress flag?\n\n' +
79
                     'You should ensure that the daemons are not operating upon this instruction first.\n\n' +
80
                     'Check the scheduled date/time. Does it appear so far in the past that it is unlikely\n' +
81
                     'a daemon is still undertaking the work for the instruction?\n\n' +
82
                     'Press OK to reset, otherwise press CANCEL\n\n' );
83
 
84
   if (proceed == true) {
85
      document.location = s;
86
   }
87
}
88
//-->
89
</script>
90
 
91
<html>
92
   <head>
93
      <title>Daemon Instructions Administration</title>
94
      <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
95
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
96
      <link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
97
      <link rel="stylesheet" href="images/navigation.css" type="text/css">
98
      <script language="JavaScript" src="images/common.js"></script>
99
      <!-- DROPDOWN MENUS -->
100
      <!--#include file="_menu_def.asp"-->
101
      <script language="JavaScript1.2" src="images/popup_menu.js"></script>
102
   </head>
103
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
104
      <!-- MENU LAYERS -------------------------------------->
105
      <div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)">
106
      </div>
107
      <!-- TIPS LAYERS -------------------------------------->
108
      <div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
109
      <!-- HEADER -->
110
      <!--#include file="_header.asp"-->
111
 
112
      <%
113
      '-- FROM START ---------------------------------------------------------------------------------------------------------
114
      objFormComponent.FormName = "DAEMON_INSTRUCTIONS"
115
      objFormComponent.Action = ScriptName
116
      objFormComponent.OnSubmit = "ShowProgress();"
117
      Call objFormComponent.FormStart()
118
      %>
119
      <table width="100%"  border="0" cellspacing="3" cellpadding="0" >
120
 
121
         <div align="left" class=" body_col">
122
            <br>Current List of DAEMON INSTRUCTIONS
123
         </div>
124
         <tr></tr>
125
         <tr>
126
            <td></td>
127
            <!-- DAEMON INSTRUCTION DETAILS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
149 ghuddy 128
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
129
               <%If parSortOrder = "1" Then%>
130
                  <a href='admin_daemon_instructions.asp?sort=1a'>
131
               <%ElseIf parSortOrder = "1a" Then%>
132
                  <a href='admin_daemon_instructions.asp?sort=1b'>
133
               <%ElseIf parSortOrder = "1b" Then%>
134
                  <a href='admin_daemon_instructions.asp?sort=1c'>
135
               <%Else%>
136
                  <a href='admin_daemon_instructions.asp?sort=1'>
137
               <%End If%>
138
               OPERATION
139
            </td>
140
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
141
               <%If parSortOrder = "2" Then%>
142
                  <a href='admin_daemon_instructions.asp?sort=2a'>
143
               <%ElseIf parSortOrder = "2a" Then%>
144
                  <a href='admin_daemon_instructions.asp?sort=2b'>
145
               <%Else%>
146
                  <a href='admin_daemon_instructions.asp?sort=2'>
147
               <%End If%>
148
               PROJECT
149
            </td>
150
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
151
               <%If parSortOrder = "3" Then%>
152
                  <a href='admin_daemon_instructions.asp?sort=3a'>
153
               <%Else%>
154
                  <a href='admin_daemon_instructions.asp?sort=3'>
155
               <%End If%>
156
               RELEASE
157
            </td>
147 ghuddy 158
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">MODE</td>
149 ghuddy 159
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
160
               <a href='admin_daemon_instructions.asp?sort=4'>PACKAGE
161
            </td>
147 ghuddy 162
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">VERSION</td>
149 ghuddy 163
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
164
               <a href='admin_daemon_instructions.asp?sort=0'>SCHEDULED TIME<br>(<SPAN style=color:Red>Red</SPAN> = overdue)<br>(<SPAN style=color:Green>Green</SPAN> = ready)</td>
147 ghuddy 165
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">REPEAT</td>
149 ghuddy 166
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
167
               <a href='admin_daemon_instructions.asp?sort=5'>ADDED BY
168
            </td>
147 ghuddy 169
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">LAST<br>UPDATED</td>
149 ghuddy 170
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">
171
               <a href='admin_daemon_instructions.asp?sort=6'>IN<br>PROGRESS
172
            </td>
147 ghuddy 173
            <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">EDIT/DELETE</td>
174
         </tr>
175
         <tr>
176
            <td colspan="13" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
177
         </tr>
178
 
179
         <%
180
         ' Load some action buttons
181
         Call objBtnControl.LoadActionButtons ( Array("btnEditDaemonInst", "btnDeleteDaemonInst"), OraDatabase )
182
         objBtnControl.ButtonSpacer = 1
183
 
184
         Dim rsQry
185
         Dim bInProgress
186
         Dim bIsReady
187
         Dim bIsOverdue
188
         Dim daemonInstId  ' This variable is needed to support the action buttons to Edit/Delete
189
         Dim bResetInProgressEnabled
149 ghuddy 190
         Dim sortClause
191
         Dim sortText
147 ghuddy 192
 
193
         ' determine if user can reset the in-progress state of a daemon instruction
194
         bResetInProgressEnabled = UserAllowedToResetInProgress()
195
 
196
         ' query the daemon_instructions table and also create an indication of an overdue instruction,
197
         ' which is defined as being one that was scheduled for action
149 ghuddy 198
         Select Case (parSortOrder)
199
         Case "1"
200
            sortClause = " ORDER BY op_code, scheduled_datetime"
201
            sortText   = "Data sorted by Operation, Scheduled time"
202
         Case "1a"
203
            sortClause = " ORDER BY op_code, proj_name, scheduled_datetime"
204
            sortText   = "Data sorted by Operation, Project, Scheduled time"
205
         Case "1b"
206
            sortClause = " ORDER BY op_code, proj_name, rtag_name, scheduled_datetime"
207
            sortText   = "Data sorted by Operation, Project, Release, Scheduled time"
208
         Case "1c"
209
            sortClause = " ORDER BY op_code, proj_name, rtag_name, pkg_name, scheduled_datetime"
210
            sortText   = "Data sorted by Operation, Project, Release, Package, Scheduled time"
211
         Case "2"
212
            sortClause = " ORDER BY proj_name, scheduled_datetime"
213
            sortText   = "Data sorted by Project, Scheduled time"
214
         Case "2a"
215
            sortClause = " ORDER BY proj_name, rtag_name, scheduled_datetime"
216
            sortText   = "Data sorted by Project, Release, Scheduled time"
217
         Case "2b"
218
            sortClause = " ORDER BY proj_name, rtag_name, pkg_name, scheduled_datetime"
219
            sortText   = "Data sorted by Project, Release, Package, Scheduled time"
220
         Case "3"
221
            sortClause = " ORDER BY rtag_name, scheduled_datetime"
222
            sortText   = "Data sorted by Release, Scheduled time"
223
         Case "3a"
224
            sortClause = " ORDER BY rtag_name, pkg_name, scheduled_datetime"
225
            sortText   = "Data sorted by Release, Package, Scheduled time"
226
         Case "4"
227
            sortClause = " ORDER BY pkg_name, scheduled_datetime"
228
            sortText   = "Data sorted by Package, Scheduled time"
229
         Case "5"
230
            sortClause = " ORDER BY full_name, scheduled_datetime"
231
            sortText   = "Data sorted by Added By, Scheduled time"
232
         Case "6"
233
            sortClause = " ORDER BY in_progress, scheduled_datetime"
234
            sortText   = "Data sorted by Progress State, Scheduled time"
235
         Case Else
236
            sortClause = " ORDER BY scheduled_datetime, proj_name, rtag_name, pkg_name"
237
            sortText   = "Data sorted by Scheduled time"
238
         End Select
239
 
240
         Set rsQry = OraDatabase.DbCreateDynaset("SELECT DAEMON_INSTRUCTIONS_ID,"&_
241
                                                 "       proj_id,"&_
242
                                                 "       proj_name,"&_
243
                                                 "       official,"&_
244
                                                 "       rtag_id,"&_
245
                                                 "       rtag_name,"&_
246
                                                 "       OP_CODE,"&_
247
                                                 "       pkg_id,"&_
248
                                                 "       (CASE WHEN NVL2(pv_id,pv_id,0) = 0 THEN 'N/A' ELSE pkg_name END) AS pkg_name,"&_
249
                                                 "       (CASE WHEN NVL2(pv_id,pv_id,0) = 0 THEN 'N/A' ELSE pkg_version END) AS pkg_version,"&_
250
                                                 "       PV_ID,"&_
251
                                                 "       SCHEDULED_DATETIME,"&_
252
                                                 "       REPEAT_SECS,"&_
253
                                                 "       ADDED_DATETIME,"&_
254
                                                 "       USER_ID,"&_
255
                                                 "       IN_PROGRESS,"&_
256
                                                 "       (CASE WHEN SCHEDULED_DATETIME <= SYSDATE THEN 1 ELSE 0 END) AS READY,"&_
257
                                                 "       (CASE WHEN (SCHEDULED_DATETIME + (1/144)) < SYSDATE THEN 1 ELSE 0 END) AS OVERDUE,"&_
258
                                                 "       full_name,"&_
259
                                                 "       user_email"&_
260
                                                 " FROM"&_
261
                                                 " daemon_instructions"&_
262
                                                 " LEFT JOIN package_versions USING (pv_id)"&_
263
                                                 " LEFT JOIN release_tags USING (rtag_id)"&_
264
                                                 " LEFT JOIN projects USING (proj_id)"&_
265
                                                 " LEFT JOIN packages USING (pkg_id)"&_
266
                                                 " LEFT JOIN users USING (user_id)"&_
267
                                                 sortClause, ORADYN_DEFAULT )
268
 
147 ghuddy 269
         While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
270
 
271
            daemonInstId = rsQry("DAEMON_INSTRUCTIONS_ID")
272
 
273
            If IsNull(rsQry("IN_PROGRESS")) OR rsQry("IN_PROGRESS") = "0" Then
274
               bInProgress = False
275
            Else
276
               bInProgress = True
277
            End If
278
 
279
            ' only flag as overdue if time threshold has been met but the daemon has not marked the instruction as being in progress.
280
            If rsQry("OVERDUE") AND NOT bInProgress Then
281
               bIsOverdue = True
282
            Else
283
               bIsOverdue = False
284
            End If
285
 
286
            If rsQry("READY") Then
287
               bIsReady = True
288
            Else
289
               bIsReady = False
290
            End If
291
 
292
 
293
            %>
294
            <tr>
295
               <input type="hidden" name="DAEMON_INSTRUCTIONS_ID_" & daemonInstId value=daemonInstId>
296
 
297
               <td></td>
298
 
299
               <td align="left" valign="top" class="body_txt">
300
                  <%=DaemonInstructionOperationName(rsQry("OP_CODE"))%>
301
               </td>
302
 
303
               <td align="left" valign="top" class="body_txt">
149 ghuddy 304
                  <%If rsQry("proj_id") <> "" Then%>
305
                     <a href='rtree.asp?proj_id=<%=rsQry("proj_id")%>'><%=rsQry("proj_name")%>
147 ghuddy 306
                  <%End If%>
307
               </td>
308
 
309
               <td align="left" valign="top" class="body_txt">
149 ghuddy 310
                  <%If rsQry("rtag_name") <> "" Then%>
311
                     <a href='dependencies.asp?rtag_id=<%=rsQry("RTAG_ID")%>'><%=rsQry("rtag_name")%>
147 ghuddy 312
                  <%End If%>
313
               </td>
314
 
315
               <td align="left" valign="top" class="body_txt">
149 ghuddy 316
                  <%=Get_Official(rsQry("official"))%>
147 ghuddy 317
               </td>
318
 
319
               <td align="left" valign="top" class="body_txt">
320
                  <%If (NOT IsNull(rsQry("PV_ID"))) AND (rsQry("PV_ID") <> "") Then%>
149 ghuddy 321
                     <a href='fixed_issues.asp?rtag_id=<%=rsQry("RTAG_ID")%>&pv_id=<%=rsQry("PV_ID")%>'><%=rsQry("pkg_name")%>
147 ghuddy 322
                  <%Else%>
149 ghuddy 323
                     <%=rsQry("pkg_name")%>
147 ghuddy 324
                  <%End If%>
325
               </td>
326
 
327
               <td align="left" valign="top" class="body_txt">
149 ghuddy 328
                  <%=rsQry("pkg_version")%>
147 ghuddy 329
               </td>
330
 
331
               <td align="left" valign="top" class="body_txt" <%If bIsOverdue Then%>style=color:Red<%Elseif bIsReady Then%>style=color:Green<%End If%>><%=EuroDateTime(rsQry("SCHEDULED_DATETIME"))%></td>
332
 
333
               <td align="left" valign="top" class="body_txt"><%=DaemonInstructionRepeatString(rsQry("OP_CODE"), rsQry("REPEAT_SECS"))%></td>
334
 
335
               <td align="left" valign="top" class="body_txt">
149 ghuddy 336
                  <%If rsQry("full_name") <> "" AND rsQry("user_email") <> "" Then%>
337
                     <a href='mailto:<%=rsQry("user_email")%>' title='<%=rsQry("user_email")%>' class="txt_linked"><%=rsQry("full_name")%></a>
147 ghuddy 338
                  <%End If%>
339
               </td>
340
 
341
               <td align="left" valign="top" class="body_txt">
342
                  <%=EuroDateTime(rsQry("ADDED_DATETIME"))%>
343
               </td>
344
 
345
               <td align="left" valign="top" class="body_txt">
346
                  <%If bInProgress Then%>
347
                     <%If bResetInProgressEnabled Then%>
348
                        <img src="images/i_reset.gif" onclick="reset_in_progress(<%=daemonInstId%>);"></img>
349
                     <%End If%>
350
                     YES
351
                  <%Else%>
352
                     NO
353
                  <%End If%>
354
               </td>
355
 
356
               <td align="left" valign="top" class="body_txt">
153 ghuddy 357
                  <%If UserCanAddOrEditThisDaemonInst(rsQry("proj_id"), rsQry("official"), rsQry("OP_CODE")) Then%>
147 ghuddy 358
                     <%Call objBtnControl.Render ( Array("btnEditDaemonInst", "btnDeleteDaemonInst"), objAccessControl )%>
359
                  <%Else%>
360
                     No Edit Permission
361
                  <%End If%>
362
               </td>
363
 
364
            </tr>
365
            <%
366
            rsQry.MoveNext()
367
            %>
368
            <tr>
369
               <td colspan="13" background="images/bg_table_border.gif"><img src="images/spacer.gif" width="1" height="1"></td>
370
            </tr>
371
            <%
372
         Wend
373
         rsQry.Close()
374
         Set rsQry = nothing
375
         %>
376
      </table>
377
 
378
      <table width="50%"  border="0" cellspacing="3" cellpadding="0" >
379
         <tr>
149 ghuddy 380
            <td class="form_iname">
381
               <%=sortText%>
382
            </td>
383
         </tr>
384
      </table>
385
 
386
 
387
      <table width="50%"  border="0" cellspacing="3" cellpadding="0" >
388
         <tr>
147 ghuddy 389
            <td class="form_iname">&nbsp;</td>
390
            <td class="val_err"><a href=""><%Call Action_Buttons ( "Add Daemon Instruction" )%> </a>
391
            <td>&nbsp;</td>
392
         </tr>
393
      </table>
394
 
395
      <table width="100%"  border="0" cellspacing="3" cellpadding="0" >
396
         <tr>
397
            <td>NOTE:</td>
398
         </tr>
399
         <tr>
400
            <td valign="top" class="help_txt">1)</td>
401
            <td valign="top" class="help_txt">Instructions become overdue when they are more than 10 minutes old and are not in-progress</td>
402
         </tr>
403
         <tr>
404
            <td valign="top" class="help_txt">2)</td>
405
            <td valign="top" class="help_txt">Instructions that take a long time to act upon, may cause other instructions for the same release to become overdue. This is not a real problem.</td>
406
         </tr>
407
         <tr>
408
            <td valign="top" class="help_txt">3)</td>
409
            <td valign="top" class="help_txt">Instructions may become stranded in the "in-progress" state if build daemons crash, or a problem occurs on a build machine.
410
            Automatic deletion of the instruction will eventually occur (see next note). Contact a release manager administrator to correct this problem before automatic deletion.</td>
411
         </tr>
412
         <tr>
413
            <td valign="top" class="help_txt">4)</td>
414
            <td valign="top" class="help_txt">Instructions with scheduled times 5 days or older will be deleted automatically.</td>
415
         </tr>
153 ghuddy 416
         <tr>
417
            <td valign="top" class="help_txt">5)</td>
418
            <td valign="top" class="help_txt">Add/Edit/Delete Permissions will vary depending upon Operation, Release Mode, and User Permissions.</td>
419
         </tr>
147 ghuddy 420
 
421
      </table>
422
 
423
      <%=objPMod.ComposeHiddenTags()%>
424
      <input type="hidden" name="action" value="true">
425
      <%
426
      Call objFormComponent.FormEnd()
427
      '-- FROM END ----------------------------------------------------------------------------------------------------------------
428
      %>
429
   </body>
430
</html>
431
<!-- FOOTER -->
432
<!--#include file="_footer.asp"-->
433
<%
434
Call Destroy_All_Objects
435
%>