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:
Lisbet Alvarez authored and GitHub committed 2026-01-08 14:45:16 -08:00
1 parent 1d0941865b
commit 773c1596e5
5 files changed
+62 -5

No files matched your search

@@ -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: {