1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Account for default tags as well

This commit is contained in:
kialam 2018-06-01 12:46:58 -04:00
parent 8373d89c92
commit cc91729f72
3 changed files with 14 additions and 3 deletions

View File

@ -47,6 +47,6 @@
<at-tag tag="tag.name" icon="{{ tag.kind }}" link="/#/credentials/{{ tag.id }}"></at-tag>
</div>
<!-- If there are 5 or MORE credential tags, handle them accordingly with Toggle Tag Component -->
<at-toggle-tag tags="tagValues" ng-if="tagValues.length > 5"></at-toggle-tag>
<at-toggle-tag tag-type="cred" tags="tagValues" ng-if="tagValues.length > 5"></at-toggle-tag>
</div>
</div>

View File

@ -14,9 +14,15 @@ function controller ($scope, TagService, strings) {
};
vm.tags = [];
// build credentials from tags object
// Let the controller handle what type of tag should be passed to the directive
// e.g. default tag, crential tag, etc.
Object.keys(tags).forEach(key => {
vm.tags.push(TagService.buildCredentialTag(tags[key]));
if ($scope.tagType === 'cred') {
vm.tags.push(TagService.buildCredentialTag(tags[key]));
} else {
vm.tags.push(TagService.buildTag(tags[key]));
}
});
}
@ -32,6 +38,7 @@ function atToggleTag () {
templateUrl,
scope: {
tags: '=',
tagType: '@',
},
};
}

View File

@ -7,6 +7,10 @@ function TagService (strings, $filter) {
return { icon, link, tooltip, value };
};
this.buildTag = tag => {
const value = $filter('sanitize')(tag);
return { value };
};
}
TagService.$inject = ['ComponentsStrings', '$filter'];