diff --git a/awx/ui/client/lib/components/list/_index.less b/awx/ui/client/lib/components/list/_index.less index f1a0c8d371..36f9473cc0 100644 --- a/awx/ui/client/lib/components/list/_index.less +++ b/awx/ui/client/lib/components/list/_index.less @@ -168,6 +168,7 @@ display: flex; margin-left: @at-margin-left-list-row-item-tag-container; flex-wrap: wrap; + line-height: initial; } .at-RowItem-tag { diff --git a/awx/ui/client/lib/components/toggle/toggle-tag.directive.js b/awx/ui/client/lib/components/toggle/toggle-tag.directive.js index adcb6406cc..68a47df575 100644 --- a/awx/ui/client/lib/components/toggle/toggle-tag.directive.js +++ b/awx/ui/client/lib/components/toggle/toggle-tag.directive.js @@ -2,7 +2,8 @@ import { TRUNCATED, TRUNCATE_LENGTH } from './constants'; const templateUrl = require('~components/toggle/toggle-tag.partial.html'); -function controller () { +function controller ($scope, TagService) { + const { tags } = $scope; const vm = this; vm.truncatedLength = TRUNCATE_LENGTH; vm.truncated = TRUNCATED; @@ -10,8 +11,16 @@ function controller () { vm.toggle = () => { vm.truncated = !vm.truncated; }; + + vm.tags = []; + // build credentials from tags object + Object.keys(tags).forEach(key => { + vm.tags.push(TagService.buildCredentialTag(tags[key])); + }); } +controller.$inject = ['$scope', 'TagService']; + function atToggleTag () { return { restrict: 'E', diff --git a/awx/ui/client/lib/components/toggle/toggle-tag.partial.html b/awx/ui/client/lib/components/toggle/toggle-tag.partial.html index 83952ee7c8..e83d303eda 100644 --- a/awx/ui/client/lib/components/toggle/toggle-tag.partial.html +++ b/awx/ui/client/lib/components/toggle/toggle-tag.partial.html @@ -1,13 +1,13 @@
-
- +
+
-
- +
+
diff --git a/awx/ui/client/lib/services/index.js b/awx/ui/client/lib/services/index.js index 39ed1d8299..41ca37c836 100644 --- a/awx/ui/client/lib/services/index.js +++ b/awx/ui/client/lib/services/index.js @@ -2,6 +2,7 @@ import AppStrings from '~services/app.strings'; import BaseStringService from '~services/base-string.service'; import CacheService from '~services/cache.service'; import EventService from '~services/event.service'; +import TagService from '~services/tag.service'; const MODULE_NAME = 'at.lib.services'; @@ -12,6 +13,7 @@ angular .service('AppStrings', AppStrings) .service('BaseStringService', BaseStringService) .service('CacheService', CacheService) - .service('EventService', EventService); + .service('EventService', EventService) + .service('TagService', TagService); export default MODULE_NAME; diff --git a/awx/ui/client/lib/services/tag.service.js b/awx/ui/client/lib/services/tag.service.js new file mode 100644 index 0000000000..d0439f8f63 --- /dev/null +++ b/awx/ui/client/lib/services/tag.service.js @@ -0,0 +1,14 @@ +function TagService (strings, $filter) { + this.buildCredentialTag = (credential) => { + const icon = `${credential.kind}`; + const link = `/#/credentials/${credential.id}`; + const tooltip = strings.get('tooltips.CREDENTIAL'); + const value = $filter('sanitize')(credential.name); + + return { icon, link, tooltip, value }; + }; +} + +TagService.$inject = ['OutputStrings', '$filter']; + +export default TagService;