From f8734123a39fdaeb48c101337ec4432ab3e46a21 Mon Sep 17 00:00:00 2001 From: Lauren Date: Tue, 19 Nov 2024 19:04:35 -0500 Subject: [PATCH] [ICU-15718] Add worker filter route, template for empty state (#2576) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🎸 Vault Credential Store Worker Filter The Worker Filters tab will display the associated worker filter and have an empty state for when there is no worker filter assigned. * add template * Add missing copyright headers * update styling, remove Rose component * color primary is already default, remove * add rose component, remove custom css * fix test * singularize lang --------- Co-authored-by: laurenolivia --- addons/core/translations/resources/en-us.yaml | 5 ++ .../credential-store/nav/index.hbs | 7 +++ .../credential-store/worker-filter.js | 10 ++++ ui/admin/app/router.js | 1 + .../credential-store/worker-filter.js | 8 +++ .../credential-store/worker-filter.hbs | 49 +++++++++++++++++++ .../credential-store/worker-filter-test.js | 22 +++++++++ .../credential-store/worker-filter-test.js | 21 ++++++++ 8 files changed, 123 insertions(+) create mode 100644 ui/admin/app/controllers/scopes/scope/credential-stores/credential-store/worker-filter.js create mode 100644 ui/admin/app/routes/scopes/scope/credential-stores/credential-store/worker-filter.js create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/worker-filter.hbs create mode 100644 ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js create mode 100644 ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 19ba62d891..cc2a5ba0fd 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -827,10 +827,15 @@ credential-store: messages: welcome: title: Welcome to Credential Stores + no-filter: + title: No worker filter added + description: You haven't added a worker filter yet titles: new: New Credential Store + worker-filter: Worker Filter actions: delete: Delete Credential Store + add: Add worker filter types: vault: Vault static: Static diff --git a/ui/admin/app/components/credential-stores/credential-store/nav/index.hbs b/ui/admin/app/components/credential-stores/credential-store/nav/index.hbs index 828895fabd..0a1becdb86 100644 --- a/ui/admin/app/components/credential-stores/credential-store/nav/index.hbs +++ b/ui/admin/app/components/credential-stores/credential-store/nav/index.hbs @@ -8,6 +8,13 @@ {{t 'titles.details'}} {{#if @model.isVault}} + {{#if (feature-flag 'vault-worker-filter')}} + + {{t 'resources.credential-store.titles.worker-filter'}} + + {{/if}} {{#if (can 'navigate model' @model collection='credential-libraries')}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js new file mode 100644 index 0000000000..14ee81ec33 --- /dev/null +++ b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js @@ -0,0 +1,22 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Controller | scopes/scope/credential-stores/credential-store/worker-filter', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:scopes/scope/credential-stores/credential-store/worker-filter', + ); + assert.ok(controller); + assert.ok(controller.credentialStores); + }); + }, +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js new file mode 100644 index 0000000000..23f4e1eb3e --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js @@ -0,0 +1,21 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import { module, test } from 'qunit'; +import { setupTest } from 'admin/tests/helpers'; + +module( + 'Unit | Route | scopes/scope/credential-stores/credential-store/worker-filter', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/credential-stores/credential-store/worker-filter', + ); + assert.ok(route); + }); + }, +);