mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
add labels field to job list, extend labels directive to allow no-delete mode, resolves #2663
consistent naming whoops
This commit is contained in:
parent
b126d0a529
commit
b750b14f36
@ -13,6 +13,7 @@ export default
|
||||
scope: false,
|
||||
templateUrl: templateUrl('job-templates/labels/labelsList'),
|
||||
link: function(scope, element, attrs) {
|
||||
scope.showDelete = attrs.showDelete === 'true';
|
||||
scope.seeMoreInactive = true;
|
||||
|
||||
var getNext = function(data, arr, resolve) {
|
||||
@ -29,7 +30,7 @@ export default
|
||||
|
||||
scope.seeMore = function () {
|
||||
var seeMoreResolve = $q.defer();
|
||||
Rest.setUrl(scope.job_template.related.labels);
|
||||
Rest.setUrl(scope[scope.$parent.list.iterator].related.labels);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
if (data.next) {
|
||||
@ -70,11 +71,13 @@ export default
|
||||
});
|
||||
};
|
||||
|
||||
scope.$watch("job_template.summary_fields.labels.results", function() {
|
||||
scope.$watch(scope.$parent.list.iterator+".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;
|
||||
if (scope[scope.$parent.list.iterator].summary_fields.labels){
|
||||
scope.labels = scope[scope.$parent.list.iterator].summary_fields.labels.results;
|
||||
scope.count = scope[scope.$parent.list.iterator].summary_fields.labels.count;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,9 +1,10 @@
|
||||
<div class="LabelList-tagContainer" ng-repeat="label in labels">
|
||||
<div class="LabelList-deleteContainer"
|
||||
ng-click="deleteLabel(job_template.id, job_template.name, label.id, label.name)">
|
||||
ng-click="deleteLabel(job_template.id, job_template.name, label.id, label.name)"
|
||||
ng-show="showDelete">
|
||||
<i class="fa fa-times LabelList-tagDelete"></i>
|
||||
</div>
|
||||
<div class="LabelList-tag LabelList-tag--deletable">
|
||||
<div class="LabelList-tag" ng-class="{'LabelList-tag--deletable' : showDelete}">
|
||||
<span class="LabelList-name">{{ label.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,7 +44,7 @@ export default
|
||||
},
|
||||
name: {
|
||||
label: 'Name',
|
||||
columnClass: 'col-lg-3 col-md-3 col-sm-4 col-xs-6',
|
||||
columnClass: 'col-lg-2 col-md-3 col-sm-4 col-xs-6',
|
||||
ngClick: "viewJobDetails(all_job)",
|
||||
defaultSearchField: true,
|
||||
awToolTip: "{{ all_job.name | sanitize }}",
|
||||
@ -54,7 +54,7 @@ export default
|
||||
label: 'Type',
|
||||
ngBind: 'all_job.type_label',
|
||||
link: false,
|
||||
columnClass: "col-lg-3 col-md-3 hidden-sm hidden-xs",
|
||||
columnClass: "col-lg-2 hidden-md hidden-sm hidden-xs",
|
||||
columnShow: "showJobType",
|
||||
searchable: true,
|
||||
searchType: 'select',
|
||||
@ -65,7 +65,7 @@ export default
|
||||
noLink: true,
|
||||
searchable: false,
|
||||
filter: "longDate",
|
||||
columnClass: "col-lg-3 col-md-3 col-sm-3 hidden-xs",
|
||||
columnClass: "col-lg-2 col-md-3 col-sm-3 hidden-xs",
|
||||
key: true,
|
||||
desc: true
|
||||
},
|
||||
@ -79,7 +79,10 @@ export default
|
||||
},
|
||||
labels: {
|
||||
label: 'Labels',
|
||||
searchOnly: true,
|
||||
type: 'labels',
|
||||
nosort: true,
|
||||
showDelete: false,
|
||||
columnClass: 'List-tableCell col-lg-4 col-md-4 hidden-sm hidden-xs',
|
||||
searchType: 'related',
|
||||
sourceModel: 'labels',
|
||||
sourceField: 'name'
|
||||
|
@ -474,11 +474,12 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
||||
</td>
|
||||
`;
|
||||
} else if (field.type === 'labels') {
|
||||
var showDelete = field.showDelete === undefined ? true : field.showDelete;
|
||||
classList = (field.columnClass) ?
|
||||
Attr(field, 'columnClass') : "";
|
||||
html += `
|
||||
<td ${classList}>
|
||||
<labels-list class=\"LabelList\">
|
||||
<labels-list class=\"LabelList\" show-delete="${showDelete}">
|
||||
</labels-list>
|
||||
</td>
|
||||
`;
|
||||
|
Loading…
Reference in New Issue
Block a user