blob: 339c7a7e09d23ca85439197d1cc8b7a9928a415b [file] [log] [blame]
Wyatt Allenbe9869c2016-06-20 15:50:37 -07001<!--
2Copyright (C) 2016 The Android Open Source Project
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations 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 Siegel07c8a162017-03-13 14:23:48 -070060 <th class="keyHeader">Public key</th>
Wyatt Allenbe9869c2016-06-20 15:50:37 -070061 </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 Siegel07c8a162017-03-13 14:23:48 -070090 <span class="title">Public key</span>
Wyatt Allenbe9869c2016-06-20 15:50:37 -070091 <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 Siegel07c8a162017-03-13 14:23:48 -0700104 disabled$="[[!hasUnsavedChanges]]">Save changes</gr-button>
Wyatt Allenbe9869c2016-06-20 15:50:37 -0700105 </fieldset>
106 <fieldset>
107 <section>
Becky Siegel07c8a162017-03-13 14:23:48 -0700108 <span class="title">New SSH key</span>
Wyatt Allenbe9869c2016-06-20 15:50:37 -0700109 <span class="value">
110 <iron-autogrow-textarea
111 id="newKey"
Becky Siegel0a59ac22016-11-15 13:12:21 -0800112 autocomplete="on"
Wyatt Allenbe9869c2016-06-20 15:50:37 -0700113 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 Siegel07c8a162017-03-13 14:23:48 -0700120 on-tap="_handleAddKey">Add new SSH key</gr-button>
Wyatt Allenbe9869c2016-06-20 15:50:37 -0700121 </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>