fix: 🐛 Update worker_filter label for AWS DHC w/ static creds (#3114)
* fix: 🐛 Update worker_filter label for AWS DHC w/ static creds * test: 💍 add test case * test: 💍 fix serializer tests
This commit is contained in:
1 parent
1d0941865b
commit
773c1596e5
5 files changed
+62
-5
No files matched your search
@@ -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.',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,34 @@
|
||||
</F.HelperText>
|
||||
</Hds::Form::TextInput::Field>
|
||||
|
||||
{{#if (feature-flag 'worker-filter')}}
|
||||
<Hds::Form::Textarea::Field
|
||||
name='worker_filter'
|
||||
@value={{@model.worker_filter}}
|
||||
@isOptional={{true}}
|
||||
@isInvalid={{@model.errors.worker_filter}}
|
||||
disabled={{form.disabled}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'form.worker_filter.label'}}</F.Label>
|
||||
<F.HelperText>
|
||||
{{t 'resources.host-catalog.form.worker_filter.help'}}
|
||||
<Hds::Link::Inline @href={{doc-url 'worker.create-tags'}}>
|
||||
{{t 'actions.learn-more'}}
|
||||
</Hds::Link::Inline>
|
||||
</F.HelperText>
|
||||
{{#if @model.errors.worker_filter}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.worker_filter as |error|}}
|
||||
<E.Message>
|
||||
{{error.message}}
|
||||
</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::Textarea::Field>
|
||||
{{/if}}
|
||||
|
||||
<Hds::Form::Checkbox::Field
|
||||
name='disable_credential_rotation'
|
||||
checked={{@model.disable_credential_rotation}}
|
||||
|
||||
@@ -368,7 +368,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
|
||||
.includesText('Optional');
|
||||
});
|
||||
|
||||
test('users should see required worker filter field in hcp edition when AWS host catalog is selected', async function (assert) {
|
||||
test('users should see required worker filter field in hcp edition when AWS host catalog is selected and using assume role', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
@@ -382,12 +382,36 @@ module('Acceptance | host-catalogs | create', function (hooks) {
|
||||
featureEdition.setEdition('hcp');
|
||||
await visit(urls.newAWSDynamicHostCatalog);
|
||||
|
||||
await click(selectors.FIELD_DYNAMIC_CREDENTIAL);
|
||||
|
||||
assert.dom(selectors.FIELD_WORKER_FILTER).isVisible();
|
||||
assert
|
||||
.dom(selectors.FIELD_AWS_WORKER_FILTER_LABEL)
|
||||
.includesText('Required');
|
||||
});
|
||||
|
||||
test('users should see optional worker filter field in hcp edition when AWS host catalog is selected and using access key', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
featuresService.enable('worker-filter');
|
||||
featureEdition.setEdition('hcp');
|
||||
await visit(urls.newAWSDynamicHostCatalog);
|
||||
|
||||
await click(selectors.FIELD_STATIC_CREDENTIAL);
|
||||
|
||||
assert.dom(selectors.FIELD_WORKER_FILTER).isVisible();
|
||||
assert
|
||||
.dom(selectors.FIELD_AWS_WORKER_FILTER_LABEL)
|
||||
.includesText('Optional');
|
||||
});
|
||||
|
||||
test('users should see worker filter field in enterprise edition when GCP host catalog is selected', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
|
||||
Reference in new issue
Block a user