diff --git a/addons/api/addon/generated/models/host-catalog.js b/addons/api/addon/generated/models/host-catalog.js index 007d8587c..51fea24b9 100644 --- a/addons/api/addon/generated/models/host-catalog.js +++ b/addons/api/addon/generated/models/host-catalog.js @@ -72,7 +72,7 @@ export default class GeneratedHostCatalogModel extends BaseModel { @attr('string', { for: { type: 'plugin', - name: ['aws', 'gcp'], + name: ['aws', 'azure', 'gcp'], }, description: 'An expression used to filter the workers that have network access to a service that is hosting the external object store.', diff --git a/addons/api/tests/unit/serializers/host-catalog-test.js b/addons/api/tests/unit/serializers/host-catalog-test.js index e1aa519f0..e89220827 100644 --- a/addons/api/tests/unit/serializers/host-catalog-test.js +++ b/addons/api/tests/unit/serializers/host-catalog-test.js @@ -224,7 +224,6 @@ module('Unit | Serializer | host catalog', function (hooks) { region: 'spain', access_key_id: 'foobars', secret_access_key: 'testing', - worker_filter: 'workerfilter', // these are Azure fields and should be excluded tenant_id: 'a1b2c3', client_id: 'a1b2c3', @@ -233,6 +232,7 @@ module('Unit | Serializer | host catalog', function (hooks) { secret_value: 'a1b2c3', project_id: 'project', zone: 'zone', + worker_filter: 'workerfilter', }); const expectedResult = { name: 'Azure', @@ -248,6 +248,7 @@ module('Unit | Serializer | host catalog', function (hooks) { secret_id: 'a1b2c3', secret_value: 'a1b2c3', }, + worker_filter: 'workerfilter', }; assert.deepEqual(record.serialize(), expectedResult); }); @@ -313,6 +314,7 @@ module('Unit | Serializer | host catalog', function (hooks) { type: 'plugin', name: 'azure', description: 'test description', + worker_filter: null, attributes: { disable_credential_rotation: false, tenant_id: 'a1b2c3', diff --git a/ui/admin/app/components/form/host-catalog/aws/index.js b/ui/admin/app/components/form/host-catalog/aws/index.js index e3c37db67..afb3cf1a0 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.js +++ b/ui/admin/app/components/form/host-catalog/aws/index.js @@ -34,9 +34,12 @@ export default class FormHostCatalogAwsComponent extends Component { } /** - * Returns true if current edition is HCP. + * Returns true if current edition is HCP and dynamic credential type is specified. */ get isWorkerFilterRequired() { - return this.featureEdition.edition === 'hcp'; + return ( + this.featureEdition.edition === 'hcp' && + this.args.model.credentialType === TYPE_CREDENTIAL_DYNAMIC + ); } } diff --git a/ui/admin/app/components/form/host-catalog/azure/index.hbs b/ui/admin/app/components/form/host-catalog/azure/index.hbs index fc5033005..92261a377 100644 --- a/ui/admin/app/components/form/host-catalog/azure/index.hbs +++ b/ui/admin/app/components/form/host-catalog/azure/index.hbs @@ -176,6 +176,34 @@ + {{#if (feature-flag 'worker-filter')}} + + {{t 'form.worker_filter.label'}} + + {{t 'resources.host-catalog.form.worker_filter.help'}} + + {{t 'actions.learn-more'}} + + + {{#if @model.errors.worker_filter}} + + {{#each @model.errors.worker_filter as |error|}} + + {{error.message}} + + {{/each}} + + {{/if}} + + {{/if}} +