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
be779c04
Commit
be779c04
authored
6 years ago
by
anttil
Browse files
Options
Downloads
Patches
Plain Diff
Remember dataset type, sample identifier and property values of each dataset type in upload dialog
parent
94989f52
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jupyter-openbis-extension/static/state.js
+4
-1
4 additions, 1 deletion
jupyter-openbis-extension/static/state.js
jupyter-openbis-extension/static/uploadDIalog.js
+52
-14
52 additions, 14 deletions
jupyter-openbis-extension/static/uploadDIalog.js
with
56 additions
and
15 deletions
jupyter-openbis-extension/static/state.js
+
4
−
1
View file @
be779c04
...
...
@@ -4,7 +4,10 @@ define([],
connection
:
{
name
:
null
,
candidateName
:
null
}
},
uploadDataSetType
:
null
,
uploadDataSetTypes
:
{},
uploadEntityIdentifier
:
''
}
}
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
jupyter-openbis-extension/static/uploadDIalog.js
+
52
−
14
View file @
be779c04
...
...
@@ -39,15 +39,26 @@ define([
if
(
response
.
ok
)
{
response
.
json
()
.
then
(
function
(
data
)
{
//console.log(data.dataSetTypes)
var
change_input_fields
=
function
()
{
hideSpinner
()
cleanErrors
()
var
oldType
=
state
.
uploadDataSetType
if
(
oldType
!=
null
&&
!
(
oldType
in
state
.
uploadDataSetTypes
))
{
state
.
uploadDataSetTypes
[
oldType
]
=
{}
}
state
.
uploadDataSetType
=
dataset_types
.
options
[
dataset_types
.
selectedIndex
].
value
// remove existing input fields
while
(
input_fields
.
firstChild
)
{
input_fields
.
removeChild
(
input_fields
.
firstChild
)
var
element
=
input_fields
.
firstChild
if
(
element
.
nodeName
===
"
INPUT
"
&&
state
.
uploadDataSetType
!=
null
)
{
state
.
uploadDataSetTypes
[
oldType
][
element
.
name
]
=
element
.
value
}
input_fields
.
removeChild
(
element
)
}
// for every property assignment, create an input field.
...
...
@@ -63,6 +74,12 @@ define([
input_field
.
size
=
90
input_field
.
style
.
width
=
"
100%
"
var
mem
=
state
.
uploadDataSetTypes
[
dts
[
dataset_types
.
selectedIndex
].
code
]
if
(
mem
==
null
)
{
mem
=
{}
}
input_field
.
value
=
pa
.
code
in
mem
?
mem
[
pa
.
code
]
:
""
input_fields
.
appendChild
(
input_title
)
input_fields
.
appendChild
(
input_error
)
input_fields
.
appendChild
(
input_field
)
...
...
@@ -76,12 +93,21 @@ define([
while
(
dataset_types
.
firstChild
)
{
dataset_types
.
removeChild
(
dataset_types
.
firstChild
);
}
var
index
=
0
var
selectedIndex
=
-
1
for
(
dt
of
dts
)
{
var
option
=
document
.
createElement
(
"
OPTION
"
)
option
.
value
=
dt
.
code
option
.
textContent
=
dt
.
description
?
dt
.
code
+
"
:
"
+
dt
.
description
:
dt
.
code
dataset_types
.
appendChild
(
option
)
if
(
dt
.
code
===
state
.
uploadDataSetType
)
{
selectedIndex
=
index
}
index
++
}
dataset_types
.
selectedIndex
=
selectedIndex
===
-
1
?
0
:
selectedIndex
// change the input fields, since we just received new datasetTypes
change_input_fields
()
...
...
@@ -130,7 +156,7 @@ define([
sampleIdentifier
.
type
=
"
text
"
sampleIdentifier
.
name
=
'
sampleIdentifier
'
sampleIdentifier
.
placeholder
=
"
Sample Identifier or permId
"
sampleIdentifier
.
value
=
''
sampleIdentifier
.
value
=
state
.
uploadEntityIdentifier
sampleIdentifier
.
size
=
"
90
"
sampleIdentifier
.
style
.
width
=
"
100%
"
...
...
@@ -159,6 +185,16 @@ define([
var
uploadDialogBox
=
$
(
'
<div/>
'
).
append
(
inputs
)
function
saveState
()
{
state
.
uploadDataSetTypes
[
state
.
uploadDataSetType
]
=
{}
for
(
element
of
input_fields
.
children
)
{
if
(
element
.
nodeName
===
"
INPUT
"
&&
state
.
uploadDataSetType
!=
null
)
{
state
.
uploadDataSetTypes
[
state
.
uploadDataSetType
][
element
.
name
]
=
element
.
value
}
}
state
.
uploadEntityIdentifier
=
sampleIdentifier
.
value
}
function
onOk
()
{
var
connection_name
=
state
.
connection
.
name
...
...
@@ -199,6 +235,7 @@ define([
data
:
JSON
.
stringify
(
dataSetInfo
),
contentType
:
'
application/json
'
,
success
:
function
(
data
)
{
saveState
()
$
(
'
div.modal
'
).
remove
()
$
(
'
div.modal-backdrop
'
).
remove
()
common
.
createFeedback
(
'
success
'
,
data
.
statusText
)
...
...
@@ -219,22 +256,16 @@ define([
if
(
"
errors
"
in
data
.
responseJSON
)
{
var
errors
=
data
.
responseJSON
.
errors
for
(
error
of
errors
)
{
let
key
,
value
Object
.
keys
(
error
).
forEach
(
k
=>
{
key
=
k
value
=
error
[
k
]
})
var
element
;
if
(
key
in
errorElements
)
{
element
=
errorElements
[
key
]
}
else
{
element
=
errorElements
[
'
main
'
]
}
element
.
textContent
=
element
.
textContent
.
concat
(
value
)
errorElements
[
key
in
errorElements
?
key
:
"
main
"
].
textContent
=
value
}
}
else
{
errorElements
[
"
main
"
].
textContent
=
"
Server error
"
}
}
}
...
...
@@ -245,6 +276,11 @@ define([
return
false
}
function
onCancel
()
{
saveState
()
return
true
}
if
(
IPython
.
notebook
.
dirty
===
true
)
{
dialog
.
modal
({
body
:
'
Please save the notebook before uploading it to openBIS.
'
,
...
...
@@ -260,7 +296,9 @@ define([
body
:
uploadDialogBox
,
title
:
'
Upload openBIS DataSet
'
,
buttons
:
{
'
Cancel
'
:
{},
'
Cancel
'
:
{
click
:
onCancel
},
'
Upload
'
:
{
class
:
'
btn-primary btn-large
'
,
click
:
onOk
...
...
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