Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gy4443
chemotion_eln_server
Commits
8cebf9cc
Commit
8cebf9cc
authored
Oct 13, 2015
by
Marco Sehrer
Browse files
Extract Element base class for element models
parent
88503672
Changes
8
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/components/ReactionDetails.js
View file @
8cebf9cc
...
...
@@ -81,7 +81,7 @@ export default class ReactionDetails extends Component {
};
const
submitLabel
=
(
reaction
&&
reaction
.
isNew
)
?
"
Create
"
:
"
Save
"
;
return
(
<
Panel
header
=
"
Reaction Details
"
bsStyle
=
{
reaction
.
e
dited
?
'
info
'
:
'
primary
'
}
>
<
Panel
header
=
"
Reaction Details
"
bsStyle
=
{
reaction
.
isE
dited
?
'
info
'
:
'
primary
'
}
>
<
Row
>
<
Col
md
=
{
3
}
>
<
h3
>
{
reaction
.
name
}
<
/h3
>
...
...
app/assets/javascripts/components/models/Element.js
0 → 100644
View file @
8cebf9cc
import
sha256
from
'
sha256
'
;
import
_
from
'
lodash
'
;
export
default
class
Element
{
constructor
(
args
)
{
Object
.
assign
(
this
,
args
);
this
.
_checksum
=
this
.
checksum
();
}
get
isEdited
()
{
return
this
.
_checksum
!=
this
.
checksum
();
}
checksum
()
{
return
sha256
(
JSON
.
stringify
(
_
.
omit
(
_
.
omit
(
this
,
'
_checksum
'
),
_
.
isEmpty
)));
}
get
isNew
()
{
return
this
.
id
==
'
_new_
'
}
}
app/assets/javascripts/components/models/Molecule.js
View file @
8cebf9cc
ex
port
default
class
Molecule
{
im
port
Element
from
'
./Element
'
;
constructor
(
args
)
{
Object
.
assign
(
this
,
args
);
}
export
default
class
Molecule
extends
Element
{
get
svgPath
()
{
return
this
.
molecule_svg_file
&&
`/images/molecules/
${
this
.
molecule_svg_file
}
`
...
...
app/assets/javascripts/components/models/Reaction.js
View file @
8cebf9cc
import
sha256
from
'
sha256
'
;
import
_
from
'
lodash
'
;
import
Element
from
'
./Element
'
;
import
Sample
from
'
./Sample
'
;
import
Sample
from
'
../models/Sample
'
;
export
default
class
Reaction
{
constructor
(
args
)
{
Object
.
assign
(
this
,
args
);
this
.
_checksum
=
this
.
checksum
();
}
export
default
class
Reaction
extends
Element
{
static
buildEmpty
()
{
return
new
Reaction
({
...
...
@@ -33,18 +26,6 @@ export default class Reaction {
})
}
get
edited
()
{
return
this
.
_checksum
!=
this
.
checksum
();
}
checksum
()
{
return
sha256
(
JSON
.
stringify
(
_
.
omit
(
_
.
omit
(
this
,
'
_checksum
'
),
_
.
isEmpty
)));
}
get
isNew
()
{
return
this
.
id
==
'
_new_
'
}
get
temperature
()
{
return
this
.
_temperature
}
...
...
app/assets/javascripts/components/models/Sample.js
View file @
8cebf9cc
import
uuid
from
'
uuid
'
;
import
Element
from
'
./Element
'
;
import
Molecule
from
'
./Molecule
'
;
export
default
class
Sample
{
constructor
(
args
)
{
Object
.
assign
(
this
,
args
);
}
export
default
class
Sample
extends
Element
{
// methods regarding sharing and sample detail levels
isRestricted
()
{
...
...
app/assets/javascripts/components/models/Screen.js
View file @
8cebf9cc
import
Element
from
'
./Element
'
;
import
Wellplate
from
'
./Wellplate
'
;
export
default
class
Screen
{
constructor
(
args
)
{
Object
.
assign
(
this
,
args
);
}
export
default
class
Screen
extends
Element
{
static
buildEmpty
()
{
return
new
Screen
({
...
...
app/assets/javascripts/components/models/Well.js
View file @
8cebf9cc
ex
port
default
class
Well
{
im
port
Element
from
'
./Element
'
;
constructor
(
args
)
{
Object
.
assign
(
this
,
args
);
}
export
default
class
Well
extends
Element
{
}
app/assets/javascripts/components/models/Wellplate.js
View file @
8cebf9cc
import
Element
from
'
./Element
'
;
import
Well
from
'
./Well
'
;
export
default
class
Wellplate
{
export
default
class
Wellplate
extends
Element
{
constructor
(
args
)
{
Object
.
assign
(
this
,
args
)
;
super
(
args
)
this
.
wells
=
this
.
initWellsWithPosition
(
this
.
wells
,
96
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment