Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
5357 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|          Edit/View Build Configuration            |
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"-->
20
<!--#include file="_action_buttons.asp"-->
21
<!--#include file="class/classActionButtonControl.asp"-->
6175 dpurdie 22
<!--#include file="common/common_daemon.asp"-->
6052 dpurdie 23
<% objPMod.PersistInQryString("proj_id") %>
24
<% '------------ ACCESS CONTROL ------------------ %>
6181 dpurdie 25
<!--#include file="_access_control_login_optional.asp"-->
6070 dpurdie 26
<!--#include file="_access_control_general.asp"-->
6052 dpurdie 27
<!--#include file="_access_control_action_project.asp"-->
5357 dpurdie 28
<%
29
'------------ Variable Definition -------------
30
Dim objSortHelper
31
Dim rsQry
32
Dim parRtagId
33
Dim query_string
34
Dim objBtnControl
35
Dim rcon_id
6166 dpurdie 36
Dim masterCount
37
Dim toolsetWarning
38
 
5357 dpurdie 39
'------------ Constants Declaration -----------
40
'------------ Variable Init -------------------
41
parRtagId = Request("rtag_id")
42
objPMod.PersistInQryString("rtag_id")
43
Set objBtnControl = New ActionButtonControl
44
'----------------------------------------------
45
%>
46
<%
47
'--------------------------------------------------------------------------------------------------------------------------
48
Sub GetFormDetails ( parRtagId, ByRef outobjDetails )
49
   Dim rsQry, query
50
 
51
 
52
   OraDatabase.Parameters.Add "RTAG_ID",    parRtagId,      ORAPARM_INPUT, ORATYPE_NUMBER
53
 
54
   query = _
55
   " SELECT * "&_
56
   "  FROM RELEASE_TAGS rt"&_
57
   " WHERE rt.RTAG_ID = :RTAG_ID"
58
 
59
   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
60
 
61
   OraDatabase.Parameters.Remove "RTAG_ID"
62
 
63
 
64
 
65
   If rsQry.RecordCount > 0 Then
66
      outobjDetails.Item ("rtag_id") = rsQry("rtag_id")
67
      outobjDetails.Item ("rtag_name") = rsQry("rtag_name")
68
   Else
69
      Err.Raise 8, "Sub GetFormDetails in "& ScriptName, "Empty record set returned. parRtagId="& parRtagId
70
 
71
   End If
72
 
73
   rsQry.Close
74
   Set rsQry = Nothing
75
End Sub
76
'--------------------------------------------------------------------------------------------------------------------------
77
Sub DeleteDaemon(rcon_id_list)
78
 
79
   OraDatabase.Parameters.Add "RCON_ID_LIST",   rcon_id_list,    ORAPARM_INPUT, ORATYPE_VARCHAR2
80
 
81
   On Error Resume Next
82
   objEH.TryORA()
83
 
84
   OraDatabase.ExecuteSQL "BEGIN  PK_BUILDAPI.DELETE_DAEMON(:RCON_ID_LIST);  END;"
85
 
86
   objEH.CatchORA ( OraSession )
87
 
88
   OraDatabase.Parameters.Remove "RCON_ID_LIST"
89
End Sub
90
'--------------------------------------------------------------------------------------------------------------------------
91
Sub RemoveDaemon(rcon_id_list)
92
 
93
   OraDatabase.Parameters.Add "RCON_ID_LIST",   rcon_id_list,    ORAPARM_INPUT, ORATYPE_VARCHAR2
94
 
95
   On Error Resume Next
96
   objEH.TryORA()
97
 
98
   OraDatabase.ExecuteSQL "BEGIN  PK_BUILDAPI.REMOVE_DAEMON(:RCON_ID_LIST);  END;"
99
 
100
   objEH.CatchORA ( OraSession )
101
 
102
   OraDatabase.Parameters.Remove "RCON_ID_LIST"
103
End Sub
104
'--------------------------------------------------------------------------------------------------------------------------
6166 dpurdie 105
Sub CheckMasterConfig()
106
    Dim rsQry, query
107
    OraDatabase.Parameters.Add "RTAG_ID",    parRtagId,      ORAPARM_INPUT, ORATYPE_NUMBER
108
 
109
    '
110
    '   Check that there is exacly one master in the build set
