Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 1 | <!-- |
| 2 | Copyright (C) 2016 The Android Open Source Project |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | --> |
| 16 | |
| 17 | <link rel="import" href="../../../bower_components/polymer/polymer.html"> |
| 18 | <link rel="import" href="../../../bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html"> |
| 19 | <link rel="import" href="../../../styles/gr-settings-styles.html"> |
| 20 | <link rel="import" href="../../shared/gr-button/gr-button.html"> |
| 21 | <link rel="import" href="../../shared/gr-overlay/gr-overlay.html"> |
| 22 | <link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html"> |
| 23 | |
| 24 | <dom-module id="gr-ssh-editor"> |
| 25 | <template> |
| 26 | <style> |
| 27 | .commentHeader { |
| 28 | width: 27em; |
| 29 | } |
| 30 | .statusHeader { |
| 31 | width: 4em; |
| 32 | } |
| 33 | .keyHeader { |
| 34 | width: 7.5em; |
| 35 | } |
| 36 | #viewKeyOverlay { |
| 37 | padding: 2em; |
| 38 | width: 50em; |
| 39 | } |
| 40 | .publicKey { |
| 41 | font-family: var(--monospace-font-family); |
| 42 | overflow-x: scroll; |
| 43 | overflow-wrap: break-word; |
| 44 | width: 30em; |
| 45 | } |
| 46 | .closeButton { |
| 47 | bottom: 2em; |
| 48 | position: absolute; |
| 49 | right: 2em; |
| 50 | } |
| 51 | </style> |
| 52 | <style include="gr-settings-styles"></style> |
| 53 | <div class="gr-settings-styles"> |
| 54 | <fieldset> |
| 55 | <table> |
| 56 | <thead> |
| 57 | <tr> |
| 58 | <th class="commentHeader">Comment</th> |
| 59 | <th class="statusHeader">Status</th> |
Becky Siegel | 07c8a16 | 2017-03-13 14:23:48 -0700 | [diff] [blame] | 60 | <th class="keyHeader">Public key</th> |
Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 61 | </tr> |
| 62 | </thead> |
| 63 | <tbody> |
| 64 | <template is="dom-repeat" items="[[_keys]]" as="key"> |
| 65 | <tr> |
| 66 | <td>[[key.comment]]</td> |
| 67 | <td>[[_getStatusLabel(key.valid)]]</td> |
| 68 | <td> |
| 69 | <gr-button |
| 70 | on-tap="_showKey" |
| 71 | data-index$="[[index]]" |
| 72 | link>Click to View</gr-button> |
| 73 | </td> |
| 74 | <td> |
| 75 | <gr-button |
| 76 | data-index$="[[index]]" |
| 77 | on-tap="_handleDeleteKey">Delete</gr-button> |
| 78 | </td> |
| 79 | </tr> |
| 80 | </template> |
| 81 | </tbody> |
| 82 | </table> |
| 83 | <gr-overlay id="viewKeyOverlay" with-backdrop> |
| 84 | <fieldset> |
| 85 | <section> |
| 86 | <span class="title">Algorithm</span> |
| 87 | <span class="value">[[_keyToView.algorithm]]</span> |
| 88 | </section> |
| 89 | <section> |
Becky Siegel | 07c8a16 | 2017-03-13 14:23:48 -0700 | [diff] [blame] | 90 | <span class="title">Public key</span> |
Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 91 | <span class="value publicKey">[[_keyToView.encoded_key]]</span> |
| 92 | </section> |
| 93 | <section> |
| 94 | <span class="title">Comment</span> |
| 95 | <span class="value">[[_keyToView.comment]]</span> |
| 96 | </section> |
| 97 | </fieldset> |
| 98 | <gr-button |
| 99 | class="closeButton" |
| 100 | on-tap="_closeOverlay">Close</gr-button> |
| 101 | </gr-overlay> |
| 102 | <gr-button |
| 103 | on-tap="save" |
Becky Siegel | 07c8a16 | 2017-03-13 14:23:48 -0700 | [diff] [blame] | 104 | disabled$="[[!hasUnsavedChanges]]">Save changes</gr-button> |
Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 105 | </fieldset> |
| 106 | <fieldset> |
| 107 | <section> |
Becky Siegel | 07c8a16 | 2017-03-13 14:23:48 -0700 | [diff] [blame] | 108 | <span class="title">New SSH key</span> |
Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 109 | <span class="value"> |
| 110 | <iron-autogrow-textarea |
| 111 | id="newKey" |
Becky Siegel | 0a59ac2 | 2016-11-15 13:12:21 -0800 | [diff] [blame] | 112 | autocomplete="on" |
Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 113 | bind-value="{{_newKey}}" |
| 114 | placeholder="New SSH Key"></iron-autogrow-textarea> |
| 115 | </span> |
| 116 | </section> |
| 117 | <gr-button |
| 118 | id="addButton" |
| 119 | disabled$="[[_computeAddButtonDisabled(_newKey)]]" |
Becky Siegel | 07c8a16 | 2017-03-13 14:23:48 -0700 | [diff] [blame] | 120 | on-tap="_handleAddKey">Add new SSH key</gr-button> |
Wyatt Allen | be9869c | 2016-06-20 15:50:37 -0700 | [diff] [blame] | 121 | </fieldset> |
| 122 | </div> |
| 123 | <gr-rest-api-interface id="restAPI"></gr-rest-api-interface> |
| 124 | </template> |
| 125 | <script src="gr-ssh-editor.js"></script> |
| 126 | </dom-module> |