@@ -306,10 +306,10 @@ export default {
306
306
});
307
307
},
308
308
deleteTagLimiter : function (tagName ) {
309
- let url = ` ${ this .$api .BASE_URL } /${ this .$api .URL_POLICY } /${ this . policy . uuid } /tag/ ${ tagName} ` ;
309
+ let url = ` ${ this .$api .BASE_URL } /${ this .$api .URL_TAG } /${ encodeURIComponent ( tagName) } /policy ` ;
310
310
this .axios
311
- .delete (url)
312
- .then ((response ) => {
311
+ .delete (url, { data : [ this . policy . uuid ] } )
312
+ .then (() => {
313
313
let p = [];
314
314
for (let i = 0 ; i < this .tags .length ; i++ ) {
315
315
if (this .tags [i].name !== tagName) {
@@ -318,9 +318,6 @@ export default {
318
318
}
319
319
this .tags = p;
320
320
this .$toastr .s (this .$t (' message.updated' ));
321
- })
322
- .catch ((error ) => {
323
- this .$toastr .w (this .$t (' condition.unsuccessful_action' ));
324
321
});
325
322
},
326
323
updateProjectSelection : function (selections ) {
@@ -347,19 +344,27 @@ export default {
347
344
},
348
345
updateTagSelection : function (selections ) {
349
346
this .$root .$emit (' bv::hide::modal' , ' selectTagModal' );
347
+
348
+ let promises = [];
350
349
for (let i = 0 ; i < selections .length ; i++ ) {
351
350
let selection = selections[i];
352
- let url = ` ${ this .$api .BASE_URL } /${ this .$api .URL_POLICY } /${ this .policy .uuid } /tag/${ selection .name } ` ;
353
- this .axios
354
- .post (url)
355
- .then ((response ) => {
356
- this .tags .push (selection);
357
- this .$toastr .s (this .$t (' message.updated' ));
358
- })
359
- .catch ((error ) => {
360
- this .$toastr .w (this .$t (' condition.unsuccessful_action' ));
361
- });
351
+ let url = ` ${ this .$api .BASE_URL } /${ this .$api .URL_TAG } /${ encodeURIComponent (selection .name )} /policy` ;
352
+ promises .push (
353
+ this .axios
354
+ .post (url, [this .policy .uuid ])
355
+ .then (() => Promise .resolve (selection .name )),
356
+ );
362
357
}
358
+
359
+ Promise .all (promises).then ((addedTagNames ) => {
360
+ for (const tagName of addedTagNames) {
361
+ if (! this .tags .some ((tag ) => tag .name === tagName)) {
362
+ this .tags .push ({ name: tagName });
363
+ }
364
+ }
365
+
366
+ this .$toastr .s (this .$t (' message.updated' ));
367
+ });
363
368
},
364
369
updateIncludeChildren : function () {
365
370
let url = ` ${ this .$api .BASE_URL } /${ this .$api .URL_POLICY } ` ;
0 commit comments