ChangeScreen: Allow to disable muting of common paths in file table
In the file table, parts of the file path that are common to the file previously listed are muted. The purpose of this is to make it easier to see files that all belong under the same path, but some users find it annoying. Add a new user preference to control this feature. When it is disabled, the entire path is shown in the same color for all files. The default setting for the new preference is enabled, meaning the default behavior is the same as now, and the user must explicitly disable it. Bug: Issue 3147 Change-Id: Id9bf7270e3eb65c22c4d44f5ef6717c952aeeb2a
This commit is contained in:
parent
91cee13efd
commit
751441fdfa
@ -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.
|
||||
|`legacycid_in_change_table` |not set if `false`|
|
||||
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` ||
|
||||
The strategy used to displayed info in the review category column.
|
||||
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.
|
||||
|`legacycid_in_change_table` |optional|
|
||||
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|
|
||||
The strategy used to displayed info in the review category column.
|
||||
Allowed values are `NONE`, `NAME`, `EMAIL`, `USERNAME`, `ABBREV`.
|
||||
|
@ -42,6 +42,7 @@ public interface AccountConstants extends Constants {
|
||||
String showRelativeDateInChangeTable();
|
||||
String showSizeBarInChangeTable();
|
||||
String showLegacycidInChangeTable();
|
||||
String muteCommonPathPrefixes();
|
||||
String myMenu();
|
||||
String myMenuInfo();
|
||||
String myMenuName();
|
||||
|
@ -23,6 +23,7 @@ buttonSaveChanges = Save Changes
|
||||
showRelativeDateInChangeTable = Show Relative Dates In Changes Table
|
||||
showSizeBarInChangeTable = Show Change Sizes As Colored Bars In Changes Table
|
||||
showLegacycidInChangeTable = Show Change Number In Changes Table
|
||||
muteCommonPathPrefixes = Mute Common Path Prefixes In File List
|
||||
myMenu = My Menu
|
||||
myMenuInfo = \
|
||||
Menu items for the 'My' top level menu. \
|
||||
|
@ -50,6 +50,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
private CheckBox relativeDateInChangeTable;
|
||||
private CheckBox sizeBarInChangeTable;
|
||||
private CheckBox legacycidInChangeTable;
|
||||
private CheckBox muteCommonPathPrefixes;
|
||||
private ListBox maximumPageSize;
|
||||
private ListBox dateFormat;
|
||||
private ListBox timeFormat;
|
||||
@ -132,8 +133,9 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
|
||||
sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
|
||||
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;
|
||||
formGrid.setText(row, labelIdx, "");
|
||||
@ -172,6 +174,10 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
|
||||
row++;
|
||||
|
||||
formGrid.setText(row, labelIdx, "");
|
||||
formGrid.setWidget(row, fieldIdx, muteCommonPathPrefixes);
|
||||
row++;
|
||||
|
||||
formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
|
||||
formGrid.setWidget(row, fieldIdx, diffView);
|
||||
|
||||
@ -201,6 +207,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
e.listenTo(relativeDateInChangeTable);
|
||||
e.listenTo(sizeBarInChangeTable);
|
||||
e.listenTo(legacycidInChangeTable);
|
||||
e.listenTo(muteCommonPathPrefixes);
|
||||
e.listenTo(diffView);
|
||||
}
|
||||
|
||||
@ -226,6 +233,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
relativeDateInChangeTable.setEnabled(on);
|
||||
sizeBarInChangeTable.setEnabled(on);
|
||||
legacycidInChangeTable.setEnabled(on);
|
||||
muteCommonPathPrefixes.setEnabled(on);
|
||||
reviewCategoryStrategy.setEnabled(on);
|
||||
diffView.setEnabled(on);
|
||||
}
|
||||
@ -242,6 +250,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
|
||||
sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
|
||||
legacycidInChangeTable.setValue(p.legacycidInChangeTable());
|
||||
muteCommonPathPrefixes.setValue(p.muteCommonPathPrefixes());
|
||||
setListBox(reviewCategoryStrategy,
|
||||
AccountGeneralPreferences.ReviewCategoryStrategy.NONE,
|
||||
p.reviewCategoryStrategy());
|
||||
@ -325,6 +334,7 @@ public class MyPreferencesScreen extends SettingsScreen {
|
||||
p.setRelativeDateInChangeTable(relativeDateInChangeTable.getValue());
|
||||
p.setSizeBarInChangeTable(sizeBarInChangeTable.getValue());
|
||||
p.setLegacycidInChangeTable(legacycidInChangeTable.getValue());
|
||||
p.setMuteCommonPathPrefixes(muteCommonPathPrefixes.getValue());
|
||||
p.setReviewCategoryStrategy(getListBox(reviewCategoryStrategy,
|
||||
ReviewCategoryStrategy.NONE,
|
||||
ReviewCategoryStrategy.values()));
|
||||
|
@ -44,6 +44,7 @@ public class Preferences extends JavaScriptObject {
|
||||
p.relativeDateInChangeTable(in.isRelativeDateInChangeTable());
|
||||
p.sizeBarInChangeTable(in.isSizeBarInChangeTable());
|
||||
p.legacycidInChangeTable(in.isLegacycidInChangeTable());
|
||||
p.muteCommonPathPrefixes(in.isMuteCommonPathPrefixes());
|
||||
p.reviewCategoryStrategy(in.getReviewCategoryStrategy());
|
||||
p.diffView(in.getDiffView());
|
||||
p.setMyMenus(myMenus);
|
||||
@ -102,6 +103,9 @@ public class Preferences extends JavaScriptObject {
|
||||
public final native boolean legacycidInChangeTable()
|
||||
/*-{ return this.legacycid_in_change_table || false }-*/;
|
||||
|
||||
public final native boolean muteCommonPathPrefixes()
|
||||
/*-{ return this.mute_common_path_prefixes || false }-*/;
|
||||
|
||||
public final ReviewCategoryStrategy reviewCategoryStrategy() {
|
||||
String s = reviewCategeoryStrategyRaw();
|
||||
return s != null ? ReviewCategoryStrategy.valueOf(s) : ReviewCategoryStrategy.NONE;
|
||||
@ -164,6 +168,9 @@ public class Preferences extends JavaScriptObject {
|
||||
public final native void legacycidInChangeTable(boolean 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) {
|
||||
reviewCategoryStrategyRaw(s != null ? s.toString() : null);
|
||||
}
|
||||
|
@ -630,7 +630,8 @@ public class FileTable extends FlowPanel {
|
||||
|
||||
if (Patch.COMMIT_MSG.equals(path)) {
|
||||
sb.append(Util.C.commitMessage());
|
||||
} else {
|
||||
} else if (!hasUser || Gerrit.getUserAccount().getGeneralPreferences()
|
||||
.isMuteCommonPathPrefixes()) {
|
||||
int commonPrefixLen = commonPrefix(path);
|
||||
if (commonPrefixLen > 0) {
|
||||
sb.openSpan().setStyleName(R.css().commonPrefix())
|
||||
@ -639,6 +640,8 @@ public class FileTable extends FlowPanel {
|
||||
}
|
||||
sb.append(path.substring(commonPrefixLen));
|
||||
lastPath = path;
|
||||
} else {
|
||||
sb.append(path);
|
||||
}
|
||||
|
||||
sb.closeAnchor();
|
||||
|
@ -157,6 +157,9 @@ public final class AccountGeneralPreferences {
|
||||
@Column(id = 18, length = 20, notNull = false)
|
||||
protected String reviewCategoryStrategy;
|
||||
|
||||
@Column(id = 19)
|
||||
protected boolean muteCommonPathPrefixes;
|
||||
|
||||
public AccountGeneralPreferences() {
|
||||
}
|
||||
|
||||
@ -295,6 +298,15 @@ public final class AccountGeneralPreferences {
|
||||
this.legacycidInChangeTable = legacycidInChangeTable;
|
||||
}
|
||||
|
||||
public boolean isMuteCommonPathPrefixes() {
|
||||
return muteCommonPathPrefixes;
|
||||
}
|
||||
|
||||
public void setMuteCommonPathPrefixes(
|
||||
boolean muteCommonPathPrefixes) {
|
||||
this.muteCommonPathPrefixes = muteCommonPathPrefixes;
|
||||
}
|
||||
|
||||
public void resetToDefaults() {
|
||||
maximumPageSize = DEFAULT_PAGESIZE;
|
||||
showSiteHeader = true;
|
||||
@ -309,5 +321,6 @@ public final class AccountGeneralPreferences {
|
||||
diffView = null;
|
||||
sizeBarInChangeTable = true;
|
||||
legacycidInChangeTable = false;
|
||||
muteCommonPathPrefixes = true;
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
|
||||
Boolean relativeDateInChangeTable;
|
||||
Boolean sizeBarInChangeTable;
|
||||
Boolean legacycidInChangeTable;
|
||||
Boolean muteCommonPathPrefixes;
|
||||
ReviewCategoryStrategy reviewCategoryStrategy;
|
||||
DiffView diffView;
|
||||
List<TopMenu.MenuItem> my;
|
||||
@ -127,6 +128,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
|
||||
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
|
||||
sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null;
|
||||
legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null;
|
||||
muteCommonPathPrefixes = p.isMuteCommonPathPrefixes() ? true : null;
|
||||
reviewCategoryStrategy = p.getReviewCategoryStrategy();
|
||||
diffView = p.getDiffView();
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
||||
public Boolean relativeDateInChangeTable;
|
||||
public Boolean sizeBarInChangeTable;
|
||||
public Boolean legacycidInChangeTable;
|
||||
public Boolean muteCommonPathPrefixes;
|
||||
public ReviewCategoryStrategy reviewCategoryStrategy;
|
||||
public DiffView diffView;
|
||||
public List<TopMenu.MenuItem> my;
|
||||
@ -150,6 +151,9 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
||||
if (i.legacycidInChangeTable != null) {
|
||||
p.setLegacycidInChangeTable(i.legacycidInChangeTable);
|
||||
}
|
||||
if (i.muteCommonPathPrefixes != null) {
|
||||
p.setMuteCommonPathPrefixes(i.muteCommonPathPrefixes);
|
||||
}
|
||||
if (i.reviewCategoryStrategy != null) {
|
||||
p.setReviewCategoryStrategy(i.reviewCategoryStrategy);
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public class SetPreferences implements RestModifyView<ConfigResource, Input> {
|
||||
|| i.relativeDateInChangeTable != null
|
||||
|| i.sizeBarInChangeTable != null
|
||||
|| i.legacycidInChangeTable != null
|
||||
|| i.muteCommonPathPrefixes != null
|
||||
|| i.reviewCategoryStrategy != null) {
|
||||
throw new BadRequestException("unsupported option");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import java.util.List;
|
||||
/** A version of the database schema. */
|
||||
public abstract class SchemaVersion {
|
||||
/** 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() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user