diff --git a/addons/api/addon/serializers/host-set.js b/addons/api/addon/serializers/host-set.js index 613caf1ab..5749cd993 100644 --- a/addons/api/addon/serializers/host-set.js +++ b/addons/api/addon/serializers/host-set.js @@ -1,4 +1,5 @@ import ApplicationSerializer from './application'; +import { copy } from 'ember-copy'; const fieldByType = { aws: ['preferred_endpoints', 'filters'], @@ -69,4 +70,19 @@ export default class HostSetSerializer extends ApplicationSerializer { } return value; } + + /** + * Temporarily converts `filters` to an array if it is a string. This is a + * quirk of the API. + * + * TODO: remove once API consistently returns arrays. + */ + normalize(typeClass, hash, ...rest) { + const normalizedHash = copy(hash, true); + if (typeof normalizedHash?.filters === 'string') { + normalizedHash.filters = [normalizedHash.filters]; + } + const normalized = super.normalize(typeClass, normalizedHash, ...rest); + return normalized; + } } diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 1341dcc76..57de894d3 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -111,6 +111,9 @@ host-set: filter: label: Filter help: Create a filter to select resources using values such as tag name or tag value. Filter format is specific to each provider + preferred_endpoints: + label: Preferred Endpoints + help: Selects addresses of hosts, in cidr: or dns: format messages: welcome: title: Welcome to Host Sets diff --git a/addons/rose/addon/styles/rose/components/form/_input.scss b/addons/rose/addon/styles/rose/components/form/_input.scss index 214f57734..889c933ef 100644 --- a/addons/rose/addon/styles/rose/components/form/_input.scss +++ b/addons/rose/addon/styles/rose/components/form/_input.scss @@ -30,6 +30,10 @@ border-radius: sizing.rems(xxxs); box-shadow: inset 0px 3px 1px rgba(var(--stark-components), var(--opacity-4)); + &::placeholder { + color: var(--ui-gray-subtler-1); + } + &.error { color: var(--failure); border-color: currentColor; 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 3af6ce47f..3d7b974ab 100644 --- a/ui/admin/app/components/form/host-set/aws/index.hbs +++ b/ui/admin/app/components/form/host-set/aws/index.hbs @@ -74,6 +74,94 @@ + + <:title>{{t 'resources.host-set.form.preferred_endpoints.label'}} + <:description>{{t + 'resources.host-set.form.preferred_endpoints.help' + }} + <:body> + {{#if @model.errors.preferred_endpoints}} + + {{#each @model.errors.preferred_endpoints as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{t 'titles.value'}} + + + + + {{#each @model.preferred_endpoints as |endpoint i|}} + + + + + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + + + {{t 'actions.add'}} + + + + + + + + <:title>{{t 'resources.host-set.form.filter.label'}} <:description>{{t 'resources.host-set.form.filter.help'}} 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 686cb70d4..866577b7d 100644 --- a/ui/admin/app/components/form/host-set/azure/index.hbs +++ b/ui/admin/app/components/form/host-set/azure/index.hbs @@ -74,6 +74,94 @@ + + <:title>{{t 'resources.host-set.form.preferred_endpoints.label'}} + <:description>{{t + 'resources.host-set.form.preferred_endpoints.help' + }} + <:body> + {{#if @model.errors.preferred_endpoints}} + + {{#each @model.errors.preferred_endpoints as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{t 'titles.value'}} + + + + + {{#each @model.preferred_endpoints as |endpoint i|}} + + + + + + + + + {{t 'actions.remove'}} + + + + {{/each}} + + + + + + + + {{t 'actions.add'}} + + + + + + + +