summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html
blob: 6ce1a09c5e145823deb6deb0ef68d891f82fd1db (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
<!--
@license
Copyright (C) 2017 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="../../../bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html">
<link rel="import" href="../../../bower_components/iron-input/iron-input.html">

<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
<link rel="import" href="../../shared/gr-download-commands/gr-download-commands.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="../../../styles/gr-form-styles.html">
<link rel="import" href="../../../styles/gr-subpage-styles.html">
<link rel="import" href="../../../styles/shared-styles.html">


<dom-module id="gr-repo">
  <template>
    <style include="shared-styles"></style>
    <style include="gr-subpage-styles">
      h2.edited:after {
        color: var(--deemphasized-text-color);
        content: ' *';
      }
      .loading,
      .hideDownload {
        display: none;
      }
      #loading.loading {
        display: block;
      }
      #loading:not(.loading) {
        display: none;
      }
      .repositorySettings {
        display: none;
      }
      .repositorySettings.showConfig {
        display: block;
      }
    </style>
    <style include="gr-form-styles"></style>
    <main class="gr-form-styles read-only">
      <style include="shared-styles"></style>
      <div class="info">
        <h1 id="Title" class$="name">
          [[repo]]
          <hr/>
        </h1>
        <div>
          <a href$="[[_computeChangesUrl(repo)]]">(view changes)</a>
        </div>
      </div>
      <div id="loading" class$="[[_computeLoadingClass(_loading)]]">Loading...</div>
      <div id="loadedContent" class$="[[_computeLoadingClass(_loading)]]">
        <div id="downloadContent" class$="[[_computeDownloadClass(_schemes)]]">
          <h2 id="download">Download</h2>
          <fieldset>
            <gr-download-commands
                id="downloadCommands"
                commands="[[_computeCommands(repo, _schemesObj, _selectedScheme)]]"
                schemes="[[_schemes]]"
                selected-scheme="{{_selectedScheme}}"></gr-download-commands>
          </fieldset>
        </div>
        <h2 id="configurations"
            class$="[[_computeHeaderClass(_configChanged)]]">Configurations</h2>
        <div id="form">
          <fieldset>
            <h3 id="Description">Description</h3>
            <fieldset>
              <iron-autogrow-textarea
                  id="descriptionInput"
                  class="description"
                  autocomplete="on"
                  placeholder="<Insert repo description here>"
                  bind-value="{{_repoConfig.description}}"
                  disabled$="[[_readOnly]]"></iron-autogrow-textarea>
            </fieldset>
            <h3 id="Options">Repository Options</h3>
            <fieldset id="options">
              <section>
                <span class="title">State</span>
                <span class="value">
                  <gr-select
                      id="stateSelect"
                      bind-value="{{_repoConfig.state}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat" items=[[_states]]>
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">Submit type</span>
                <span class="value">
                  <gr-select
                      id="submitTypeSelect"
                      bind-value="{{_repoConfig.submit_type}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatSubmitTypeSelect(_repoConfig)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">Allow content merges</span>
                <span class="value">
                  <gr-select
                      id="contentMergeSelect"
                      bind-value="{{_repoConfig.use_content_merge.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.use_content_merge)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">
                  Create a new change for every commit not in the target branch
                </span>
                <span class="value">
                  <gr-select
                      id="newChangeSelect"
                      bind-value="{{_repoConfig.create_new_change_for_all_not_in_target.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.create_new_change_for_all_not_in_target)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">Require Change-Id in commit message</span>
                <span class="value">
                  <gr-select
                      id="requireChangeIdSelect"
                      bind-value="{{_repoConfig.require_change_id.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.require_change_id)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section
                   id="enableSignedPushSettings"
                   class$="repositorySettings [[_computeRepositoriesClass(_repoConfig.enable_signed_push)]]">
                <span class="title">Enable signed push</span>
                <span class="value">
                  <gr-select
                      id="enableSignedPush"
                      bind-value="{{_repoConfig.enable_signed_push.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.enable_signed_push)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section
                   id="requireSignedPushSettings"
                   class$="repositorySettings [[_computeRepositoriesClass(_repoConfig.require_signed_push)]]">
                <span class="title">Require signed push</span>
                <span class="value">
                  <gr-select
                      id="requireSignedPush"
                      bind-value="{{_repoConfig.require_signed_push.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.require_signed_push)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">
                  Reject implicit merges when changes are pushed for review</span>
                <span class="value">
                  <gr-select
                      id="rejectImplicitMergesSelect"
                      bind-value="{{_repoConfig.reject_implicit_merges.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.reject_implicit_merges)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section id="noteDbSettings" class$="repositorySettings [[_computeRepositoriesClass(_noteDbEnabled)]]">
                <span class="title">
                  Enable adding unregistered users as reviewers and CCs on changes</span>
                <span class="value">
                  <gr-select
                      id="unRegisteredCcSelect"
                      bind-value="{{_repoConfig.enable_reviewer_by_email.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.enable_reviewer_by_email)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                  </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">
                  Set all new changes private by default</span>
                <span class="value">
                  <gr-select
                      id="setAllnewChangesPrivateByDefaultSelect"
                      bind-value="{{_repoConfig.private_by_default.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.private_by_default)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">
                  Set new changes to "work in progress" by default</span>
                <span class="value">
                  <gr-select
                      id="setAllNewChangesWorkInProgressByDefaultSelect"
                      bind-value="{{_repoConfig.work_in_progress_by_default.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.work_in_progress_by_default)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">Maximum Git object size limit</span>
                <span class="value">
                  <input
                      id="maxGitObjSizeInput"
                      bind-value="{{_repoConfig.max_object_size_limit.configured_value}}"
                      is="iron-input"
                      type="text"
                      disabled$="[[_readOnly]]">
                  <template is="dom-if" if="[[_repoConfig.max_object_size_limit.value]]">
                    effective: [[_repoConfig.max_object_size_limit.value]] bytes
                  </template>
                </span>
              </section>
              <section>
                <span class="title">Match authored date with committer date upon submit</span>
                <span class="value">
                  <gr-select
                      id="matchAuthoredDateWithCommitterDateSelect"
                      bind-value="{{_repoConfig.match_author_to_committer_date.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.match_author_to_committer_date)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                  </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">Reject empty commit upon submit</span>
                <span class="value">
                  <gr-select
                      id="rejectEmptyCommitSelect"
                      bind-value="{{_repoConfig.reject_empty_commit.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                                items="[[_formatBooleanSelect(_repoConfig.reject_empty_commit)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                  </select>
                  </gr-select>
                </span>
              </section>
            </fieldset>
            <h3 id="Options">Contributor Agreements</h3>
            <fieldset id="agreements">
              <section>
                <span class="title">
                  Require a valid contributor agreement to upload</span>
                <span class="value">
                  <gr-select
                      id="contributorAgreementSelect"
                      bind-value="{{_repoConfig.use_contributor_agreements.configured_value}}">
                  <select disabled$="[[_readOnly]]">
                    <template is="dom-repeat"
                        items="[[_formatBooleanSelect(_repoConfig.use_contributor_agreements)]]">
                      <option value="[[item.value]]">[[item.label]]</option>
                    </template>
                    </select>
                  </gr-select>
                </span>
              </section>
              <section>
                <span class="title">Require Signed-off-by in commit message</span>
                <span class="value">
                  <gr-select
                        id="useSignedOffBySelect"
                        bind-value="{{_repoConfig.use_signed_off_by.configured_value}}">
                    <select disabled$="[[_readOnly]]">
                      <template is="dom-repeat"
                          items="[[_formatBooleanSelect(_repoConfig.use_signed_off_by)]]">
                        <option value="[[item.value]]">[[item.label]]</option>
                      </template>
                    </select>
                  </gr-select>
                </span>
              </section>
            </fieldset>
            <!-- TODO @beckysiegel add plugin config widgets -->
            <gr-button
                on-tap="_handleSaveRepoConfig"
                disabled$="[[_computeButtonDisabled(_readOnly, _configChanged)]]">Save changes</gr-button>
          </fieldset>
          <gr-endpoint-decorator name="repo-config">
            <gr-endpoint-param name="repoName" value="[[repo]]"></gr-endpoint-param>
          </gr-endpoint-decorator>
        </div>
      </div>
    </main>
    <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
  </template>
  <script src="gr-repo.js"></script>
</dom-module>