summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view.html
blob: 799cf5943b729c4df4c08b6468db66c596639913 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
<!--
@license
Copyright (C) 2016 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<link rel="import" href="../../../bower_components/polymer/polymer.html">

<link rel="import" href="../../../behaviors/docs-url-behavior/docs-url-behavior.html">
<link rel="import" href="../../../bower_components/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../../../styles/gr-form-styles.html">
<link rel="import" href="../../../styles/gr-menu-page-styles.html">
<link rel="import" href="../../../styles/gr-page-nav-styles.html">
<link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
<link rel="import" href="../../settings/gr-change-table-editor/gr-change-table-editor.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
<link rel="import" href="../../shared/gr-date-formatter/gr-date-formatter.html">
<link rel="import" href="../../shared/gr-page-nav/gr-page-nav.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../../shared/gr-select/gr-select.html">
<link rel="import" href="../gr-account-info/gr-account-info.html">
<link rel="import" href="../gr-agreements-list/gr-agreements-list.html">
<link rel="import" href="../gr-edit-preferences/gr-edit-preferences.html">
<link rel="import" href="../gr-email-editor/gr-email-editor.html">
<link rel="import" href="../gr-gpg-editor/gr-gpg-editor.html">
<link rel="import" href="../gr-group-list/gr-group-list.html">
<link rel="import" href="../gr-http-password/gr-http-password.html">
<link rel="import" href="../gr-identities/gr-identities.html">
<link rel="import" href="../gr-menu-editor/gr-menu-editor.html">
<link rel="import" href="../gr-ssh-editor/gr-ssh-editor.html">
<link rel="import" href="../gr-watched-projects-editor/gr-watched-projects-editor.html">

