@abi-software/mapintegratedvuer 1.17.2 → 1.17.3-simulation.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectivityGraph-BL4B9GZX.js → ConnectivityGraph-9pXPgFJR.js} +2 -2
- package/dist/{ContentMixin-Djmb_gqk.js → ContentMixin-DIqgKIz6.js} +279 -536
- package/dist/Flatmap-D7GVPV7o.js +103422 -0
- package/dist/{Iframe-ByYxT4Yq.js → Iframe-CCEA3d9c.js} +2 -2
- package/dist/{MultiFlatmap-DSkdlRiS.js → MultiFlatmap-Cuke1uNp.js} +3 -3
- package/dist/{Plot-ymkHVq_A.js → Plot-B4oTBVAT.js} +2 -2
- package/dist/{Scaffold-bw7posKm.js → Scaffold-Czz8X5kL.js} +79 -53
- package/dist/Simulation-BKmz8zwm.js +107 -0
- package/dist/{index-CwfUgFL1.js → index-_b4VBGHk.js} +30002 -25408
- package/dist/mapintegratedvuer.js +1 -1
- package/dist/mapintegratedvuer.umd.cjs +4291 -229
- package/dist/style-CM86xE3J.js +119 -0
- package/dist/style.css +1 -1
- package/package.json +10 -5
- package/src/App.vue +285 -258
- package/src/assets/styles.scss +1 -1
- package/src/components/ContextCard.vue +0 -1
- package/src/components/DummyRouteComponent.vue +1 -0
- package/src/components/EventBus.ts +13 -0
- package/src/components/FloatingWindow.vue +142 -0
- package/src/components/MapContent.vue +9 -4
- package/src/components/PlotComponent.vue +56 -0
- package/src/components/SplitDialog.vue +1 -6
- package/src/components/SplitFlow.vue +504 -444
- package/src/components/scripts/utilities.js +1 -1
- package/src/components/viewers/Flatmap.vue +166 -83
- package/src/components/viewers/Simulation.vue +118 -11
- package/src/components.d.ts +3 -0
- package/src/main.js +9 -3
- package/src/mixins/ContentMixin.js +467 -406
- package/src/mixins/DynamicMarkerMixin.js +50 -17
- package/src/services/mapping.js +69 -0
- package/src/services/testData.js +71 -0
- package/src/stores/entries.js +1 -1
- package/src/stores/mapping.js +29 -0
- package/src/stores/settings.js +4 -0
- package/src/stores/simulationPlotStore.js +124 -0
- package/src/stores/splitFlow.js +425 -352
- package/src/types/simulation.js +18 -0
- package/dist/Flatmap-uPEQNDkK.js +0 -202
- package/dist/Simulation-C_gdqDes.js +0 -28
- package/dist/style-Czqe2bTf.js +0 -57
- package/src/components/EventBus.js +0 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="viewer-container">
|
|
2
|
+
<div class="viewer-container" ref="container">
|
|
3
|
+
<resize-sensor @resize="calculateOffset()"> </resize-sensor>
|
|
3
4
|
<FlatmapVuer
|
|
4
5
|
:state="entry.state"
|
|
5
6
|
:entry="entry.resource"
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
:flatmapAPI="flatmapAPI"
|
|
36
37
|
:render="visible"
|
|
37
38
|
:sparcAPI="apiLocation"
|
|
39
|
+
:testDataLocation="testDataLocation"
|
|
38
40
|
:showLocalSettings="showLocalSettings"
|
|
39
41
|
:showOpenMapButton="showOpenMapButton"
|
|
40
42
|
@open-map="openMap"
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
@mapmanager-loaded="onMapmanagerLoaded"
|
|
43
45
|
:showPathwayFilter="false"
|
|
44
46
|
@trackEvent="trackEvent"
|
|
47
|
+
@open-simulation="onSimulationOpen"
|
|
45
48
|
/>
|
|
46
49
|
|
|
47
50
|
<HelpModeDialog
|
|
@@ -52,83 +55,120 @@
|
|
|
52
55
|
@show-next="onHelpModeShowNext"
|
|
53
56
|
@finish-help-mode="onFinishHelpMode"
|
|
54
57
|
/>
|
|
58
|
+
|
|
59
|
+
<FloatingWindow
|
|
60
|
+
v-for="win in plotWindows"
|
|
61
|
+
:key="win.id"
|
|
62
|
+
:windowData="win"
|
|
63
|
+
:offsetX="left"
|
|
64
|
+
:offsetY="top"
|
|
65
|
+
@closeWindow="handleClosePlotWindow"
|
|
66
|
+
@mouseDown="bringToFront"
|
|
67
|
+
>
|
|
68
|
+
<PlotComponent :data="win.data" />
|
|
69
|
+
</FloatingWindow>
|
|
55
70
|
</div>
|
|
56
71
|
</template>
|
|
57
72
|
|
|
58
73
|
<script>
|
|
59
|
-
|
|
60
|
-
import
|
|
61
|
-
import EventBus from "../EventBus";
|
|
62
|
-
import ContentMixin from "../../mixins/ContentMixin";
|
|
63
|
-
import DynamicMarkerMixin from "../../mixins/DynamicMarkerMixin";
|
|
74
|
+
import { ref, markRaw } from 'vue'
|
|
75
|
+
import { useMouseInElement } from '@vueuse/core'
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
import
|
|
77
|
+
/* eslint-disable no-alert, no-console */
|
|
78
|
+
import Tagging from '../../services/tagging.js'
|
|
79
|
+
import EventBus from '../EventBus'
|
|
80
|
+
import ContentMixin from '../../mixins/ContentMixin'
|
|
81
|
+
import DynamicMarkerMixin from '../../mixins/DynamicMarkerMixin'
|
|
82
|
+
import ResizeSensor from '../ResizeSensor.vue'
|
|
83
|
+
import { FlatmapVuer } from '@abi-software/flatmapvuer'
|
|
84
|
+
import '@abi-software/flatmapvuer/dist/style.css'
|
|
67
85
|
import { HelpModeDialog } from '@abi-software/map-utilities'
|
|
68
86
|
import '@abi-software/map-utilities/dist/style.css'
|
|
87
|
+
import { useSimulationPlotStore } from '../../stores/simulationPlotStore'
|
|
88
|
+
import { retrieveProtocolData } from '../../services/testData.js';
|
|
89
|
+
|
|
90
|
+
import PlotComponent from '../PlotComponent.vue'
|
|
91
|
+
import FloatingWindow from '../FloatingWindow.vue'
|
|
92
|
+
import { useMappingStore } from '../../stores/mapping'
|
|
93
|
+
|
|
94
|
+
const BASE_Z_INDEX = 100
|
|
69
95
|
|
|
70
96
|
export default {
|
|
71
|
-
name:
|
|
72
|
-
mixins: [
|
|
97
|
+
name: 'Flatmap',
|
|
98
|
+
mixins: [ContentMixin, DynamicMarkerMixin],
|
|
73
99
|
components: {
|
|
74
100
|
FlatmapVuer,
|
|
75
101
|
HelpModeDialog,
|
|
102
|
+
ResizeSensor,
|
|
103
|
+
},
|
|
104
|
+
setup() {
|
|
105
|
+
// const flatmap = ref(null)
|
|
106
|
+
const container = ref(null)
|
|
107
|
+
const simulationPlotStore = useSimulationPlotStore()
|
|
108
|
+
const mappingStore = useMappingStore()
|
|
109
|
+
mappingStore.initializeMapping()
|
|
110
|
+
const { elementX, elementY } = useMouseInElement(container)
|
|
111
|
+
return { container, elementX, elementY, mappingStore, simulationPlotStore }
|
|
76
112
|
},
|
|
77
113
|
data: function () {
|
|
78
114
|
return {
|
|
79
115
|
flatmapReady: false,
|
|
80
116
|
displayMinimap: false,
|
|
117
|
+
protocolData: undefined,
|
|
118
|
+
zStack: [],
|
|
119
|
+
left: 0,
|
|
120
|
+
top: 0,
|
|
81
121
|
}
|
|
82
122
|
},
|
|
83
123
|
methods: {
|
|
84
124
|
getState: function () {
|
|
85
|
-
return this.$refs.flatmap.getState()
|
|
125
|
+
return this.$refs.flatmap.getState()
|
|
86
126
|
},
|
|
87
127
|
/**
|
|
88
128
|
* Perform a local search on this contentvuer
|
|
89
129
|
* This is similar to directly clicking onthe map
|
|
90
130
|
*/
|
|
91
131
|
search: function (term) {
|
|
92
|
-
return this.$refs.flatmap.searchAndShowResult(term, true, true)
|
|
132
|
+
return this.$refs.flatmap.searchAndShowResult(term, true, true)
|
|
93
133
|
},
|
|
94
134
|
getFlatmapImp() {
|
|
95
|
-
return this.$refs.flatmap?.mapImp
|
|
135
|
+
return this.$refs.flatmap?.mapImp
|
|
96
136
|
},
|
|
97
137
|
contextRestored(flatmap) {
|
|
98
|
-
this.flatmapReadyForMarkerUpdates(flatmap)
|
|
99
|
-
this.updateViewerSettings()
|
|
138
|
+
this.flatmapReadyForMarkerUpdates(flatmap)
|
|
139
|
+
this.updateViewerSettings()
|
|
100
140
|
},
|
|
101
141
|
flatmapReadyCall: function (flatmap) {
|
|
102
|
-
this.flatmapReady = true
|
|
103
|
-
const mapImp = this.getFlatmapImp()
|
|
142
|
+
this.flatmapReady = true
|
|
143
|
+
const mapImp = this.getFlatmapImp()
|
|
104
144
|
if (mapImp?.mapMetadata?.name) {
|
|
105
|
-
this.updateEntryLabel(mapImp?.mapMetadata?.name)
|
|
106
|
-
this.updateEntryTitle(mapImp?.mapMetadata?.name)
|
|
145
|
+
this.updateEntryLabel(mapImp?.mapMetadata?.name)
|
|
146
|
+
this.updateEntryTitle(mapImp?.mapMetadata?.name)
|
|
107
147
|
}
|
|
108
|
-
let provClone = {id: this.entry.id, prov: mapImp.mapMetadata}
|
|
109
|
-
EventBus.emit(
|
|
110
|
-
this.$emit(
|
|
111
|
-
this.flatmapReadyForMarkerUpdates(flatmap)
|
|
112
|
-
this.updateViewerSettings()
|
|
148
|
+
let provClone = { id: this.entry.id, prov: mapImp.mapMetadata } //create clone of provenance and add id
|
|
149
|
+
EventBus.emit('mapImpProv', provClone) // send clone to context card
|
|
150
|
+
this.$emit('flatmap-provenance-ready', provClone)
|
|
151
|
+
this.flatmapReadyForMarkerUpdates(flatmap)
|
|
152
|
+
this.updateViewerSettings()
|
|
113
153
|
// Wait for flatmap's connectivity to load before emitting mapLoaded
|
|
114
154
|
this.loadConnectivityExplorerConfig(flatmap).then(() => {
|
|
115
|
-
EventBus.emit(
|
|
116
|
-
})
|
|
155
|
+
EventBus.emit('mapLoaded', flatmap)
|
|
156
|
+
})
|
|
117
157
|
},
|
|
118
158
|
onPathwaySelectionChanged: function (data) {
|
|
119
|
-
const { label, property, checked, selectionsTitle } = data
|
|
159
|
+
const { label, property, checked, selectionsTitle } = data
|
|
120
160
|
// GA Tagging
|
|
121
161
|
// Event tracking for maps' pathway selection change
|
|
122
162
|
Tagging.sendEvent({
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
163
|
+
event: 'interaction_event',
|
|
164
|
+
event_name: 'portal_maps_pathway_change',
|
|
165
|
+
category: label + ' [' + property + '] ' + checked,
|
|
166
|
+
location: selectionsTitle,
|
|
167
|
+
})
|
|
128
168
|
},
|
|
129
|
-
onSidebarAnnotationClose: function() {
|
|
169
|
+
onSidebarAnnotationClose: function () {
|
|
130
170
|
if (this.flatmapReady) {
|
|
131
|
-
const currentFlatmap = this.$refs.flatmap
|
|
171
|
+
const currentFlatmap = this.$refs.flatmap
|
|
132
172
|
if (currentFlatmap) {
|
|
133
173
|
this.$refs.flatmap.annotationEventCallback({}, { type: 'aborted' })
|
|
134
174
|
}
|
|
@@ -139,117 +179,160 @@ export default {
|
|
|
139
179
|
*/
|
|
140
180
|
searchSuggestions: function (term, suggestions) {
|
|
141
181
|
if (term && this.$refs.flatmap.mapImp) {
|
|
142
|
-
const results = this.$refs.flatmap.mapImp.search(term)
|
|
143
|
-
const featureIds = results.__featureIds || results.featureIds
|
|
144
|
-
featureIds.forEach(id => {
|
|
145
|
-
const annotation = this.$refs.flatmap.mapImp.annotation(id)
|
|
146
|
-
if (annotation && annotation.label)
|
|
147
|
-
|
|
148
|
-
});
|
|
182
|
+
const results = this.$refs.flatmap.mapImp.search(term)
|
|
183
|
+
const featureIds = results.__featureIds || results.featureIds
|
|
184
|
+
featureIds.forEach((id) => {
|
|
185
|
+
const annotation = this.$refs.flatmap.mapImp.annotation(id)
|
|
186
|
+
if (annotation && annotation.label) suggestions.push(annotation.label)
|
|
187
|
+
})
|
|
149
188
|
}
|
|
150
189
|
},
|
|
151
190
|
showConnectivity: function (payload) {
|
|
152
191
|
if (this?.alive) {
|
|
153
|
-
const { featureIds, offset } = payload
|
|
154
|
-
const currentFlatmap = this.$refs.flatmap
|
|
192
|
+
const { featureIds, offset } = payload
|
|
193
|
+
const currentFlatmap = this.$refs.flatmap
|
|
155
194
|
if (currentFlatmap) {
|
|
156
195
|
currentFlatmap.moveMap(featureIds, {
|
|
157
196
|
offsetX: offset ? -150 : 0,
|
|
158
197
|
zoom: 4,
|
|
159
|
-
})
|
|
198
|
+
})
|
|
160
199
|
}
|
|
161
200
|
}
|
|
162
201
|
},
|
|
163
202
|
showConnectivityTooltips: function (payload) {
|
|
164
203
|
if (this?.alive && this.flatmapReady) {
|
|
165
|
-
const flatmap = this.$refs.multiflatmap.getCurrentFlatmap()
|
|
166
|
-
flatmap.showConnectivityTooltips(payload)
|
|
204
|
+
const flatmap = this.$refs.multiflatmap.getCurrentFlatmap()
|
|
205
|
+
flatmap.showConnectivityTooltips(payload)
|
|
167
206
|
}
|
|
168
207
|
},
|
|
169
208
|
showConnectivitiesByReference: function (payload) {
|
|
170
209
|
if (this?.alive) {
|
|
171
|
-
const currentFlatmap = this.$refs.flatmap
|
|
210
|
+
const currentFlatmap = this.$refs.flatmap
|
|
172
211
|
if (currentFlatmap) {
|
|
173
|
-
currentFlatmap.showConnectivitiesByReference(payload)
|
|
212
|
+
currentFlatmap.showConnectivitiesByReference(payload)
|
|
174
213
|
}
|
|
175
214
|
}
|
|
176
215
|
},
|
|
177
216
|
changeConnectivitySource: function (payload, ongoingSource) {
|
|
178
217
|
if (this?.alive && this.flatmapReady) {
|
|
179
|
-
const flatmap = this.$refs.flatmap
|
|
180
|
-
const flatmapUUID = flatmap.mapImp.mapMetadata.uuid
|
|
218
|
+
const flatmap = this.$refs.flatmap
|
|
219
|
+
const flatmapUUID = flatmap.mapImp.mapMetadata.uuid
|
|
181
220
|
if (!ongoingSource.includes(flatmapUUID)) {
|
|
182
|
-
ongoingSource.push(flatmapUUID)
|
|
183
|
-
flatmap.changeConnectivitySource(payload)
|
|
221
|
+
ongoingSource.push(flatmapUUID)
|
|
222
|
+
flatmap.changeConnectivitySource(payload)
|
|
184
223
|
}
|
|
185
224
|
}
|
|
186
225
|
},
|
|
187
|
-
zoomToFeatures: function(info, forceSelect) {
|
|
188
|
-
let name = info.name
|
|
189
|
-
const flatmap = this.$refs.flatmap.mapImp
|
|
226
|
+
zoomToFeatures: function (info, forceSelect) {
|
|
227
|
+
let name = info.name
|
|
228
|
+
const flatmap = this.$refs.flatmap.mapImp
|
|
190
229
|
if (name) {
|
|
191
|
-
const results = flatmap.search(name)
|
|
230
|
+
const results = flatmap.search(name)
|
|
192
231
|
if (results.featureIds.length) {
|
|
193
|
-
let externalId = flatmap.modelForFeature(results.featureIds[0])
|
|
232
|
+
let externalId = flatmap.modelForFeature(results.featureIds[0])
|
|
194
233
|
if (externalId) {
|
|
195
234
|
if (forceSelect) {
|
|
196
|
-
flatmap.selectFeatures(externalId)
|
|
235
|
+
flatmap.selectFeatures(externalId)
|
|
197
236
|
}
|
|
198
|
-
flatmap.zoomToFeatures(externalId)
|
|
199
|
-
} else flatmap.clearSearchResults()
|
|
237
|
+
flatmap.zoomToFeatures(externalId)
|
|
238
|
+
} else flatmap.clearSearchResults()
|
|
200
239
|
}
|
|
201
240
|
} else {
|
|
202
|
-
flatmap.clearSearchResults()
|
|
241
|
+
flatmap.clearSearchResults()
|
|
203
242
|
}
|
|
204
243
|
},
|
|
205
244
|
changeViewingMode: function (modeName) {
|
|
206
|
-
this.$refs.flatmap.changeViewingMode(modeName)
|
|
245
|
+
this.$refs.flatmap.changeViewingMode(modeName)
|
|
207
246
|
},
|
|
208
247
|
updateViewerSettings: function () {
|
|
209
|
-
const {
|
|
210
|
-
|
|
211
|
-
viewingMode,
|
|
212
|
-
flightPathDisplay,
|
|
213
|
-
organsDisplay,
|
|
214
|
-
outlinesDisplay,
|
|
215
|
-
connectionType,
|
|
216
|
-
} = this.settingsStore.globalSettings;
|
|
248
|
+
const { backgroundDisplay, viewingMode, flightPathDisplay, organsDisplay, outlinesDisplay, connectionType } =
|
|
249
|
+
this.settingsStore.globalSettings
|
|
217
250
|
|
|
218
|
-
const currentFlatmap = this.$refs.flatmap
|
|
251
|
+
const currentFlatmap = this.$refs.flatmap
|
|
219
252
|
|
|
220
|
-
currentFlatmap.changeViewingMode(viewingMode)
|
|
221
|
-
currentFlatmap.setFlightPath3D(flightPathDisplay)
|
|
222
|
-
currentFlatmap.setColour(organsDisplay)
|
|
223
|
-
currentFlatmap.setOutlines(outlinesDisplay)
|
|
224
|
-
currentFlatmap.backgroundChangeCallback(backgroundDisplay)
|
|
225
|
-
currentFlatmap.setConnectionType(connectionType)
|
|
253
|
+
currentFlatmap.changeViewingMode(viewingMode)
|
|
254
|
+
currentFlatmap.setFlightPath3D(flightPathDisplay)
|
|
255
|
+
currentFlatmap.setColour(organsDisplay)
|
|
256
|
+
currentFlatmap.setOutlines(outlinesDisplay)
|
|
257
|
+
currentFlatmap.backgroundChangeCallback(backgroundDisplay)
|
|
258
|
+
currentFlatmap.setConnectionType(connectionType)
|
|
226
259
|
},
|
|
227
260
|
setVisibilityFilter: function (payload) {
|
|
228
261
|
if (this?.alive) {
|
|
229
|
-
const currentFlatmap = this.$refs.flatmap
|
|
262
|
+
const currentFlatmap = this.$refs.flatmap
|
|
230
263
|
if (currentFlatmap) {
|
|
231
|
-
currentFlatmap.setVisibilityFilter(payload)
|
|
264
|
+
currentFlatmap.setVisibilityFilter(payload)
|
|
232
265
|
}
|
|
233
266
|
}
|
|
234
267
|
},
|
|
235
268
|
getKnowledgeTooltip: async function (payload) {
|
|
236
269
|
if (this?.alive) {
|
|
237
|
-
const currentFlatmap = this.$refs.flatmap
|
|
270
|
+
const currentFlatmap = this.$refs.flatmap
|
|
238
271
|
if (currentFlatmap) {
|
|
239
272
|
// This is for expanding connectivity card
|
|
240
273
|
// The length of payload.data should always be 1
|
|
241
|
-
const data = payload.data[0]
|
|
242
|
-
currentFlatmap.searchAndShowResult(data.id, true, false)
|
|
274
|
+
const data = payload.data[0]
|
|
275
|
+
currentFlatmap.searchAndShowResult(data.id, true, false)
|
|
243
276
|
}
|
|
244
277
|
}
|
|
245
278
|
},
|
|
279
|
+
populateProtocolMarkers: function(simulation) {
|
|
280
|
+
if (simulation?.path && this.protocolData) {
|
|
281
|
+
const ids = this.protocolData.reduce((results, item) => {
|
|
282
|
+
if (item.protocol.includes(simulation.path)) {
|
|
283
|
+
if (item.columns) {
|
|
284
|
+
item.columns.forEach((column) =>{
|
|
285
|
+
if (column.anatomic_location) {
|
|
286
|
+
results.push(column.anatomic_location);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return results;
|
|
292
|
+
}, []);
|
|
293
|
+
this.updateProtocolMarkers(this.getFlatmapImp(), ids);
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
onSimulationOpen: async function (simulation) {
|
|
297
|
+
const uuid = this.$refs.flatmap?.mapImp?.mapMetadata?.uuid;
|
|
298
|
+
EventBus.emit('simulation-open-clicked', {...simulation, requesterEntryId: this.entry.id,
|
|
299
|
+
flatmapUUID: uuid})
|
|
300
|
+
if (!this.protocolData) {
|
|
301
|
+
this.protocolData = markRaw(await retrieveProtocolData(this.settingsStore.testDataLocation, uuid));
|
|
302
|
+
}
|
|
303
|
+
this.populateProtocolMarkers(simulation);
|
|
304
|
+
},
|
|
305
|
+
handleClosePlotWindow: function (windowId) {
|
|
306
|
+
this.simulationPlotStore.removeWindow(windowId)
|
|
307
|
+
},
|
|
308
|
+
bringToFront: function (windowId) {
|
|
309
|
+
this.simulationPlotStore.bringToFront(windowId, this.calculateOffset())
|
|
310
|
+
},
|
|
311
|
+
calculateOffset: function () {
|
|
312
|
+
const element = this.$refs.container
|
|
313
|
+
if (!element) return
|
|
314
|
+
const rect = element.getBoundingClientRect()
|
|
315
|
+
this.top = rect.top
|
|
316
|
+
this.left = rect.left
|
|
317
|
+
},
|
|
318
|
+
onResize: function () {
|
|
319
|
+
this.calculateOffset()
|
|
320
|
+
},
|
|
246
321
|
},
|
|
247
322
|
computed: {
|
|
248
323
|
facetSpecies() {
|
|
249
324
|
return this.settingsStore.facets.species;
|
|
250
325
|
},
|
|
326
|
+
plotWindows() {
|
|
327
|
+
const entries = this.simulationPlotStore.windows.filter((win) => win.ownerId === this.entry.id);
|
|
328
|
+
console.log(entries)
|
|
329
|
+
return entries
|
|
330
|
+
},
|
|
331
|
+
testDataLocation() {
|
|
332
|
+
return this.settingsStore.testDataLocation;
|
|
333
|
+
}
|
|
251
334
|
},
|
|
252
|
-
}
|
|
335
|
+
}
|
|
253
336
|
</script>
|
|
254
337
|
|
|
255
338
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
@@ -1,29 +1,136 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<SimulationVuer
|
|
3
3
|
:apiLocation="apiLocation"
|
|
4
|
-
:id="id"
|
|
5
|
-
|
|
4
|
+
:id="id" ref="simulation"
|
|
5
|
+
@data-notification="handleDataNotification"
|
|
6
|
+
@externalData="handleExternalEvent"
|
|
7
|
+
@file="handleFileEvent"
|
|
8
|
+
|
|
6
9
|
/>
|
|
7
10
|
</template>
|
|
8
11
|
|
|
9
12
|
<script>
|
|
10
13
|
/* eslint-disable no-alert, no-console */
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
+
import EventBus from '../EventBus'
|
|
15
|
+
import ContentMixin from '../../mixins/ContentMixin'
|
|
16
|
+
import { SimulationVuer } from '@abi-software/simulationvuer'
|
|
17
|
+
import '@abi-software/simulationvuer/dist/style.css'
|
|
14
18
|
|
|
15
19
|
export default {
|
|
16
|
-
name:
|
|
17
|
-
mixins: [
|
|
20
|
+
name: 'Simulation',
|
|
21
|
+
mixins: [ContentMixin],
|
|
18
22
|
components: {
|
|
19
23
|
SimulationVuer,
|
|
20
24
|
},
|
|
21
25
|
computed: {
|
|
22
|
-
id: function() {
|
|
26
|
+
id: function () {
|
|
23
27
|
//resource field is only available for simulation omex file and it will run locally.
|
|
24
28
|
//discoverId field is used for simulations running on O2SPARC.
|
|
25
|
-
return this.entry.resource ? this.entry.resource: this.entry.discoverId
|
|
29
|
+
return this.entry.resource ? this.entry.resource : this.entry.discoverId
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
data: function () {
|
|
33
|
+
return {
|
|
34
|
+
columns: undefined,
|
|
35
|
+
csv: undefined,
|
|
36
|
+
fileOpened: false,
|
|
26
37
|
}
|
|
27
|
-
}
|
|
28
|
-
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
handleDataNotification: function (update) {
|
|
41
|
+
EventBus.emit('simulation-response', update)
|
|
42
|
+
},
|
|
43
|
+
handleDataRequest(payload) {
|
|
44
|
+
this.processRequest(payload);
|
|
45
|
+
},
|
|
46
|
+
handleExternalEvent(payload) {
|
|
47
|
+
console.log("handleExternalEvent", payload)
|
|
48
|
+
},
|
|
49
|
+
handleFileEvent(payload) {
|
|
50
|
+
if (payload?.type === "opened") {
|
|
51
|
+
this.$nextTick(() => {
|
|
52
|
+
this.fileOpened = true
|
|
53
|
+
if (this.entry.csv_file || this.csv_file) {
|
|
54
|
+
this.addExternalData(
|
|
55
|
+
{
|
|
56
|
+
targetEntryId: this.entry.id,
|
|
57
|
+
action: this.entry
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
handleWindowClosed(payload) {
|
|
65
|
+
this.$refs.simulation?.removeDataSubscription(payload.id);
|
|
66
|
+
},
|
|
67
|
+
processRequest: function (req) {
|
|
68
|
+
// strict check against the literal type
|
|
69
|
+
if (req.id !== 'nz.ac.auckland.simulation-data-request') return
|
|
70
|
+
|
|
71
|
+
const requestMajorVersion = parseInt(req.version.split('.')[0])
|
|
72
|
+
if (requestMajorVersion !== 0) {
|
|
73
|
+
console.warn('Unsupported simulation request version:', req.version)
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (req.payload.protocol?.resource !== this.id) {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.$refs.simulation?.addDataSubscription({
|
|
82
|
+
id: req.id,
|
|
83
|
+
version: req.version,
|
|
84
|
+
payload: {
|
|
85
|
+
windowId: req.payload.windowId,
|
|
86
|
+
ownerId: req.payload.ownerId,
|
|
87
|
+
component: req.payload.component,
|
|
88
|
+
variable: req.payload.variable,
|
|
89
|
+
withVOI: true,
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
},
|
|
93
|
+
addExternalData: function(payload) {
|
|
94
|
+
if (this.entry.id === payload.targetEntryId) {
|
|
95
|
+
const data = payload.action
|
|
96
|
+
if (data.csv_file) {
|
|
97
|
+
this.csv_file = data.csv_file
|
|
98
|
+
this.columns = data.columns
|
|
99
|
+
}
|
|
100
|
+
if (this.csv_file && this.fileOpened) {
|
|
101
|
+
const parameters = []
|
|
102
|
+
if (this.columns) {
|
|
103
|
+
this.columns.forEach((col) => {
|
|
104
|
+
if (col.cellml_variable && col.cellml_variable !== "main/t") {
|
|
105
|
+
parameters.push(col.cellml_variable)
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
this.$refs.simulation.addExternalData(this.csv_file, undefined, parameters)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
mounted: function () {
|
|
115
|
+
EventBus.on('simulation-external-data', this.addExternalData)
|
|
116
|
+
EventBus.on('simulation-data-request', this.handleDataRequest)
|
|
117
|
+
EventBus.on('plot-window-closed', this.handleWindowClosed)
|
|
118
|
+
|
|
119
|
+
EventBus.emit('simulation-ready', {
|
|
120
|
+
resourceId: this.id,
|
|
121
|
+
entryId: this.entry.id,
|
|
122
|
+
ready: true,
|
|
123
|
+
})
|
|
124
|
+
console.log(this.entry)
|
|
125
|
+
},
|
|
126
|
+
beforeUnmount: function () {
|
|
127
|
+
EventBus.emit('simulation-ready', {
|
|
128
|
+
resourceId: this.id,
|
|
129
|
+
entryId: this.entry.id,
|
|
130
|
+
ready: false,
|
|
131
|
+
})
|
|
132
|
+
EventBus.off('simulation-data-request', this.handleDataRequest)
|
|
133
|
+
EventBus.off('plot-window-closed', this.handleWindowClosed)
|
|
134
|
+
},
|
|
135
|
+
}
|
|
29
136
|
</script>
|
package/src/components.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare module 'vue' {
|
|
|
15
15
|
CustomSplitter: typeof import('./components/CustomSplitter.vue')['default']
|
|
16
16
|
DatasetHeader: typeof import('./components/DatasetHeader.vue')['default']
|
|
17
17
|
DialogToolbarContent: typeof import('./components/DialogToolbarContent.vue')['default']
|
|
18
|
+
DummyRouteComponent: typeof import('./components/DummyRouteComponent.vue')['default']
|
|
18
19
|
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
|
|
19
20
|
ElButton: typeof import('element-plus/es')['ElButton']
|
|
20
21
|
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
|
@@ -44,10 +45,12 @@ declare module 'vue' {
|
|
|
44
45
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
|
45
46
|
Flatmap: typeof import('./components/viewers/Flatmap.vue')['default']
|
|
46
47
|
FlatmapContextCard: typeof import('./components/FlatmapContextCard.vue')['default']
|
|
48
|
+
FloatingWindow: typeof import('./components/FloatingWindow.vue')['default']
|
|
47
49
|
Iframe: typeof import('./components/viewers/Iframe.vue')['default']
|
|
48
50
|
MapContent: typeof import('./components/MapContent.vue')['default']
|
|
49
51
|
MultiFlatmap: typeof import('./components/viewers/MultiFlatmap.vue')['default']
|
|
50
52
|
Plot: typeof import('./components/viewers/Plot.vue')['default']
|
|
53
|
+
PlotComponent: typeof import('./components/PlotComponent.vue')['default']
|
|
51
54
|
ResizeSensor: typeof import('./components/ResizeSensor.vue')['default']
|
|
52
55
|
RouterLink: typeof import('vue-router')['RouterLink']
|
|
53
56
|
RouterView: typeof import('vue-router')['RouterView']
|
package/src/main.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
import { createApp } from 'vue'
|
|
3
2
|
import { createPinia } from 'pinia'
|
|
4
3
|
import * as VueRouter from 'vue-router'
|
|
5
4
|
import App from './App.vue'
|
|
5
|
+
|
|
6
|
+
import ElementPlus from 'element-plus'
|
|
7
|
+
import 'element-plus/dist/index.css'
|
|
8
|
+
|
|
6
9
|
import { useMainStore } from './stores/index'
|
|
10
|
+
import DummyRouteComponent from './components/DummyRouteComponent.vue'
|
|
7
11
|
|
|
8
12
|
const routes = [
|
|
9
|
-
{ path: '/' },
|
|
13
|
+
{ path: '/', component: DummyRouteComponent },
|
|
10
14
|
]
|
|
11
15
|
|
|
12
16
|
const router = VueRouter.createRouter({
|
|
@@ -21,6 +25,8 @@ const app = createApp(App)
|
|
|
21
25
|
app.use(pinia)
|
|
22
26
|
app.use(router)
|
|
23
27
|
|
|
28
|
+
app.use(ElementPlus)
|
|
29
|
+
|
|
24
30
|
const mainStore = useMainStore()
|
|
25
31
|
const token = document.cookie
|
|
26
32
|
.split("; ")
|
|
@@ -29,4 +35,4 @@ if (mainStore && token) {
|
|
|
29
35
|
mainStore.setUserToken(token.split("=")[1])
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
app.mount('#app')
|
|
38
|
+
app.mount('#app')
|