Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jupyter-openbis-gui-widget
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
openbis
openbis-public
jupyter
jupyter-openbis-gui-widget
Commits
be57f2b8
Commit
be57f2b8
authored
6 years ago
by
Swen Vermeul
Browse files
Options
Downloads
Patches
Plain Diff
added general/filelist endpoint which returns all (visible) files in current working directory
parent
2d7f9b2a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jupyter-openbis-extension/server.py
+42
-7
42 additions, 7 deletions
jupyter-openbis-extension/server.py
with
42 additions
and
7 deletions
jupyter-openbis-extension/server.py
+
42
−
7
View file @
be57f2b8
...
...
@@ -69,6 +69,15 @@ def load_jupyter_server_extension(nb_server_app):
host_pattern
=
'
.*$
'
base_url
=
web_app
.
settings
[
'
base_url
'
]
# get the file list
web_app
.
add_handlers
(
host_pattern
,
[(
url_path_join
(
base_url
,
'
/general/filelist
'
),
FileListHandler
)]
)
# DataSet download
web_app
.
add_handlers
(
host_pattern
,
...
...
@@ -81,10 +90,7 @@ def load_jupyter_server_extension(nb_server_app):
# DataSet upload
web_app
.
add_handlers
(
host_pattern
,
[(
url_path_join
(
base_url
,
'
/openbis/dataset/(?P<connection_name>.*)
'
),
url_path_join
(
base_url
,
'
/openbis/dataset/(?P<connection_name>.*)
'
),
DataSetUploadHandler
)]
)
...
...
@@ -93,9 +99,7 @@ def load_jupyter_server_extension(nb_server_app):
web_app
.
add_handlers
(
host_pattern
,
[(
url_path_join
(
base_url
,
'
/openbis/datasetTypes/(?P<connection_name>.*)
'
url_path_join
(
base_url
,
'
/openbis/datasetTypes/(?P<connection_name>.*)
'
),
DataSetTypesHandler
)]
...
...
@@ -352,6 +356,37 @@ class SampleHandler(IPythonHandler):
})
class
FileListHandler
(
IPythonHandler
):
def
get
(
self
,
**
params
):
"""
Returns the file list of the current working directory
:param params:
:return: dictionary of files, key is the fully qualified name,
value is the relative name (for display)
"""
cwd
=
os
.
getcwd
()
files
=
{}
for
(
dirpath
,
dirnames
,
filenames
)
in
os
.
walk
(
cwd
):
if
filenames
:
for
filename
in
filenames
:
# ignore hidden files
if
filename
.
startswith
(
'
.
'
):
continue
# ignore hidden folders
if
os
.
path
.
relpath
(
dirpath
)
!=
'
.
'
\
and
os
.
path
.
relpath
(
dirpath
).
startswith
(
'
.
'
):
continue
fqn
=
os
.
path
.
join
(
dirpath
,
filename
)
files
[
fqn
]
=
os
.
path
.
relpath
(
fqn
,
cwd
)
self
.
set_status
(
200
)
self
.
write
({
"
files
"
:
files
})
class
DataSetDownloadHandler
(
IPythonHandler
):
"""
Handle the requests for /openbis/dataset/connection/permId
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment