From daa227af0da372124effa799b9d8babd8e2334a7 Mon Sep 17 00:00:00 2001 From: Sergey Linev <S.Linev@gsi.de> Date: Tue, 20 Apr 2021 15:13:17 +0200 Subject: [PATCH] [rbrowser] show warning dialog when dblclick processing takes longer In this time server will not react on any other user actions, therefore just block UI with modal message --- gui/browserv7/src/RBrowser.cxx | 6 ++- ui5/browser/controller/Browser.controller.js | 55 ++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/gui/browserv7/src/RBrowser.cxx b/gui/browserv7/src/RBrowser.cxx index 32dae43d30b..1d1929f360f 100644 --- a/gui/browserv7/src/RBrowser.cxx +++ b/gui/browserv7/src/RBrowser.cxx @@ -533,8 +533,10 @@ void RBrowser::ProcessMsg(unsigned connid, const std::string &arg0) if (arr && (arr->size() > 2)) reply = ProcessDblClick(*arr); - if (!reply.empty()) - fWebWindow->Send(connid, reply); + if (reply.empty()) + reply = "NOPE"; + + fWebWindow->Send(connid, reply); } else if (kind == "WIDGET_SELECTED") { fActiveWidgetName = msg; diff --git a/ui5/browser/controller/Browser.controller.js b/ui5/browser/controller/Browser.controller.js index d9537a0822c..17b11edea7d 100644 --- a/ui5/browser/controller/Browser.controller.js +++ b/ui5/browser/controller/Browser.controller.js @@ -14,6 +14,10 @@ sap.ui.define(['sap/ui/core/mvc/Controller', 'sap/ui/core/mvc/XMLView', 'sap/ui/core/Icon', 'sap/m/Button', + 'sap/m/ButtonType', + 'sap/ui/core/ValueState', + 'sap/m/Dialog', + 'sap/m/DialogType', 'sap/ui/codeeditor/CodeEditor', 'sap/m/Image', 'sap/tnt/ToolHeader', @@ -36,6 +40,10 @@ sap.ui.define(['sap/ui/core/mvc/Controller', XMLView, CoreIcon, Button, + ButtonType, + ValueState, + Dialog, + DialogType, CodeEditor, Image, ToolHeader, @@ -757,6 +765,45 @@ sap.ui.define(['sap/ui/core/mvc/Controller', args.push(opt, exec); this.websocket.send("DBLCLK:" + JSON.stringify(args)); + + this.invokeWarning("Processing double click on: " + prop.name, 200); + }, + + invokeWarning: function(msg, tmout) { + this.cancelWarning(); + + this.warn_timeout = setTimeout(() => { + if (!this.warn_timeout) return; + delete this.warn_timeout; + + this.oWarningDialog = new Dialog({ + type: DialogType.Message, + title: "Warning", + state: ValueState.Warning, + content: new mText({ text: msg }), + beginButton: new Button({ + type: ButtonType.Emphasized, + text: "OK", + press: () => this.cancelWarning() + }) + }); + + this.oWarningDialog.open(); + + }, tmout); + + }, + + cancelWarning: function() { + if (this.warn_timeout) { + clearTimeout(this.warn_timeout); + delete this.warn_timeout; + } + if (this.oWarningDialog) { + this.oWarningDialog.close(); + delete this.oWarningDialog; + } + }, getBaseClass: function(className) { @@ -789,16 +836,24 @@ sap.ui.define(['sap/ui/core/mvc/Controller', /** @summary Entry point for all data from server */ onWebsocketMsg: function(handle, msg, offset) { + // any message from server clear all warnings + this.cancelWarning(); + if (typeof msg != "string") return console.error("Browser do not uses binary messages len = " + mgs.byteLength); + // console.log('MSG', msg.substr(0,20)); + let mhdr = msg.split(":")[0]; msg = msg.substr(mhdr.length+1); + switch (mhdr) { case "INMSG": this.processInitMsg(msg); break; + case "NOPE": + break; case "EDITOR": { // update code editor let arr = JSON.parse(msg); let tab = this.findTab(arr[0]); -- GitLab