Skip to content

Commit 059c76e

Browse files
committed
[rbrowser] remove last cycle from request
Now it is global settings, which changed only when really clicked on the gui side. Or when WebGui.Browser.LastCycle rootrc parameter configured - which is analyzed only once when browser started
1 parent 5429260 commit 059c76e

5 files changed

Lines changed: 20 additions & 25 deletions

File tree

gui/browserv7/inc/ROOT/RBrowserRequest.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public:
3131
bool reverse{false}; ///< reverse item order
3232
bool hidden{false}; ///< show hidden files
3333
bool reload{false}; ///< force items reload
34-
int lastcycle{0}; ///< show only last cycle, -1 - off, 0 - not change, +1 on,
3534
std::string regex; ///< applied regex
3635
};
3736

gui/browserv7/src/RBrowser.cxx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,13 @@ Chrome or Firefox browsers are though required when running ROOT in batch mode.
269269
Most configuration options for RBrowser, such as default web browser, server mode are not specific to this class,
270270
but are rather applied for all web widgets: canvases, geometry viewer, eve7, browser, fit panel, etc.
271271
272-
Following .rootrc parameters can be configured for the browser:
272+
Following `.rootrc` parameters can be configured for the browser:
273273
274274
* WebGui.Browser.SortBy: sort by "name", "size", "none" (default "name")
275275
* WebGui.Browser.Reverse: reverse item order (default off)
276276
* WebGui.Browser.ShowHidden: show hidden files (default off)
277277
* WebGui.Browser.LastCycle: show only last key cycle (default off)
278+
* WebGui.Browser.Expand: expand browsable area (default off)
278279
279280
\note See major settings in RWebWindowWindowsManager::CreateServer and RWebWindowsManager::ShowWindow
280281
*/
@@ -312,16 +313,12 @@ RBrowser::RBrowser(bool use_rcanvas)
312313

313314
reverse = (reverse == "on" || reverse == "yes" || reverse == "1") ? "true" : "false";
314315
hidden = (hidden == "on" || hidden == "yes" || hidden == "1") ? "true" : "false";
315-
if (lastcycle == "on" || lastcycle == "yes" || lastcycle == "1") {
316-
lastcycle = "1";
316+
if (lastcycle == "on" || lastcycle == "yes" || lastcycle == "1")
317317
Browsable::RElement::SetLastKeyCycle(true);
318-
} else if (lastcycle == "off" || lastcycle == "no" || lastcycle == "0") {
319-
lastcycle = "-1";
318+
else if (lastcycle == "off" || lastcycle == "no" || lastcycle == "0")
320319
Browsable::RElement::SetLastKeyCycle(false);
321-
} else
322-
lastcycle = Browsable::RElement::IsLastKeyCycle() ? "1" : "0";
323320

324-
fWebWindow->SetUserArgs(TString::Format("{ sort: \"%s\", reverse: %s, hidden: %s, lastcycle: %s }", sortby.c_str(), reverse.c_str(), hidden.c_str(), lastcycle.c_str()).Data());
321+
fWebWindow->SetUserArgs(TString::Format("{ sort: \"%s\", reverse: %s, hidden: %s }", sortby.c_str(), reverse.c_str(), hidden.c_str()).Data());
325322

326323
// this is call-back, invoked when message received via websocket
327324
fWebWindow->SetCallBacks([this](unsigned connid) { fConnId = connid; SendInitMsg(connid); },
@@ -774,7 +771,8 @@ void RBrowser::SendInitMsg(unsigned connid)
774771

775772
reply.emplace_back(std::vector<std::string>({
776773
"settings"s,
777-
gEnv->GetValue("WebGui.Browser.Expand", "no")
774+
gEnv->GetValue("WebGui.Browser.Expand", "no"),
775+
Browsable::RElement::IsLastKeyCycle() ? "1" : "0"
778776
}));
779777

780778
std::string msg = "INMSG:";
@@ -898,6 +896,10 @@ void RBrowser::ProcessMsg(unsigned connid, const std::string &arg0)
898896
auto json = ProcessBrowserRequest(msg);
899897
if (!json.empty()) fWebWindow->Send(connid, json);
900898

899+
} else if (kind == "LASTCYCLE") {
900+
// when changed on clients side
901+
Browsable::RElement::SetLastKeyCycle(msg == "1");
902+
901903
} else if (kind == "DBLCLK") {
902904

903905
auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(msg);

gui/browserv7/src/RBrowserData.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,6 @@ bool RBrowserData::ProcessBrowserRequest(const RBrowserRequest &request, RBrowse
268268

269269
std::string RBrowserData::ProcessRequest(const RBrowserRequest &request)
270270
{
271-
if (request.lastcycle < 0)
272-
Browsable::RElement::SetLastKeyCycle(false);
273-
else if (request.lastcycle > 0)
274-
Browsable::RElement::SetLastKeyCycle(true);
275-
276271
RBrowserReply reply;
277272

278273
reply.path = request.path;

ui5/browser/controller/Browser.controller.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ sap.ui.define(['sap/ui/core/mvc/Controller',
8383

8484
const SortMethod = this.websocket.getUserArgs('sort') ?? 'name',
8585
ReverseOrder = this.websocket.getUserArgs('reverse') ?? false,
86-
ShowHiddenFiles = this.websocket.getUserArgs('hidden') ?? false,
87-
LastCycle = this.websocket.getUserArgs('lastcycle') ?? 0;
86+
ShowHiddenFiles = this.websocket.getUserArgs('hidden') ?? false;
8887

8988
this._oSettingsModel = new JSONModel({
9089
SortMethods: [
@@ -95,7 +94,7 @@ sap.ui.define(['sap/ui/core/mvc/Controller',
9594
SortMethod,
9695
ReverseOrder,
9796
ShowHiddenFiles,
98-
OnlyLastCycle: (LastCycle > 0),
97+
OnlyLastCycle: false,
9998
AppendToCanvas: false,
10099
HandleDoubleClick: true,
101100
DBLCLKRun: false,
@@ -194,7 +193,6 @@ sap.ui.define(['sap/ui/core/mvc/Controller',
194193
this.model.setSortMethod(SortMethod);
195194
this.model.setReverseOrder(ReverseOrder);
196195
this.model.setShowHidden(ShowHiddenFiles);
197-
this.model.setOnlyLastCycle(LastCycle);
198196

199197
// copy extra attributes from element to node in the browser
200198
// later can be done automatically
@@ -785,7 +783,7 @@ sap.ui.define(['sap/ui/core/mvc/Controller',
785783
onSettingsPress() {
786784
this._oSettingsModel.setProperty("/AppendToCanvas", this.model.isAppendToCanvas());
787785
this._oSettingsModel.setProperty("/HandleDoubleClick", this.model.isHandleDoubleClick());
788-
this._oSettingsModel.setProperty("/OnlyLastCycle", (this.model.getOnlyLastCycle() > 0));
786+
this._oSettingsModel.setProperty("/OnlyLastCycle", this.model.getOnlyLastCycle());
789787
this._oSettingsModel.setProperty("/ShowHiddenFiles", this.model.isShowHidden());
790788
this._oSettingsModel.setProperty("/SortMethod", this.model.getSortMethod());
791789
this._oSettingsModel.setProperty("/ReverseOrder", this.model.isReverseOrder());
@@ -826,9 +824,10 @@ sap.ui.define(['sap/ui/core/mvc/Controller',
826824
changed_dblclick = true;
827825
}
828826

829-
if (lastcycle != (this.model.getOnlyLastCycle() > 0)) {
827+
if (lastcycle != this.model.getOnlyLastCycle()) {
830828
changed = true;
831-
this.model.setOnlyLastCycle(lastcycle ? 1 : -1);
829+
this.model.setOnlyLastCycle(lastcycle);
830+
this.websocket.send('LASTCYCLE:' + (lastcycle ? '1' : '0'));
832831
}
833832

834833
if (hidden != this.model.isShowHidden()) {
@@ -1420,8 +1419,9 @@ sap.ui.define(['sap/ui/core/mvc/Controller',
14201419
this._oSettingsModel.setProperty('/optTProfile', arr[k][3]|| '<dflt>');
14211420
} else if (kind == "settings") {
14221421
const expand = (arr[k][1] == 'on' || arr[k][1] == 'yes' || arr[k][1] == '1');
1423-
if (expand)
1422+
if (expand)
14241423
this.onExpandMaster();
1424+
this.model.setOnlyLastCycle(arr[k][2] == '1');
14251425
} else {
14261426
const pr = this.createElement(kind, arr[k][1], arr[k][2], arr[k][3], arr[k][4]);
14271427
Promise.resolve(pr).then(tab => {

ui5/browser/model/BrowserModel.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ sap.ui.define([
2929
this.showHidden = false;
3030
this.appendToCanvas = false;
3131
this.handleDoubleClick = true;
32-
this.onlyLastCycle = 0; // 0 - not changed, -1 off , +1 on
32+
this.onlyLastCycle = false;
3333

3434
this.threshold = 100; // default threshold to prefetch items
3535
},
@@ -280,7 +280,6 @@ sap.ui.define([
280280
sort: this.sortMethod || '',
281281
reverse: this.reverseOrder || false,
282282
hidden: this.showHidden ? true : false,
283-
lastcycle: this.onlyLastCycle ?? 0,
284283
reload: force_reload ? true : false, // re-scan items by server even when path was not changed
285284
regex
286285
};

0 commit comments

Comments
 (0)