diff --git a/changelog/12890.txt b/changelog/12890.txt new file mode 100644 index 0000000000000..603e72d8d8cdf --- /dev/null +++ b/changelog/12890.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: Click to copy database static role last rotation value in tooltip +``` \ No newline at end of file diff --git a/ui/app/templates/components/generate-credentials-database.hbs b/ui/app/templates/components/generate-credentials-database.hbs index c28cba7200c97..1ce449d1caad0 100644 --- a/ui/app/templates/components/generate-credentials-database.hbs +++ b/ui/app/templates/components/generate-credentials-database.hbs @@ -76,6 +76,7 @@ @label="Last Vault rotation" @value={{date-format @model.lastVaultRotation 'MMMM d yyyy, h:mm:ss a'}} @tooltipText={{@model.lastVaultRotation}} + @isTooltipCopyable={{true}} /> {{value}} -
- {{tooltipText}} -
+ +
+ {{tooltipText}} +
+
{{else}} diff --git a/ui/lib/core/addon/templates/components/tool-tip.hbs b/ui/lib/core/addon/templates/components/tool-tip.hbs index b6fb4e837eecf..b987aebac0a38 100644 --- a/ui/lib/core/addon/templates/components/tool-tip.hbs +++ b/ui/lib/core/addon/templates/components/tool-tip.hbs @@ -1,4 +1,5 @@ -{{#basic-dropdown-hover renderInPlace=renderInPlace +{{#basic-dropdown-hover + renderInPlace=renderInPlace verticalPosition=verticalPosition horizontalPosition=horizontalPosition matchTriggerWidth=matchTriggerWidth @@ -8,14 +9,17 @@ onOpen=onOpen onClose=onClose onFocus=onFocus - calculateInPlacePosition=calculateInPlacePosition as |dd|}} + calculateInPlacePosition=calculateInPlacePosition + as |dd| +}} {{yield (assign dd (hash trigger=(component dd.trigger onMouseDown=(action "prevent") onMouseEnter=(action "open") - onMouseLeave=(action "close")) + onMouseLeave=(action "close") + ) content=(component dd.content onMouseEnter=(action "open") onMouseLeave=(action "close") diff --git a/ui/tests/integration/components/info-table-row-test.js b/ui/tests/integration/components/info-table-row-test.js index 9093109b203c5..b24f48f5adaa3 100644 --- a/ui/tests/integration/components/info-table-row-test.js +++ b/ui/tests/integration/components/info-table-row-test.js @@ -71,6 +71,29 @@ module('Integration | Component | InfoTableRow', function(hooks) { assert.equal(tooltip, 'Tooltip text!', 'renders tooltip text'); }); + test('it should copy tooltip', async function(assert) { + assert.expect(4); + + this.set('isCopyable', false); + + await render(hbs` + + `); + + await triggerEvent('[data-test-value-div="test label"] .ember-basic-dropdown-trigger', 'mouseenter'); + await settled(); + assert.dom('[data-test-tooltip-copy]').hasAttribute('disabled', '', 'Tooltip copy button is disabled'); + assert.dom('[data-test-tooltip-copy]').doesNotHaveClass('has-pointer', 'Pointer class not applied when disabled'); + this.set('isCopyable', true); + assert.dom('[data-test-tooltip-copy]').doesNotHaveAttribute('disabled', 'Tooltip copy button is enabled'); + assert.dom('[data-test-tooltip-copy]').hasClass('has-pointer', 'Pointer class applied to copy button'); + }); + test('it renders a string with no link if isLink is true and the item type is not an array.', async function(assert) { // This could be changed in the component so that it adds a link for any item type, but right now it should only add a link if item type is an array. await render(hbs`