Merge "PolyGerrit: Add some more missing configs to gr-project"

This commit is contained in:
Kasper Nilsson
2017-11-20 20:17:18 +00:00
committed by Gerrit Code Review
3 changed files with 56 additions and 7 deletions

View File

@@ -44,10 +44,10 @@ limitations under the License.
#loading:not(.loading) {
display: none;
}
#noteDbSettings {
.projectSettings {
display: none;
}
#noteDbSettings.showNoteDb {
.projectSettings.showConfig {
display: block;
}
</style>
@@ -157,6 +157,40 @@ limitations under the License.
</gr-select>
</span>
</section>
<section
id="enableSignedPushSettings"
class$="projectSettings [[_computeProjectsClass(_projectConfig.enable_signed_push)]]">
<span class="title">Enable signed push</span>
<span class="value">
<gr-select
id="enableSignedPush"
bind-value="{{_projectConfig.enable_signed_push.configured_value}}">
<select disabled$="[[_readOnly]]">
<template is="dom-repeat"
items="[[_formatBooleanSelect(_projectConfig.enable_signed_push)]]">
<option value="[[item.value]]">[[item.label]]</option>
</template>
</select>
</gr-select>
</span>
</section>
<section
id="requireSignedPushSettings"
class$="projectSettings [[_computeProjectsClass(_projectConfig.require_signed_push)]]">
<span class="title">Require signed push</span>
<span class="value">
<gr-select
id="requireSignedPush"
bind-value="{{_projectConfig.require_signed_push.configured_value}}">
<select disabled$="[[_readOnly]]">
<template is="dom-repeat"
items="[[_formatBooleanSelect(_projectConfig.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>
@@ -173,7 +207,7 @@ limitations under the License.
</gr-select>
</span>
</section>
<section id="noteDbSettings class$=[[_computeNoteDbClass(_noteDbEnabled)]]">
<section id="noteDbSettings" class$="projectSettings [[_computeProjectsClass(_noteDbEnabled)]]">
<span class="title">
Enable adding unregistered users as reviewers and CCs on changes</span>
<span class="value">

View File

@@ -255,8 +255,8 @@
return commands;
},
_computeNoteDbClass(noteDB) {
return noteDB ? 'showNoteDb': '';
_computeProjectsClass(config) {
return config ? 'showConfig': '';
},
});
})();

View File

@@ -73,6 +73,14 @@ limitations under the License.
value: false,
configured_value: 'FALSE',
},
enable_signed_push: {
value: false,
configured_value: 'FALSE',
},
require_signed_push: {
value: false,
configured_value: 'FALSE',
},
reject_implicit_merges: {
value: false,
configured_value: 'FALSE',
@@ -244,15 +252,16 @@ limitations under the License.
});
test('fields update and save correctly', done => {
// test notedb
element._noteDbEnabled = false;
assert.equal(
element._computeNoteDbClass(element._noteDbEnabled), '');
element._computeProjectsClass(element._noteDbEnabled), '');
element._noteDbEnabled = true;
assert.equal(
element._computeNoteDbClass(element._noteDbEnabled), 'showNoteDb');
element._computeProjectsClass(element._noteDbEnabled), 'showConfig');
const configInputObj = {
description: 'new description',
@@ -261,6 +270,8 @@ limitations under the License.
use_signed_off_by: 'TRUE',
create_new_change_for_all_not_in_target: 'TRUE',
require_change_id: 'TRUE',
enable_signed_push: 'TRUE',
require_signed_push: 'TRUE',
reject_implicit_merges: 'TRUE',
private_by_default: 'TRUE',
match_author_to_committer_date: 'TRUE',
@@ -289,6 +300,10 @@ limitations under the License.
configInputObj.create_new_change_for_all_not_in_target;
element.$.requireChangeIdSelect.bindValue =
configInputObj.require_change_id;
element.$.enableSignedPush.bindValue =
configInputObj.enable_signed_push;
element.$.requireSignedPush.bindValue =
configInputObj.require_signed_push;
element.$.rejectImplicitMergesSelect.bindValue =
configInputObj.reject_implicit_merges;
element.$.setAllnewChangesPrivateByDefaultSelect.bindValue =