Add popup for support ticket

This commit is contained in:
Manfred Karrer 2016-03-09 13:20:05 +01:00
parent b67a80d658
commit 93d89cadaa
6 changed files with 82 additions and 105 deletions

View file

@ -148,10 +148,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
Tuple2<TextField, VBox> availableBalanceBox = getBalanceBox("Available balance");
availableBalanceBox.first.textProperty().bind(model.availableBalance);
Tuple2<TextField, VBox> reservedBalanceBox = getBalanceBox("Reserved balance");
Tuple2<TextField, VBox> reservedBalanceBox = getBalanceBox("Reserved in offers");
reservedBalanceBox.first.textProperty().bind(model.reservedBalance);
Tuple2<TextField, VBox> lockedBalanceBox = getBalanceBox("Locked balance");
Tuple2<TextField, VBox> lockedBalanceBox = getBalanceBox("Locked in trades");
lockedBalanceBox.first.textProperty().bind(model.lockedBalance);
HBox rightNavPane = new HBox(marketPriceBox.third, availableBalanceBox.second, reservedBalanceBox.second, lockedBalanceBox.second,

View file

@ -17,6 +17,7 @@
package io.bitsquare.gui.main.disputes;
import io.bitsquare.app.BitsquareApp;
import io.bitsquare.arbitration.Arbitrator;
import io.bitsquare.arbitration.ArbitratorManager;
import io.bitsquare.common.crypto.KeyRing;
@ -26,7 +27,11 @@ import io.bitsquare.gui.common.view.*;
import io.bitsquare.gui.main.MainView;
import io.bitsquare.gui.main.disputes.arbitrator.ArbitratorDisputeView;
import io.bitsquare.gui.main.disputes.trader.TraderDisputeView;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.main.portfolio.PortfolioView;
import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView;
import io.bitsquare.p2p.NodeAddress;
import io.bitsquare.user.Preferences;
import javafx.beans.value.ChangeListener;
import javafx.collections.MapChangeListener;
import javafx.fxml.FXML;
@ -47,6 +52,7 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
private final Navigation navigation;
private final ArbitratorManager arbitratorManager;
private final KeyRing keyRing;
private Preferences preferences;
private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;
@ -56,13 +62,15 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
private boolean isArbitrator;
@Inject
public DisputesView(CachingViewLoader viewLoader, Navigation navigation, ArbitratorManager arbitratorManager, KeyRing keyRing) {
public DisputesView(CachingViewLoader viewLoader, Navigation navigation, ArbitratorManager arbitratorManager,
KeyRing keyRing, Preferences preferences) {
this.viewLoader = viewLoader;
this.navigation = navigation;
this.arbitratorManager = arbitratorManager;
this.keyRing = keyRing;
this.preferences = preferences;
}
@Override
@ -109,6 +117,54 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
navigation.navigateTo(MainView.class, DisputesView.class, ArbitratorDisputeView.class);
else
navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class);
String key = "supportInfo";
if (!BitsquareApp.DEV_MODE)
new Popup().backgroundInfo("Bitsquare is not a company and not operating any kind of customer support.\n\n" +
"If there are disputes in the trade process (e.g. one trader does not follow the trade protocol) " +
"the application will display a \"Open dispute\" button after the trade period is over " +
"for contacting the arbitrator.\n" +
"In cases of software bugs or network problems, which are detected by the application there will " +
"be displayed a \"Open support ticket\" button to contact the arbitrator who will forward the issue " +
"to the developers.\n\n" +
"In cases where a user got stuck by a bug without getting displayed that \"Open support ticket\" button, " +
"you can open a support ticket manually with a special short cut.\n\n" +
"Please use that only if you are sure that the software is not working like expected. " +
"If you have problems how to use Bitsquare or any questions please review the FAQ at the " +
"Bitsquare.io web page or contact the Bitsquare team using " +
"any of the communication channels offered " +
"at the Bitsquare.io web page.\n\n" +
"If you are sure you want to open a support ticket please select the trade which causes the problem " +
"under \"Portfolio/Open trades\" and type the key combination \"cmd + o\" to open the support ticket.")
.closeButtonText("Go to \"Open trades\"")
.onClose(() -> navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class))
.actionButtonText("Close")
.onAction(() -> {
})
.dontShowAgainId(key, preferences)
.show();
/*
.backgroundInfo("Bitsquare is not a company and not operating any kind of customer support.\n\n" +
"If there are disputes in the trade process (e.g. one trader does not follow the trade protocol) " +
"the application will display a \"Open dispute\" button after the trade period is over " +
"for contacting the arbitrator.\n" +
"In cases of software bugs or network problems, which are detected by the application there will " +
"be displayed a \"Open support ticket\" button to contact the arbitrator who will forward the issue " +
"to the developers.\n\n" +
"In cases where a user got stuck by a bug without getting displayed that \"Open support ticket\" button, " +
"you can open here a support ticket manually.\n\n" +
"Please use that only if you are sure that the software is not working like expected. " +
"If you have problems how to use Bitsquare of questions please review the FAQ at the " +
"Bitsquare.io web page or contact the Bitsquare over " +
"any of the communication channels offered " +
"at the Bitsquare.io web page.")
.closeButtonText("Open Bitsquare.io web page")
.onClose(() -> Utilities.openWebPage("https://bitsquare.io"))
.actionButtonText("I understand")
.onAction(() -> {
})
.dontShowAgainId(key, preferences)
.show();*/
}
@Override

