Add a copy button to copy the ssh key/gpg key
Bug: Issue 10047
Change-Id: If69f1a18065374000249b9157018c21024013085
diff --git a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.html b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.html
index 7a63605..0c589c9 100644
--- a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.html
+++ b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.html
@@ -19,6 +19,7 @@
<link rel="import" href="../../../bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html">
<link rel="import" href="../../../styles/gr-form-styles.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
+<link rel="import" href="../../shared/gr-copy-clipboard/gr-copy-clipboard.html">
<link rel="import" href="../../shared/gr-overlay/gr-overlay.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../../../styles/shared-styles.html">
@@ -69,6 +70,7 @@
<th class="userIdHeader">User IDs</th>
<th class="keyHeader">Public Key</th>
<th></th>
+ <th></th>
</tr>
</thead>
<tbody>
@@ -88,6 +90,14 @@
link>Click to View</gr-button>
</td>
<td>
+ <gr-copy-clipboard
+ has-tooltip
+ button-title="Copy GPG public key to clipboard"
+ hide-input
+ text="[[key.key]]">
+ </gr-copy-clipboard>
+ </td>
+ <td>
<gr-button
data-index$="[[index]]"
on-tap="_handleDeleteKey">Delete</gr-button>
diff --git a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.html b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.html
index 13b3152..c29bfe2 100644
--- a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.html
+++ b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.html
@@ -95,7 +95,7 @@
// Get the delete button for the last row.
const button = Polymer.dom(element.root).querySelector(
- 'tbody tr:last-of-type td:nth-child(5) gr-button');
+ 'tbody tr:last-of-type td:nth-child(6) gr-button');
MockInteractions.tap(button);
diff --git a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.html b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.html
index ab12403..57458f8 100644
--- a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.html
+++ b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor.html
@@ -19,6 +19,7 @@
<link rel="import" href="../../../bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html">
<link rel="import" href="../../../styles/gr-form-styles.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
+<link rel="import" href="../../shared/gr-copy-clipboard/gr-copy-clipboard.html">
<link rel="import" href="../../shared/gr-overlay/gr-overlay.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../../../styles/shared-styles.html">
@@ -65,6 +66,7 @@
<th class="statusHeader">Status</th>
<th class="keyHeader">Public key</th>
<th></th>
+ <th></th>
</tr>
</thead>
<tbody>
@@ -80,6 +82,14 @@
link>Click to View</gr-button>
</td>
<td>
+ <gr-copy-clipboard
+ has-tooltip
+ button-title="Copy SSH public key to clipboard"
+ hide-input
+ text="[[key.ssh_public_key]]">
+ </gr-copy-clipboard>
+ </td>
+ <td>
<gr-button
link
data-index$="[[index]]"
diff --git a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.html b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.html
index 8607948..1a884c9 100644
--- a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.html
+++ b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.html
@@ -86,7 +86,7 @@
// Get the delete button for the last row.
const button = Polymer.dom(element.root).querySelector(
- 'tbody tr:last-of-type td:nth-child(4) gr-button');
+ 'tbody tr:last-of-type td:nth-child(5) gr-button');
MockInteractions.tap(button);