diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 8f7563fd6..a13b995f2 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -139,6 +139,7 @@ region: provider: label: Provider Details description: This is the provider for this host catalog. The format of the host set filters are specific to each provider. + help: client: label: Client ID help: The client ID for the client you want Boundary to use. @@ -146,3 +147,7 @@ provider: choose_a_provider: label: Choose a provider description: There are several built-in plugins for the most common providers. You can choose from on of the included plugins or use a custom plugin. + 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. + link-text: Learn more about using filters for Azure resources. \ No newline at end of file diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 27e3497c0..29bd6c7a3 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -129,10 +129,15 @@ host-set: title: No Hosts Available description: No hosts available for selection. types: - static: Static - unknown: Unknown - aws: AWS - azure: Azure + static: + label: Static + help: Provide a list of hosts and host sets with static addresses + unknown: + label: Unknown + aws: + label: AWS + azure: + label: Azure host: title: Host title_plural: Hosts diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index 110d1efd5..36ebed43a 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -78,9 +78,7 @@ - <:title>{{t - 'form.provider.choose_a_provider.label' - }} + <:title>{{t 'form.provider.choose_a_provider.label'}} <:description>{{t 'form.provider.choose_a_provider.description' }} @@ -110,9 +108,7 @@ {{else}} <:title>{{t 'form.provider.label'}} - <:description>{{t - 'form.provider.description' - }} + <:description>{{t 'form.provider.description'}} <:body> {{t 'form.provider.label'}} - <:title>{{t - 'form.provider.choose_a_provider.label' - }} + <:title>{{t 'form.provider.choose_a_provider.label'}} <:description>{{t 'form.provider.choose_a_provider.description' }} @@ -110,9 +108,7 @@ <:title>{{t 'form.provider.label'}} - <:description>{{t - 'form.provider.description' - }} + <:description>{{t 'form.provider.description'}} <:body> - <:title>{{t - 'form.provider.choose_a_provider.label' - }} + <:title>{{t 'form.provider.choose_a_provider.label'}} <:description>{{t 'form.provider.choose_a_provider.description' }} diff --git a/ui/admin/app/components/form/host-set/aws/index.hbs b/ui/admin/app/components/form/host-set/aws/index.hbs new file mode 100644 index 000000000..f800e9d53 --- /dev/null +++ b/ui/admin/app/components/form/host-set/aws/index.hbs @@ -0,0 +1,93 @@ + + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + + <:title>{{t 'resources.host-catalog.form.provider.label'}} + <:description>{{t + 'resources.host-catalog.form.provider.description' + }} + + <:body> + + + + + + + {{! placeholder for filter, update me when the model is ready }} + + <:title>{{t 'form.provider.filter.label'}} + <:description>{{t 'form.provider.filter.help'}} + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-set/azure/index.hbs b/ui/admin/app/components/form/host-set/azure/index.hbs new file mode 100644 index 000000000..340860893 --- /dev/null +++ b/ui/admin/app/components/form/host-set/azure/index.hbs @@ -0,0 +1,108 @@ + + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + + + <:title>{{t 'resources.host-catalog.form.provider.label'}} + <:description>{{t + 'resources.host-catalog.form.provider.description' + }} + + <:body> + + + + + + + {{! placeholder for filter, update me when the model is ready }} + + {{#if @model.errors.filter}} + + {{#each @model.errors.filter as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/host-set/index.hbs b/ui/admin/app/components/form/host-set/index.hbs index 01864acc5..5c3bd3f0c 100644 --- a/ui/admin/app/components/form/host-set/index.hbs +++ b/ui/admin/app/components/form/host-set/index.hbs @@ -1,63 +1,6 @@ - - - - - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +{{component + (concat 'form/host-set/' @model.compositeType) + model=@model + submit=@submit + cancel=@cancel +}} \ No newline at end of file diff --git a/ui/admin/app/components/form/host-set/static/index.hbs b/ui/admin/app/components/form/host-set/static/index.hbs new file mode 100644 index 000000000..7ed797846 --- /dev/null +++ b/ui/admin/app/components/form/host-set/static/index.hbs @@ -0,0 +1,57 @@ + + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js index 3980cf51b..952e5d195 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js @@ -1,18 +1,26 @@ import Route from '@ember/routing/route'; +import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends Route { - // =methods + // =services + @service router; + // =methods /** * Creates a new unsaved host set in current host catalog scope. * @return {HostSetModel} */ model() { - const { id: host_catalog_id } = this.modelFor( + const { id: host_catalog_id, compositeType } = this.modelFor( 'scopes.scope.host-catalogs.host-catalog' ); + if (this.currentModel?.isNew) { + this.currentModel.rollbackAttributes(); + } + console.log('typedwed', compositeType); return this.store.createRecord('host-set', { - type: 'static', + compositeType, host_catalog_id, }); } @@ -47,4 +55,12 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends model: model, }); } + /** + * Update type of host set + * @param {string} type + */ + @action + async changeType(type) { + await this.router.replaceWith({ queryParams: { type } }); + } } diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs index 80ba8a4f8..9bcbe0fd4 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs @@ -8,7 +8,9 @@ {{t 'form.name.label'}} {{t 'form.type.label'}} {{t 'form.id.label'}} - {{t 'titles.actions'}} + {{#if @model.isStatic}} + {{t 'titles.actions'}} + {{/if}} diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs index d60d0cb30..50188d665 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs @@ -27,7 +27,11 @@ {{#if hostSet.isStatic}} - {{t (concat 'resources.host-set.types.' hostSet.compositeType)}} + {{t + (concat + 'resources.host-set.types.' hostSet.compositeType '.label' + ) + }} {{else}} - {{t (concat 'resources.host-set.types.' hostSet.compositeType)}} + {{t + (concat + 'resources.host-set.types.' hostSet.compositeType '.label' + ) + }} {{/if}} 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 9f68f1549..941f3e819 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 @@ -4,4 +4,5 @@ @model={{@model}} @submit={{route-action 'save' @model}} @cancel={{route-action 'cancel' @model}} + @changeType={{route-action 'changeType' @model.type}} /> \ No newline at end of file