diff --git a/awx/ui/client/features/templates/templatesList.controller.js b/awx/ui/client/features/templates/templatesList.controller.js index 4f0ec55116..b8a29f4db8 100644 --- a/awx/ui/client/features/templates/templatesList.controller.js +++ b/awx/ui/client/features/templates/templatesList.controller.js @@ -164,6 +164,17 @@ function ListTemplatesController( return html; }; + + vm.buildCredentialTags = (credentials) => { + return credentials.map(credential => { + const icon = `${credential.kind}`; + const link = `/#/credentials/${credential.id}`; + const tooltip = strings.get('tooltips.VIEW_THE_CREDENTIAL'); + const value = $filter('sanitize')(credential.name); + + return { icon, link, tooltip, value }; + }) + }; vm.getLastRan = template => { const lastJobRun = _.get(template, 'last_job_run'); diff --git a/awx/ui/client/features/templates/templatesList.view.html b/awx/ui/client/features/templates/templatesList.view.html index 5a00912663..5aed695f57 100644 --- a/awx/ui/client/features/templates/templatesList.view.html +++ b/awx/ui/client/features/templates/templatesList.view.html @@ -68,11 +68,11 @@ value="{{ template.summary_fields.project.name }}" value-link="/#/projects/{{ template.summary_fields.project.id }}"> - +
-
- - - - - - - - - {{ tag.name }} -
+
diff --git a/awx/ui/client/lib/components/tag/_index.less b/awx/ui/client/lib/components/tag/_index.less index 5fa309c106..d1b14a6893 100644 --- a/awx/ui/client/lib/components/tag/_index.less +++ b/awx/ui/client/lib/components/tag/_index.less @@ -27,10 +27,15 @@ } .TagComponent-icon { + .at-mixin-VerticallyCenter(); line-height: 20px; margin-left: @at-space-2x; - &--cloud:before { + &--cloud:before, + &--aws:before, + &--tower:before, + &--azure_rm:before, + { content: '\f0c2'; } diff --git a/awx/ui/client/lib/components/toggle-tag/_index.less b/awx/ui/client/lib/components/toggle-tag/_index.less new file mode 100644 index 0000000000..18639c5648 --- /dev/null +++ b/awx/ui/client/lib/components/toggle-tag/_index.less @@ -0,0 +1,19 @@ +.ToggleComponent-wrapper { + line-height: initial; +} + +.ToggleComponent-container { + display: flex; + flex-wrap: wrap; +} + +.ToggleComponent-button { + border: none; + background: transparent; + color: @at-blue; + font-size: @at-font-size; + + &:hover { + color: @at-blue-hover; + } +} \ No newline at end of file diff --git a/awx/ui/client/lib/components/toggle-tag/constants.js b/awx/ui/client/lib/components/toggle-tag/constants.js new file mode 100644 index 0000000000..f3a4951c9c --- /dev/null +++ b/awx/ui/client/lib/components/toggle-tag/constants.js @@ -0,0 +1,2 @@ +export const TRUNCATE_LENGTH = 5; +export const IS_TRUNCATED = true; diff --git a/awx/ui/client/lib/components/toggle-tag/toggle-tag.directive.js b/awx/ui/client/lib/components/toggle-tag/toggle-tag.directive.js new file mode 100644 index 0000000000..4fec4cd794 --- /dev/null +++ b/awx/ui/client/lib/components/toggle-tag/toggle-tag.directive.js @@ -0,0 +1,32 @@ +import { IS_TRUNCATED, TRUNCATE_LENGTH } from './constants'; + +const templateUrl = require('~components/toggle-tag/toggle-tag.partial.html'); + +function controller (strings) { + const vm = this; + vm.truncatedLength = TRUNCATE_LENGTH; + vm.isTruncated = IS_TRUNCATED; + vm.strings = strings; + + vm.toggle = () => { + vm.isTruncated = !vm.isTruncated; + }; +} + +controller.$inject = ['ComponentsStrings']; + +function atToggleTag () { + return { + restrict: 'E', + replace: true, + transclude: true, + controller, + controllerAs: 'vm', + templateUrl, + scope: { + tags: '=', + }, + }; +} + +export default atToggleTag; diff --git a/awx/ui/client/lib/components/toggle-tag/toggle-tag.partial.html b/awx/ui/client/lib/components/toggle-tag/toggle-tag.partial.html new file mode 100644 index 0000000000..fada04154e --- /dev/null +++ b/awx/ui/client/lib/components/toggle-tag/toggle-tag.partial.html @@ -0,0 +1,21 @@ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+