Display the text "invalid key" instead of a red X icon in SSH Keys panel

Some users were confused by the red X placed next to an SSH key.  They
thought this was a delete icon, to remove a key from the key list.  It
was meant to signal an invalid key.

We instead now show the slightly less ambiguous "Invalid Key" message
as English text, bold and in red, so its very clear that this key is
not a valid key.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-02-16 09:54:29 -08:00
parent b0bf482fb5
commit 183aecb672
4 changed files with 18 additions and 6 deletions

View File

@@ -36,6 +36,7 @@ public interface AccountConstants extends Constants {
String buttonDeleteSshKey();
String buttonAddSshKey();
String sshKeyInvalid();
String sshKeyAlgorithm();
String sshKeyKey();
String sshKeyComment();

View File

@@ -17,6 +17,7 @@ tabAgreements = Agreements
buttonDeleteSshKey = Delete
buttonAddSshKey = Add
sshKeyInvalid = Invalid Key
sshKeyAlgorithm = Algorithm
sshKeyKey = Key
sshKeyComment = Comment

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.client.account;
import com.google.gerrit.client.FormatUtil;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.reviewdb.AccountSshKey;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.ui.FancyFlexTable;
@@ -117,6 +116,8 @@ class SshKeyPanel extends Composite {
}
private class SshKeyTable extends FancyFlexTable<AccountSshKey> {
private static final String S_INVALID = "gerrit-SshKeyPanel-Invalid";
SshKeyTable() {
table.setText(0, 3, Util.C.sshKeyAlgorithm());
table.setText(0, 4, Util.C.sshKeyKey());
@@ -133,8 +134,7 @@ class SshKeyPanel extends Composite {
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, S_ICON_HEADER);
fmt.addStyleName(0, 2, S_ICON_HEADER);
fmt.addStyleName(0, 2, S_DATA_HEADER);
fmt.addStyleName(0, 3, S_DATA_HEADER);
fmt.addStyleName(0, 4, S_DATA_HEADER);
fmt.addStyleName(0, 5, S_DATA_HEADER);
@@ -207,20 +207,25 @@ class SshKeyPanel extends Composite {
}
void addOneKey(final AccountSshKey k) {
final FlexCellFormatter fmt = table.getFlexCellFormatter();
final int row = table.getRowCount();
table.insertRow(row);
applyDataRowStyle(row);
table.setWidget(row, 1, new CheckBox());
table.setWidget(row, 2, k.isValid() ? Gerrit.ICONS.greenCheck()
.createImage() : Gerrit.ICONS.redNot().createImage());
if (k.isValid()) {
table.setText(row, 2, "");
fmt.removeStyleName(row, 2, S_INVALID);
} else {
table.setText(row, 2, Util.C.sshKeyInvalid());
fmt.addStyleName(row, 2, S_INVALID);
}
table.setText(row, 3, k.getAlgorithm());
table.setText(row, 4, elide(k.getEncodedKey()));
table.setText(row, 5, k.getComment());
table.setText(row, 6, FormatUtil.mediumFormat(k.getLastUsedOn()));
table.setText(row, 7, FormatUtil.mediumFormat(k.getStoredOn()));
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(row, 1, S_ICON_CELL);
fmt.addStyleName(row, 2, S_ICON_CELL);
fmt.addStyleName(row, 4, "gerrit-SshKeyPanel-EncodedKey");

View File

@@ -677,6 +677,11 @@
font-family: monospace;
font-size: small;
}
.gerrit-SshKeyPanel-Invalid {
white-space: nowrap;
color: red;
font-weight: bold;
}
.gerrit-AccountInfoBlock {
margin-bottom: 10px;