22
22
<!-- Actions Panel -->
23
23
<div class =" ui grid" >
24
24
<div class =" row" >
25
- <div class =" four wide column" >
26
- <button class =" ui button delete-snapshots" @click =" delete_snapshots($event)"
27
- data-content =" You must choose at least one snapshot to delete" >
28
- <i ></i > Delete
29
- </button >
30
- <button class =" ui button validate-snapshots" @click =" validate_snapshots($event)" >
31
- <i class =" sync icon" ></i > Validate
25
+ <div class =" five wide column" >
26
+ <div class =" ui buttons" >
27
+ <div class =" ui labeled icon button delete-snapshots" data-tooltip =" Delete selected snapshots"
28
+ v-on:click =" delete_snapshots($event)" >
29
+ <i class =" trash icon" ></i >Delete
30
+ </div >
31
+ <div class =" ui floating dropdown icon button button-spacing" >
32
+ <i class =" dropdown icon" ></i >
33
+ <div class =" menu" >
34
+ <div class =" ui checkbox item"
35
+ data-tooltip =" Delete will ignore errors related to the environment"
36
+ data-position =" bottom center" >
37
+ <input type =" checkbox" v-model =" ignoreErrors" />
38
+ <label >Ignore Env Errors</label >
39
+ </div >
40
+ </div >
41
+ </div >
42
+ </div >
43
+ <button class =" ui labeled icon button validate-snapshots" @click =" validate_snapshots($event)"
44
+ data-tooltip =" Confirm that the snapshots exist in the S3 bucket" >
45
+ <i class =" sync icon" ></i >Validate
32
46
</button >
33
47
</div >
34
48
<div class =" ten wide column" >
104
118
</thead >
105
119
106
120
<tbody >
107
- <template v-for =" build_config_snapshots in snapshots " v-bind = " snapshots " >
108
- <tr >
121
+ <template v-for =" build_config_snapshots in snapshots " >
122
+ <tr :key = " 'build-config-' + build_config_snapshots._id " >
109
123
<td colspan =" 5" >
110
124
<div class =" ui checkbox checkbox-popup" title =" Select all snapshots for this build config" >
111
125
<input type =" checkbox" @click =" toggleAllSnapshots($event, build_config_snapshots._id)" >
114
128
</td >
115
129
</tr >
116
130
117
- <tr v-for =" snapshot_data in build_config_snapshots.items" v-bind = " build_config_snapshots " >
131
+ <tr v-for =" snapshot_data in build_config_snapshots.items" :key = " 'snapshot-' + snapshot_data._id " >
118
132
<td >
119
133
<div class =" ui checkbox" >
120
134
<input class =" checkbox-snapshot" type =" checkbox"
@@ -164,7 +178,6 @@ export default {
164
178
onShow : function () {
165
179
self .resetMessages ();
166
180
self .loadData ();
167
- $ (" .checkbox-popup" ).popup ();
168
181
}
169
182
});
170
183
@@ -196,6 +209,7 @@ export default {
196
209
snapshots_error: null ,
197
210
snapshots_validated: 0 ,
198
211
show_snapshots_validated: false ,
212
+ ignoreErrors: false ,
199
213
}
200
214
},
201
215
methods: {
@@ -273,6 +287,18 @@ export default {
273
287
self .environments .add (snapshot .environment )
274
288
})
275
289
})
290
+
291
+ self .$nextTick (function () {
292
+ // Re-initialize the checkboxes
293
+ $ (' .ui.checkbox' ).checkbox ();
294
+
295
+ // Re-initialize the popups
296
+ $ (" .checkbox-popup" ).popup ({
297
+ boundary: ' .table-container' ,
298
+ scrollContext: ' .table-container' ,
299
+ });
300
+ });
301
+
276
302
self .loaded ()
277
303
})
278
304
.catch (err => {
@@ -294,23 +320,22 @@ export default {
294
320
}
295
321
},
296
322
delete_snapshots (event ) {
297
- const self = this
323
+ const self = this ;
298
324
this .resetMessages ();
299
- const $checked_snapshots = $ (" .checkbox-snapshot:checked" )
325
+ const $checked_snapshots = $ (" .checkbox-snapshot:checked" );
300
326
if ($checked_snapshots .length == 0 ) {
301
- $ (event .target ).popup (" show" )
302
- return
327
+ $ (event .target ).popup (" show" );
328
+ return ;
303
329
}
304
330
305
- self .loading ()
331
+ self .loading ();
306
332
307
333
const cmd = function () {
308
- const data = { snapshots_data: {} };
334
+ const data = { snapshots_data: {}, ignoreErrors : self . ignoreErrors };
309
335
$checked_snapshots .map ((_ , element ) => {
310
336
const name = $ (element).data (" snapshotName" );
311
337
let environment = $ (element).data (" environment" );
312
338
313
- // Handle undefined environment
314
339
if (environment === undefined ) {
315
340
environment = " __no_env__" ;
316
341
}
@@ -321,22 +346,26 @@ export default {
321
346
data .snapshots_data [environment].push (name);
322
347
});
323
348
324
-
325
- return axios .put (axios .defaults .baseURL + ' /delete_snapshots' , data)
326
- }
349
+ return axios .put (axios .defaults .baseURL + ' /delete_snapshots' , data);
350
+ };
327
351
328
352
const onSuccess = function (response ) {
329
- console .log (' Snapshots deleted: ' + response .data .result )
330
- self .loadData ()
331
- }
353
+ console .log (' Snapshots deleted: ' + response .data .result );
354
+ self .loadData ();
355
+
356
+ self .$nextTick (() => {
357
+ $ (' .ui.checkbox' ).checkbox ();
358
+ });
359
+ };
332
360
333
361
const onError = function (err ) {
334
- self .loaderror (" Error when deleting snapshots" , err)
335
- console .error (' Failed delete snapshots: ' + err)
336
- }
362
+ self .loaderror (" Error when deleting snapshots" , err);
363
+ console .error (' Failed delete snapshots: ' + err);
364
+ };
337
365
338
- this .launchAsyncCommand (cmd, onSuccess, onError)
366
+ this .launchAsyncCommand (cmd, onSuccess, onError);
339
367
},
368
+
340
369
getBucketName (snapshot_data ) {
341
370
if (
342
371
snapshot_data .conf &&
@@ -421,7 +450,6 @@ export default {
421
450
const errorMessage = results .errors .join (' <br>' );
422
451
this .snapshots_error = ` <div class="text red"><b>Validation completed with errors</b><br>${ errorMessage} </div>` ;
423
452
} else {
424
- // Successful validation
425
453
this .snapshots_error = ` <div class="text green"><b>Validation completed successfully</b><br>${ snapshotsDeleted} snapshots were removed during validation.</div>` ;
426
454
}
427
455
this .loadData (true );
@@ -481,6 +509,7 @@ export default {
481
509
max-height : 60vh ;
482
510
overflow-y : auto ;
483
511
margin-top : 5px ;
512
+ position : relative ;
484
513
}
485
514
486
515
.cleanup.modal {
@@ -502,4 +531,8 @@ export default {
502
531
border : 1px solid #e0b4b4 ;
503
532
border-radius : 5px ;
504
533
}
534
+
535
+ .button-spacing {
536
+ margin-right : 10px !important ;
537
+ }
505
538
</style >
0 commit comments