Merge pull request #2411 from mabashian/job-templates-remove-label

Refresh label array whenever one is removed
This commit is contained in:
Michael Abashian 2016-06-15 11:41:50 -04:00 committed by GitHub
commit 69c994bd16

View File

@ -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;
});
}
};
}