111
    query = _
112
        "SELECT COUNT (rc.daemon_mode) as masterCount" &_
113
        " FROM release_manager.release_config rc, release_manager.run_level rl" &_
114
        " WHERE rc.rtag_id   = :RTAG_ID" &_
115
        " AND rl.RCON_ID = rc.RCON_ID" &_
116
        " AND   rc.bmcon_id is not NULL" &_
117
        " GROUP BY rc.daemon_mode" &_
118
        " HAVING rc.daemon_mode = 'M'"
119
 
120
    Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
121
 
122
    If rsQry.RecordCount > 0 Then
123
       masterCount = rsQry("masterCount")
124
    End If
125
    rsQry.Close
126
    Set rsQry = Nothing
127
 
6183 dpurdie 128
    If bGetApplication("CheckToolset", TRUE) Then
129
        '
130
        '   Check that each GBE_MACHTYPE has exactly one instance where the BUILDFILTER contains
131
        '   a TOOLSET builder. The test is a bit sloppy
132
        query = _
133
            "SELECT * from ( " &_
134
            "SELECT GBE_ID, COUNT(hasToolset) as ToolsetCount " &_
135
            "FROM  " &_
136
            "  (SELECT bc.GBE_ID, " &_
137
            "    CASE " &_
138
            "      WHEN INSTR(rc.GBE_BUILDFILTER, 'TOOLSET') > 0 " &_
139
            "      THEN 1 " &_
140
            "      ELSE NULL " &_
141
            "    END AS hasToolset " &_
142
            "  FROM release_manager.release_config rc, " &_
143
            "    BUILD_MACHINE_CONFIG bc " &_
144
            "  WHERE rc.rtag_id = :RTAG_ID " &_
145
            "  AND rc.bmcon_id IS NOT NULL " &_
146
            "  AND bc.bmcon_id  = rc.bmcon_id " &_
147
            "  ) " &_
148
            "GROUP BY GBE_ID ) " &_
149
            "Where  ToolsetCount != 1 "
6166 dpurdie 150
 
6183 dpurdie 151
        Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
6166 dpurdie 152
 
6183 dpurdie 153
        toolsetWarning =  rsQry.RecordCount > 0 
154
        rsQry.Close
155
        Set rsQry = Nothing
156
    End If
6166 dpurdie 157
 
158
    OraDatabase.Parameters.Remove "RTAG_ID"
159
 
160
End Sub
5357 dpurdie 161
%>
162
<%
163
'------------ RUN BEFORE PAGE RENDER ----------
164
' --- Get Form details from DB ---
165
Call GetFormDetails ( Request("rtag_id"), objFormCollector )
166
 
167
' --- Enter Form Validation Rule Changes here... ----
168
'----------------------------------------------------
169
 
170
' --- RUN onPostBack ---
171
If Request("action") <> "" AND objAccessControl.UserLogedIn Then
172
   If objForm.IsValidOnPostBack Then
173
      If canActionControlInProject("BuildConfiguration") Then
174
         If Request("btn") = "Delete" Then
175
             Call DeleteDaemon(Request("rcon_id_list"))
176
         ElseIf Request("btn") = "Unlink" Then
177
             Call RemoveDaemon(Request("rcon_id_list"))
178
        End If
179
      End If
180
 
181
      If objEH.Finally Then
182
         Call OpenInWindow ( "release_config.asp?rtag_id="& parRtagId )
183
      End If
184
 
185
   End If
186
 
187
End If
6166 dpurdie 188
Call CheckMasterConfig()
5357 dpurdie 189
'----------------------------------------------
190
%>
191
 
192
<html>
193
   <head>
194
      <title>Release Manager</title>
195
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
196
      <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
197
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
198
      <link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
199
      <link rel="stylesheet" href="images/navigation.css" type="text/css">
200
      <script language="JavaScript" src="images/common.js"></script>
201
      <!--#include file="_jquery_includes.asp"-->
202
      <!-- DROPDOWN MENUS -->
203
      <!--#include file="_menu_def.asp"-->
204
      <script language="JavaScript1.2" src="images/popup_menu.js"></script>
205
   </head>
206
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
207
      <!-- HEADER -->
208
      <!--#include file="_header.asp"-->
209
      <!-- BODY ---->
210
 
