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
9a7c592d
Commit
9a7c592d
authored
5 years ago
by
Swen Vermeul
Browse files
Options
Downloads
Patches
Plain Diff
added convenient file browser
parent
5f9c53b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jupyter-openbis-extension/static/uploadDialog.js
+83
-8
83 additions, 8 deletions
jupyter-openbis-extension/static/uploadDialog.js
with
83 additions
and
8 deletions
jupyter-openbis-extension/static/uploadDialog.js
+
83
−
8
View file @
9a7c592d
...
...
@@ -30,17 +30,18 @@ define([
spinner
.
src
=
""
}
function
get_file_list
(
env
,
container
)
{
var
url
=
env
.
notebook
.
base_url
+
'
general/filelist
'
function
get_file_list
(
env
,
container
,
path
)
{
var
url
=
env
.
notebook
.
base_url
+
'
api/contents
'
if
(
path
!==
""
)
{
url
=
url
+
'
/
'
+
path
}
fetch
(
url
)
.
then
(
function
(
response
)
{
if
(
response
.
ok
)
{
response
.
json
()
.
then
(
function
(
data
){
var
values
=
Object
.
keys
(
data
.
files
)
values
.
sort
()
state
.
fileCheckboxes
=
createSelectTable
(
values
,
container
,
false
,
state
.
selectedFiles
)
state
.
fileCheckboxes
=
createFileTable
(
env
,
data
,
container
,
false
,
state
.
selectedFiles
)
})
}
else
{
...
...
@@ -210,6 +211,80 @@ define([
return
checkboxes
}
function
createFileTable
(
env
,
data
,
container
,
checked
,
overrides
)
{
var
table
=
document
.
createElement
(
"
TABLE
"
)
table
.
className
=
'
table-bordered table-striped table-condensed
'
table
.
style
.
width
=
"
100%
"
var
body
=
table
.
createTBody
()
if
(
data
.
path
!==
""
)
{
var
row
=
body
.
insertRow
()
row
.
insertCell
()
var
iconCell
=
row
.
insertCell
()
iconCell
.
className
=
"
item_icon folder_icon icon-fixed-width
"
var
filenameCell
=
row
.
insertCell
()
filenameCell
.
textContent
=
"
..
"
filenameCell
.
style
.
width
=
"
80%
"
filenameCell
.
onclick
=
function
(){
var
elems
=
data
.
path
.
split
(
'
/
'
)
elems
.
pop
()
get_file_list
(
env
,
container
,
elems
.
join
(
'
/
'
))
}
var
sizeCell
=
row
.
insertCell
()
sizeCell
.
style
.
textAlign
=
"
right
"
sizeCell
.
style
.
width
=
"
15%
"
}
var
checkboxes
=
[]
data
.
content
.
sort
(
(
a
,
b
)
=>
a
.
name
.
localeCompare
(
b
.
name
,
undefined
,
{
sensitivity
:
'
base
'
})
).
forEach
(
file
=>
{
var
row
=
body
.
insertRow
()
var
checkboxCell
=
row
.
insertCell
()
checkboxCell
.
style
.
width
=
"
5%
"
var
iconCell
=
row
.
insertCell
()
var
filenameCell
=
row
.
insertCell
()
filenameCell
.
textContent
=
file
.
name
filenameCell
.
style
.
width
=
"
100%
"
if
(
file
.
type
===
"
directory
"
)
{
iconCell
.
className
=
"
item_icon folder_icon icon-fixed-width
"
filenameCell
.
onclick
=
function
()
{
get_file_list
(
env
,
container
,
file
.
path
)
}
}
else
{
var
checkbox
=
document
.
createElement
(
"
INPUT
"
)
checkbox
.
type
=
"
checkbox
"
checkbox
.
value
=
file
.
path
checkbox
.
checked
=
overrides
.
includes
(
file
.
name
)
?
!
checked
:
checked
checkboxes
.
push
(
checkbox
)
checkboxCell
.
appendChild
(
checkbox
)
if
(
file
.
type
===
"
notebook
"
)
{
iconCell
.
className
=
"
item_icon notebook_icon icon-fixed-width
"
}
else
{
iconCell
.
className
=
"
item_icon file_icon icon-fixed-width
"
}
filenameCell
.
onclick
=
function
()
{
this
.
parentElement
.
firstElementChild
.
firstElementChild
.
checked
=
!
this
.
parentElement
.
firstElementChild
.
firstElementChild
.
checked
}
}
var
sizeCell
=
row
.
insertCell
()
sizeCell
.
textContent
=
file
.
size
sizeCell
.
style
.
textAlign
=
"
right
"
sizeCell
.
style
.
width
=
"
15%
"
})
container
.
innerHTML
=
""
container
.
appendChild
(
table
)
return
checkboxes
}
return
{
help
:
'
upload Notebook and Data to openBIS
'
,
icon
:
'
fa-upload
'
,
...
...
@@ -252,7 +327,7 @@ define([
var
fileListContainer
=
document
.
createElement
(
"
DIV
"
)
fileListContainer
.
style
.
maxHeight
=
"
150px
"
fileListContainer
.
style
.
overflow
=
"
auto
"
get_file_list
(
env
,
fileListContainer
)
get_file_list
(
env
,
fileListContainer
,
""
)
var
inputs
=
document
.
createElement
(
"
DIV
"
)
inputs
.
style
.
marginTop
=
'
10px
'
...
...
@@ -396,4 +471,4 @@ define([
}
}
}
)
\ No newline at end of file
)
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