Display info icon for groups and blocked usernames on settings screen
Change-Id: I416f6e34678c62b6ed9d123a58e4fcca43c82c67
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserSettingsScreen.java b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserSettingsScreen.java
index 9b23513..12afb28 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserSettingsScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserSettingsScreen.java
@@ -171,11 +171,16 @@
blockedUsernamesPanel =
new StringListPanel("Blocked Usernames", "Username",
info.getBlockedNames(), saveButton);
+ blockedUsernamesPanel.setInfo("List of usernames which are "
+ + "forbidden to be used as name for a service user. "
+ + "The blocked usernames are case insensitive.");
add(blockedUsernamesPanel);
groupsPanel =
new StringListPanel("Groups", "Group Name",
info.getGroups().keySet(), saveButton);
+ groupsPanel.setInfo("Names of groups to which newly created "
+ + "service users should be added automatically.");
add(groupsPanel);
HorizontalPanel buttons = new HorizontalPanel();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/StringListPanel.java b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/StringListPanel.java
index 9aeaf6f..2a2f970 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/StringListPanel.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/StringListPanel.java
@@ -29,6 +29,7 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwtexpui.globalkey.client.NpTextBox;
@@ -40,6 +41,8 @@
private final NpTextBox input;
private final StringListTable t;
private final Button deleteButton;
+ private final HorizontalPanel titlePanel;
+ private Image info;
StringListPanel(String title, String fieldName, JsArrayString values,
final FocusWidget w) {
@@ -48,9 +51,11 @@
StringListPanel(String title, String fieldName, Collection<String> values,
final FocusWidget w) {
+ titlePanel = new HorizontalPanel();
Label titleLabel = new Label(title);
titleLabel.setStyleName("serviceuser-smallHeading");
- add(titleLabel);
+ titlePanel.add(titleLabel);
+ add(titlePanel);
input = new NpTextBox();
input.addKeyPressHandler(new KeyPressHandler() {
@Override
@@ -93,6 +98,14 @@
t.display(values);
}
+ void setInfo(String msg) {
+ if (info == null) {
+ info = new Image(ServiceUserPlugin.RESOURCES.info());
+ titlePanel.add(info);
+ }
+ info.setTitle(msg);
+ }
+
List<String> getValues() {
return t.getValues();
}