211
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
212
         <%
213
         '-- FROM START ---------------------------------------------------------------------------------------------------------
214
         objFormComponent.FormName = "FormName"
215
         objFormComponent.Action = ScriptName
216
         Call objFormComponent.FormStart()
217
         %>
218
         <tr>
6175 dpurdie 219
            <td width="146px" class="panel_bg" valign="top"><%Call BuildMenuPane%></td>
5357 dpurdie 220
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
221
               <table width="10" border="0" cellspacing="0" cellpadding="0">
222
                  <tr>
223
                     <td width="1%"></td>
224
                     <td width="100%">
225
                        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
226
                           <tr>
227
                              <td nowrap class="body_txt"></td>
228
                           </tr>
229
                        </table>
230
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
231
                           <tr>
232
                              <td nowrap class="form_ttl">
233
                                 <p>&nbsp;</p>
234
                                 <p>
235
                                    <%If canActionControlInProject("BuildConfiguration") Then%>
236
                                       ADMINISTER
237
                                    <%Else%>
238
                                       VIEW
239
                                    <%End If%>
240
                                    BUILD CONFIGURATION
241
                                 </p>
242
                              </td>
243
                              <td align="right" valign="bottom"></td>
244
                           </tr>
245
                        </table>
246
                     </td>
247
                     <td width="1%"></td>
248
                  </tr>
249
                  <tr>
250
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
251
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
252
                     <td align="right" valign="top"  background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
253
                  </tr>
254
                  <tr>
255
                     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
256
                     <td bgcolor="#FFFFFF" valign="top">
257
                        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
258
                        <!--#include file="messages/_msg_inline.asp"-->
259
                        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
260
                        <br>
261
                        <!-- BUTTONS CONTROL +++++++++++++++++++ -->
262
                        <%
263
                        If canActionControlInProject("BuildConfiguration") Then
264
                           Call Action_Buttons ( "Add Daemon" )
265
                        End If
266
 
267
                        ' Load some action buttons
268
                        Call objBtnControl.LoadActionButtons ( Array("btnEditDaemon", "btnRemoveDaemon", "btnDeleteDaemon"), OraDatabase )
269
                        objBtnControl.ButtonSpacer = 1
270
 
271
                        %>
272
 
273
                        <!-- +++++++++++++++++++++++++++++++++++ -->
274
 
275
                        <table width="100%"  border="0" cellspacing="2" cellpadding="0">
276
                     </td>
277
                     <td width="9%" valign="top"></td>
278
                  </tr>
279
                  <tr>
280
                     <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"></td>
281
                     <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">DAEMON HOST</td>
282
                     <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">GBE_MACHTYPE</td>
283
                     <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">DAEMON MODE</td>
284
                     <td valign="top"   wrap background="images/bg_table_col.gif" class="body_col">GBE_BUILDFILTER</td>
285
                     <%If canActionControlInProject("BuildConfiguration") Then%>
286
                        <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">ACTION</td>
287
                     <%End If%>
288
                     <td valign="top">
289
                  </tr>
290
                  <%
291
 
292
                  query_string = "select rcon_id, display_name, rc.bmcon_id, daemon_mode, gbe_value, gbe_buildfilter " &_
293
                                 " from release_manager.release_config rc," &_
294
                                 "      release_manager.build_machine_config bm," &_
295
                                 "      release_manager.gbe_machtype gbe" &_
296
                                 " where rc.rtag_id=" & parRtagId &_
297
                                 "      and rc.bmcon_id=bm.bmcon_id(+)" &_
298
                                 "      and rc.gbe_id=gbe.gbe_id" &_
299
                                 " order by daemon_mode, bm.display_name"
300
                  Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
301
                  Dim daemon_mode, daemon, cbtype
302
 
303
                  cbtype = "hidden"
304
                  If canActionControlInProject("BuildConfiguration") Then
305
                     cbtype = "checkbox"
306
                  End If
307
 
308
                  '--- Render rows ---
309
                  Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
310
                     rcon_id = rsQry("rcon_id")
311
                     daemon  = rsQry("display_name")
312
                     If IsNull(daemon) Then
313
                         daemon = ""
314
                     End If
315
 
316
                     If rsQry("daemon_mode") = "M" Then
317
                        daemon_mode = "MASTER"
318
                     Else
