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