Files
gerrit/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.html
Dave Borowitz c8f8d2ea83 Support inheriting project submit type
Change Project to only expose the configured submit type for that
project, and modify all callers to call the equivalent method on
ProjectState which respects inheritance.

In the extension/REST API, expose the inherited submit type analogously
to the inherited boolean values, using an object containing configured
and inherited values. For backwards compatibility, leave the old
submit_type field as-is, but mark it deprecated, in the hopes that we
can eventually replace it.

Do not change the default of a project with no configured submit type,
leaving the default as MERGE_IF_NECESSARY. This avoids, for now, the
need for migrating existing projects that do not have a submit type set,
including those that were created outside of Gerrit and don't have
refs/meta/config at all.

After this change, the global `repository.<name>.defaultSubmitType`
configuration still takes effect when creating a new project. A later
change may remove support for defaultSubmitType, but the migration to
convert global config into appropriate inheritable config values is
nontrivial, so we're punting on it.

Change-Id: Ib5711baaa67b2c92239a1ff4564349a80d211c28
2018-01-09 08:38:52 -05:00

316 lines
14 KiB
HTML

<!--
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="../../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/shared-styles.html">
<dom-module id="gr-repo">
<template>
<style include="shared-styles">
main {
margin: 2em 1em;
}
h2.edited:after {
color: #444;
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">
<h1 id="Title">[[repo]]</h1>
<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">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]]">
</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>
</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>
</div>
</div>
</main>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-repo.js"></script>
</dom-module>