From 4b1c2bfb5f038c60ec492e9f994d3a52c32b124f Mon Sep 17 00:00:00 2001 From: Josh Turmel Date: Sun, 6 Feb 2011 02:01:23 -0600 Subject: [PATCH] Add reviewer/verifier name out beside check/plus/minus * The purpose of this change is to be able to look at the various change lists and see who reviewed, verified without clicking in. There are various reasons this is nice, you can easily see who's doing reviews, who isn't lately just by looking quickly, as well as if anyone did a review for themselves (we're a small to mid team and people have access and sometimes do this)... this compared to the title label which you need to hover to see. * A user perference has been added to allow the user to toggle this setting on/off, it defaults to off to keep existing layout Change-Id: Iae347521b7645082a1d65759198d0347502ab55d --- .../com/google/gerrit/client/GerritCss.java | 1 + .../client/account/AccountConstants.java | 1 + .../account/AccountConstants.properties | 1 + .../client/account/MyPreferencesScreen.java | 13 +++++- .../gerrit/client/changes/ChangeTable.java | 46 +++++++++++++++++-- .../java/com/google/gerrit/client/gerrit.css | 6 ++- .../reviewdb/AccountGeneralPreferences.java | 12 +++++ .../gerrit/server/schema/SchemaVersion.java | 2 +- .../gerrit/server/schema/Schema_50.java | 36 +++++++++++++++ 9 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_50.java diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java index ca9f248fcd..e3dbb01526 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java @@ -166,6 +166,7 @@ public interface GerritCss extends CssResource { String sectionHeader(); String sideBySideScreenLinkTable(); String sideBySideScreenSideBySideTable(); + String singleLine(); String skipLine(); String smallHeading(); String sourceFilePath(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java index 276fc27d19..59cb46e3a6 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java @@ -31,6 +31,7 @@ public interface AccountConstants extends Constants { String useFlashClipboard(); String copySelfOnEmails(); String displayPatchSetsInReverseOrder(); + String displayPersonNameInReviewCategory(); String buttonSaveChanges(); String tabAccountSummary(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties index a5a652f34e..16bf204273 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties @@ -8,6 +8,7 @@ showSiteHeader = Show Site Header useFlashClipboard = Use Flash Clipboard Widget copySelfOnEmails = CC Me On Comments I Write displayPatchSetsInReverseOrder = Display Patch Sets In Reverse Order +displayPersonNameInReviewCategory = Display Person Name In Review Category defaultContextFieldLabel = Default Context: maximumPageSizeFieldLabel = Maximum Page Size: dateFormatLabel = Date/Time Format: diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java index 3f32195eed..1415167a8d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java @@ -42,6 +42,7 @@ public class MyPreferencesScreen extends SettingsScreen { private CheckBox useFlashClipboard; private CheckBox copySelfOnEmails; private CheckBox displayPatchSetsInReverseOrder; + private CheckBox displayPersonNameInReviewCategory; private ListBox maximumPageSize; private ListBox dateFormat; private ListBox timeFormat; @@ -76,6 +77,9 @@ public class MyPreferencesScreen extends SettingsScreen { displayPatchSetsInReverseOrder = new CheckBox(Util.C.displayPatchSetsInReverseOrder()); displayPatchSetsInReverseOrder.addClickHandler(onClickSave); + displayPersonNameInReviewCategory = new CheckBox(Util.C.displayPersonNameInReviewCategory()); + displayPersonNameInReviewCategory.addClickHandler(onClickSave); + maximumPageSize = new ListBox(); for (final short v : PAGESIZE_CHOICES) { maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v)); @@ -117,7 +121,7 @@ public class MyPreferencesScreen extends SettingsScreen { dateTimePanel.add(dateFormat); dateTimePanel.add(timeFormat); } - final Grid formGrid = new Grid(6, 2); + final Grid formGrid = new Grid(7, 2); int row = 0; formGrid.setText(row, labelIdx, ""); @@ -136,6 +140,10 @@ public class MyPreferencesScreen extends SettingsScreen { formGrid.setWidget(row, fieldIdx, displayPatchSetsInReverseOrder); row++; + formGrid.setText(row, labelIdx, ""); + formGrid.setWidget(row, fieldIdx, displayPersonNameInReviewCategory); + row++; + formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel()); formGrid.setWidget(row, fieldIdx, maximumPageSize); row++; @@ -172,6 +180,7 @@ public class MyPreferencesScreen extends SettingsScreen { useFlashClipboard.setEnabled(on); copySelfOnEmails.setEnabled(on); displayPatchSetsInReverseOrder.setEnabled(on); + displayPersonNameInReviewCategory.setEnabled(on); maximumPageSize.setEnabled(on); dateFormat.setEnabled(on); timeFormat.setEnabled(on); @@ -182,6 +191,7 @@ public class MyPreferencesScreen extends SettingsScreen { useFlashClipboard.setValue(p.isUseFlashClipboard()); copySelfOnEmails.setValue(p.isCopySelfOnEmails()); displayPatchSetsInReverseOrder.setValue(p.isDisplayPatchSetsInReverseOrder()); + displayPersonNameInReviewCategory.setValue(p.isDisplayPersonNameInReviewCategory()); setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.getMaximumPageSize()); setListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, // p.getDateFormat()); @@ -242,6 +252,7 @@ public class MyPreferencesScreen extends SettingsScreen { p.setUseFlashClipboard(useFlashClipboard.getValue()); p.setCopySelfOnEmails(copySelfOnEmails.getValue()); p.setDisplayPatchSetsInReverseOrder(displayPatchSetsInReverseOrder.getValue()); + p.setDisplayPersonNameInReviewCategory(displayPersonNameInReviewCategory.getValue()); p.setMaximumPageSize(getListBox(maximumPageSize, DEFAULT_PAGESIZE)); p.setDateFormat(getListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java index 76b9f49e10..602d45cd2a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java @@ -35,6 +35,7 @@ import com.google.gerrit.common.data.ApprovalType; import com.google.gerrit.common.data.ChangeInfo; import com.google.gerrit.common.data.ToggleStarRequest; import com.google.gerrit.reviewdb.Account; +import com.google.gerrit.reviewdb.AccountGeneralPreferences; import com.google.gerrit.reviewdb.ApprovalCategory; import com.google.gerrit.reviewdb.ApprovalCategoryValue; import com.google.gerrit.reviewdb.Change; @@ -46,7 +47,10 @@ import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.InlineLabel; import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter; @@ -309,11 +313,22 @@ public class ChangeTable extends NavigationTable { int col = BASE_COLUMNS; boolean haveReview = false; + boolean displayPersonNameInReviewCategory = false; + + if (Gerrit.isSignedIn()) { + AccountGeneralPreferences prefs = Gerrit.getUserAccount().getGeneralPreferences(); + + if (prefs.isDisplayPersonNameInReviewCategory()) { + displayPersonNameInReviewCategory = true; + } + } + for (final ApprovalType type : approvalTypes) { final PatchSetApproval ca = approvals.get(type.getCategory().getId()); fmt.removeStyleName(row, col, Gerrit.RESOURCES.css().negscore()); fmt.removeStyleName(row, col, Gerrit.RESOURCES.css().posscore()); + fmt.addStyleName(row, col, Gerrit.RESOURCES.css().singleLine()); if (ca == null || ca.getValue() == 0) { table.clearCell(row, col); @@ -321,14 +336,38 @@ public class ChangeTable extends NavigationTable { } else { haveReview = true; + final ApprovalCategoryValue acv = type.getValue(ca); + final AccountInfo ai = aic.get(ca.getAccountId()); + if (type.isMaxNegative(ca)) { - table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot())); + + if (displayPersonNameInReviewCategory) { + FlowPanel fp = new FlowPanel(); + fp.add(new Image(Gerrit.RESOURCES.redNot())); + fp.add(new InlineLabel(FormatUtil.name(ai))); + table.setWidget(row, col, fp); + } else { + table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot())); + } } else if (type.isMaxPositive(ca)) { - table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck())); + + if (displayPersonNameInReviewCategory) { + FlowPanel fp = new FlowPanel(); + fp.add(new Image(Gerrit.RESOURCES.greenCheck())); + fp.add(new InlineLabel(FormatUtil.name(ai))); + table.setWidget(row, col, fp); + } else { + table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck())); + } } else { String vstr = String.valueOf(ca.getValue()); + + if (displayPersonNameInReviewCategory) { + vstr = vstr + " " + FormatUtil.name(ai); + } + if (ca.getValue() > 0) { vstr = "+" + vstr; fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore()); @@ -338,9 +377,6 @@ public class ChangeTable extends NavigationTable { table.setText(row, col, vstr); } - final ApprovalCategoryValue acv = type.getValue(ca); - final AccountInfo ai = aic.get(ca.getAccountId()); - // Some web browsers ignore the embedded newline; some like it; // so we include a space before the newline to accommodate both. // diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css index c8f16d0afc..775f244f8a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css @@ -464,7 +464,7 @@ background: backgroundColor; } -.changeTable .activeRow, +.changeTable .activeRow, .accountDashboard.changeTable .activeRow, .accountDashboard.changeTable .activeRow a { background: selectionColor; @@ -507,7 +507,9 @@ .changeTable .dataCell.posscore { color: #08a400; } - +.changeTable .dataCell.singleLine { + white-space: nowrap; +} .changeTable .iconHeader { border-top: 1px solid backgroundColor; border-bottom: 1px solid backgroundColor; diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java index b90129cd82..a551ebb84b 100644 --- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java +++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java @@ -117,6 +117,9 @@ public final class AccountGeneralPreferences { @Column(id = 10) protected boolean displayPatchSetsInReverseOrder; + @Column(id = 11) + protected boolean displayPersonNameInReviewCategory; + public AccountGeneralPreferences() { } @@ -190,6 +193,14 @@ public final class AccountGeneralPreferences { this.displayPatchSetsInReverseOrder = displayPatchSetsInReverseOrder; } + public boolean isDisplayPersonNameInReviewCategory() { + return displayPersonNameInReviewCategory; + } + + public void setDisplayPersonNameInReviewCategory(final boolean displayPersonNameInReviewCategory) { + this.displayPersonNameInReviewCategory = displayPersonNameInReviewCategory; + } + public DateFormat getDateFormat() { if (dateFormat == null) { return DateFormat.STD; @@ -218,6 +229,7 @@ public final class AccountGeneralPreferences { useFlashClipboard = true; copySelfOnEmail = false; displayPatchSetsInReverseOrder = false; + displayPersonNameInReviewCategory = false; downloadUrl = null; downloadCommand = null; dateFormat = null; diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java index 67d2aa4e8e..fb5f1f8286 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java @@ -32,7 +32,7 @@ import java.util.List; /** A version of the database schema. */ public abstract class SchemaVersion { /** The current schema version. */ - private static final Class C = Schema_49.class; + private static final Class C = Schema_50.class; public static class Module extends AbstractModule { @Override diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_50.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_50.java new file mode 100644 index 0000000000..6c9c5cfba9 --- /dev/null +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_50.java @@ -0,0 +1,36 @@ +// Copyright (C) 2011 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.AccountProjectWatch; +import com.google.gerrit.reviewdb.ReviewDb; +import com.google.gwtorm.client.OrmException; +import com.google.gwtorm.jdbc.JdbcSchema; +import com.google.gwtorm.schema.sql.DialectH2; +import com.google.gwtorm.schema.sql.DialectMySQL; +import com.google.gwtorm.schema.sql.DialectPostgreSQL; +import com.google.gwtorm.schema.sql.SqlDialect; +import com.google.inject.Inject; +import com.google.inject.Provider; + +import java.sql.SQLException; +import java.sql.Statement; + +public class Schema_50 extends SchemaVersion { + @Inject + Schema_50(Provider prior) { + super(prior); + } +} \ No newline at end of file