-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseConnectionModel.js
44 lines (43 loc) · 1.2 KB
/
BaseConnectionModel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { getParent, types } from 'mobx-state-tree'
export default pluginManager => {
return types
.model('Connection', {
name: types.identifier,
tracks: types.array(pluginManager.pluggableConfigSchemaType('track')),
sequence:
pluginManager.elementTypes.track.ReferenceSequenceTrack.configSchema,
defaultSequence: false,
})
.views(self => ({
get assemblyConf() {
let configParent = self.configuration
do {
configParent = getParent(configParent)
} while (!configParent.assembly)
return configParent.assembly
},
}))
.actions(self => ({
afterAttach() {
self.connect()
},
addTrackConf(trackConf) {
const length = self.tracks.push(trackConf)
return self.tracks[length - 1]
},
setTrackConfs(trackConfs) {
self.tracks = trackConfs
return self.track
},
setSequence(sequenceConf) {
self.sequence = sequenceConf
return self.sequence
},
setDefaultSequence(isDefault) {
self.defaultSequence = isDefault
},
// connect(connectionConf) {
// // Add assemblies and tracks here
// },
}))
}