319
                        daemon_mode = "SLAVE"
320
                     End If
321
                     %>
322
                     <tr>
323
                        <td colspan="5" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
324
                     </tr>
325
                     <tr>
326
                        <td valign="top" align="center"><input type=<%=cbtype%> name="rcon_id_list" value="<%=rsQry("rcon_id")%>"></td>
327
                        <td valign="top"    nowrap class="body_rowg"><%=daemon%></td>
328
                        <td valign="top"    nowrap class="body_rowg"><%=rsQry("gbe_value")%></td>
329
                        <td valign="top"    nowrap class="body_rowg"><%=daemon_mode%></td>
330
                        <td valign="top"      wrap class="body_rowg"><%=rsQry("gbe_buildfilter")%></td>
331
                        <%If canActionControlInProject("BuildConfiguration") Then%>
332
                           <td valign="top" nowrap class="body_rowg"><%Call objBtnControl.Render  ( Array("btnEditDaemon", "btnRemoveDaemon", "btnDeleteDaemon"), objAccessControl )%></td>
333
                        <%End If%>
334
                     </tr>
335
                     <%
336
                     rsQry.MoveNext
337
                  Loop
338
                  rsQry.Close()
339
                  Set rsQry = nothing
340
                  %>
341
               </table>
342
            </td>
343
            <td background="images/lbox_bgside_white.gif">&nbsp;</td>
344
         </tr>
6166 dpurdie 345
        <%If masterCount <> 1 OR toolsetWarning Then %>
346
          <tr class="form_error form_btn">
347
            <td></td>
348
            <td style="padding: 10px;">
349
            <table class="full_table form_error">
350
                <%If masterCount <> 1 Then %>
351
                 <tr>
352
                    <td nowrap class="err_alert">Error
353
                    <td class="body_rowg"> The set of Build Machines must have exactly one Master.
354
                 </tr>
355
                <%End If%>
356
                <%If toolsetWarning Then %>
357
                 <tr>
358
                    <td nowrap class="err_alert">Warning
359
                    <td class="body_rowg">There should be one TOOLSET builder within each set of machines with the same GBE_MACHTYPE.
360
                 </tr>
361
                <%End If%>
362
                </tr>
363
            </table>
364
         </td>
365
            <td></td>
366
         </tr>
367
        <%End If%>
5357 dpurdie 368
         <tr>
6166 dpurdie 369
            <!-- ACTION BUTTONS ---------------------------------------------->
5357 dpurdie 370
            <td background="images/bg_action_norm.gif" ></td>
371
            <td align="right" background="images/bg_action_norm.gif" >
372
 
373
               <%=objFormComponent.CancelButton ( "OK", "class='form_btn'", "build_status.asp?rtag_id="& parRtagId )%>
374
               <%=objPMod.ComposeHiddenTags()%>
375
               <%If canActionControlInProject("BuildConfiguration") Then%>
376
                  <input name="btn" type="submit" class="form_btn" value="Unlink">
377
                  <input name="btn" type="submit" class="form_btn" value="Delete">
378
               <%End If%>
379
               <input type="hidden" name="rcon_id_list" value="<%=Request("rcon_id_list")%>">
380
               <input type="hidden" name="action" value="true">
381
            </td>
382
            <td background="images/bg_action_norm.gif" ><img src="images/h_trsp_dot.gif" width="5" height="30"></td>
6166 dpurdie 383
         <!-- ACTION BUTTONS END  ------------------------------------------></td>
5357 dpurdie 384
         </tr>
385
         <tr>
386
            <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
387
            <td background="images/lbox_bg_blue.gif"></td>
388
            <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
389
         </tr>
390
      </table>
391
 
392
      <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
393
  </tr>
394
  <tr>
6175 dpurdie 395
    <td valign="bottom" align="center" background="images/bg_home_orange.gif"><img src="images/img_gear.gif" width="86" height="99" vspace="20" hspace="30"></td>
5357 dpurdie 396
    <td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="500"></td>
397
  </tr>
398
<%
399
Call objFormComponent.FormEnd()
400
'-- FROM END ----------------------------------------------------------------------------------------------------------------
401
%>
402
</table>
403
<!-- FOOTER -->
404
<!--#include file="_footer.asp"-->
405
</body>
406
</html>