diff --git a/addons/api/addon/generated/models/host-catalog.js b/addons/api/addon/generated/models/host-catalog.js index 0591352e2..660711a70 100644 --- a/addons/api/addon/generated/models/host-catalog.js +++ b/addons/api/addon/generated/models/host-catalog.js @@ -39,11 +39,6 @@ export default class GeneratedHostCatalogModel extends BaseModel { }) disabled; - @attr({ - description: 'Attributes specific to the catalog type', - }) - attributes; - @attr('number', { description: 'Current version number of this resource.', }) diff --git a/addons/api/addon/serializers/application.js b/addons/api/addon/serializers/application.js index dcc33eff6..8f519e8e2 100644 --- a/addons/api/addon/serializers/application.js +++ b/addons/api/addon/serializers/application.js @@ -234,11 +234,13 @@ export default class ApplicationSerializer extends RESTSerializer { */ normalizeNestedAttributes(typeClass, hash) { typeClass.attributes.forEach((attribute) => { - const { isNestedAttribute } = attribute.options; - const attributeValue = hash.attributes?.[attribute.name]; - if (isNestedAttribute && typeof attributeValue != 'undefined') { - hash[attribute.name] = attributeValue; - } + const { + name, + options: { isNestedAttribute }, + } = attribute; + const value = hash.attributes?.[name]; + const isUndefined = value === undefined; + if (isNestedAttribute && !isUndefined) hash[name] = value; }); return hash; } @@ -261,15 +263,8 @@ export default class ApplicationSerializer extends RESTSerializer { name, options: { isNestedSecret }, } = attribute; - const attributeValue = hash.secrets?.[name]; - - // FIXME: This could be improved - if (isNestedSecret) { - hash[name] = null; - if (typeof attributeValue != 'undefined') { - hash[name] = attributeValue; - } - } + const value = hash.secrets?.[name]; + if (isNestedSecret) hash[name] = value || null; }); return hash; } diff --git a/addons/api/addon/serializers/host-catalog.js b/addons/api/addon/serializers/host-catalog.js index f5d1cd983..77c78c680 100644 --- a/addons/api/addon/serializers/host-catalog.js +++ b/addons/api/addon/serializers/host-catalog.js @@ -1,5 +1,4 @@ import ApplicationSerializer from './application'; -import { copy } from 'ember-copy'; const fieldsByType = { aws: [ @@ -57,11 +56,4 @@ export default class HostCatalogSerializer extends ApplicationSerializer { delete serialized.secrets; return serialized; } - - normalize(typeClass, hash, ...rest) { - let normalizedHash = copy(hash, true); - const normalized = super.normalize(typeClass, normalizedHash, ...rest); - delete normalized.data.attributes.attributes; - return normalized; - } } diff --git a/ui/admin/app/components/form/host-set/aws/index.hbs b/ui/admin/app/components/form/host-set/aws/index.hbs index d61cdc0de..f090e2d18 100644 --- a/ui/admin/app/components/form/host-set/aws/index.hbs +++ b/ui/admin/app/components/form/host-set/aws/index.hbs @@ -78,6 +78,75 @@ <:title>{{t 'form.provider.filter.label'}} <:description>{{t 'form.provider.filter.help'}} + <:body> + {{#if @model.errors.filters}} + + {{#each @model.errors.filters as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{t 'titles.value'}} + + + + + {{#each @model.filters as |filter i|}} + + + + + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + + + {{t 'actions.add'}} + + + + + + {{#if (can 'save model' @model)}} diff --git a/ui/admin/app/components/form/host-set/azure/index.hbs b/ui/admin/app/components/form/host-set/azure/index.hbs index 9150d5e7f..8abc0724d 100644 --- a/ui/admin/app/components/form/host-set/azure/index.hbs +++ b/ui/admin/app/components/form/host-set/azure/index.hbs @@ -78,6 +78,7 @@ \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs index 941f3e819..4047f364c 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs @@ -5,4 +5,6 @@ @submit={{route-action 'save' @model}} @cancel={{route-action 'cancel' @model}} @changeType={{route-action 'changeType' @model.type}} + @removeItemByIndex={{route-action 'removeItemByIndex' @model}} + @addStringItem={{route-action 'addStringItem' @model}} /> \ No newline at end of file