Skip to content

Commit

Permalink
[ICU-15718] Add worker filter route, template for empty state (#2576)
Browse files Browse the repository at this point in the history
* 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 <laurenolivia@users.noreply.github.com>
  • Loading branch information
2 people authored and cameronperera committed Dec 11, 2024
1 parent 077d053 commit e2cd4f1
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addons/core/translations/resources/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
{{t 'titles.details'}}
</nav.link>
{{#if @model.isVault}}
{{#if (feature-flag 'vault-worker-filter')}}
<nav.link
@route='scopes.scope.credential-stores.credential-store.worker-filter'
>
{{t 'resources.credential-store.titles.worker-filter'}}
</nav.link>
{{/if}}
{{#if (can 'navigate model' @model collection='credential-libraries')}}
<nav.link
@route='scopes.scope.credential-stores.credential-store.credential-libraries'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import Controller, { inject as controller } from '@ember/controller';

export default class ScopesScopeCredentialStoresCredentialStoreWorkerFilterController extends Controller {
@controller('scopes/scope/credential-stores/index') credentialStores;
}
1 change: 1 addition & 0 deletions ui/admin/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Router.map(function () {
function () {},
);
});
this.route('worker-filter');
},
);
this.route('new');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import Route from '@ember/routing/route';

export default class ScopesScopeCredentialStoresCredentialStoreWorkerFilterRoute extends Route {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}

{{page-title (t 'resources.credential-store.titles.worker-filter')}}

<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<Breadcrumbs::Container />
</page.breadcrumbs>

<page.header>
<CredentialStores::CredentialStore::Header @model={{@model}} />
</page.header>

<page.navigation>
<CredentialStores::CredentialStore::Nav @model={{@model}} />
</page.navigation>

<page.actions>
<CredentialStores::CredentialStore::Actions
@model={{@model}}
@delete={{fn this.credentialStores.delete @model}}
/>
</page.actions>

<page.body>
<Rose::Layout::Centered>
<Hds::ApplicationState as |A|>
<A.Header
@title={{t 'resources.credential-store.messages.no-filter.title'}}
/>
<A.Body
@text={{t
'resources.credential-store.messages.no-filter.description'
}}
/>
<A.Footer as |F|>
<F.LinkStandalone
@icon='plus-circle'
@text={{t 'resources.credential-store.actions.add'}}
@route='scopes.scope.credential-stores.credential-store.index'
/>
</A.Footer>
</Hds::ApplicationState>
</Rose::Layout::Centered>
</page.body>
</Rose::Layout::Page>
Original file line number Diff line number Diff line change
@@ -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);
});
},
);
Original file line number Diff line number Diff line change
@@ -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);
});
},
);

0 comments on commit e2cd4f1

Please sign in to comment.