diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index d9b5702f60..c41e059c81 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -355,7 +355,7 @@ export default ['$location', '$compile', '$rootScope', 'Attr', 'Icon', innerTable += "
"; - let handleEditStateParams = function(stateParams){console.log(stateParams); + let handleEditStateParams = function(stateParams){ let matchingConditions = []; angular.forEach(stateParams, function(stateParam) { diff --git a/awx/ui/client/src/templates/labels/labelsList.directive.js b/awx/ui/client/src/templates/labels/labelsList.directive.js index c7b83618db..69a2295549 100644 --- a/awx/ui/client/src/templates/labels/labelsList.directive.js +++ b/awx/ui/client/src/templates/labels/labelsList.directive.js @@ -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: '
Confirm the removal of the ' + $filter('sanitize')(labelName) + ' label.
', + hdr: 'Remove Label from ' + template.name , + body: '
Confirm the removal of the ' + $filter('sanitize')(label.name) + ' label.
', action: action, actionText: 'REMOVE' }); diff --git a/awx/ui/client/src/templates/labels/labelsList.partial.html b/awx/ui/client/src/templates/labels/labelsList.partial.html index 0837cdfc00..e614692a6e 100644 --- a/awx/ui/client/src/templates/labels/labelsList.partial.html +++ b/awx/ui/client/src/templates/labels/labelsList.partial.html @@ -1,6 +1,6 @@