From cc91729f7208e97c38dd27151f79caa365062e7f Mon Sep 17 00:00:00 2001 From: kialam Date: Fri, 1 Jun 2018 12:46:58 -0400 Subject: [PATCH] Account for default tags as well --- .../client/lib/components/list/row-item.partial.html | 2 +- .../lib/components/toggle/toggle-tag.directive.js | 11 +++++++++-- awx/ui/client/lib/services/tag.service.js | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/lib/components/list/row-item.partial.html b/awx/ui/client/lib/components/list/row-item.partial.html index e477156d59..69058b1c43 100644 --- a/awx/ui/client/lib/components/list/row-item.partial.html +++ b/awx/ui/client/lib/components/list/row-item.partial.html @@ -47,6 +47,6 @@ - + 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 7cce99831e..a60c253a8c 100644 --- a/awx/ui/client/lib/components/toggle/toggle-tag.directive.js +++ b/awx/ui/client/lib/components/toggle/toggle-tag.directive.js @@ -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: '@', }, }; } diff --git a/awx/ui/client/lib/services/tag.service.js b/awx/ui/client/lib/services/tag.service.js index 3795776a81..fa44e0e894 100644 --- a/awx/ui/client/lib/services/tag.service.js +++ b/awx/ui/client/lib/services/tag.service.js @@ -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'];