feat(GODT-2355): improve wording and actions on bad event

This commit is contained in:
Jakub
2023-02-13 09:46:27 +01:00
parent cbd36184bd
commit b4b66f94ec
8 changed files with 71 additions and 20 deletions

View File

@ -294,7 +294,7 @@ gofiles: ./internal/bridge/credits.go
cd ./utils/ && ./credits.sh bridge cd ./utils/ && ./credits.sh bridge
## Run and debug ## Run and debug
.PHONY: run run-qt run-qt-cli run-nogui run-cli run-noninteractive run-debug run-qml-preview clean-vendor clean-frontend-qt clean-frontend-qt-common clean .PHONY: run run-qt run-qt-cli run-nogui run-cli run-noninteractive run-debug run-gui-tester clean-vendor clean-frontend-qt clean-frontend-qt-common clean
LOG?=debug LOG?=debug
LOG_IMAP?=client # client/server/all, or empty to turn it off LOG_IMAP?=client # client/server/all, or empty to turn it off
@ -321,6 +321,20 @@ run-nogui: build-nogui clean-vendor gofiles
run-debug: run-debug:
dlv debug ./cmd/Desktop-Bridge/main.go -- -l=debug dlv debug ./cmd/Desktop-Bridge/main.go -- -l=debug
ifeq "${TARGET_OS}" "windows"
EXE_SUFFIX=.exe
endif
bridge-gui-tester: build-gui
cp ./cmd/Desktop-Bridge/deploy/${TARGET_OS}/bridge-gui${EXE_SUFFIX} .
cd ./internal/frontend/bridge-gui/bridge-gui-tester && cmake . && make
run-gui-tester: bridge-gui-tester
# copying tester as bridge so bridge-gui will start it and connect to it automatically
cp ./internal/frontend/bridge-gui/bridge-gui-tester/bridge-gui-tester${EXE_SUFFIX} bridge${EXE_SUFFIX}
./bridge-gui${EXE_SUFFIX}
clean-vendor: clean-vendor:
rm -rf ./vendor rm -rf ./vendor

View File

