Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: HDS adoption replace <CopyButton> component #22333

Merged
merged 26 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
86ff82c
Part 1: Upgrade HDS to 2.9.0 (#22311)
malinac02 Aug 15, 2023
1ae69ad
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
malinac02 Aug 24, 2023
228c6a2
UI: HDS adoption replace <CopyButton> part 2 (#22356)
malinac02 Aug 29, 2023
499e047
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
malinac02 Sep 5, 2023
0045a29
UI: HDS adoption replace <CopyButton> part 3 (#22614)
malinac02 Sep 6, 2023
4f8dc36
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
malinac02 Sep 8, 2023
662c631
UI: HDS adoption replace <CopyButton> part 4 (#22749)
malinac02 Sep 8, 2023
d596f80
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
hellobontempo Sep 13, 2023
ed2d5f3
update code snippet copy button
hellobontempo Sep 13, 2023
a27881c
UI: HDS adoption replace <CopyButton> part 5: Cleanup (#22884)
malinac02 Sep 13, 2023
5329b58
rename class to transparent background
hellobontempo Sep 14, 2023
0379783
remove unused test selectors
hellobontempo Sep 14, 2023
7a65c27
replace transit actions with Copy::Snippet
hellobontempo Sep 14, 2023
0a7bfa8
replace transfrom code blocks with code snippet component
hellobontempo Sep 14, 2023
effb2a0
revert extra css fiddling
hellobontempo Sep 14, 2023
7f58d4b
misc cleanup, unused action
hellobontempo Sep 14, 2023
a1156f9
remove copy & close buttons from transit modals
hellobontempo Sep 14, 2023
2bf3524
remove is- from class naming
hellobontempo Sep 14, 2023
abeb6be
remove hds-copy-button class
hellobontempo Sep 14, 2023
2f09675
add other grey class
hellobontempo Sep 14, 2023
230d1d6
more small cleanup
hellobontempo Sep 14, 2023
4eaf13a
add -top to margin
hellobontempo Sep 15, 2023
948b9fa
add changelog
hellobontempo Sep 15, 2023
6468f7b
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
hellobontempo Sep 15, 2023
790ef37
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
hellobontempo Sep 15, 2023
961fbf1
Merge branch 'main' into ui/VAULT-18829/hds-adoption-replace-CopyButton
hellobontempo Sep 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
UI: HDS adoption replace <CopyButton> part 3 (#22614)
* encrypt.hbs: replace 2 <CopyButton> with <Hds::Copy::Button>

* decrypt.hbs: replace 2 <CopyButton> with <Hds::Copy::Button>

* datakey.hbs. replace 6 <CopyButton> with <Hds::Copy::Button>

* rewrap.hbs: replace 2 <CopyButton> with <Hds::Copy::Button>

* hmac.hbs: replace 2 <CopyButton> with <Hds::Copy::Button>

* fix typo

* add copy-close class to copy & close buttons

* export.hbs: replace 2 <CopyButton> with <Hds::Copy::Button>. fix styling

* sign.hbs: replace 2 <CopyButton> with <Hds::Copy::Button>

* fix test caused by changing <pre> tag to <code> in export.hbs

* rename class

* add extra style to class needed for part 4 of copy button replacement
  • Loading branch information
malinac02 authored Sep 6, 2023
commit 0045a29500e1fef8392a3903d79b95c4c36ffbef
17 changes: 17 additions & 0 deletions ui/app/styles/core/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,24 @@ a.button.disabled {
min-width: $spacing-l;
padding: 0;
}

&.white-icon svg {
color: $white;
}

&.is-primary {
background-color: $blue;
box-shadow: $box-shadow-low;
border-radius: $radius;
border-color: darken($blue, 2%);
color: $white;
font-weight: $font-weight-bold;
text-shadow: 0 1px 1px rgba($black, 0.25);
height: 2.5rem;
min-width: 6rem;

svg {
color: $white;
}
}
}
4 changes: 4 additions & 0 deletions ui/app/styles/helper-classes/flexbox-and-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
flex-direction: row;
}

.has-gap-xxs {
gap: $spacing-xxs;
}

.has-gap-m {
gap: $spacing-m;
}
Expand Down
93 changes: 42 additions & 51 deletions ui/app/templates/components/transit-key-action/datakey.hbs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consulted design and opted to remove blue copy buttons as they were redundant and anti-pattern

before / after

Screenshot 2023-09-14 at 2 52 46 PM

all of the /transit-key-action files have similar before/after views

Original file line number Diff line number Diff line change
Expand Up @@ -79,74 +79,65 @@
<div class="box is-shadowless is-fullwidth is-sideless">
{{#if (eq @param "plaintext")}}
<h2 class="title is-6">Plaintext</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left">{{@plaintext}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@plaintext}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@plaintext}}
@buttonType="button"
@success={{action (set-flash-message "Plaintext copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
<p class="help has-bottom-margin-m">Plaintext is base64 encoded</p>
<h2 class="title is-6">Ciphertext</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left">{{@ciphertext}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@ciphertext}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action (set-flash-message "Ciphertext copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
<div class="is-flex-align-baseline has-gap-xxs">
<Hds::Copy::Button
@text="Copy Plaintext"
@textToCopy={{@plaintext}}
class="hds-copy-button is-primary white-icon"
data-test-button="modal-copy-close"
/>
<Hds::Copy::Button
@text="Copy Ciphertext"
@textToCopy={{@ciphertext}}
class="hds-copy-button is-primary white-icon"
data-test-button="modal-copy-close"
/>
<button type="submit" class="button is-secondary" onclick={{action (mut @isModalActive) false}}>Close</button>
</div>
<CopyButton
class="button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{@plaintext}}
@buttonType="button"
@success={{action (set-flash-message "Plaintext copied!")}}
>
Copy Plaintext
</CopyButton>
<CopyButton
class="button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action (set-flash-message "Ciphertext copied!")}}
>
Copy Ciphertext
</CopyButton>
<button type="submit" class="button is-secondary" onclick={{action (mut @isModalActive) false}}>Close</button>
{{else}}
<h2 class="title is-6">Ciphertext</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left">{{@ciphertext}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@ciphertext}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action (set-flash-message "Ciphertext copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
<CopyButton
class="button is-primary copy-close"
<Hds::Copy::Button
@text="Copy & Close"
@textToCopy={{@ciphertext}}
class="hds-copy-button is-primary has-top-margin-m"
data-test-button="modal-copy-close"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action @toggleModal "Ciphertext copied!"}}
>
Copy &amp; Close
</CopyButton>
{{on "click" (fn @toggleModal "Ciphertext copied!")}}
/>
{{/if}}
</div>
</section>
Expand Down
29 changes: 13 additions & 16 deletions ui/app/templates/components/transit-key-action/decrypt.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,28 @@
<section class="modal-card-body">
<div class="box is-shadowless is-fullwidth is-sideless">
<h2 class="title is-6">Plaintext</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left" data-test-encrypted-value="plaintext">{{@plaintext}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@plaintext}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@plaintext}}
@buttonType="button"
@success={{action (set-flash-message "Plaintext copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
<p class="help">Plaintext is base64 encoded</p>
</div>
</section>
<footer class="modal-card-foot">
<CopyButton
class="button is-primary copy-close"
<Hds::Copy::Button
@text="Copy & Close"
@textToCopy={{@plaintext}}
class="hds-copy-button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{@plaintext}}
@buttonType="button"
@success={{action @toggleModal "Plaintext copied!"}}
>
Copy &amp; Close
</CopyButton>
{{on "click" (fn @toggleModal "Plaintext copied!")}}
/>
</footer>
</Modal>
{{/if}}
29 changes: 13 additions & 16 deletions ui/app/templates/components/transit-key-action/encrypt.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,26 @@
<section class="modal-card-body">
<div class="box is-shadowless is-fullwidth is-sideless">
<h2 class="title is-6">Ciphertext</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left" data-test-encrypted-value="ciphertext">{{@ciphertext}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@ciphertext}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action (set-flash-message "Ciphertext copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
</div>
</section>
<footer class="modal-card-foot">
<CopyButton
class="button is-primary copy-close"
<Hds::Copy::Button
@text="Copy & Close"
@textToCopy={{@ciphertext}}
class="hds-copy-button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action @toggleModal "Ciphertext copied!"}}
>
Copy &amp; Close
</CopyButton>
{{on "click" (fn @toggleModal "Ciphertext copied!")}}
/>
</footer>
</Modal>
33 changes: 16 additions & 17 deletions ui/app/templates/components/transit-key-action/export.hbs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-09-14 at 2 55 19 PM

Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,28 @@
<section class="modal-card-body">
<div class="box is-shadowless is-fullwidth is-sideless">
<h2 class="title is-6">Wrapped Key</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<pre data-test-encrypted-value="export" class="level-left">{{if this.wrapTTL @wrappedToken (stringify @keys)}}</pre>
<CopyButton
class="button is-compact is-transparent level-right"
<code data-test-encrypted-value="export" class="level-left">
{{if this.wrapTTL @wrappedToken (stringify @keys)}}
</code>
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{if this.wrapTTL @wrappedToken (stringify @keys)}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{if this.wrapTTL @wrappedToken (stringify @keys)}}
@buttonType="button"
@success={{action (set-flash-message "Token copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
</div>
</section>
<footer class="modal-card-foot">
<CopyButton
class="button is-primary copy-close"
<Hds::Copy::Button
@text="Copy & Close"
@textToCopy={{if this.wrapTTL @wrappedToken (stringify @keys)}}
class="hds-copy-button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{if this.wrapTTL @wrappedToken (stringify @keys)}}
@buttonType="button"
@success={{action @toggleModal "Token copied!"}}
>
Copy &amp; Close
</CopyButton>
{{on "click" (fn @toggleModal "Token copied!")}}
/>
</footer>
</Modal>
29 changes: 13 additions & 16 deletions ui/app/templates/components/transit-key-action/hmac.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,26 @@
<section class="modal-card-body">
<div class="box is-shadowless is-fullwidth is-sideless">
<h2 class="title is-6">HMAC</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left" data-test-encrypted-value="hmac">{{@hmac}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@hmac}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@hmac}}
@buttonType="button"
@success={{action (set-flash-message "HMAC copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
</div>
</section>
<footer class="modal-card-foot">
<CopyButton
class="button is-primary copy-close"
<Hds::Copy::Button
@text="Copy & Close"
@textToCopy={{@hmac}}
class="hds-copy-button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{@hmac}}
@buttonType="button"
@success={{action @toggleModal "HMAC copied!"}}
>
Copy &amp; Close
</CopyButton>
{{on "click" (fn @toggleModal "HMAC copied!")}}
/>
</footer>
</Modal>
29 changes: 13 additions & 16 deletions ui/app/templates/components/transit-key-action/rewrap.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,26 @@
<section class="modal-card-body">
<div class="box is-shadowless is-fullwidth is-sideless">
<h2 class="title is-6">Ciphertext</h2>
{{! HDS Adoption: Replace with Hds::Copy::Snippet }}
<div class="copy-text level">
<code class="level-left" data-test-encrypted-value="ciphertext">{{@ciphertext}}</code>
<CopyButton
class="button is-compact is-transparent level-right"
<Hds::Copy::Button
@text="Copy"
@isIconOnly={{true}}
@textToCopy={{@ciphertext}}
class="hds-copy-button icon-only"
data-test-button="modal-copy"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action (set-flash-message "Ciphertext copied!")}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
/>
</div>
</div>
</section>
<footer class="modal-card-foot">
<CopyButton
class="button is-primary copy-close"
<Hds::Copy::Button
@text="Copy & Close"
@textToCopy={{@ciphertext}}
class="hds-copy-button is-primary"
data-test-button="modal-copy-close"
@clipboardText={{@ciphertext}}
@buttonType="button"
@success={{action @toggleModal "Ciphertext copied!"}}
>
Copy &amp; Close
</CopyButton>
{{on "click" (fn @toggleModal "Ciphertext copied!")}}
/>
</footer>
</Modal>
Loading