Expose index.change.mergeable in ServerInfo
This commit exposes indexMergeable in ServerInfo to allow the UI to hide the 'is:mergeable' operator conditionally if the Gerrit instance does not support indexing the 'mergeable' bit. Change-Id: I1959244ff0069d0368bbee1fc8a527c3f3b2b0b2
This commit is contained in:
@@ -1572,6 +1572,21 @@ configuration parameter] that controls whether the mergeability bit in
|
|||||||
link:rest-api-changes.html#change-info[ChangeInfo] will never be set.
|
link:rest-api-changes.html#change-info[ChangeInfo] will never be set.
|
||||||
|=============================
|
|=============================
|
||||||
|
|
||||||
|
[[change-index-config-info]]
|
||||||
|
=== ChangeIndexConfigInfo
|
||||||
|
The `ChangeIndexConfigInfo` entity contains information about Gerrit
|
||||||
|
configuration from the link:config-gerrit.html#index.change[index.change]
|
||||||
|
section.
|
||||||
|
|
||||||
|
[options="header",cols="1,^1,5"]
|
||||||
|
|=============================
|
||||||
|
|Field Name ||Description
|
||||||
|
|`index_mergeable` |not set if `false`|
|
||||||
|
Value of the link:config-gerrit.html#index.change.indexMergeable[
|
||||||
|
configuration parameter] that controls whether the mergeability bit is
|
||||||
|
indexed (hence queryable using `is:mergeable`).
|
||||||
|
|=============================
|
||||||
|
|
||||||
[[check-account-external-ids-input]]
|
[[check-account-external-ids-input]]
|
||||||
=== CheckAccountExternalIdsInput
|
=== CheckAccountExternalIdsInput
|
||||||
The `CheckAccountExternalIdsInput` entity contains input for the
|
The `CheckAccountExternalIdsInput` entity contains input for the
|
||||||
@@ -1821,6 +1836,21 @@ Whether to enable the web UI for editing GPG keys.
|
|||||||
link:config-gerrit.html#gerrit.reportBugUrl[URL to report bugs].
|
link:config-gerrit.html#gerrit.reportBugUrl[URL to report bugs].
|
||||||
|=================================
|
|=================================
|
||||||
|
|
||||||
|
[[index-config-info]]
|
||||||
|
=== IndexConfigInfo
|
||||||
|
The `IndexConfigInfo` entity contains information about Gerrit
|
||||||
|
configuration from the link:config-gerrit.html#index[index]
|
||||||
|
section.
|
||||||
|
|
||||||
|
[options="header",cols="1,^1,5"]
|
||||||
|
|=============================
|
||||||
|
|Field Name ||Description
|
||||||
|
|`change` ||
|
||||||
|
Information about the configuration from the
|
||||||
|
link:config-gerrit.html#index.change[index.change] section as
|
||||||
|
link:#index.change[ChangeIndexConfigInfo] entity.
|
||||||
|
|=============================
|
||||||
|
|
||||||
[[hit-ration-info]]
|
[[hit-ration-info]]
|
||||||
=== HitRatioInfo
|
=== HitRatioInfo
|
||||||
The `HitRatioInfo` entity contains information about the hit ratio of a
|
The `HitRatioInfo` entity contains information about the hit ratio of a
|
||||||
@@ -1947,6 +1977,10 @@ information about Gerrit
|
|||||||
Information about the configuration from the
|
Information about the configuration from the
|
||||||
link:config-gerrit.html#gerrit[gerrit] section as link:#gerrit-info[
|
link:config-gerrit.html#gerrit[gerrit] section as link:#gerrit-info[
|
||||||
GerritInfo] entity.
|
GerritInfo] entity.
|
||||||
|
|`index` ||
|
||||||
|
Information about the configuration from the
|
||||||
|
link:config-gerrit.html#index[index] section as link:#index[
|
||||||
|
IndexConfigInfo] entity.
|
||||||
|`note_db_enabled` |not set if `false`|
|
|`note_db_enabled` |not set if `false`|
|
||||||
Whether the NoteDb storage backend is fully enabled.
|
Whether the NoteDb storage backend is fully enabled.
|
||||||
|`plugin` ||
|
|`plugin` ||
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2019 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.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class ChangeIndexConfigInfo {
|
||||||
|
public Boolean indexMergeable;
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2019 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.
|
||||||
|
|
||||||
|
package com.google.gerrit.extensions.common;
|
||||||
|
|
||||||
|
public class IndexConfigInfo {
|
||||||
|
public ChangeIndexConfigInfo change;
|
||||||
|
}
|
@@ -20,6 +20,7 @@ public class ServerInfo {
|
|||||||
public ChangeConfigInfo change;
|
public ChangeConfigInfo change;
|
||||||
public DownloadInfo download;
|
public DownloadInfo download;
|
||||||
public GerritInfo gerrit;
|
public GerritInfo gerrit;
|
||||||
|
public IndexConfigInfo index;
|
||||||
public Boolean noteDbEnabled;
|
public Boolean noteDbEnabled;
|
||||||
public PluginConfigInfo plugin;
|
public PluginConfigInfo plugin;
|
||||||
public SshdInfo sshd;
|
public SshdInfo sshd;
|
||||||
|
@@ -23,9 +23,11 @@ import com.google.gerrit.common.data.ContributorAgreement;
|
|||||||
import com.google.gerrit.extensions.common.AccountsInfo;
|
import com.google.gerrit.extensions.common.AccountsInfo;
|
||||||
import com.google.gerrit.extensions.common.AuthInfo;
|
import com.google.gerrit.extensions.common.AuthInfo;
|
||||||
import com.google.gerrit.extensions.common.ChangeConfigInfo;
|
import com.google.gerrit.extensions.common.ChangeConfigInfo;
|
||||||
|
import com.google.gerrit.extensions.common.ChangeIndexConfigInfo;
|
||||||
import com.google.gerrit.extensions.common.DownloadInfo;
|
import com.google.gerrit.extensions.common.DownloadInfo;
|
||||||
import com.google.gerrit.extensions.common.DownloadSchemeInfo;
|
import com.google.gerrit.extensions.common.DownloadSchemeInfo;
|
||||||
import com.google.gerrit.extensions.common.GerritInfo;
|
import com.google.gerrit.extensions.common.GerritInfo;
|
||||||
|
import com.google.gerrit.extensions.common.IndexConfigInfo;
|
||||||
import com.google.gerrit.extensions.common.PluginConfigInfo;
|
import com.google.gerrit.extensions.common.PluginConfigInfo;
|
||||||
import com.google.gerrit.extensions.common.ReceiveInfo;
|
import com.google.gerrit.extensions.common.ReceiveInfo;
|
||||||
import com.google.gerrit.extensions.common.ServerInfo;
|
import com.google.gerrit.extensions.common.ServerInfo;
|
||||||
@@ -141,6 +143,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
|||||||
info.change = getChangeInfo();
|
info.change = getChangeInfo();
|
||||||
info.download = getDownloadInfo();
|
info.download = getDownloadInfo();
|
||||||
info.gerrit = getGerritInfo();
|
info.gerrit = getGerritInfo();
|
||||||
|
info.index = getIndexInfo();
|
||||||
info.noteDbEnabled = true;
|
info.noteDbEnabled = true;
|
||||||
info.plugin = getPluginInfo();
|
info.plugin = getPluginInfo();
|
||||||
info.defaultTheme = getDefaultTheme();
|
info.defaultTheme = getDefaultTheme();
|
||||||
@@ -296,6 +299,14 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IndexConfigInfo getIndexInfo() {
|
||||||
|
ChangeIndexConfigInfo change = new ChangeIndexConfigInfo();
|
||||||
|
change.indexMergeable = toBoolean(config.getBoolean("index", "change", "indexMergeable", true));
|
||||||
|
IndexConfigInfo index = new IndexConfigInfo();
|
||||||
|
index.change = change;
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
private String getDocUrl() {
|
private String getDocUrl() {
|
||||||
String docUrl = config.getString("gerrit", null, "docUrl");
|
String docUrl = config.getString("gerrit", null, "docUrl");
|
||||||
if (Strings.isNullOrEmpty(docUrl)) {
|
if (Strings.isNullOrEmpty(docUrl)) {
|
||||||
|
@@ -180,6 +180,9 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
|||||||
assertThat(i.gerrit.allUsers).isEqualTo(AllUsersNameProvider.DEFAULT);
|
assertThat(i.gerrit.allUsers).isEqualTo(AllUsersNameProvider.DEFAULT);
|
||||||
assertThat(i.gerrit.reportBugUrl).isNull();
|
assertThat(i.gerrit.reportBugUrl).isNull();
|
||||||
|
|
||||||
|
// index
|
||||||
|
assertThat(i.index.change.indexMergeable).isNull(); // false in all tests
|
||||||
|
|
||||||
// plugin
|
// plugin
|
||||||
assertThat(i.plugin.jsResourcePaths).isEmpty();
|
assertThat(i.plugin.jsResourcePaths).isEmpty();
|
||||||
|
|
||||||
@@ -206,4 +209,11 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
|||||||
ServerInfo i = gApi.config().server().getInfo();
|
ServerInfo i = gApi.config().server().getInfo();
|
||||||
assertThat(i.change.excludeMergeableInChangeInfo).isTrue();
|
assertThat(i.change.excludeMergeableInChangeInfo).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@GerritConfig(name = "index.change.indexMergeable", value = "true")
|
||||||
|
public void indexMergeableIsTrueWhenTrueInConfig() throws Exception {
|
||||||
|
ServerInfo i = gApi.config().server().getInfo();
|
||||||
|
assertThat(i.index.change.indexMergeable).isTrue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user