refactor: 💡 update label and description for AWS DHC (#2909)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17308
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2025-06-27 14:17:06 -07:00
1 parent f1d334b848
commit 30c05eb834
8 files changed
+51 -9

No files matched your search

+1 -3
View File
@@ -26,8 +26,6 @@ const pluginTypes = [
'foobar',
];
let pluginTypeCounter = 1;
export default factory.extend({
id: () => generateId('hc_'),
@@ -64,7 +62,7 @@ export default factory.extend({
if (this.type === TYPE_HOST_CATALOG_DYNAMIC) {
return {
id: `plugin-id-${i}`,
name: pluginTypes[pluginTypeCounter++ % pluginTypes.length],
name: pluginTypes[i % pluginTypes.length],
description: faker.word.words(),
};
}
+12 -1
View File
@@ -110,7 +110,18 @@ export default function (server) {
// Other resources
server.schema.scopes.where({ type: 'project' }).models.forEach((scope) => {
server.createList('host-catalog', 8, { scope }, 'withChildren');
server.createList(
'host-catalog',
2,
{ scope, type: 'static' },
'withChildren',
);
server.createList(
'host-catalog',
8,
{ scope, type: 'plugin' },
'withChildren',
);
server.createList('credential-store', 3, { scope }, 'withAssociations');
server.createList('target', 2, { scope }, 'withAssociations');
server.create('target', { scope, address: '0.0.0.0' });
@@ -241,7 +241,7 @@ host-catalog:
label: Client/Application ID
help: The client (application) ID of an Azure service principal that Boundary will use to authenticate and discover hosts from Azure.
worker_filter:
help: Insert a worker filter in order to route requests to the correct worker.
help: Insert a worker filter in order to select the correct worker.
project_id:
label: Project ID
help: Project ID of the instances you want to add to this GCP Host Catalog.
@@ -354,12 +354,15 @@
<Hds::Form::Textarea::Field
name='worker_filter'
@value={{@model.worker_filter}}
@isOptional={{true}}
@isRequired={{this.isWorkerFilterRequired}}
@isOptional={{not this.isWorkerFilterRequired}}
@isInvalid={{@model.errors.worker_filter}}
disabled={{form.disabled}}
as |F|
>
<F.Label>{{t 'form.worker_filter.label'}}</F.Label>
<F.Label data-test-aws-worker-filter-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'}}>
@@ -4,12 +4,17 @@
*/
import Component from '@glimmer/component';
import { service } from '@ember/service';
import {
TYPES_CREDENTIALS,
TYPE_CREDENTIAL_DYNAMIC,
} from 'api/models/host-catalog';
export default class FormHostCatalogAwsComponent extends Component {
// =services
@service featureEdition;
// =attributes
/**
@@ -27,4 +32,11 @@ export default class FormHostCatalogAwsComponent extends Component {
get showDynamicCredentials() {
return this.args.model.credentialType === TYPE_CREDENTIAL_DYNAMIC;
}
/**
* Returns true if current edition is HCP.
*/
get isWorkerFilterRequired() {
return this.featureEdition.edition === 'hcp';
}
}
-1
View File
@@ -144,7 +144,6 @@ module.exports = function (environment) {
},
features: features,
featureFlags: {},
};
if (environment === 'development') {
@@ -19,6 +19,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
setupIndexedDb(hooks);
let featuresService;
let featureEdition;
let getHostCatalogCount;
const instances = {
@@ -78,6 +79,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
urls.newAzureDynamicHostCatalog = `${urls.newHostCatalog}?type=azure`;
urls.newGCPDynamicHostCatalog = `${urls.newHostCatalog}?type=gcp`;
featuresService = this.owner.lookup('service:features');
featureEdition = this.owner.lookup('service:featureEdition');
// Generate resource counter
getHostCatalogCount = () =>
@@ -262,11 +264,26 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.dom(selectors.FIELD_WORKER_FILTER).doesNotExist();
});
test('users should see worker filter field in enterprise edition when AWS host catalog is selected', async function (assert) {
test('users should see optional worker filter field in enterprise edition when AWS host catalog is selected', async function (assert) {
featuresService.enable('worker-filter');
featureEdition.setEdition('enterprise');
await visit(urls.newAWSDynamicHostCatalog);
assert.dom(selectors.FIELD_WORKER_FILTER).isVisible();
assert
.dom(selectors.FIELD_AWS_WORKER_FILTER_LABEL)
.includesText('Optional');
});
test('users should see required worker filter field in hcp edition when AWS host catalog is selected', async function (assert) {
featuresService.enable('worker-filter');
featureEdition.setEdition('hcp');
await visit(urls.newAWSDynamicHostCatalog);
assert.dom(selectors.FIELD_WORKER_FILTER).isVisible();
assert
.dom(selectors.FIELD_AWS_WORKER_FILTER_LABEL)
.includesText('Required');
});
test('users should see worker filter field in enterprise edition when GCP host catalog is selected', async function (assert) {
@@ -7,6 +7,8 @@ export const FIELD_TYPE = '[name="Type"]';
export const FIELD_TYPE_VALUE = (type) => `[value=${type}]`;
export const FIELD_WORKER_FILTER = '[name=worker_filter]';
export const FIELD_AWS_WORKER_FILTER_LABEL =
'[data-test-aws-worker-filter-label]';
export const FIELD_ZONE = '[name="zone"]';
export const FIELD_ZONE_VALUE = 'us-west-1';