Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7395 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'   View S3 SYNC State Information
5
'       form_view_s3Sync_state.asp
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
11
Response.Expires = 0   ' always load the page, dont store
12
%>
13
<!--#include file="common/conf.asp"-->
14
<!--#include file="common/globals.asp"-->
15
<!--#include file="common/formating.asp"-->
16
<!--#include file="common/qstr.asp"-->
17
<!--#include file="common/common_subs.asp"-->
18
<!--#include file="common/_form_window_common.asp"-->
19
<!--#include file="_action_buttons.asp"-->
20
 
21
<!--#include file="class/classActionButtonControl.asp"-->
22
<%
23
'------------ ACCESS CONTROL ------------------
24
%>
25
<!--#include file="_access_control_login_optional.asp"-->
26
<!--#include file="_access_control_general.asp"-->
27
<%
28
'------------ Variable Definition -------------
29
Dim parRtagId
30
Dim modifyState
31
Dim bReleaseSyncEnabled
32
 
33
'------------ Constants Declaration -----------
34
'------------ Variable Init -------------------
35
parRtagId = Request("rtag_id")
36
objPMod.PersistInQryString("rtag_id")
37
ReleaseMode = GetReleaseMode( Request("rtag_id") )
38
modifyState = "disabled"
39
bReleaseSyncEnabled = (releaseInfoHash("S3SYNC") = "Y")
40
 
41
If releaseIsWritable(ReleaseMode) Then
42
    If canActionControlInProject("ConfigureRelease") OR canActionControlInProject("EditNonCriticalInfoForLockedPackage") Then modifyState = ""
43
End If
44
'----------------------------------------------
45
Sub ShowSidePanel
46
End Sub
47
'----------------------------------------------
48
Sub ShowMainPanel
49
 %>
50
    <table class="embedded_table" style="margin-bottom:10px; width:70%">
51
      <tr>
52
         <td>
53
            <span nowrap class="form_ttl">View S3 Sync-enabled packages</span>
54
            <!-- Section Top Border ---->
55
            <div class="rounded_box" style="background: white;">
56
                <!-- Section Body Header ---->
57
                <!-- Main Pane -->
58
                <table id="s3synctable" width="100%" class="stripe">
59
                    <thead class="body_col">
60
                        <tr>
61
                          <th>PV_ID
62
                          <th>Package Name
63
                          <th>Package Version
64
                          <th>Package Extension
65
                          <th>Short Description
66
                          <th>S3 Sync Enabled<%=Quick_Help("f_s3sync")%>
67
                          <th>S3 Image<%=Quick_Help("f_s3image")%>
68
                        </tr>
69
                    </thead>
70
                    <tbody>
71
                    </tbody>
72
                </table>
73
                <!-- Info / Ajax Progress bar -->
74
                <div class='bg_dialog body_txt' style='position:relative;min-height:19px;' >
75
                    <div style='position: absolute;'><span id='ds_info'></span>
76
<%If not bReleaseSyncEnabled Then%>
77
				<span class='err_alert'>This Release does not have S3 Sync Enabled</span>
78
<%End If%>
79
					</div>
80
 
81
                    <div>
82
                          <button id='ds_refresh'  class='rmbutton' style="display:inline; float:right;">Refresh</button>
83
                          <button id='ds_avail'    class='rmbutton' style="display:inline; float:right;">Show S3 Image</button>
84
                          <button id='ds_show'     class='rmbutton' style="display:inline; float:right;">Show Sync Enabled</button>
85
                          <button id='ds_clearAll' class='rmbutton' style="display:inline; float:right;" <%=modifyState%>>Clear All</button>
86
                    </div>
87
                </div>
88
            </div>
89
            </td>
90
        </tr>
91
    </table>
92
<%
93
End Sub
94
'----------------------------------------------
95
%>
96
<html>
97
   <head>
98
        <title>Release Manager</title>
99
        <link rel="shortcut icon" href="<%=FavIcon%>"/>
100
        <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
101
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
102
        <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
103
        <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
104
        <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
105
        <%bJqueryDataTables = TRUE%>
106
        <!--#include file="_jquery_includes.asp"-->
107
        <!-- TIPS -->
108
        <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
109
        <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
110
        <script language="JavaScript" type="text/javascript">
7417 dpurdie 111
        formTips.tips.f_s3sync       = stdTip(300, 'S3 SYNC', 'Show packages that are marked to be synced to an S3 bucket' +
7395 dpurdie 112
                                                              '<p>These packages may be processed by CI/CD tools' );
7417 dpurdie 113
        formTips.tips.f_s3image      = stdTip(300, 'S3 TRANSFER', 'Marked packages currently have S3Tranfer.json file.' );
7395 dpurdie 114
 
115
        </script>
116
        <script type="text/javascript" charset="utf-8">
117
        var table;
118
        var showHide = false;
119
        var showHideImg = false;