<dom-module id="gr-settings-view">
  <template>
    <style include="shared-styles">
      :host {
        color: var(--primary-text-color);
      }
      #newEmailInput {
        width: 20em;
      }
      #email {
        margin-bottom: 1em;
      }
      .filters p,
      .darkToggle p {
        margin-bottom: 1em;
      }
      .queryExample em {
        color: violet;
      }
      .toggle {
        align-items: center;
        display: flex;
        margin-bottom: 1rem;
        margin-right: 1rem;
      }
    </style>
    <style include="gr-form-styles"></style>
    <style include="gr-menu-page-styles"></style>
    <style include="gr-page-nav-styles"></style>
    <div class="loading" hidden$="[[!_loading]]">Loading...</div>
    <div hidden$="[[_loading]]" hidden>
      <gr-page-nav class="navStyles">
        <ul>
          <li><a href="#Profile">Profile</a></li>
          <li><a href="#Preferences">Preferences</a></li>
          <li><a href="#DiffPreferences">Diff Preferences</a></li>
          <li><a href="#EditPreferences">Edit Preferences</a></li>
          <li><a href="#Menu">Menu</a></li>
          <li><a href="#ChangeTableColumns">Change Table Columns</a></li>
          <li><a href="#Notifications">Notifications</a></li>
          <li><a href="#EmailAddresses">Email Addresses</a></li>
          <li><a href="#HTTPCredentials">HTTP Credentials</a></li>
          <li hidden$="[[!_serverConfig.sshd]]"><a href="#SSHKeys">
            SSH Keys
          </a></li>
          <li hidden$="[[!_serverConfig.receive.enable_signed_push]]"><a href="#GPGKeys">
            GPG Keys
          </a></li>
          <li><a href="#Groups">Groups</a></li>
          <li><a href="#Identities">Identities</a></li>
          <template is="dom-if" if="[[_serverConfig.auth.use_contributor_agreements]]">
            <li>
              <a href="#Agreements">Agreements</a>
            </li>
          </template>
          <li><a href="#MailFilters">Mail Filters</a></li>
          <gr-endpoint-decorator name="settings-menu-item">
          </gr-endpoint-decorator>
        </ul>
      </gr-page-nav>
      <main class="gr-form-styles">
        <h1>User Settings</h1>
        <section class="darkToggle">
          <div class="toggle">
            <paper-toggle-button
                checked="[[_isDark]]"
                on-change="_handleToggleDark"></paper-toggle-button>
            <div>Dark theme (alpha)</div>
          </div>
          <p>
            Gerrit's dark theme is in early alpha, and almost definitely will
            not play nicely with themes set by specific Gerrit hosts. Filing
            feedback via the link in the app footer is strongly encouraged!
          </p>
        </section>
        <h2
            id="Profile"
            class$="[[_computeHeaderClass(_accountInfoChanged)]]">Profile</h2>
        <fieldset id="profile">
          <gr-account-info
              id="accountInfo"
              mutable="{{_accountNameMutable}}"
              has-unsaved-changes="{{_accountInfoChanged}}"></gr-account-info>
          <gr-button
              on-tap="_handleSaveAccountInfo"
              disabled="[[!_accountInfoChanged]]">Save changes</gr-button>
        </fieldset>
        <h2
            id="Preferences"
            class$="[[_computeHeaderClass(_prefsChanged)]]">Preferences</h2>
        <fieldset id="preferences">
          <section>
            <span class="title">Changes per page</span>
            <span class="value">
              <gr-select
                  bind-value="{{_localPrefs.changes_per_page}}">
                <select>
                  <option value="10">10 rows per page</option>
                  <option value="25">25 rows per page</option>
                  <option value="50">50 rows per page</option>
                  <option value="100">100 rows per page</option>
                </select>
              </gr-select>
            </span>
          </section>
          <section>
            <span class="title">Date/time format</span>
            <span class="value">
              <gr-select
                  bind-value="{{_localPrefs.date_format}}">
                <select>
                  <option value="STD">Jun 3 ; Jun 3, 2016</option>
                  <option value="US">06/03 ; 06/03/16</option>
                  <option value="ISO">06-03 ; 2016-06-03</option>
                  <option value="EURO">3. Jun ; 03.06.2016</option>
                  <option value="UK">03/06 ; 03/06/2016</option>
                </select>
              </gr-select>
              <gr-select
                  bind-value="{{_localPrefs.time_format}}">
                <select>
                  <option value="HHMM_12">4:10 PM</option>
                  <option value="HHMM_24">16:10</option>
                </select>
              </gr-select>
            </span>
          </section>
          <section>
            <span class="title">Email notifications</span>
            <span class="value">
              <gr-select
                  bind-value="{{_localPrefs.email_strategy}}">
                <select>
                  <option value="CC_ON_OWN_COMMENTS">Every comment</option>
                  <option value="ENABLED">Only comments left by others</option>
                  <option value="DISABLED">None</option>
                </select>
              </gr-select>
            </span>
          </section>
          <section hidden$="[[!_localPrefs.email_format]]">
            <span class="title">Email format</span>
            <span class="value">
              <gr-select
                  bind-value="{{_localPrefs.email_format}}">
                <select>
                  <option value="HTML_PLAINTEXT">HTML and plaintext</option>
                  <option value="PLAINTEXT">Plaintext only</option>
                </select>
              </gr-select>
            </span>
          </section>
          <section>
            <span class="title">Diff view</span>
            <span class="value">
              <gr-select
                  bind-value="{{_localPrefs.diff_view}}">
                <select>
                  <option value="SIDE_BY_SIDE">Side by side</option>
                  <option value="UNIFIED_DIFF">Unified diff</option>
                </select>
              </gr-select>
            </span>
          </section>
          <section>
            <span class="title">Show size bars in file list</span>
            <span class="value">
              <input
                  id="showSizeBarsInFileList"
                  type="checkbox"
                  checked$="[[_localPrefs.size_bar_in_change_table]]"
                  on-change="_handleShowSizeBarsInFileListChanged">
            </span>
          </section>
          <section>
            <span class="title">Publish comments on push</span>
            <span class="value">
              <input
                  id="publishCommentsOnPush"
                  type="checkbox"
                  checked$="[[_localPrefs.publish_comments_on_push]]"
                  on-change="_handlePublishCommentsOnPushChanged">
            </span>
          </section>
          <section>
            <span class="title">Set new changes to "work in progress" by default</span>
            <span class="value">
              <input
                  id="workInProgressByDefault"
                  type="checkbox"
                  checked$="[[_localPrefs.work_in_progress_by_default]]"
                  on-change="_handleWorkInProgressByDefault">
            </span>
          </section>
          <section>
            <span class="title">
              Insert Signed-off-by Footer For Inline Edit Changes
            </span>
            <span class="value">
              <input
                  id="insertSignedOff"
                  type="checkbox"
                  checked$="[[_localPrefs.signed_off_by]]"
                  on-change="_handleInsertSignedOff">
            </span>
          </section>
          <gr-button
              id="savePrefs"
              on-tap="_handleSavePreferences"
              disabled="[[!_prefsChanged]]">Save changes</gr-button>
        </fieldset>
        <h2
            id="DiffPreferences"
            class$="[[_computeHeaderClass(_diffPrefsChanged)]]">
          Diff Preferences
        </h2>
        <fieldset id="diffPreferences">
          <section>
            <span class="title">Context</span>
            <span class="value">
              <gr-select bind-value="{{_diffPrefs.context}}">
                <select>
                  <option value="3">3 lines</option>
                  <option value="10">10 lines</option>
                  <option value="25">25 lines</option>
                  <option value="50">50 lines</option>
                  <option value="75">75 lines</option>
                  <option value="100">100 lines</option>
                  <option value="-1">Whole file</option>
                </select>
              </gr-select>
            </span>
          </section>
          <section>
            <span class="title">Fit to screen</span>
            <span class="value">
              <input
                  id="diffLineWrapping"
                  type="checkbox"
                  checked$="[[_diffPrefs.line_wrapping]]"
                  on-change="_handleDiffLineWrappingChanged">
            </span>
          </section>
          <section id="columnsPref" hidden$="[[_diffPrefs.line_wrapping]]">
            <span class="title">Diff width</span>
            <span class="value">
              <input
                  is="iron-input"
                  type="number"
                  prevent-invalid-input
                  allowed-pattern="[0-9]"
                  bind-value="{{_diffPrefs.line_length}}">
            </span>
          </section>
          <section>
            <span class="title">Tab width</span>
            <span class="value">
              <input
                  is="iron-input"
                  type="number"
                  prevent-invalid-input
                  allowed-pattern="[0-9]"
                  bind-value="{{_diffPrefs.tab_size}}">
            </span>
          </section>
          <section hidden$="[[!_diffPrefs.font_size]]">
            <span class="title">Font size</span>
            <span class="value">
              <input
                  is="iron-input"
                  type="number"
                  prevent-invalid-input
                  allowed-pattern="[0-9]"
                  bind-value="{{_diffPrefs.font_size}}">
            </span>
          </section>
          <section>
            <span class="title">Show tabs</span>
            <span class="value">
              <input
                  id="diffShowTabs"
                  type="checkbox"
                  checked$="[[_diffPrefs.show_tabs]]"
                  on-change="_handleDiffShowTabsChanged">
            </span>
          </section>
          <section>
            <span class="title">Show trailing whitespace</span>
            <span class="value">
              <input
                  id="showTrailingWhitespace"
                  type="checkbox"
                  checked$="[[_diffPrefs.show_whitespace_errors]]"
                  on-change="_handleShowTrailingWhitespaceChanged">
            </span>
          </section>
          <section>
            <span class="title">Syntax highlighting</span>
            <span class="value">
              <input
                  id="diffSyntaxHighlighting"
                  type="checkbox"
                  checked$="[[_diffPrefs.syntax_highlighting]]"
                  on-change="_handleDiffSyntaxHighlightingChanged">
            </span>
          </section>
          <section>
            <div class="pref">
              <span class="title">Ignore Whitespace</span>
              <span class="value">
                <gr-select bind-value="{{_diffPrefs.ignore_whitespace}}">
                  <select>
                    <option value="IGNORE_NONE">None</option>
                    <option value="IGNORE_TRAILING">Trailing</option>
                    <option value="IGNORE_LEADING_AND_TRAILING">Leading & trailing</option>
                    <option value="IGNORE_ALL">All</option>
                  </select>
                </gr-select>
              </span>
            </div>
          </section>
          <gr-button
              id="saveDiffPrefs"
              on-tap="_handleSaveDiffPreferences"
              disabled$="[[!_diffPrefsChanged]]">Save changes</gr-button>
        </fieldset>
        <h2
            id="EditPreferences"
            class$="[[_computeHeaderClass(_editPrefsChanged)]]">
          Edit Preferences
        </h2>
        <fieldset id="editPreferences">
          <gr-edit-preferences
              id="editPrefs"
              has-unsaved-changes="{{_editPrefsChanged}}"></gr-edit-preferences>
          <gr-button
              id="saveEditPrefs"
              on-tap="_handleSaveEditPreferences"
              disabled$="[[!_editPrefsChanged]]">Save changes</gr-button>
        </fieldset>
        <h2 id="Menu" class$="[[_computeHeaderClass(_menuChanged)]]">Menu</h2>
        <fieldset id="menu">
          <gr-menu-editor
              menu-items="{{_localMenu}}"></gr-menu-editor>
          <gr-button
              id="saveMenu"
              on-tap="_handleSaveMenu"
              disabled="[[!_menuChanged]]">Save changes</gr-button>
          <gr-button
              id="resetMenu"
              link
              on-tap="_handleResetMenuButton">Reset</gr-button>
        </fieldset>
        <h2 id="ChangeTableColumns"
            class$="[[_computeHeaderClass(_changeTableChanged)]]">
          Change Table Columns
        </h2>
        <fieldset id="changeTableColumns">
          <gr-change-table-editor
              show-number="{{_showNumber}}"
              displayed-columns="{{_localChangeTableColumns}}">
          </gr-change-table-editor>
          <gr-button
              id="saveChangeTable"
              on-tap="_handleSaveChangeTable"
              disabled="[[!_changeTableChanged]]">Save changes</gr-button>
        </fieldset>
        <h2
            id="Notifications"
            class$="[[_computeHeaderClass(_watchedProjectsChanged)]]">
          Notifications
        </h2>
        <fieldset id="watchedProjects">
          <gr-watched-projects-editor
              has-unsaved-changes="{{_watchedProjectsChanged}}"
              id="watchedProjectsEditor"></gr-watched-projects-editor>
          <gr-button
              on-tap="_handleSaveWatchedProjects"
              disabled$="[[!_watchedProjectsChanged]]"
              id="_handleSaveWatchedProjects">Save changes</gr-button>
        </fieldset>
        <h2
            id="EmailAddresses"
            class$="[[_computeHeaderClass(_emailsChanged)]]">
          Email Addresses
        </h2>
        <fieldset id="email">
          <gr-email-editor
              id="emailEditor"
              has-unsaved-changes="{{_emailsChanged}}"></gr-email-editor>
          <gr-button
              on-tap="_handleSaveEmails"
              disabled$="[[!_emailsChanged]]">Save changes</gr-button>
        </fieldset>
        <fieldset id="newEmail">
          <section>
            <span class="title">New email address</span>
            <span class="value">
              <input
                  id="newEmailInput"
                  bind-value="{{_newEmail}}"
                  is="iron-input"
                  type="text"
                  disabled="[[_addingEmail]]"
                  on-keydown="_handleNewEmailKeydown"
                  placeholder="email@example.com">
            </span>
          </section>
          <section
              id="verificationSentMessage"
              hidden$="[[!_lastSentVerificationEmail]]">
            <p>
              A verification email was sent to
              <em>[[_lastSentVerificationEmail]]</em>. Please check your inbox.
            </p>
          </section>
          <gr-button
              disabled="[[!_computeAddEmailButtonEnabled(_newEmail, _addingEmail)]]"
              on-tap="_handleAddEmailButton">Send verification</gr-button>
        </fieldset>
        <h2 id="HTTPCredentials">HTTP Credentials</h2>
        <fieldset>
          <gr-http-password id="httpPass"></gr-http-password>
        </fieldset>
        <div hidden$="[[!_serverConfig.sshd]]">
          <h2
              id="SSHKeys"
              class$="[[_computeHeaderClass(_keysChanged)]]">SSH keys</h2>
          <gr-ssh-editor
              id="sshEditor"
              has-unsaved-changes="{{_keysChanged}}"></gr-ssh-editor>
        </div>
        <div hidden$="[[!_serverConfig.receive.enable_signed_push]]">
          <h2
              id="GPGKeys"
              class$="[[_computeHeaderClass(_gpgKeysChanged)]]">GPG keys</h2>
          <gr-gpg-editor
              id="gpgEditor"
              has-unsaved-changes="{{_gpgKeysChanged}}"></gr-gpg-editor>
        </div>
        <h2 id="Groups">Groups</h2>
        <fieldset>
          <gr-group-list id="groupList"></gr-group-list>
        </fieldset>
        <h2 id="Identities">Identities</h2>
        <fieldset>
          <gr-identities id="identities"></gr-identities>
        </fieldset>
        <template is="dom-if" if="[[_serverConfig.auth.use_contributor_agreements]]">
          <h2 id="Agreements">Agreements</h2>
          <fieldset>
            <gr-agreements-list id="agreementsList"></gr-agreements-list>
          </fieldset>
        </template>
        <h2 id="MailFilters">Mail Filters</h2>
        <fieldset class="filters">
          <p>
            Gerrit emails include metadata about the change to support
            writing mail filters.
          </p>
          <p>
            Here are some example Gmail queries that can be used for filters or
            for searching through archived messages. View the
            <a href$="[[_getFilterDocsLink(_docsBaseUrl)]]"
                target="_blank"
                rel="nofollow">Gerrit documentation</a>
            for the complete set of footers.
          </p>
          <table>
            <tbody>
              <tr><th>Name</th><th>Query</th></tr>
              <tr>
                <td>Changes requesting my review</td>
                <td>
                  <code class="queryExample">
                    "Gerrit-Reviewer: <em>Your Name</em>
                    &lt;<em>your.email@example.com</em>&gt;"
                  </code>
                </td>
              </tr>
              <tr>
                <td>Changes from a specific owner</td>
                <td>
                  <code class="queryExample">
                    "Gerrit-Owner: <em>Owner name</em>
                    &lt;<em>owner.email@example.com</em>&gt;"
                  </code>
                </td>
              </tr>
              <tr>
                <td>Changes targeting a specific branch</td>
                <td>
                  <code class="queryExample">
                    "Gerrit-Branch: <em>branch-name</em>"
                  </code>
                </td>
              </tr>
              <tr>
                <td>Changes in a specific project</td>
                <td>
                  <code class="queryExample">
                    "Gerrit-Project: <em>project-name</em>"
                  </code>
                </td>
              </tr>
              <tr>
                <td>Messages related to a specific Change ID</td>
                <td>
                  <code class="queryExample">
                    "Gerrit-Change-Id: <em>Change ID</em>"
                  </code>
                </td>
              </tr>
              <tr>
                <td>Messages related to a specific change number</td>
                <td>
                  <code class="queryExample">
                    "Gerrit-Change-Number: <em>change number</em>"
                  </code>
                </td>
              </tr>
            </tbody>
          </table>
        </fieldset>
        <gr-endpoint-decorator name="settings-screen">
        </gr-endpoint-decorator>
      </main>
    </div>
    <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
  </template>
  <script src="../../../scripts/util.js"></script>
  <script src="gr-settings-view.js"></script>
</dom-module>