@ -874,12 +874,14 @@ void QMLBackend::onLoginAlreadyLoggedIn(QString const &userID) {
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
void QMLBackend::onUserBadEvent(QString const &userID, QString const &errorMessage) { void QMLBackend::onUserBadEvent(QString const &userID, QString const &errorMessage) {
HANDLE_EXCEPTION( HANDLE_EXCEPTION(
Q_UNUSED(errorMessage);
SPUser const user = users_->getUserWithID(userID); SPUser const user = users_->getUserWithID(userID);
if (!user) if (!user)
app().log().error(QString("Received bad event for unknown user %1").arg(user->id())); app().log().error(QString("Received bad event for unknown user %1").arg(user->id()));
user->setState(UserState::SignedOut); user->setState(UserState::SignedOut);
emit userBadEvent(tr("%1 was logged out because of an internal error.").arg(user->primaryEmailOrUsername())); emit userBadEvent(
tr("Internal error: %1 was automatically logged out. Please log in again or report this problem if the issue persists.").arg(user->primaryEmailOrUsername()),
errorMessage
);
emit selectUser(userID); emit selectUser(userID);
emit showMainWindow(); emit showMainWindow();
) )

View File

@ -222,7 +222,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
void addressChangedLogout(QString const &address); ///< Signal for the 'addressChangedLogout' gRPC stream event. void addressChangedLogout(QString const &address); ///< Signal for the 'addressChangedLogout' gRPC stream event.
void apiCertIssue(); ///< Signal for the 'apiCertIssue' gRPC stream event. void apiCertIssue(); ///< Signal for the 'apiCertIssue' gRPC stream event.
void userDisconnected(QString const &username); ///< Signal for the 'userDisconnected' gRPC stream event. void userDisconnected(QString const &username); ///< Signal for the 'userDisconnected' gRPC stream event.
void userBadEvent(QString const &message); ///< Signal for the 'userBadEvent' gRPC stream event. void userBadEvent(QString const &description, QString const &errorMessage); ///< Signal for the 'userBadEvent' gRPC stream event.
void internetOff(); ///< Signal for the 'internetOff' gRPC stream event. void internetOff(); ///< Signal for the 'internetOff' gRPC stream event.
void internetOn(); ///< Signal for the 'internetOn' gRPC stream event. void internetOn(); ///< Signal for the 'internetOn' gRPC stream event.
void resetFinished(); ///< Signal for the 'resetFinished' gRPC stream event. void resetFinished(); ///< Signal for the 'resetFinished' gRPC stream event.

View File

@ -170,6 +170,10 @@ SettingsView {
} }
} }
function setDescription(message) {
description.text = message
}
function setDefaultValue() { function setDefaultValue() {
description.text = "" description.text = ""
address.text = root.selectedAddress address.text = root.selectedAddress

View File

@ -348,6 +348,7 @@ Item {
} }
BugReportView { // 8 BugReportView { // 8
id: bugReport
colorScheme: root.colorScheme colorScheme: root.colorScheme
selectedAddress: { selectedAddress: {
if (accounts.currentIndex < 0) return "" if (accounts.currentIndex < 0) return ""
@ -415,4 +416,8 @@ Item {
console.error("User with ID ", userID, " was not found in the account list") console.error("User with ID ", userID, " was not found in the account list")
} }
function showBugReportAndPrefill(description) {
rightContent.showBugReport()
bugReport.setDescription(description)
}
} }

View File

@ -169,7 +169,6 @@ ApplicationWindow {
root.showSetup(null,"") root.showSetup(null,"")
} }
} }
} }
NotificationPopups { NotificationPopups {
@ -188,6 +187,10 @@ ApplicationWindow {
function showHelp() { contentWrapper.showHelp() } function showHelp() { contentWrapper.showHelp() }
function selectUser(userID) { contentWrapper.selectUser(userID) } function selectUser(userID) { contentWrapper.selectUser(userID) }
function showBugReportAndPrefill(message) {
contentWrapper.showBugReportAndPrefill(message)
}
function showSignIn(username) { function showSignIn(username) {
if (contentLayout.currentIndex == 1) return if (contentLayout.currentIndex == 1) return
contentWrapper.showSignIn(username) contentWrapper.showSignIn(username)

View File

@ -129,6 +129,11 @@ Item {
notification: root.notifications.noActiveKeyForRecipient notification: root.notifications.noActiveKeyForRecipient
} }
NotificationDialog {
colorScheme: root.colorScheme
notification: root.notifications.userBadEvent
}
NotificationDialog { NotificationDialog {
colorScheme: root.colorScheme colorScheme: root.colorScheme
notification: root.notifications.genericError notification: root.notifications.genericError

View File

@ -1103,17 +1103,21 @@ QtObject {
} }
property Notification userBadEvent: Notification { property Notification userBadEvent: Notification {
title: qsTr("User was logged out") title: qsTr("Your account was logged out")
brief: title brief: title
description: "#PlaceHolderText" description: "#PlaceHolderText"
icon: "./icons/ic-exclamation-circle-filled.svg" icon: "./icons/ic-exclamation-circle-filled.svg"
type: Notification.NotificationType.Danger type: Notification.NotificationType.Danger
group: Notifications.Group.Connection group: Notifications.Group.Connection | Notifications.Group.Dialogs
property var bugReportMsg: "Reporting an issue:\n\n\"%1\"\n\nError: %2\n\nThe issue persists even after loggin back in."
property var errorMessage: ""
Connections { Connections {
target: Backend target: Backend
function onUserBadEvent(message) { function onUserBadEvent(description, errorMessage) {
root.userBadEvent.description = message root.userBadEvent.description = description
root.userBadEvent.errorMessage = errorMessage
root.userBadEvent.active = true root.userBadEvent.active = true
} }
} }
@ -1125,8 +1129,22 @@ QtObject {
onTriggered: { onTriggered: {
root.userBadEvent.active = false root.userBadEvent.active = false
} }
},
Action {
text: qsTr("Report")
onTriggered: {
root.frontendMain.showBugReportAndPrefill(
root.userBadEvent.bugReportMsg.
arg( root.userBadEvent.description).
arg(root.userBadEvent.errorMessage)
)
root.userBadEvent.active = false
}
} }
] ]
} }
property Notification genericError: Notification { property Notification genericError: Notification {