View file

@ -671,8 +671,8 @@ public abstract class Overlay<T extends Overlay> {
}
protected void setTruncatedMessage() {
if (message != null && message.length() > 900)
truncatedMessage = StringUtils.abbreviate(message, 900);
if (message != null && message.length() > 1200)
truncatedMessage = StringUtils.abbreviate(message, 1200);
else
truncatedMessage = message;
}

View file

@ -1,96 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.main.overlays.windows;
import io.bitsquare.common.handlers.ResultHandler;
import io.bitsquare.gui.main.overlays.Overlay;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.FormBuilder.addMultilineLabel;
public class OpenEmergencyTicketWindow extends Overlay<OpenEmergencyTicketWindow> {
private static final Logger log = LoggerFactory.getLogger(OpenEmergencyTicketWindow.class);
private Button openTicketButton;
private ResultHandler openTicketHandler;
///////////////////////////////////////////////////////////////////////////////////////////
// Public API
///////////////////////////////////////////////////////////////////////////////////////////
public OpenEmergencyTicketWindow() {
}
public void show() {
if (headLine == null)
headLine = "Open support ticket";
width = 700;
createGridPane();
addHeadLine();
addSeparator();
addContent();
applyStyles();
display();
}
public OpenEmergencyTicketWindow onOpenTicket(ResultHandler openTicketHandler) {
this.openTicketHandler = openTicketHandler;
return this;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////
private void addContent() {
addMultilineLabel(gridPane, ++rowIndex,
"Please use that only in emergency case if you don't get displayed a support or dispute screen in the UI.\n" +
"When you open a ticket the trade will be interrupted and handled by the arbitrator.",
10);
openTicketButton = new Button("Open support ticket");
openTicketButton.setOnAction(e -> {
openTicketHandler.handleResult();
hide();
});
closeButton = new Button("Cancel");
closeButton.setOnAction(e -> {
hide();
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
});
HBox hBox = new HBox();
hBox.setSpacing(10);
GridPane.setRowIndex(hBox, ++rowIndex);
GridPane.setColumnIndex(hBox, 1);
hBox.getChildren().addAll(openTicketButton, closeButton);
gridPane.getChildren().add(hBox);
GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
}

View file

@ -22,7 +22,7 @@ import io.bitsquare.common.UserThread;
import io.bitsquare.gui.common.view.ActivatableViewAndModel;
import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.components.HyperlinkWithIcon;
import io.bitsquare.gui.main.overlays.windows.OpenEmergencyTicketWindow;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow;
import io.bitsquare.gui.util.BSFormatter;
import javafx.beans.property.ReadOnlyObjectWrapper;
@ -95,8 +95,20 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
// we use a hidden emergency shortcut to open support ticket
keyEventEventHandler = event -> {
if (new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN).match(event))
new OpenEmergencyTicketWindow().onOpenTicket(model.dataModel::onOpenSupportTicket).show();
if (new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN).match(event)) {
Popup popup = new Popup();
popup.headLine("Open support ticket")
.message("Please use that only in emergency case if you don't get displayed a \"Open support\" or \"Open dispute\" button.\n\n" +
"When you open a support ticket the trade will be interrupted and handled by the arbitrator\n\n" +
"Unjustified support tickets (e.g. caused by usability problems or questions) will " +
"cause a loss of the security deposit by the trader who opened the ticket.")
.closeButtonText("Open support ticket")
.onClose(model.dataModel::onOpenSupportTicket)
.actionButtonText("Cancel")
.onAction(() -> popup.hide())
.show();
}
//new OpenSupportTicketWindow().onOpenTicket(model.dataModel::onOpenSupportTicket).show();
};
}

View file

@ -375,7 +375,12 @@ public class BSFormatter {
}
public String getDaysHoursMinutes(Date startDate, Date endDate) {
try {
return DurationFormatUtils.formatDurationWords(endDate.getTime() - startDate.getTime(), true, true);
} catch (Throwable t) {
// in case we get a invalid duration we set swallow the exception
return "";
}
}