diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 227029c9b..489145681 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -139,4 +139,8 @@ region: provider_client_id: label: Client ID link-text : Learn more - help: The client ID for the client you want Boundary to use. \ No newline at end of file + help: The client ID for the client you want Boundary to use. +provider_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-set/aws/index.hbs b/ui/admin/app/components/form/host-set/aws/index.hbs new file mode 100644 index 000000000..d5cb69c13 --- /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..9679cc6c4 --- /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/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