Replace "display name in review category" preference with a list of options

Gerrit has a preference to show names in label columns on gerrit dashboards.
This is a nice feature however it limits what options can be displayed on
the columns.  For example some users have very long names which takes
up too much screen real estate to display.  It would be nice to allow
users to select an alternative to the user's name, maybe just their
abbreviations?

This change replaces the single checkbox to "display person name in review
category" with a selection list of alternative options.

This change provides the following options:
 * None (default)
 * Show Name
 * Show Email
 * Show Abbreviation

Also this change will make it easier to add additional options for this
preference in the future.

Feature: issue 2628
Change-Id: I8858147cfd5513b8c7bcc9d199c1ed7a8a70dcd5
This commit is contained in:
Khai Do
2014-06-15 22:53:27 -07:00
committed by David Ostrovsky
parent 7bf593385a
commit 767b128038
12 changed files with 184 additions and 56 deletions

View File

@@ -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_97> C = Schema_97.class;
public static final Class<Schema_98> C = Schema_98.class;
public static class Module extends AbstractModule {
@Override

View File

@@ -0,0 +1,44 @@
// Copyright (C) 2014 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_98 extends SchemaVersion {
@Inject
Schema_98(Provider<Schema_97> prior) {
super(prior);
}
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws SQLException {
ui.message("Migrate user preference showUserInReview to "
+ "reviewCategoryStrategy");
Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
try {
stmt.executeUpdate("UPDATE ACCOUNTS SET "
+ "REVIEW_CATEGORY_STRATEGY='NAME' "
+ "WHERE (SHOW_USER_IN_REVIEW='Y')");
} finally {
stmt.close();
}
}
}