mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Fixed bug where UI was not hitting different endpoints when deleting wfjt labels v. normal jt labels
This commit is contained in:
parent
deca2bb5c1
commit
7e54783fca
@ -355,7 +355,7 @@ export default ['$location', '$compile', '$rootScope', 'Attr', 'Icon',
|
||||
|
||||
innerTable += "<td class=\"List-actionsContainer\"><div class=\"List-actionButtonCell List-tableCell\">";
|
||||
|
||||
let handleEditStateParams = function(stateParams){console.log(stateParams);
|
||||
let handleEditStateParams = function(stateParams){
|
||||
let matchingConditions = [];
|
||||
|
||||
angular.forEach(stateParams, function(stateParam) {
|
||||
|
||||
@ -55,28 +55,37 @@ export default
|
||||
scope.seeMoreInactive = true;
|
||||
};
|
||||
|
||||
scope.deleteLabel = function(templateId, templateName, labelId, labelName) {
|
||||
scope.deleteLabel = function(template, label) {
|
||||
var action = function () {
|
||||
$('#prompt-modal').modal('hide');
|
||||
scope.seeMoreInactive = true;
|
||||
Wait('start');
|
||||
var url = GetBasePath("job_templates") + templateId + "/labels/";
|
||||
Rest.setUrl(url);
|
||||
Rest.post({"disassociate": true, "id": labelId})
|
||||
.success(function () {
|
||||
Wait('stop');
|
||||
$state.go('.', null, {reload: true});
|
||||
})
|
||||
.error(function (data, status) {
|
||||
Wait('stop');
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Could not disassociate label from JT. Call to ' + url + ' failed. DELETE returned status: ' + status });
|
||||
});
|
||||
let url;
|
||||
if(template.type === 'job_template') {
|
||||
url = GetBasePath("job_templates") + template.id + "/labels/";
|
||||
}
|
||||
else if(template.type === 'workflow_job_template') {
|
||||
url = GetBasePath("workflow_job_templates") + template.id + "/labels/";
|
||||
}
|
||||
|
||||
if(url) {
|
||||
Rest.setUrl(url);
|
||||
Rest.post({"disassociate": true, "id": label.id})
|
||||
.success(function () {
|
||||
Wait('stop');
|
||||
$state.go('.', null, {reload: true});
|
||||
})
|
||||
.error(function (data, status) {
|
||||
Wait('stop');
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Could not disassociate label from JT. Call to ' + url + ' failed. DELETE returned status: ' + status });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Prompt({
|
||||
hdr: 'Remove Label from ' + templateName ,
|
||||
body: '<div class="Prompt-bodyQuery">Confirm the removal of the <span class="Prompt-emphasis">' + $filter('sanitize')(labelName) + '</span> label.</div>',
|
||||
hdr: 'Remove Label from ' + template.name ,
|
||||
body: '<div class="Prompt-bodyQuery">Confirm the removal of the <span class="Prompt-emphasis">' + $filter('sanitize')(label.name) + '</span> label.</div>',
|
||||
action: action,
|
||||
actionText: 'REMOVE'
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<div class="LabelList-tagContainer" ng-repeat="label in labels">
|
||||
<div class="LabelList-deleteContainer"
|
||||
ng-click="deleteLabel(template.id, template.name, label.id, label.name)"
|
||||
ng-click="deleteLabel(template, label)"
|
||||
ng-show="showDelete && template.summary_fields.user_capabilities.edit">
|
||||
<i class="fa fa-times LabelList-tagDelete"></i>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user