Skip to content

Commit

Permalink
Llb/worker filter improvements (#2614)
Browse files Browse the repository at this point in the history
* test: ๐Ÿ’ clean up worker filter component tests (#2559)

* Icu 15741 add show filter generator toggle to worker filter component (#2562)

* feat: ๐ŸŽธ add filter generator to worker filter component

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15741

* feat: ๐ŸŽธ show add worker filter when none set for targets (#2564)

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15760

* Icu 15743 tag workflow (#2565)

* feat: ๐ŸŽธ add tag generator workflow

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15743

* test: ๐Ÿ’ add test cases

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15743

* refactor: ๐Ÿ’ก update selected type name to selectedGeneratorType

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15743

* Apply suggestions from code review

minor translation change

Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>

* refactor: ๐Ÿ’ก update id for generated-value

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15743

---------

Co-authored-by: Lisbet Alvarez <lisbet.alvarez@hashicorp.com>
Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>

* Icu 15744 name workflow (#2566)

* feat: ๐ŸŽธ add name workflow

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15744

* test: ๐Ÿ’ add "name" workflow tests for filter generator

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15744

* refactor: ๐Ÿ’ก use const test selectors for filter generator

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15744

* refactor: ๐Ÿ’ก add default option

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15744

* docs: โœ๏ธ fix comment

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15744

---------

Co-authored-by: cameronperera <cameron.perera@hashicorp.com>

* refactor: ๐Ÿ’ก move worker filter generator outside of rose::form (#2574)

* refactor: ๐Ÿ’ก move worker filter generator outside of rose::form

* [ICU-15718] Add worker filter route, template for empty state (#2576)

* 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>

* feat: ๐ŸŽธ update worker filter field to use code editor (#2578)

* feat: ๐ŸŽธ update worker filter field to use code editor

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15737

* test: ๐Ÿ’ fix failing storage bucket tests

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15737

* test: ๐Ÿ’ update tests for new worker filter field (#2580)

* test: ๐Ÿ’ update tests for new worker filter field

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15739

* Update ui/admin/tests/acceptance/storage-buckets/update-test.js

Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>

---------

Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>

* [ICU-15719] Create edit worker filter route and template (#2582)

* add codeblock to template

* add cancel btn fn

* add controller test

* add save fn

* display formatted worker filter text inside codeblock

* move codeblock component outside rose::layout::centered

* remove console.log

* remove router.refresh() and refactor translations yaml

* refactor translations, add breadcrumb::item

* replace html elements with hds

* move component, delete file

* [ICU-15720] Add edit worker filter action to manage dropdown (#2593)

* add acceptance test file

* delete test file

* add edit option to manage dropdown

* update route in dropdown

* add check for model isVault

* add acceptance test file

* delete test file

* remove data test selectors, fix syntax

* [ICU-15721] Remove worker filter input field (#2596)

* remove worker filter input field from vault credential store form

* revert yaml

* [ICU-15838] Add vault credential store worker filter tests (#2595)

* add data test elements

* add subtests to update-test.js

* add subtext to check for .hasText()

* add subtest when worker filter exists

* update subtest name

* remove console.log

* clean up

* add new selectors

* refactor: ๐Ÿ’ก worker filter clean-up (#2592)

* refactor: ๐Ÿ’ก worker filter clean-up

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15816

* refactor: ๐Ÿ’ก add aria labels & missing can save check

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15816

* refactor: ๐Ÿ’ก pr feedback of using uuid

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15816

* Add missing copyright headers

* refactor: ๐Ÿ’ก use unique-id helper for aria labels (pr feedback)

โœ… Closes: https://hashicorp.atlassian.net/browse/ICU-15816

---------

Co-authored-by: lisbet-alvarez <lisbet-alvarez@users.noreply.github.com>

* refactor: ๐Ÿ’ก update icon logic for egress worker filter (#2612)

* refactor: ๐Ÿ’ก update worker_filter help translation

* refactor: ๐Ÿ’ก add maxHeight to worker filter code blocks

* refactor: ๐Ÿ’ก use existing default option for dropdowns

* refactor: ๐Ÿ’ก hide copy button when no result to copy

and remove unused styles

---------

Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>
Co-authored-by: Lisbet Alvarez <lisbet.alvarez@hashicorp.com>
Co-authored-by: Lauren <lauren.burwell@hashicorp.com>
Co-authored-by: laurenolivia <laurenolivia@users.noreply.github.com>
Co-authored-by: lisbet-alvarez <lisbet-alvarez@users.noreply.github.com>
  • Loading branch information
6 people authored Dec 11, 2024
1 parent 40c8cee commit 2869020
Show file tree
Hide file tree
Showing 40 changed files with 1,045 additions and 212 deletions.
24 changes: 24 additions & 0 deletions addons/core/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,27 @@ settings:
alerts:
cache-daemon: There may be a problem with the cache daemon
client-agent: There may be a problem with the client agent
worker-filter-generator:
toggle:
title: Show filter generator
description: The generator will automatically generate a pre-formatted filter for you. You can copy the result to the editor above.
filter-generator:
title: Filter generator
description: Choose what you want to format into a filter.
link: Learn more about formatting a worker filter.
input-values:
title: Input values
description: Next, input what you want to format.
formatted-result:
title: Formatted result
description: Copy and paste this into the editor above.
label: Generated result
tag:
label: Tag
helper: Format a worker tag
name:
label: Name
helper: Format a worker name
operator:
matches: matches
contains: contains
2 changes: 2 additions & 0 deletions addons/core/translations/form/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ key:
label: Key
value:
label: Value
operator:
label: Operator
callback_url:
label: Callback URL
help: The URL to which the third-party provider sends the authentication response. Paste this into the provider configuration.
Expand Down
15 changes: 14 additions & 1 deletion addons/core/translations/resources/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ storage-bucket:
help: The secret access key generated by your storage provider for the IAM user to use with this storage bucket. We will not show this data after it is saved, but you can replace it.
worker_filter:
label: Worker filter
help: Filter for Boundary workers that have network access to your storage. Boolean expression.
help: Filters to the worker(s) that can handle requests for this storage bucket.
disable_credential_rotation:
label: Disable credential rotation
help: Disabling credential rotation could allow entities outside of Boundary to know the client secret in use.
Expand Down Expand Up @@ -819,6 +819,7 @@ target:
ingress-workers: Ingress workers
actions:
edit-worker-filter: Edit worker filter
add-worker-filter: Add worker filter
credential-store:
title: Credential Store
title_plural: Credential Stores
Expand All @@ -828,8 +829,20 @@ credential-store:
title: Welcome to Credential Stores
titles:
new: New Credential Store
worker-filter:
title: Worker Filter
description: The worker filter format for this credential store.
messages:
none:
title: No worker filter added
description: You haven't added a worker filter yet.
edit:
title: Edit Worker Filter
description: Specify workers that have access to the credential store.
actions:
add: Add Worker Filter
delete: Delete Credential Store
edit: Edit Worker Filter
types:
vault: Vault
static: Static
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
{{t 'resources.credential.actions.create'}}
</dd.Interactive>
{{/if}}
{{#if (and (feature-flag 'vault-worker-filter') @model.isVault)}}
<dd.Interactive
@route='scopes.scope.credential-stores.credential-store.edit-worker-filter'
@text={{t 'resources.credential-store.actions.edit'}}
/>
{{/if}}
{{#if (can 'delete model' @model)}}
<dd.Separator />
<dd.Interactive @color='critical' {{on 'click' @delete}}>
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.worker-filter.title'}}
</nav.link>
{{/if}}
{{#if (can 'navigate model' @model collection='credential-libraries')}}
<nav.link
@route='scopes.scope.credential-stores.credential-store.credential-libraries'
Expand Down
29 changes: 0 additions & 29 deletions ui/admin/app/components/form/credential-store/vault/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -115,35 +115,6 @@
{{/if}}
</Hds::Form::TextInput::Field>

{{#if (feature-flag 'vault-worker-filter')}}
<Hds::Form::TextInput::Field
name='worker_filter'
@value={{@model.worker_filter}}
@isOptional={{true}}
@isInvalid={{@model.errors.worker_filter}}
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'worker_filter')}}
as |F|
>
<F.Label>
{{t 'resources.credential-store.form.worker_filter.label'}}
</F.Label>
<F.HelperText>
{{t 'resources.credential-store.form.worker_filter.help'}}
<Hds::Link::Inline @href={{doc-url 'worker-filters'}}>
{{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::TextInput::Field>
{{/if}}

{{#if (or @model.isNew form.isEditable)}}
<Hds::Form::TextInput::Field
name='token'
Expand Down
59 changes: 35 additions & 24 deletions ui/admin/app/components/form/storage-bucket/aws/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -456,30 +456,41 @@
{{/if}}

{{! worker_filter }}
<Hds::Form::TextInput::Field
name='worker_filter'
@isRequired={{true}}
@value={{@model.worker_filter}}
@isInvalid={{@model.errors.worker_filter}}
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'worker_filter')}}
as |F|
>
<F.Label>{{t 'resources.storage-bucket.form.worker_filter.label'}}</F.Label>
<F.HelperText>
{{t 'resources.storage-bucket.form.worker_filter.help'}}
<Hds::Link::Inline @href={{doc-url 'storage-bucket.worker-filter'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.worker_filter}}
<F.Error data-test-worker-filter-error as |E|>
{{#each @model.errors.worker_filter as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
{{#let (unique-id) (unique-id) as |labelId helpId|}}
<Hds::Form::Fieldset
aria-labelledby={{labelId}}
aria-describedby={{helpId}}
class='storage-bucket-worker-filter'
@isRequired={{true}}
as |F|
>
<F.Legend id={{labelId}}>{{t
'resources.storage-bucket.form.worker_filter.label'
}}</F.Legend>
<F.HelperText id={{helpId}}>
{{t 'resources.storage-bucket.form.worker_filter.help'}}
<Hds::Link::Inline @href={{doc-url 'storage-bucket.worker-filter'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
<F.Control>
{{#if form.disabled}}
<Hds::CodeBlock
@language='bash'
@value={{@model.worker_filter}}
@hasCopyButton={{true}}
data-test-worker-filter
/>
{{else}}
<WorkerFilterGenerator
@model={{@model}}
@name='worker_filter'
@hideToolbar={{true}}
/>
{{/if}}
</F.Control>
</Hds::Form::Fieldset>
{{/let}}

{{! JUST for static credentials }}
{{#unless this.showDynamicCredentials}}
Expand Down
5 changes: 3 additions & 2 deletions ui/admin/app/components/form/storage-bucket/aws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import { tracked } from '@glimmer/tracking';

export default class FormStorageBucketAwsIndexComponent extends Component {
// =attributes
@tracked selectedCredentialType = this.args.model.credentialType;

@tracked selectedCredentialType = this.args.model.credentialType;
@tracked showDynamicCredentials =
this.args.model.credentialType === TYPE_CREDENTIAL_DYNAMIC;

/**
* returns an array of available credential types
* @type {array}
Expand All @@ -28,7 +29,7 @@ export default class FormStorageBucketAwsIndexComponent extends Component {
// =actions
/**
* Allows to update the credential type
* @param type {string}
* @param {string} type
*/
@action
updateCredentialTypeSelection(type) {
Expand Down
60 changes: 36 additions & 24 deletions ui/admin/app/components/form/storage-bucket/minio/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -315,30 +315,42 @@
{{/if}}

{{! worker_filter }}
<Hds::Form::TextInput::Field
name='worker_filter'
@isRequired={{true}}
@value={{@model.worker_filter}}
@isInvalid={{@model.errors.worker_filter}}
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'worker_filter')}}
as |F|
>
<F.Label>{{t 'resources.storage-bucket.form.worker_filter.label'}}</F.Label>
<F.HelperText>
{{t 'resources.storage-bucket.form.worker_filter.help'}}
<Hds::Link::Inline @href={{doc-url 'storage-bucket.worker-filter'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
{{#if @model.errors.worker_filter}}
<F.Error data-test-worker-filter-error as |E|>
{{#each @model.errors.worker_filter as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
{{#let (unique-id) (unique-id) as |labelId helpId|}}
<Hds::Form::Fieldset
aria-labelledby={{labelId}}
aria-describedby={{helpId}}
class='storage-bucket-worker-filter'
@isRequired={{true}}
as |F|
>
<F.Legend id={{labelId}}>{{t
'resources.storage-bucket.form.worker_filter.label'
}}</F.Legend>
<F.HelperText {{helpId}}>
{{t 'resources.storage-bucket.form.worker_filter.help'}}
<Hds::Link::Inline @href={{doc-url 'storage-bucket.worker-filter'}}>
{{t 'actions.learn-more'}}
</Hds::Link::Inline>
</F.HelperText>
<F.Control>
{{#if form.disabled}}
<Hds::CodeBlock
@maxHeight='300px'
@language='bash'
@value={{@model.worker_filter}}
@hasCopyButton={{true}}
data-test-worker-filter
/>
{{else}}
<WorkerFilterGenerator
@model={{@model}}
@name='worker_filter'
@hideToolbar={{true}}
/>
{{/if}}
</F.Control>
</Hds::Form::Fieldset>
{{/let}}

{{! disable_credential_rotation }}
<Hds::Form::Checkbox::Field
Expand Down
21 changes: 21 additions & 0 deletions ui/admin/app/components/form/worker-filter/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}

<Rose::Form
class='full-width'
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
as |form|
>
<WorkerFilterGenerator @model={{@model}} @name={{@name}} />

{{#if (can 'save model' @model)}}
<form.actions
@submitText={{t 'actions.save'}}
@cancelText={{t 'actions.cancel'}}
/>
{{/if}}
</Rose::Form>
Loading

0 comments on commit 2869020

Please sign in to comment.