Merge "ChangeScreen: Allow to disable muting of common paths in file table"
This commit is contained in:
@@ -1550,6 +1550,8 @@ Whether to show relative dates in the changes table.
|
|||||||
Whether to show the change sizes as colored bars in the change table.
|
Whether to show the change sizes as colored bars in the change table.
|
||||||
|`legacycid_in_change_table` |not set if `false`|
|
|`legacycid_in_change_table` |not set if `false`|
|
||||||
Whether to show change number in the change table.
|
Whether to show change number in the change table.
|
||||||
|
|`mute_common_path_prefixes` |not set if `false`|
|
||||||
|
Whether to mute common path prefixes in file names in the file table.
|
||||||
|`review_category_strategy` ||
|
|`review_category_strategy` ||
|
||||||
The strategy used to displayed info in the review category column.
|
The strategy used to displayed info in the review category column.
|
||||||
Allowed values are `NONE`, `NAME`, `EMAIL`, `USERNAME`, `ABBREV`.
|
Allowed values are `NONE`, `NAME`, `EMAIL`, `USERNAME`, `ABBREV`.
|
||||||
@@ -1591,6 +1593,8 @@ Whether to show relative dates in the changes table.
|
|||||||
Whether to show the change sizes as colored bars in the change table.
|
Whether to show the change sizes as colored bars in the change table.
|
||||||
|`legacycid_in_change_table` |optional|
|
|`legacycid_in_change_table` |optional|
|
||||||
Whether to show change number in the change table.
|
Whether to show change number in the change table.
|
||||||
|
|`mute_common_path_prefixes` |optional|
|
||||||
|
Whether to mute common path prefixes in file names in the file table.
|
||||||
|`review_category_strategy` |optional|
|
|`review_category_strategy` |optional|
|
||||||
The strategy used to displayed info in the review category column.
|
The strategy used to displayed info in the review category column.
|
||||||
Allowed values are `NONE`, `NAME`, `EMAIL`, `USERNAME`, `ABBREV`.
|
Allowed values are `NONE`, `NAME`, `EMAIL`, `USERNAME`, `ABBREV`.
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public interface AccountConstants extends Constants {
|
|||||||
String showRelativeDateInChangeTable();
|
String showRelativeDateInChangeTable();
|
||||||
String showSizeBarInChangeTable();
|
String showSizeBarInChangeTable();
|
||||||
String showLegacycidInChangeTable();
|
String showLegacycidInChangeTable();
|
||||||
|
String muteCommonPathPrefixes();
|
||||||
String myMenu();
|
String myMenu();
|
||||||
String myMenuInfo();
|
String myMenuInfo();
|
||||||
String myMenuName();
|
String myMenuName();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ buttonSaveChanges = Save Changes
|
|||||||
showRelativeDateInChangeTable = Show Relative Dates In Changes Table
|
showRelativeDateInChangeTable = Show Relative Dates In Changes Table
|
||||||
showSizeBarInChangeTable = Show Change Sizes As Colored Bars In Changes Table
|
showSizeBarInChangeTable = Show Change Sizes As Colored Bars In Changes Table
|
||||||
showLegacycidInChangeTable = Show Change Number In Changes Table
|
showLegacycidInChangeTable = Show Change Number In Changes Table
|
||||||
|
muteCommonPathPrefixes = Mute Common Path Prefixes In File List
|
||||||
myMenu = My Menu
|
myMenu = My Menu
|
||||||
myMenuInfo = \
|
myMenuInfo = \
|
||||||
Menu items for the 'My' top level menu. \
|
Menu items for the 'My' top level menu. \
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
private CheckBox relativeDateInChangeTable;
|
private CheckBox relativeDateInChangeTable;
|
||||||
private CheckBox sizeBarInChangeTable;
|
private CheckBox sizeBarInChangeTable;
|
||||||
private CheckBox legacycidInChangeTable;
|
private CheckBox legacycidInChangeTable;
|
||||||
|
private CheckBox muteCommonPathPrefixes;
|
||||||
private ListBox maximumPageSize;
|
private ListBox maximumPageSize;
|
||||||
private ListBox dateFormat;
|
private ListBox dateFormat;
|
||||||
private ListBox timeFormat;
|
private ListBox timeFormat;
|
||||||
@@ -132,8 +133,9 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
|
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
|
||||||
sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
|
sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
|
||||||
legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
|
legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
|
||||||
|
muteCommonPathPrefixes = new CheckBox(Util.C.muteCommonPathPrefixes());
|
||||||
|
|
||||||
final Grid formGrid = new Grid(10, 2);
|
final Grid formGrid = new Grid(11, 2);
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
formGrid.setText(row, labelIdx, "");
|
formGrid.setText(row, labelIdx, "");
|
||||||
@@ -172,6 +174,10 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
|
formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
|
formGrid.setText(row, labelIdx, "");
|
||||||
|
formGrid.setWidget(row, fieldIdx, muteCommonPathPrefixes);
|
||||||
|
row++;
|
||||||
|
|
||||||
formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
|
formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
|
||||||
formGrid.setWidget(row, fieldIdx, diffView);
|
formGrid.setWidget(row, fieldIdx, diffView);
|
||||||
|
|
||||||
@@ -201,6 +207,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
e.listenTo(relativeDateInChangeTable);
|
e.listenTo(relativeDateInChangeTable);
|
||||||
e.listenTo(sizeBarInChangeTable);
|
e.listenTo(sizeBarInChangeTable);
|
||||||
e.listenTo(legacycidInChangeTable);
|
e.listenTo(legacycidInChangeTable);
|
||||||
|
e.listenTo(muteCommonPathPrefixes);
|
||||||
e.listenTo(diffView);
|
e.listenTo(diffView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +233,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
relativeDateInChangeTable.setEnabled(on);
|
relativeDateInChangeTable.setEnabled(on);
|
||||||
sizeBarInChangeTable.setEnabled(on);
|
sizeBarInChangeTable.setEnabled(on);
|
||||||
legacycidInChangeTable.setEnabled(on);
|
legacycidInChangeTable.setEnabled(on);
|
||||||
|
muteCommonPathPrefixes.setEnabled(on);
|
||||||
reviewCategoryStrategy.setEnabled(on);
|
reviewCategoryStrategy.setEnabled(on);
|
||||||
diffView.setEnabled(on);
|
diffView.setEnabled(on);
|
||||||
}
|
}
|
||||||
@@ -242,6 +250,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
|
relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
|
||||||
sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
|
sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
|
||||||
legacycidInChangeTable.setValue(p.legacycidInChangeTable());
|
legacycidInChangeTable.setValue(p.legacycidInChangeTable());
|
||||||
|
muteCommonPathPrefixes.setValue(p.muteCommonPathPrefixes());
|
||||||
setListBox(reviewCategoryStrategy,
|
setListBox(reviewCategoryStrategy,
|
||||||
AccountGeneralPreferences.ReviewCategoryStrategy.NONE,
|
AccountGeneralPreferences.ReviewCategoryStrategy.NONE,
|
||||||
p.reviewCategoryStrategy());
|
p.reviewCategoryStrategy());
|
||||||
@@ -325,6 +334,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
|||||||
p.setRelativeDateInChangeTable(relativeDateInChangeTable.getValue());
|
p.setRelativeDateInChangeTable(relativeDateInChangeTable.getValue());
|
||||||
p.setSizeBarInChangeTable(sizeBarInChangeTable.getValue());
|
p.setSizeBarInChangeTable(sizeBarInChangeTable.getValue());
|
||||||
p.setLegacycidInChangeTable(legacycidInChangeTable.getValue());
|
p.setLegacycidInChangeTable(legacycidInChangeTable.getValue());
|
||||||
|
p.setMuteCommonPathPrefixes(muteCommonPathPrefixes.getValue());
|
||||||
p.setReviewCategoryStrategy(getListBox(reviewCategoryStrategy,
|
p.setReviewCategoryStrategy(getListBox(reviewCategoryStrategy,
|
||||||
ReviewCategoryStrategy.NONE,
|
ReviewCategoryStrategy.NONE,
|
||||||
ReviewCategoryStrategy.values()));
|
ReviewCategoryStrategy.values()));
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class Preferences extends JavaScriptObject {
|
|||||||
p.relativeDateInChangeTable(in.isRelativeDateInChangeTable());
|
p.relativeDateInChangeTable(in.isRelativeDateInChangeTable());
|
||||||
p.sizeBarInChangeTable(in.isSizeBarInChangeTable());
|
p.sizeBarInChangeTable(in.isSizeBarInChangeTable());
|
||||||
p.legacycidInChangeTable(in.isLegacycidInChangeTable());
|
p.legacycidInChangeTable(in.isLegacycidInChangeTable());
|
||||||
|
p.muteCommonPathPrefixes(in.isMuteCommonPathPrefixes());
|
||||||
p.reviewCategoryStrategy(in.getReviewCategoryStrategy());
|
p.reviewCategoryStrategy(in.getReviewCategoryStrategy());
|
||||||
p.diffView(in.getDiffView());
|
p.diffView(in.getDiffView());
|
||||||
p.setMyMenus(myMenus);
|
p.setMyMenus(myMenus);
|
||||||
@@ -102,6 +103,9 @@ public class Preferences extends JavaScriptObject {
|
|||||||
public final native boolean legacycidInChangeTable()
|
public final native boolean legacycidInChangeTable()
|
||||||
/*-{ return this.legacycid_in_change_table || false }-*/;
|
/*-{ return this.legacycid_in_change_table || false }-*/;
|
||||||
|
|
||||||
|
public final native boolean muteCommonPathPrefixes()
|
||||||
|
/*-{ return this.mute_common_path_prefixes || false }-*/;
|
||||||
|
|
||||||
public final ReviewCategoryStrategy reviewCategoryStrategy() {
|
public final ReviewCategoryStrategy reviewCategoryStrategy() {
|
||||||
String s = reviewCategeoryStrategyRaw();
|
String s = reviewCategeoryStrategyRaw();
|
||||||
return s != null ? ReviewCategoryStrategy.valueOf(s) : ReviewCategoryStrategy.NONE;
|
return s != null ? ReviewCategoryStrategy.valueOf(s) : ReviewCategoryStrategy.NONE;
|
||||||
@@ -164,6 +168,9 @@ public class Preferences extends JavaScriptObject {
|
|||||||
public final native void legacycidInChangeTable(boolean s)
|
public final native void legacycidInChangeTable(boolean s)
|
||||||
/*-{ this.legacycid_in_change_table = s }-*/;
|
/*-{ this.legacycid_in_change_table = s }-*/;
|
||||||
|
|
||||||
|
public final native void muteCommonPathPrefixes(boolean s)
|
||||||
|
/*-{ this.mute_common_path_prefixes = s }-*/;
|
||||||
|
|
||||||
public final void reviewCategoryStrategy(ReviewCategoryStrategy s) {
|
public final void reviewCategoryStrategy(ReviewCategoryStrategy s) {
|
||||||
reviewCategoryStrategyRaw(s != null ? s.toString() : null);
|
reviewCategoryStrategyRaw(s != null ? s.toString() : null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -630,7 +630,8 @@ public class FileTable extends FlowPanel {
|
|||||||
|
|
||||||
if (Patch.COMMIT_MSG.equals(path)) {
|
if (Patch.COMMIT_MSG.equals(path)) {
|
||||||
sb.append(Util.C.commitMessage());
|
sb.append(Util.C.commitMessage());
|
||||||
} else {
|
} else if (!hasUser || Gerrit.getUserAccount().getGeneralPreferences()
|
||||||
|
.isMuteCommonPathPrefixes()) {
|
||||||
int commonPrefixLen = commonPrefix(path);
|
int commonPrefixLen = commonPrefix(path);
|
||||||
if (commonPrefixLen > 0) {
|
if (commonPrefixLen > 0) {
|
||||||
sb.openSpan().setStyleName(R.css().commonPrefix())
|
sb.openSpan().setStyleName(R.css().commonPrefix())
|
||||||
@@ -639,6 +640,8 @@ public class FileTable extends FlowPanel {
|
|||||||
}
|
}
|
||||||
sb.append(path.substring(commonPrefixLen));
|
sb.append(path.substring(commonPrefixLen));
|
||||||
lastPath = path;
|
lastPath = path;
|
||||||
|
} else {
|
||||||
|
sb.append(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.closeAnchor();
|
sb.closeAnchor();
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ public final class AccountGeneralPreferences {
|
|||||||
@Column(id = 18, length = 20, notNull = false)
|
@Column(id = 18, length = 20, notNull = false)
|
||||||
protected String reviewCategoryStrategy;
|
protected String reviewCategoryStrategy;
|
||||||
|
|
||||||
|
@Column(id = 19)
|
||||||
|
protected boolean muteCommonPathPrefixes;
|
||||||
|
|
||||||
public AccountGeneralPreferences() {
|
public AccountGeneralPreferences() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,6 +298,15 @@ public final class AccountGeneralPreferences {
|
|||||||
this.legacycidInChangeTable = legacycidInChangeTable;
|
this.legacycidInChangeTable = legacycidInChangeTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMuteCommonPathPrefixes() {
|
||||||
|
return muteCommonPathPrefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMuteCommonPathPrefixes(
|
||||||
|
boolean muteCommonPathPrefixes) {
|
||||||
|
this.muteCommonPathPrefixes = muteCommonPathPrefixes;
|
||||||
|
}
|
||||||
|
|
||||||
public void resetToDefaults() {
|
public void resetToDefaults() {
|
||||||
maximumPageSize = DEFAULT_PAGESIZE;
|
maximumPageSize = DEFAULT_PAGESIZE;
|
||||||
showSiteHeader = true;
|
showSiteHeader = true;
|
||||||
@@ -309,5 +321,6 @@ public final class AccountGeneralPreferences {
|
|||||||
diffView = null;
|
diffView = null;
|
||||||
sizeBarInChangeTable = true;
|
sizeBarInChangeTable = true;
|
||||||
legacycidInChangeTable = false;
|
legacycidInChangeTable = false;
|
||||||
|
muteCommonPathPrefixes = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
|
|||||||
Boolean relativeDateInChangeTable;
|
Boolean relativeDateInChangeTable;
|
||||||
Boolean sizeBarInChangeTable;
|
Boolean sizeBarInChangeTable;
|
||||||
Boolean legacycidInChangeTable;
|
Boolean legacycidInChangeTable;
|
||||||
|
Boolean muteCommonPathPrefixes;
|
||||||
ReviewCategoryStrategy reviewCategoryStrategy;
|
ReviewCategoryStrategy reviewCategoryStrategy;
|
||||||
DiffView diffView;
|
DiffView diffView;
|
||||||
List<TopMenu.MenuItem> my;
|
List<TopMenu.MenuItem> my;
|
||||||
@@ -127,6 +128,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
|
|||||||
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
|
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
|
||||||
sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null;
|
sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null;
|
||||||
legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null;
|
legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null;
|
||||||
|
muteCommonPathPrefixes = p.isMuteCommonPathPrefixes() ? true : null;
|
||||||
reviewCategoryStrategy = p.getReviewCategoryStrategy();
|
reviewCategoryStrategy = p.getReviewCategoryStrategy();
|
||||||
diffView = p.getDiffView();
|
diffView = p.getDiffView();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
|||||||
public Boolean relativeDateInChangeTable;
|
public Boolean relativeDateInChangeTable;
|
||||||
public Boolean sizeBarInChangeTable;
|
public Boolean sizeBarInChangeTable;
|
||||||
public Boolean legacycidInChangeTable;
|
public Boolean legacycidInChangeTable;
|
||||||
|
public Boolean muteCommonPathPrefixes;
|
||||||
public ReviewCategoryStrategy reviewCategoryStrategy;
|
public ReviewCategoryStrategy reviewCategoryStrategy;
|
||||||
public DiffView diffView;
|
public DiffView diffView;
|
||||||
public List<TopMenu.MenuItem> my;
|
public List<TopMenu.MenuItem> my;
|
||||||
@@ -150,6 +151,9 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
|||||||
if (i.legacycidInChangeTable != null) {
|
if (i.legacycidInChangeTable != null) {
|
||||||
p.setLegacycidInChangeTable(i.legacycidInChangeTable);
|
p.setLegacycidInChangeTable(i.legacycidInChangeTable);
|
||||||
}
|
}
|
||||||
|
if (i.muteCommonPathPrefixes != null) {
|
||||||
|
p.setMuteCommonPathPrefixes(i.muteCommonPathPrefixes);
|
||||||
|
}
|
||||||
if (i.reviewCategoryStrategy != null) {
|
if (i.reviewCategoryStrategy != null) {
|
||||||
p.setReviewCategoryStrategy(i.reviewCategoryStrategy);
|
p.setReviewCategoryStrategy(i.reviewCategoryStrategy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class SetPreferences implements RestModifyView<ConfigResource, Input> {
|
|||||||
|| i.relativeDateInChangeTable != null
|
|| i.relativeDateInChangeTable != null
|
||||||
|| i.sizeBarInChangeTable != null
|
|| i.sizeBarInChangeTable != null
|
||||||
|| i.legacycidInChangeTable != null
|
|| i.legacycidInChangeTable != null
|
||||||
|
|| i.muteCommonPathPrefixes != null
|
||||||
|| i.reviewCategoryStrategy != null) {
|
|| i.reviewCategoryStrategy != null) {
|
||||||
throw new BadRequestException("unsupported option");
|
throw new BadRequestException("unsupported option");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
/** A version of the database schema. */
|
/** A version of the database schema. */
|
||||||
public abstract class SchemaVersion {
|
public abstract class SchemaVersion {
|
||||||
/** The current schema version. */
|
/** The current schema version. */
|
||||||
public static final Class<Schema_106> C = Schema_106.class;
|
public static final Class<Schema_107> C = Schema_107.class;
|
||||||
|
|
||||||
public static int getBinaryVersion() {
|
public static int getBinaryVersion() {
|
||||||
return guessVersion(C);
|
return guessVersion(C);
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// Copyright (C) 2015 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.server.schema;
|
||||||
|
|
||||||
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
|
import com.google.gwtorm.jdbc.JdbcSchema;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Provider;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
public class Schema_107 extends SchemaVersion {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
Schema_107(Provider<Schema_106> prior) {
|
||||||
|
super(prior);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void migrateData(ReviewDb db, UpdateUI ui) throws SQLException {
|
||||||
|
Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
|
||||||
|
try {
|
||||||
|
stmt.executeUpdate("UPDATE accounts set mute_common_path_prefixes = 'Y'");
|
||||||
|
} finally {
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user