120
	$(document).ready(function() {
121
		/* Init DataTables */
122
        table = $("#s3synctable").DataTable({
123
            processing: true,
124
            deferRender: true,
125
            dom: "frtiS",
126
            sScrollY: $( document ).height() - 45 - 200 - 15,
127
            scrollCollapse: true,
128
            retrieve:true,
129
            serverSide: true,
130
            ajax : {
131
                url : "s3Sync_state_json.asp",
132
                data : function (o){
133
                    o.rtag_id = <%=parRtagId%>;
134
                    o.show = showHide;
135
                    o.showImg = showHideImg;
136
                },
137
                dataSrc : function (json){
138
                    //  Process the raw Ajax data
139
                    //      Create a checkbox for the state
140
                    //      Add a data item to the entry - to allow traceback when saving
141
                    $.each(json.data, function(idx,row){
142
                        var checked = row[5] == "Y" ? 'checked' : '';
143
                        row[5] = '<div><input type="checkbox" class=clickable <%=modifyState%> '+ checked + ' data-pvid='+ row[0] +'></div>'
144
 
145
						var hasS3Image = row[6] > 0 ? 'checked' : '';
146
                        row[6] = '<div><input type="checkbox" disabled '+ hasS3Image + '></div>'
147
                    });
148
                    return json.data;
149
                }
150
            },
151
            ordering: true,
152
            order: [[ 1, "asc" ]],
153
            lengthChange : false,
154
 
155
            scroller : {
156
			    loadingIndicator : true,
157
                displayBuffer: 9,
158
		    },
159
            columns: [
160
               { visible : false },
161
               { width: "10%", className: "dt-nowrap"  },
162
               { width: "10%", className: "dt-nowrap"  },
163
               { width: "1%", className: "dt-nowrap"  },
164
               { width: "60%",orderable: false },
165
               { width: "10%",className: "dt-nowrap" },
166
               { width: "10%",className: "dt-nowrap" }
167
           ]
168
        });
169
 
170
    // Wire Up buttons
171
    $('#ds_refresh').on("click", function(){
172
        table.ajax.reload(null, false);        
173
    });
174
 
175
    $('#ds_show').on("click", function(){
176
        $(this).text( showHide ? 'Show Sync Enabled' : 'Show All');
177
        showHide = !showHide;
178
        table.ajax.reload();        
179
    });
180
 
181
    $('#ds_avail').on("click", function(){
182
        $(this).text( showHideImg ? 'Show S3 Image' : 'Show All');
183
        showHideImg = !showHideImg;
184
        table.ajax.reload();        
185
    });
186
 
187
    $('#ds_clearAll').on("click", function(){
188
        var msg  = 'Are you sure you want to reset the "S3 Sync" flag on all packages in this Release?' +
189
                   '<p>The flag is a function of the release (unlike the Deployable flag).' +
190
                   '<p>Resetting all the flags will not affect other Releases and Projects.';
191
 
192
        vixConfirm (msg,{
193
            title:'Reset All S3 Sync Flags', 
194
            button: 'Reset All Flags',
195
            ok : function(){
196
                getAjaxData (
197
                    "_json_UpdateVersion.asp",
198
                    { opr : 'clearAllS3Sync',
199
                      rtag_id : <%=parRtagId%>   
200
                    },
201
                    null,
202
                    function() {table.ajax.reload();}
203
                    );
204
                }});
205
    });
206
 
207
 
208
    // Process click on checkboxes within the datatable
209
    //      this - a DOM node
210
    //      $(this) - The jquery wrapped node
211
    //
212
    $('#s3synctable').on( 'click', 'tbody td :checkbox', function () {
213
        getAjaxData (
214
            "_json_UpdateVersion.asp",
215
            { opr : 'setS3Sync', 
216
              rtag_id : <%=parRtagId%> ,  
217
              pv_id : $(this).data('pvid'), 
218
              s3sync_state : this.checked ? 'Y' : '-' 
219
            });
220
        });
221
 
222
	} );
223
 
224
//  getAjaxData - with error processing
225
//      url - url to fetch
226
//      data    - additional data to pass to ajax request
227
//      success - function to call on success
228
//      always -  function to call at completion
229
function getAjaxData( url, data, success, always )
230
{
231
    clearInfo();
232
    $("#progressSpinner").css('visibility', 'visible');
233
    $(document.body).css({ 'cursor': 'progress' })
234
    $.ajax(
235
    {
236
        url : url,
237
        type: "POST",
238
        data : data,
239
        dataType : "json",
240
        cache: false,
241
        success:function(data, textStatus, jqXHR) {
242
            //data: return data from server
243
            //console.log ("UpdateData", data);
244
            if (data.result != 0) {
245
                setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
246
                return;
247
            }
248
            //  call user success function
249
            if (jQuery.isFunction(success)) {
250
                success(data);
251
            }
252
        },
253
        error: function(jqXHR, textStatus, errorThrown) {
254
            setInfo("Error:" + errorThrown);
255
            //if fails
256
        },
257
        complete : function() {
258
            $("#progressSpinner").css('visibility', 'hidden');
259
            $(document.body).css({ 'cursor': 'auto' });
260
            //  call user always function
261
            if (jQuery.isFunction(always)) {
262
                always();
263
            }
264
        }
265
    });
266
 
267
function setInfo(txt) {
268
    $("#ds_info").text( txt);
269
}
270
 
271
function clearInfo(txt) {
272
    $("#ds_info").text(" ");
273
}
274
 
275
}
276
</script>
277
 
278
      <!-- DROPDOWN MENUS -->
279
      <!--#include file="_menu_def.asp"-->
280
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
281
   </head>
282
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
283
      <!-- HEADER -->
284
      <!--#include file="_header.asp"-->
285
      <!-- BODY ---->
286
      <table class="full_table">
287
         <tr>
288
            <td class="bg_panel" valign="top" style="min-width:146px">
289
                <%Call ShowSidePanel%>
290
            </td>
291
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
292
                <%Call ShowMainPanel%>
293
            </td>
294
         </tr>
295
         <tr>
296
            <td class="bg_panel_btm" height="350"></td>
297
         </tr>
298
      </table>
299
      <!-- FOOTER -->
300
      <!--#include file="_footer.asp"-->
301
   </body>
302
</html>