Skip to content
Snippets Groups Projects
Commit 52540c99 authored by Sergey Linev's avatar Sergey Linev
Browse files

[webgui] use RWebWindow client version in ui5 panel

Most of user-defined ui5 panles will use "currentdir" as location of
XML/JS/JSON files. To effectively control browser cache, 
client version should be used here as well
parent c7f3fdde
No related branches found
No related tags found
No related merge requests found
...@@ -74,10 +74,15 @@ void server() ...@@ -74,10 +74,15 @@ void server()
window = ROOT::Experimental::RWebWindow::Create(); window = ROOT::Experimental::RWebWindow::Create();
// Important - defines name of openui5 widget // Important - defines name of openui5 widget
// "localapp" prefix indicates that all files located in current directory // "localapp" prefix will be point on current directory, where script executed
// "localapp.view.TestPanel" means file ./view/TestPanel.view.xml will be loaded // "localapp.view.TestPanel" means file ./view/TestPanel.view.xml will be loaded
window->SetPanelName("localapp.view.TestPanel"); window->SetPanelName("localapp.view.TestPanel");
// Provide window client version to control browser cache
// When value changed, URL for JSROOT, UI5 and local files will differ
// Therefore web browser automatically reload all these files
// window->SetClientVersion("1.2");
// these are different callbacks // these are different callbacks
window->SetCallBacks(ProcessConnection, ProcessData, ProcessCloseConnection); window->SetCallBacks(ProcessConnection, ProcessData, ProcessCloseConnection);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<title>ROOT7 web panel</title> <title>ROOT7 web panel</title>
<script type="text/javascript" src="jsrootsys/scripts/JSRootCore.js"></script> <script type="text/javascript" src="jsrootsys/scripts/JSRootCore.js"></script>
</head> </head>
<style> <style>
html { height: 100%; } html { height: 100%; }
body { min-height: 100%; margin: 0; overflow: hidden } body { min-height: 100%; margin: 0; overflow: hidden }
...@@ -26,26 +26,30 @@ ...@@ -26,26 +26,30 @@
loading scripts... loading scripts...
</div> </div>
</body> </body>
<script type='text/javascript'> <script type='text/javascript'>
function ShowOpenui5Panel(panel_handle, arg) { function ShowOpenui5Panel(panel_handle, arg) {
if (!panel_handle || !arg.first_msg || !sap) return false; if (!panel_handle || !arg.first_msg || !sap) return false;
var panelid = "TopPanelId"; var panelid = "TopPanelId";
var viewName = arg.first_msg; var viewName = arg.first_msg;
if ((viewName.indexOf("rootui5.") !== 0) && (viewName.indexOf("jsroot.") !== 0) && (viewName.indexOf("sap.") !== 0)) { if ((viewName.indexOf("rootui5.") !== 0) && (viewName.indexOf("jsroot.") !== 0) && (viewName.indexOf("sap.") !== 0)) {
var p = viewName.indexOf("."); var p = viewName.indexOf(".");
if ((p > 1) && (p < viewName.length - 1)) { if ((p > 1) && (p < viewName.length - 1)) {
console.log('Register module path', viewName.substr(0,p)); var tgtpath = "/currentdir/";
var _paths = {}; _paths[viewName.substr(0,p)] = "/currentdir/"; var pp = JSROOT.source_dir.indexOf("/jsrootsys/");
if (pp>0) tgtpath = JSROOT.source_dir.substr(0,pp) + "currentdir/";
var _paths = {};
_paths[viewName.substr(0,p)] = tgtpath;
console.log('Register module path', viewName.substr(0,p), ' as ', tgtpath);
sap.ui.loader.config({ paths: _paths }); sap.ui.loader.config({ paths: _paths });
} }
} }
sap.ui.require(["sap/ui/core/mvc/XMLView"], function(XMLView) { sap.ui.require(["sap/ui/core/mvc/XMLView"], function(XMLView) {
XMLView.create({ XMLView.create({
id: panelid, id: panelid,
...@@ -57,7 +61,7 @@ ...@@ -57,7 +61,7 @@
}); });
} }
JSROOT.ConnectWebWindow({ JSROOT.ConnectWebWindow({
prereq_logdiv: "PanelDiv", prereq_logdiv: "PanelDiv",
// openui5src: "jsroot", // openui5src: "jsroot",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment