Skip to content

Commit 13fb249

Browse files
committed
Remove localfile url option
Only interactively one can open file selection dialog
1 parent 8db8014 commit 13fb249

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

docs/JSROOT.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ To automate files loading and objects drawing, one can provide number of URL par
2828

2929
- file - name of the file, which will be automatically open with page loading
3030
- files - array of file names for loading
31-
- localfile - automatically activate dialog for selecting local ROOT files
3231
- json - name of JSON file with stored ROOT object like histogram or canvas
3332
- item - item name to be displayed
3433
- opt - drawing option for the item
@@ -502,12 +501,6 @@ Main limitation here - user should interactively select files for reading.
502501
There is button __"..."__ on the main JSROOT page, which starts file selection dialog.
503502
If valid ROOT file is selected, JSROOT will be able to normally read content of such file.
504503

505-
One could try to invoke such dialog with "localfile" parameter in URL string:
506-
507-
- <https://root.cern/js/latest/?localfile>
508-
509-
It could happen, that due to security limitations automatic popup will be blocked.
510-
511504

512505
## JSROOT with THttpServer
513506

modules/gui/HierarchyPainter.mjs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,7 +3203,6 @@ class HierarchyPainter extends BasePainter {
32033203
let prereq = GetOption('prereq') || '',
32043204
filesdir = d.get('path') || '', // path used in normal gui
32053205
filesarr = GetOptionAsArray('#file;files'),
3206-
localfile = GetOption('localfile'),
32073206
jsonarr = GetOptionAsArray('#json;jsons'),
32083207
expanditems = GetOptionAsArray('expand'),
32093208
focusitem = GetOption('focus'),
@@ -3308,9 +3307,7 @@ class HierarchyPainter extends BasePainter {
33083307
promise = this.openJsonFile(jsonarr.shift());
33093308
else if (filesarr.length > 0)
33103309
promise = this.openRootFile(filesarr.shift());
3311-
else if ((localfile !== null) && isFunc(this.selectLocalFile)) {
3312-
localfile = null; promise = this.selectLocalFile();
3313-
} else if (expanditems.length > 0)
3310+
else if (expanditems.length > 0)
33143311
promise = this.expandItem(expanditems.shift());
33153312
else if (style.length > 0)
33163313
promise = this.applyStyle(style.shift());
@@ -3504,8 +3501,6 @@ class HierarchyPainter extends BasePainter {
35043501
});
35053502
});
35063503

3507-
let localfile_read_callback = null;
3508-
35093504
if (!this.is_online && !this.no_select) {
35103505

35113506
this.readSelectedFile = function() {
@@ -3531,28 +3526,14 @@ class HierarchyPainter extends BasePainter {
35313526
});
35323527

35333528
main.select('.gui_localFile').on('change', evnt => {
3534-
let files = evnt.target.files, promises = [];
3529+
let files = evnt.target.files;
35353530

35363531
for (let n = 0; n < files.length; ++n) {
35373532
let f = files[n];
35383533
main.select('.gui_urlToLoad').property('value', f.name);
3539-
promises.push(this.openRootFile(f));
3534+
this.openRootFile(f);
35403535
}
3541-
3542-
Promise.all(promises).then(() => {
3543-
if (localfile_read_callback) {
3544-
localfile_read_callback();
3545-
localfile_read_callback = null;
3546-
}
3547-
});
35483536
});
3549-
3550-
this.selectLocalFile = async function() {
3551-
return new Promise(resolveFunc => {
3552-
localfile_read_callback = resolveFunc;
3553-
main.select('.gui_localFile').node().click();
3554-
});
3555-
};
35563537
}
35573538

35583539
let layout = main.select('.gui_layout');

0 commit comments

Comments
 (0)