Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
[1131896] multi-click on New Dashboard button creates dashboards with…
Browse files Browse the repository at this point in the history
… the same title

Prevent multi-click by disabling button until prior DB is created.

(cherry picked from commit f102c31)
Signed-off-by: Jay Shaughnessy <jshaughn@redhat.com>
  • Loading branch information
jshaughn committed Aug 28, 2014
1 parent ee7abdc commit 115bcb0
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ public void onClick(ClickEvent clickEvent) {
newDashboardButton.setAutoFit(true);
newDashboardButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
addNewDashboard();
newDashboardButton.disable();
addNewDashboard(newDashboardButton);
}
});

Expand Down Expand Up @@ -336,7 +337,7 @@ public boolean isValidDashboardName(String name) {
return (!this.dashboardsByName.containsKey(name));
}

public void addNewDashboard() {
public void addNewDashboard(final IButton newDashboardButton) {
int i = 0;
String availableDashboardName = null;
while (availableDashboardName == null) {
Expand All @@ -356,6 +357,7 @@ public void addNewDashboard() {
dashboardService.storeDashboard(dashboard, new AsyncCallback<Dashboard>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_dashboardsManager_error1(), caught);
newDashboardButton.enable();
}

public void onSuccess(Dashboard result) {
Expand All @@ -371,6 +373,8 @@ public void onSuccess(Dashboard result) {

tabSet.addTab(tab);
tabSet.selectTab(tab);

newDashboardButton.enable();
}
});
}
Expand Down

0 comments on commit 115bcb0

Please sign in to comment.