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
7951a9d0
Commit
7951a9d0
authored
10 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-110: Annotations Support
SVN: 31419
parent
19e56944
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
plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js
+40
-27
40 additions, 27 deletions
...s/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js
with
40 additions
and
27 deletions
plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SampleLinksWidget.js
+
40
−
27
View file @
7951a9d0
...
...
@@ -40,6 +40,37 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
this
.
_lastUsedId
=
null
;
this
.
_lastIndex
=
0
;
this
.
_writeState
=
function
(
permId
,
propertyTypeCode
,
propertyTypeValue
)
{
this
.
_readState
();
var
sampleTypeAnnotations
=
this
.
stateObj
[
permId
];
if
(
!
sampleTypeAnnotations
)
{
sampleTypeAnnotations
=
{};
this
.
stateObj
[
permId
]
=
sampleTypeAnnotations
;
}
if
(
propertyTypeValue
===
null
)
{
delete
this
.
stateObj
[
permId
];
}
else
{
sampleTypeAnnotations
[
propertyTypeCode
]
=
propertyTypeValue
;
}
$
(
"
#ANNOTATIONS_STATE
"
).
val
(
JSON
.
stringify
(
this
.
stateObj
));
}
this
.
_readState
=
function
()
{
var
stateField
=
$
(
"
#ANNOTATIONS_STATE
"
);
if
(
stateField
.
length
===
0
)
{
Util
.
showError
(
"
You need a property with code ANNOTATIONS_STATE on this entity to store the state of the annotations.
"
);
}
else
{
//Hide State Field
var
fieldset
=
stateField
.
parent
().
parent
().
parent
();
fieldset
.
hide
();
//Update Values
this
.
stateObj
=
JSON
.
parse
((
!
stateField
.
val
())?
"
{}
"
:
stateField
.
val
());
}
}
this
.
_getDefaultSampleHint
=
function
(
sampleTypeCode
)
{
var
defaultMinCount
=
0
;
var
defaultProperties
=
[];
...
...
@@ -139,17 +170,11 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
$propertyField
.
attr
(
"
property-type-code
"
,
annotations
[
i
][
"
TYPE
"
]);
$propertyField
.
prop
(
"
disabled
"
,
true
);
$propertyField
.
change
(
function
()
{
var
samplePermId
=
_this
.
samples
[
sampleId
].
permId
;
var
field
=
$
(
this
);
var
sampleTypeAnnotations
=
_this
.
stateObj
[
samplePermId
];
if
(
!
sampleTypeAnnotations
)
{
sampleTypeAnnotations
=
{};
_this
.
stateObj
[
samplePermId
]
=
sampleTypeAnnotations
;
}
sampleTypeAnnotations
[
field
.
attr
(
"
property-type-code
"
)]
=
field
.
val
();
$
(
"
#ANNOTATIONS_STATE
"
).
val
(
JSON
.
stringify
(
_this
.
stateObj
));
var
$field
=
$
(
this
);
var
permId
=
_this
.
samples
[
sampleId
].
permId
;
var
propertyTypeCode
=
$field
.
attr
(
"
property-type-code
"
);
var
propertyTypeValue
=
$field
.
val
();
_this
.
_writeState
(
permId
,
propertyTypeCode
,
propertyTypeValue
);
});
$controls
.
append
(
propertyType
.
label
+
"
:
"
);
...
...
@@ -259,17 +284,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
}
//Initialize annotations from property
var
stateField
=
$
(
"
#ANNOTATIONS_STATE
"
);
if
(
stateField
.
length
===
0
)
{
Util
.
showError
(
"
You need a property with code ANNOTATIONS_STATE on this entity to store the state of the annotations.
"
);
}
else
{
//Hide State Field
var
fieldset
=
stateField
.
parent
().
parent
().
parent
();
fieldset
.
hide
();
//Update Values
this
.
stateObj
=
JSON
.
parse
((
!
stateField
.
val
())?
"
{}
"
:
stateField
.
val
());
}
this
.
_readState
();
//Add sample links to edit
for
(
var
i
=
0
;
i
<
this
.
samplesToEdit
.
length
;
i
++
)
{
...
...
@@ -410,18 +425,16 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
$input
.
append
(
"
Select
"
);
//Remove Link Annotations
var
sampleState
=
this
.
stateObj
[
sample
.
permId
];
var
items
=
$input
.
parent
().
children
();
for
(
var
i
=
0
;
i
<
items
.
length
;
i
++
)
{
var
item
=
$
(
items
[
i
]);
var
propertyTypeCode
=
item
.
attr
(
"
property-type-code
"
);
if
(
propertyTypeCode
&&
sampleState
&&
sampleState
[
propertyTypeCode
]
)
{
if
(
propertyTypeCode
)
{
item
.
val
(
""
);
delete
this
.
stateObj
[
sample
.
permId
];
this
.
_writeState
(
sample
.
permId
,
propertyTypeCode
,
null
);
item
.
prop
(
"
disabled
"
,
true
);
}
item
.
prop
(
"
disabled
"
,
true
);
}
$
(
"
#ANNOTATIONS_STATE
"
).
val
(
JSON
.
stringify
(
this
.
stateObj
));
//Update
this
.
samplesRemoved
[
sampleId
]
=
this
.
samples
[
sampleId
];
...
...
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