Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
abd7ad38
Commit
abd7ad38
authored
10 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-983 : PAPER - Annotations on Batch Import
SVN: 32773
parent
46f016f5
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
plasmid/source/core-plugins/newbrowser/1/compatibility/managed.py
+19
-16
19 additions, 16 deletions
...source/core-plugins/newbrowser/1/compatibility/managed.py
with
19 additions
and
16 deletions
plasmid/source/core-plugins/newbrowser/1/compatibility/managed.py
+
19
−
16
View file @
abd7ad38
...
...
@@ -86,22 +86,23 @@ propertyTypes = server.listPropertyTypes(contextOrNull.getSessionToken(), False)
##
## Help Methods
##
def
getAllAnnotableSampleTypes
(
):
def
getAllAnnotableSampleTypes
ForType
(
fromAnnotableType
):
allTypes
=
{};
for
sampleTypeWithAnnotations
in
configuration
:
for
sampleTypeWithAnnotationsForType
in
configuration
[
sampleTypeWithAnnotations
]:
allTypes
[
sampleTypeWithAnnotationsForType
]
=
True
;
if
(
fromAnnotableType
==
None
)
or
(
fromAnnotableType
==
sampleTypeWithAnnotations
):
for
sampleTypeWithAnnotationsForType
in
configuration
[
sampleTypeWithAnnotations
]:
allTypes
[
sampleTypeWithAnnotationsForType
]
=
True
;
return
allTypes
;
def
getPropertyTypesForSampleType
IgnoringCurrent
Type
(
sampleTypeCodeToFind
):
def
getPropertyTypesForSampleType
FromAnnotable
Type
(
sampleTypeCodeToFind
,
fromAnnotableType
):
for
sampleTypeWithAnnotations
in
configuration
:
for
sampleTypeWithAnnotationsForType
in
configuration
[
sampleTypeWithAnnotations
]:
if
sampleTypeWithAnnotationsForType
==
sampleTypeCodeToFind
:
return
configuration
[
sampleTypeWithAnnotations
][
sampleTypeWithAnnotationsForType
];
if
(
fromAnnotableType
==
None
)
or
(
fromAnnotableType
==
sampleTypeWithAnnotations
):
for
sampleTypeWithAnnotationsForType
in
configuration
[
sampleTypeWithAnnotations
]:
if
sampleTypeWithAnnotationsForType
==
sampleTypeCodeToFind
:
return
configuration
[
sampleTypeWithAnnotations
][
sampleTypeWithAnnotationsForType
];
return
None
;
def
getPropertyType
(
propertyTypeCode
):
print
"
Searching property type:
"
+
propertyTypeCode
for
propertyType
in
propertyTypes
:
if
propertyType
.
code
==
propertyTypeCode
:
return
propertyType
...
...
@@ -113,7 +114,7 @@ def createAnnotationsFor(permId, annotations):
newAnnotation
.
addAttribute
(
annotation
,
annotations
[
annotation
])
return
newAnnotation
def
getWidgetForAdd
(
sampleTypeCode
):
def
getWidgetForAdd
(
sampleTypeCode
,
annotableType
):
widgets
=
[]
widgetPermId
=
inputWidgetFactory
().
createTextInputField
(
"
permId
"
)
\
.
setMandatory
(
True
)
\
...
...
@@ -125,10 +126,10 @@ def getWidgetForAdd(sampleTypeCode):
.
setValue
(
""
)
\
.
setDescription
(
""
)
widgets
.
append
(
widgetCode
)
for
propertyTypeCode
in
getPropertyTypesForSampleType
IgnoringCurrent
Type
(
sampleTypeCode
):
for
propertyTypeCode
in
getPropertyTypesForSampleType
FromAnnotable
Type
(
sampleTypeCode
,
annotableType
):
propertyType
=
getPropertyType
(
propertyTypeCode
)
widget
=
inputWidgetFactory
().
createTextInputField
(
propertyType
.
label
)
\
.
setMandatory
(
getPropertyTypesForSampleType
IgnoringCurrent
Type
(
sampleTypeCode
)[
propertyTypeCode
])
\
.
setMandatory
(
getPropertyTypesForSampleType
FromAnnotable
Type
(
sampleTypeCode
,
annotableType
)[
propertyTypeCode
])
\
.
setValue
(
""
)
\
.
setDescription
(
propertyType
.
description
)
widgets
.
append
(
widget
)
...
...
@@ -141,13 +142,14 @@ def isValid(dataType, value):
## Help Methods
##
def
configureUI
():
annotableType
=
None
# Add Headers
tableBuilder
=
createTableBuilder
()
tableBuilder
.
addHeader
(
"
permId
"
)
tableBuilder
.
addHeader
(
"
code
"
)
usedTableHeaders
=
{
"
permId
"
:
True
,
"
code
"
:
True
}
for
sampleTypeCode
in
getAllAnnotableSampleTypes
(
):
for
propertyTypeCode
in
getPropertyTypesForSampleType
IgnoringCurrent
Type
(
sampleTypeCode
):
for
sampleTypeCode
in
getAllAnnotableSampleTypes
ForType
(
annotableType
):
for
propertyTypeCode
in
getPropertyTypesForSampleType
FromAnnotable
Type
(
sampleTypeCode
,
annotableType
):
if
propertyTypeCode
not
in
usedTableHeaders
:
tableBuilder
.
addHeader
(
propertyTypeCode
)
usedTableHeaders
[
propertyTypeCode
]
=
True
...
...
@@ -164,10 +166,10 @@ def configureUI():
row
.
setCell
(
annotation
,
sample
.
getAttribute
(
annotation
))
# Add Create buttons
for
sampleTypeCode
in
getAllAnnotableSampleTypes
(
):
for
sampleTypeCode
in
getAllAnnotableSampleTypes
ForType
(
annotableType
):
title
=
"
Add
"
+
sampleTypeCode
;
addAction
=
uiDescription
.
addTableAction
(
title
).
setDescription
(
title
)
widgets
=
getWidgetForAdd
(
sampleTypeCode
)
widgets
=
getWidgetForAdd
(
sampleTypeCode
,
annotableType
)
addAction
.
addInputWidgets
(
widgets
)
# Add Delete button
...
...
@@ -176,6 +178,7 @@ def configureUI():
deleteAction
.
setRowSelectionRequired
()
# Delete is enabled when at least 1 row is selected.
def
updateFromUI
(
action
):
annotableType
=
None
converter
=
propertyConverter
()
elements
=
list
(
converter
.
convertToElements
(
property
))
...
...
@@ -183,7 +186,7 @@ def updateFromUI(action):
sampleTypeCode
=
action
.
name
[
4
:]
permId
=
action
.
getInputValue
(
"
permId
"
)
annotations
=
{}
for
propertyTypeCode
in
getPropertyTypesForSampleType
IgnoringCurrent
Type
(
sampleTypeCode
):
for
propertyTypeCode
in
getPropertyTypesForSampleType
FromAnnotable
Type
(
sampleTypeCode
,
annotableType
):
propertyType
=
getPropertyType
(
propertyTypeCode
)
propertyTypeValue
=
action
.
getInputValue
(
propertyType
.
label
)
if
not
isValid
(
propertyType
.
dataType
,
propertyTypeValue
):
...
...
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