From ee74905d41091ea768922f777670a123e061478e Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Tue, 14 Jun 2016 17:25:33 -0400 Subject: [PATCH] Fixed bug where removing a label from a job template via the list wasn't updating the list without a hard refresh. --- .../job-templates/labels/labelsList.directive.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/awx/ui/client/src/job-templates/labels/labelsList.directive.js b/awx/ui/client/src/job-templates/labels/labelsList.directive.js index 4fb8225f3b..4e401c4d71 100644 --- a/awx/ui/client/src/job-templates/labels/labelsList.directive.js +++ b/awx/ui/client/src/job-templates/labels/labelsList.directive.js @@ -15,12 +15,6 @@ export default link: function(scope, element, attrs) { scope.seeMoreInactive = true; - scope.labels = scope. - job_template.summary_fields.labels.results; - - scope.count = scope. - job_template.summary_fields.labels.count; - var getNext = function(data, arr, resolve) { Rest.setUrl(data.next); Rest.get() @@ -75,6 +69,13 @@ export default actionText: 'REMOVE' }); }; + + scope.$watch("job_template.summary_fields.labels.results", function() { + // To keep the array of labels fresh, we need to set up a watcher - otherwise, the + // array will get set initially and then never be updated as labels are removed + scope.labels = scope.job_template.summary_fields.labels.results; + scope.count = scope.job_template.summary_fields.labels.count; + }); } }; }