diff --git a/ui/admin/app/components/form/credential-store/vault/index.hbs b/ui/admin/app/components/form/credential-store/vault/index.hbs index e036d1d52..b1f90a7ba 100644 --- a/ui/admin/app/components/form/credential-store/vault/index.hbs +++ b/ui/admin/app/components/form/credential-store/vault/index.hbs @@ -117,6 +117,34 @@ {{/if}} + {{! worker_filter }} + {{#if (and (feature-flag 'vault-worker-filter') @model.isNew)}} + {{#let (unique-id) (unique-id) as |labelId helpId|}} + + {{t 'form.worker_filter.label'}} + + {{t 'resources.credential-store.worker-filter.description'}} + + {{t 'actions.learn-more'}} + + + + + + + {{/let}} + {{/if}} + {{#if (or @model.isNew form.isEditable)}} diff --git a/ui/admin/app/components/form/storage-bucket/minio/index.hbs b/ui/admin/app/components/form/storage-bucket/minio/index.hbs index ad298c3cb..5c9251f0e 100644 --- a/ui/admin/app/components/form/storage-bucket/minio/index.hbs +++ b/ui/admin/app/components/form/storage-bucket/minio/index.hbs @@ -319,7 +319,7 @@ diff --git a/ui/admin/app/styles/app.scss b/ui/admin/app/styles/app.scss index 3b0997be6..2ee969578 100644 --- a/ui/admin/app/styles/app.scss +++ b/ui/admin/app/styles/app.scss @@ -1077,8 +1077,8 @@ align-items: flex-start; } -// storage buckets -.storage-bucket-worker-filter { +// worker filter generator layout in form +.worker-filter-generator-form-layout { .hds-form-field--layout-flag { margin-bottom: 0; } diff --git a/ui/admin/tests/acceptance/credential-store/create-test.js b/ui/admin/tests/acceptance/credential-store/create-test.js index 24f09d4a4..0088fe715 100644 --- a/ui/admin/tests/acceptance/credential-store/create-test.js +++ b/ui/admin/tests/acceptance/credential-store/create-test.js @@ -89,6 +89,24 @@ module('Acceptance | credential-stores | create', function (hooks) { assert.strictEqual(getVaultCredentialStoresCount(), count + 1); }); + test('Users can create a new credential store of type vault with a worker filter', async function (assert) { + featuresService.enable('static-credentials'); + featuresService.enable('vault-worker-filter'); + const count = getVaultCredentialStoresCount(); + await visit(urls.newCredentialStore); + + await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE); + await click(selectors.TYPE_VAULT); + await fillIn( + selectors.CODE_EDITOR_BODY, + selectors.EDITOR_WORKER_FILTER_VALUE, + ); + await click(commonSelectors.SAVE_BTN); + + assert.dom(selectors.CODE_BLOCK_BODY).doesNotExist(); + assert.strictEqual(getVaultCredentialStoresCount(), count + 1); + }); + test('Users can cancel create new credential stores', async function (assert) { const count = getCredentialStoresCount(); await visit(urls.newCredentialStore); diff --git a/ui/admin/tests/acceptance/credential-store/selectors.js b/ui/admin/tests/acceptance/credential-store/selectors.js index 681714bf7..828d15529 100644 --- a/ui/admin/tests/acceptance/credential-store/selectors.js +++ b/ui/admin/tests/acceptance/credential-store/selectors.js @@ -11,6 +11,7 @@ export const EDIT_ACTION = export const CODE_EDITOR_BODY = '[data-test-code-editor-field-editor] textarea'; export const CODE_BLOCK_BODY = '.hds-code-block__code'; +export const EDITOR_WORKER_FILTER_VALUE = '"dev" in "/tags/env"'; export const TYPE_VAULT = '[value="vault"]';