@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.
Files changed (43) hide show
  1. package/dist/{ConnectivityGraph-BL4B9GZX.js → ConnectivityGraph-9pXPgFJR.js} +2 -2
  2. package/dist/{ContentMixin-Djmb_gqk.js → ContentMixin-DIqgKIz6.js} +279 -536
  3. package/dist/Flatmap-D7GVPV7o.js +103422 -0
  4. package/dist/{Iframe-ByYxT4Yq.js → Iframe-CCEA3d9c.js} +2 -2
  5. package/dist/{MultiFlatmap-DSkdlRiS.js → MultiFlatmap-Cuke1uNp.js} +3 -3
  6. package/dist/{Plot-ymkHVq_A.js → Plot-B4oTBVAT.js} +2 -2
  7. package/dist/{Scaffold-bw7posKm.js → Scaffold-Czz8X5kL.js} +79 -53
  8. package/dist/Simulation-BKmz8zwm.js +107 -0
  9. package/dist/{index-CwfUgFL1.js → index-_b4VBGHk.js} +30002 -25408
  10. package/dist/mapintegratedvuer.js +1 -1
  11. package/dist/mapintegratedvuer.umd.cjs +4291 -229
  12. package/dist/style-CM86xE3J.js +119 -0
  13. package/dist/style.css +1 -1
  14. package/package.json +10 -5
  15. package/src/App.vue +285 -258
  16. package/src/assets/styles.scss +1 -1
  17. package/src/components/ContextCard.vue +0 -1
  18. package/src/components/DummyRouteComponent.vue +1 -0
  19. package/src/components/EventBus.ts +13 -0
  20. package/src/components/FloatingWindow.vue +142 -0
  21. package/src/components/MapContent.vue +9 -4
  22. package/src/components/PlotComponent.vue +56 -0
  23. package/src/components/SplitDialog.vue +1 -6
  24. package/src/components/SplitFlow.vue +504 -444
  25. package/src/components/scripts/utilities.js +1 -1
  26. package/src/components/viewers/Flatmap.vue +166 -83
  27. package/src/components/viewers/Simulation.vue +118 -11
  28. package/src/components.d.ts +3 -0
  29. package/src/main.js +9 -3
  30. package/src/mixins/ContentMixin.js +467 -406
  31. package/src/mixins/DynamicMarkerMixin.js +50 -17
  32. package/src/services/mapping.js +69 -0
  33. package/src/services/testData.js +71 -0
  34. package/src/stores/entries.js +1 -1
  35. package/src/stores/mapping.js +29 -0
  36. package/src/stores/settings.js +4 -0
  37. package/src/stores/simulationPlotStore.js +124 -0
  38. package/src/stores/splitFlow.js +425 -352
  39. package/src/types/simulation.js +18 -0
  40. package/dist/Flatmap-uPEQNDkK.js +0 -202
  41. package/dist/Simulation-C_gdqDes.js +0 -28
  42. package/dist/style-Czqe2bTf.js +0 -57
  43. package/src/components/EventBus.js +0 -3
@@ -1,11 +1,6 @@
1
1
  <template>
2
2
  <el-container style="height: 100%; background: white">
3
- <el-header
4
- ref="header"
5
- style="text-align: left; font-size: 14px; padding: 0"
6
- height="32px"
7
- class="dialog-header"
8
- >
3
+ <el-header ref="header" style="text-align: left; font-size: 14px; padding: 0" height="32px" class="dialog-header">
9
4
  <DialogToolbarContent
10
5
  :numberOfEntries="entries.length"
11
6
  @onFullscreen="onFullscreen"
@@ -15,13 +10,10 @@
15
10
  />
16
11
  </el-header>
17
12
  <el-main class="dialog-main">
18
- <div
19
- style="width: 100%; height: 100%; position: relative; overflow: hidden"
20
- >
13
+ <div style="width: 100%; height: 100%; position: relative; overflow: hidden">
21
14
  <SideBar
22
15
  ref="sideBar"
23
16
  :envVars="envVars"
24
- :visible="sideBarVisibility"
25
17
  :class="['side-bar', { 'start-up': startUp }]"
26
18
  :open-at-start="startUp"
27
19
  :annotationEntry="annotationEntry"
@@ -67,11 +59,11 @@
67
59
 
68
60
  <script>
69
61
  /* eslint-disable no-alert, no-console */
70
- import { provide, markRaw } from 'vue'
71
- import Tagging from '../services/tagging.js';
72
- import DialogToolbarContent from "./DialogToolbarContent.vue";
73
- import EventBus from "./EventBus";
74
- import SplitDialog from "./SplitDialog.vue";
62
+ import { provide, markRaw, nextTick } from 'vue'
63
+ import Tagging from '../services/tagging.js'
64
+ import DialogToolbarContent from './DialogToolbarContent.vue'
65
+ import EventBus from './EventBus'
66
+ import SplitDialog from './SplitDialog.vue'
75
67
  // import contextCards from './context-cards'
76
68
  import { SideBar } from "@abi-software/map-side-bar";
77
69
  import "@abi-software/map-side-bar/dist/style.css";
@@ -85,10 +77,11 @@ import {
85
77
  intersectArrays,
86
78
  } from "./scripts/utilities.js";
87
79
  import { AnnotationService } from '@abi-software/sparc-annotation'
88
- import { mapStores } from 'pinia';
89
- import { useEntriesStore } from '../stores/entries';
80
+ import { mapStores } from 'pinia'
81
+ import { useEntriesStore } from '../stores/entries'
90
82
  import { useMainStore } from '../stores/index'
91
83
  import { useSettingsStore } from '../stores/settings';
84
+ import { useSimulationPlotStore } from '../stores/simulationPlotStore'
92
85
  import { useSplitFlowStore } from '../stores/splitFlow';
93
86
  import { useConnectivitiesStore } from '../stores/connectivities';
94
87
  import {
@@ -98,36 +91,35 @@ import {
98
91
  } from "element-plus";
99
92
 
100
93
  const getAllFacetLabels = (children) => {
101
- const labels = [];
94
+ const labels = []
102
95
  if (children) {
103
96
  children.forEach((child) => {
104
97
  if (child.label) {
105
- labels.push(child.label.toLowerCase());
98
+ labels.push(child.label.toLowerCase())
106
99
  }
107
- labels.push(...getAllFacetLabels(child.children));
108
- });
100
+ labels.push(...getAllFacetLabels(child.children))
101
+ })
109
102
  }
110
- return labels;
103
+ return labels
111
104
  }
112
105
 
113
-
114
106
  const getAnatomyTermsForFilters = (action, availableNameCurieMapping) => {
115
- const facets = [];
107
+ const facets = []
116
108
  for (const facet of action.facets) {
117
109
  if (facet in availableNameCurieMapping) {
118
- facets.push(availableNameCurieMapping[facet]);
110
+ facets.push(availableNameCurieMapping[facet])
119
111
  } else {
120
- facets.push(facet);
112
+ facets.push(facet)
121
113
  }
122
114
  }
123
- return facets;
115
+ return facets
124
116
  }
125
117
 
126
118
  /**
127
119
  * Component of the floating dialogs.
128
120
  */
129
121
  export default {
130
- name: "SplitFlow",
122
+ name: 'SplitFlow',
131
123
  components: {
132
124
  Container,
133
125
  Header,
@@ -137,10 +129,10 @@ export default {
137
129
  SideBar,
138
130
  },
139
131
  setup() {
140
- const mainStore = useMainStore();
141
- provide('userApiKey', mainStore.userToken);
142
- const settings = useSettingsStore();
143
- let annotator = markRaw(new AnnotationService(`${settings.flatmapAPI}annotator`));
132
+ const mainStore = useMainStore()
133
+ provide('userApiKey', mainStore.userToken)
134
+ const settings = useSettingsStore()
135
+ let annotator = markRaw(new AnnotationService(`${settings.flatmapAPI}annotator`))
144
136
  provide('$annotator', annotator)
145
137
  return { annotator }
146
138
  },
@@ -158,7 +150,6 @@ export default {
158
150
  return {
159
151
  availableFacets: undefined,
160
152
  availableNameCurieMapping: undefined,
161
- sideBarVisibility: true,
162
153
  startUp: true,
163
154
  sidebarStateRestored: false,
164
155
  sidebarAnnotationState: false,
@@ -187,266 +178,330 @@ export default {
187
178
  state: {
188
179
  handler: function (value) {
189
180
  if (value) {
190
- if (!this._externalStateSet) this.setState(value);
191
- this._externalStateSet = true;
192
- this.updateGlobalSettingsFromState(value);
181
+ if (!this._externalStateSet) this.setState(value)
182
+ this._externalStateSet = true
183
+ this.updateGlobalSettingsFromState(value)
193
184
  }
194
185
  },
195
186
  immediate: true,
196
187
  },
197
188
  connectivityHighlight: {
198
189
  handler: function () {
199
- this.hoverChanged({ tabType: 'connectivity' });
200
- this.onFilterVisibility(this.filterVisibility);
190
+ this.hoverChanged({ tabType: 'connectivity' })
191
+ this.onFilterVisibility(this.filterVisibility)
201
192
  },
202
193
  },
203
194
  annotationHighlight: {
204
195
  handler: function () {
205
- this.hoverChanged({ tabType: 'annotation' });
196
+ this.hoverChanged({ tabType: 'annotation' })
206
197
  },
207
198
  },
208
199
  },
209
200
  methods: {
210
201
  onFilterVisibility: function (state) {
211
- this.filterVisibility = state;
202
+ this.filterVisibility = state
212
203
  const filterExpression = {
213
204
  OR: [
214
205
  { NOT: { 'tile-layer': 'pathways' } },
215
- { NOT: { 'HAS': 'nerves' } },
206
+ { NOT: { HAS: 'nerves' } },
216
207
  {
217
- AND: [
218
- { 'tile-layer': 'pathways' },
219
- { 'models': this.connectivityHighlight }
220
- ]
221
- }
222
- ]
223
- };
224
- const validFilter = this.filterVisibility && this.connectivityProcessed;
225
- const payload = validFilter ? filterExpression : undefined;
226
- EventBus.emit('filter-visibility', payload);
208
+ AND: [{ 'tile-layer': 'pathways' }, { models: this.connectivityHighlight }],
209
+ },
210
+ ],
211
+ }
212
+ const validFilter = this.filterVisibility && this.connectivityProcessed
213
+ const payload = validFilter ? filterExpression : undefined
214
+ EventBus.emit('filter-visibility', payload)
227
215
  },
228
216
  onConnectivityCollapseChange: function (payload) {
229
217
  this.expanded = payload.id
230
- const splitdialog = this.$refs.splitdialog;
218
+ const splitdialog = this.$refs.splitdialog
231
219
  if (splitdialog) {
232
- const activeContents = splitdialog.getActiveContents();
233
- const hasFlatmap = activeContents.find(c => c.viewerType.includes('Flatmap'));
234
- const hasHumanMaleFlatmap = activeContents.find(c => c.activeSpecies === "Human Male");
220
+ const activeContents = splitdialog.getActiveContents()
221
+ const hasFlatmap = activeContents.find((c) => c.viewerType.includes('Flatmap'))
222
+ const hasHumanMaleFlatmap = activeContents.find((c) => c.activeSpecies === 'Human Male')
235
223
  let nonFlatmapLoad = false
236
- activeContents.forEach(content => {
237
- const isFlatmap = content.viewerType === 'Flatmap' || content.viewerType === 'MultiFlatmap';
224
+ activeContents.forEach((content) => {
225
+ const isFlatmap = content.viewerType === 'Flatmap' || content.viewerType === 'MultiFlatmap'
238
226
  // minimise connectivity detail fetch
239
227
  const shouldLoad =
240
228
  (hasFlatmap && isFlatmap) ||
241
229
  (hasFlatmap && !hasHumanMaleFlatmap && !isFlatmap && !nonFlatmapLoad) ||
242
- (!hasFlatmap && !nonFlatmapLoad);
230
+ (!hasFlatmap && !nonFlatmapLoad)
243
231
 
244
232
  if (shouldLoad) {
245
- this.connectivityExplorerClicked.push(true);
246
- content.onLoadConnectivityDetail({ data: [payload] });
247
- if (!isFlatmap) nonFlatmapLoad = true;
233
+ this.connectivityExplorerClicked.push(true)
234
+ content.onLoadConnectivityDetail({ data: [payload] })
235
+ if (!isFlatmap) nonFlatmapLoad = true
248
236
  }
249
- });
237
+ })
250
238
  }
251
239
  },
252
240
  onConnectivityItemClose: function () {
253
- EventBus.emit('connectivity-item-close');
241
+ EventBus.emit('connectivity-item-close')
254
242
  },
255
243
  getActiveFlatmaps: function () {
256
- const activeFlatmaps = [];
257
- let splitdialog = this.$refs.splitdialog;
244
+ const activeFlatmaps = []
245
+ let splitdialog = this.$refs.splitdialog
258
246
 
259
247
  if (splitdialog) {
260
- const activeContents = splitdialog.getActiveContents();
248
+ const activeContents = splitdialog.getActiveContents()
261
249
 
262
- activeContents.forEach(content => {
250
+ activeContents.forEach((content) => {
263
251
  if (content?.$refs['viewer']) {
264
- const contentViewer = content.$refs['viewer'];
265
- const flatmapRef = contentViewer.flatmapRef;
266
- const multiflatmapRef = contentViewer.multiflatmapRef;
267
- let flatmap = null;
252
+ const contentViewer = content.$refs['viewer']
253
+ const flatmapRef = contentViewer.flatmapRef
254
+ const multiflatmapRef = contentViewer.multiflatmapRef
255
+ let flatmap = null
268
256
 
269
- if (flatmapRef) flatmap = flatmapRef;
270
- if (multiflatmapRef) flatmap = multiflatmapRef.getCurrentFlatmap();
257
+ if (flatmapRef) flatmap = flatmapRef
258
+ if (multiflatmapRef) flatmap = multiflatmapRef.getCurrentFlatmap()
271
259
 
272
260
  if (flatmap) {
273
- activeFlatmaps.push(flatmap);
261
+ activeFlatmaps.push(flatmap)
274
262
  }
275
263
  }
276
- });
264
+ })
277
265
  }
278
- return activeFlatmaps;
266
+ return activeFlatmaps
279
267
  },
280
268
  /**
281
269
  * Callback when an action is performed (open new dialogs).
282
270
  */
283
271
  actionClick: function (action) {
284
272
  if (action) {
285
- if (!this.availableFacets || (this.availableFacets.length === 0)) {
286
- const availableFacetsRaw = localStorage.getItem('available-anatomy-facets');
287
- const availableFacetsAll = availableFacetsRaw ? JSON.parse(availableFacetsRaw) : [];
273
+ if (!this.availableFacets || this.availableFacets.length === 0) {
274
+ const availableFacetsRaw = localStorage.getItem('available-anatomy-facets')
275
+ const availableFacetsAll = availableFacetsRaw ? JSON.parse(availableFacetsRaw) : []
288
276
 
289
277
  // get label values
290
- this.availableFacets = markRaw([...new Set(getAllFacetLabels(availableFacetsAll))]);
278
+ this.availableFacets = markRaw([...new Set(getAllFacetLabels(availableFacetsAll))])
291
279
  }
292
280
 
293
- if (!this.availableNameCurieMapping || (Object.keys(this.availableNameCurieMapping).length === 0)) {
294
- const availableDataRaw = localStorage.getItem('available-name-curie-mapping');
295
- const availableData = availableDataRaw ? JSON.parse(availableDataRaw) : {};
281
+ if (!this.availableNameCurieMapping || Object.keys(this.availableNameCurieMapping).length === 0) {
282
+ const availableDataRaw = localStorage.getItem('available-name-curie-mapping')
283
+ const availableData = availableDataRaw ? JSON.parse(availableDataRaw) : {}
296
284
 
297
285
  // get label values
298
- this.availableNameCurieMapping = markRaw(availableData);
286
+ this.availableNameCurieMapping = markRaw(availableData)
299
287
  }
300
288
 
301
- if (action.type == "Search") {
289
+ if (action.type == 'Search') {
302
290
  if (action.nervePath) {
303
- this.openSearch([action.filter], action.label);
291
+ this.openSearch([action.filter], action.label)
304
292
  } else {
305
- this.openSearch([], action.term);
293
+ this.openSearch([], action.term)
306
294
  // GA Tagging
307
295
  // Event tracking for map action search/filter data
308
296
  const eventName = action.featuredDataset
309
297
  ? 'portal_maps_featured_dataset_search'
310
- : 'portal_maps_action_search';
298
+ : 'portal_maps_action_search'
311
299
  Tagging.sendEvent({
312
- 'event': 'interaction_event',
313
- 'event_name': eventName,
314
- 'category': action.term || 'filter',
315
- 'location': 'map_location_pin'
316
- });
317
- this.filterTriggered = true;
300
+ event: 'interaction_event',
301
+ event_name: eventName,
302
+ category: action.term || 'filter',
303
+ location: 'map_location_pin',
304
+ })
305
+ this.filterTriggered = true
318
306
  }
319
- } else if (action.type == "URL") {
320
- window.open(action.resource, "_blank");
321
- } else if (action.type == "Facet") {
307
+ } else if (action.type == 'URL') {
308
+ window.open(action.resource, '_blank')
309
+ } else if (action.type == 'Facet') {
322
310
  if (this.$refs.sideBar) {
323
311
  const sendAction = {
324
- facetPropPath: "anatomy.organ.category.name",
325
- facetSubPropPath: "anatomy.organ.name",
326
- term: "Anatomical structure",
327
- };
328
- const filters = [];
329
- const facets = getAnatomyTermsForFilters(action, this.availableNameCurieMapping);
330
- const facetString = action.facets.join(', ');
331
- facets.forEach(facet => filters.push({...sendAction, facet}));
332
- this.$refs.sideBar.addFilter(filters);
312
+ facetPropPath: 'anatomy.organ.category.name',
313
+ facetSubPropPath: 'anatomy.organ.name',
314
+ term: 'Anatomical structure',
315
+ }
316
+ const filters = []
317
+ const facets = getAnatomyTermsForFilters(action, this.availableNameCurieMapping)
318
+ const facetString = action.facets.join(', ')
319
+ facets.forEach((facet) => filters.push({ ...sendAction, facet }))
320
+ this.$refs.sideBar.addFilter(filters)
333
321
  // GA Tagging
334
322
  // Event tracking for map action search/filter data
335
323
  Tagging.sendEvent({
336
- 'event': 'interaction_event',
337
- 'event_name': 'portal_maps_action_filter',
338
- 'category': facetString || 'filter_reset',
339
- 'location': 'map_location_pin'
340
- });
341
- this.filterTriggered = true;
324
+ event: 'interaction_event',
325
+ event_name: 'portal_maps_action_filter',
326
+ category: facetString || 'filter_reset',
327
+ location: 'map_location_pin',
328
+ })
329
+ this.filterTriggered = true
342
330
  }
343
- } else if (action.type == "Facets") {
344
- const facets = [];
345
- const facetsArray = getAnatomyTermsForFilters(action, this.availableNameCurieMapping);
346
- const filterValuesArray = intersectArrays(this.availableFacets, facetsArray);
347
- const filterValues = filterValuesArray.join(', ');
331
+ } else if (action.type == 'Facets') {
332
+ const facets = []
333
+ const facetsArray = getAnatomyTermsForFilters(action, this.availableNameCurieMapping)
334
+ const filterValuesArray = intersectArrays(this.availableFacets, facetsArray)
335
+ const filterValues = filterValuesArray.join(', ')
348
336
 
349
- this.settingsStore.facets.species.forEach(e => {
337
+ this.settingsStore.facets.species.forEach((e) => {
350
338
  facets.push({
351
339
  facet: capitalise(e),
352
- term: "Species",
353
- facetPropPath: "organisms.primary.species.name",
354
- });
355
- });
340
+ term: 'Species',
341
+ facetPropPath: 'organisms.primary.species.name',
342
+ })
343
+ })
356
344
  facets.push(
357
- ...filterValuesArray.map(val => ({
345
+ ...filterValuesArray.map((val) => ({
358
346
  facet: capitalise(val),
359
- term: "Anatomical structure",
360
- facetPropPath: "anatomy.organ.category.name",
361
- facetSubPropPath: "anatomy.organ.name",
347
+ term: 'Anatomical structure',
348
+ facetPropPath: 'anatomy.organ.category.name',
349
+ facetSubPropPath: 'anatomy.organ.name',
362
350
  }))
363
- );
364
- this.openSearch(facets, "")
351
+ )
352
+ this.openSearch(facets, '')
365
353
  // GA Tagging
366
354
  // Event tracking for map action search/filter data
367
355
  Tagging.sendEvent({
368
- 'event': 'interaction_event',
369
- 'event_name': 'portal_maps_action_filter',
370
- 'category': filterValues || 'filter_reset',
371
- 'location': 'map_popup_button'
372
- });
373
- this.filterTriggered = true;
374
- } else {
356
+ event: 'interaction_event',
357
+ event_name: 'portal_maps_action_filter',
358
+ category: filterValues || 'filter_reset',
359
+ location: 'map_popup_button',
360
+ })
361
+ this.filterTriggered = true
362
+ } else if (action.type == 'Simulation' && action.flatmapUUID) {
363
+ Tagging.sendEvent({
364
+ event: 'interaction_event',
365
+ event_name: 'flatmaps_simulation_popup_click',
366
+ category: 'simulation',
367
+ location: 'flatmap_feature',
368
+ })
369
+ const splitFlowState = this.splitFlowStore.getState()
370
+ let entryId = this.simulationPlotStore.getEntryIdWithResource(action)
371
+ if (splitFlowState.activeView === 'singlepanel') {
372
+ if (!entryId) {
373
+ entryId= this.createNewEntry(action)
374
+ this.splitFlowStore.setIdToPane(action.requesterEntryId)
375
+ }
376
+ const newView = {
377
+ view: '2vertpanel',
378
+ 'pane-1': { id: action.requesterEntryId },
379
+ 'pane-2': { id: entryId },
380
+ entries: this.entries,
381
+ }
382
+ this.splitFlowStore.updateActiveView(newView)
383
+ this.splitFlowStore.setIdToPane(entryId, 'pane-2')
384
+ // nextTick(() => {
385
+ // const newView = {
386
+ // view: '2vertpanel',
387
+ // 'pane-1': { id: action.requesterEntryId },
388
+ // 'pane-2': { id: newEntry },
389
+ // }
390
+ // this.splitFlowStore.updateActiveView(newView)
391
+ // })
392
+ } else if (splitFlowState.activeView === '2vertpanel') {
393
+ if (entryId) {
394
+ this.splitFlowStore.setIdToPane(entryId, 'pane-2')
395
+ } else {
396
+ this.createNewEntry(action, 'pane-2')
397
+ }
398
+ // const newView = {
399
+ // view: splitFlowState.activeView,
400
+ // 'pane-1': { id: action.requesterEntryId },
401
+ // 'pane-2': { id: newEntryId },
402
+ // }
403
+ // this.splitFlowStore.updateActiveView(newView, false)
404
+ // splitFlowState.customLayout
405
+ // this.splitFlowStore.updateActiveView(newView)
406
+ }
407
+ } else if (action.type == 'ProtocolSearch') {
408
+ if (action.protocol) {
409
+ this.$refs.sideBar.displayFileInfo(
410
+ Number(action.protocol.dataset_id), action.term, "reveal");
411
+ }
412
+ } else if (action.type == 'Protocol') {
375
413
  this.trackGalleryClick(action);
376
- this.createNewEntry(action);
414
+ let entryId = this.simulationPlotStore.runExperimentalData(action);
415
+ if (entryId) {
416
+ if (!this.splitFlowStore.isIdVisible(entryId)) {
417
+ this.splitFlowStore.setIdToPane(entryId, 'pane-1')
418
+ }
419
+ this.$refs.sideBar.close()
420
+ } else {
421
+ const entryId = this.createNewEntry(action);
422
+ this.$nextTick(() =>
423
+ EventBus.emit('simulation-experimental-data', {
424
+ targetEntryId: entryId,
425
+ action: action,
426
+ })
427
+ )
428
+ }
429
+ } else {
430
+ this.trackGalleryClick(action)
431
+ this.createNewEntry(action)
377
432
  }
378
433
  }
379
434
  },
380
435
  trackGalleryClick: function (action) {
381
- const categoryValues = [];
382
- const { label, type, datasetId, discoverId, resource } = action;
383
- let filePath = '';
384
- let id = datasetId ? datasetId : discoverId;
385
- if (label) categoryValues.push(label);
386
- if (type) categoryValues.push(type);
387
- if (datasetId) categoryValues.push('(' + id + ')');
436
+ const categoryValues = []
437
+ const { label, type, datasetId, discoverId, resource } = action
438
+ let filePath = ''
439
+ let id = datasetId ? datasetId : discoverId
440
+ if (label) categoryValues.push(label)
441
+ if (type) categoryValues.push(type)
442
+ if (datasetId) categoryValues.push('(' + id + ')')
388
443
  if (resource) {
389
- if (type === "Plot") {
390
- filePath = resource.dataSource.url;
444
+ if (type === 'Plot') {
445
+ filePath = resource.dataSource.url
391
446
  } else {
392
- filePath = typeof resource === 'string' ? resource : resource.share_link;
447
+ filePath = typeof resource === 'string' ? resource : resource.share_link
393
448
  }
394
449
  }
395
450
 
396
451
  // GA Tagging
397
452
  // Event tracking for map sidebar gallery click
398
453
  Tagging.sendEvent({
399
- 'event': 'interaction_event',
400
- 'event_name': 'portal_maps_gallery_click',
401
- 'category': categoryValues.join(' '),
402
- 'location': 'map_sidebar_gallery',
403
- 'dataset_id': id ? id + '' : '', // change to string format
404
- 'file_path': filePath,
405
- });
454
+ event: 'interaction_event',
455
+ event_name: 'portal_maps_gallery_click',
456
+ category: categoryValues.join(' '),
457
+ location: 'map_sidebar_gallery',
458
+ dataset_id: id ? id + '' : '', // change to string format
459
+ file_path: filePath,
460
+ })
406
461
  },
407
462
  onDisplaySearch: function (payload, tracking = true) {
408
- let searchFound = false;
463
+ let searchFound = false
409
464
  //Search all active viewers when global callback is on
410
- let splitdialog = this.$refs.splitdialog;
465
+ let splitdialog = this.$refs.splitdialog
411
466
  if (splitdialog) {
412
- const activeContents = splitdialog.getActiveContents();
413
- activeContents.forEach(content => {
467
+ const activeContents = splitdialog.getActiveContents()
468
+ activeContents.forEach((content) => {
414
469
  if (content.search(payload.term)) {
415
- searchFound = true;
470
+ searchFound = true
416
471
  }
417
- });
472
+ })
418
473
  }
419
- this.$refs.dialogToolbar.setFailedSearch(searchFound ? undefined : payload.term);
474
+ this.$refs.dialogToolbar.setFailedSearch(searchFound ? undefined : payload.term)
420
475
 
421
476
  if (tracking) {
422
477
  // GA Tagging
423
478
  // Event tracking for map on display search
424
479
  Tagging.sendEvent({
425
- 'event': 'interaction_event',
426
- 'event_name': 'portal_maps_display_search',
427
- 'category': payload.term,
428
- 'location': 'map_toolbar'
429
- });
480
+ event: 'interaction_event',
481
+ event_name: 'portal_maps_display_search',
482
+ category: payload.term,
483
+ location: 'map_toolbar',
484
+ })
430
485
  }
431
486
  },
432
- fetchSuggestions: function(payload) {
433
- const suggestions = [];
487
+ fetchSuggestions: function (payload) {
488
+ const suggestions = []
434
489
  //Search all active viewers when global callback is on
435
- let splitdialog = this.$refs.splitdialog;
436
- const activeContents = splitdialog.getActiveContents();
490
+ let splitdialog = this.$refs.splitdialog
491
+ const activeContents = splitdialog.getActiveContents()
437
492
  //Push new suggestions into the pre-existing suggestions array
438
- activeContents.forEach(content => content.searchSuggestions(payload.data.term, suggestions));
439
- const parsed = [];
493
+ activeContents.forEach((content) => content.searchSuggestions(payload.data.term, suggestions))
494
+ const parsed = []
440
495
  //Remove double quote as it is used as a speical character
441
- suggestions.forEach(suggestion => {
442
- parsed.push(suggestion.replaceAll("\"", ""));
443
- });
444
- const unique = new Set(parsed);
445
- suggestions.length = 0;
496
+ suggestions.forEach((suggestion) => {
497
+ parsed.push(suggestion.replaceAll('"', ''))
498
+ })
499
+ const unique = new Set(parsed)
500
+ suggestions.length = 0
446
501
  for (const item of unique) {
447
- suggestions.push({"value": "\"" + item +"\""});
502
+ suggestions.push({ value: '"' + item + '"' })
448
503
  }
449
- payload.data.cb(suggestions);
504
+ payload.data.cb(suggestions)
450
505
  },
451
506
  /**
452
507
  * This event is emitted when the show connectivity button in sidebar is clicked.
@@ -455,23 +510,23 @@ export default {
455
510
  */
456
511
  onShowConnectivity: function (featureIds) {
457
512
  if (featureIds.length) {
458
- const splitFlowState = this.splitFlowStore.getState();
459
- const activeView = splitFlowState?.activeView || '';
513
+ const splitFlowState = this.splitFlowStore.getState()
514
+ const activeView = splitFlowState?.activeView || ''
460
515
  // offset sidebar only on singlepanel and 2horpanel views
461
516
  EventBus.emit('show-connectivity', {
462
517
  featureIds: featureIds,
463
- offset: activeView === 'singlepanel' || activeView === '2horpanel'
464
- });
518
+ offset: activeView === 'singlepanel' || activeView === '2horpanel',
519
+ })
465
520
  }
466
521
  },
467
522
  openConnectivityInfo: async function (payload) {
468
523
  // expand connectivity card and show connectivity info
469
524
  // if expanded exist, payload should be an array of one element
470
525
  // skip payload not match the expanded in multiple views
471
- const isMatched = payload.some(entry => entry.featureId[0] === this.expanded);
526
+ const isMatched = payload.some((entry) => entry.featureId[0] === this.expanded)
472
527
  if (this.expanded && this.connectivityExplorerClicked.length && !isMatched) {
473
- this.connectivityExplorerClicked.pop();
474
- return;
528
+ this.connectivityExplorerClicked.pop()
529
+ return
475
530
  }
476
531
 
477
532
  // Remove duplicate items from payload
@@ -482,9 +537,9 @@ export default {
482
537
  label: entry.title,
483
538
  id: entry.featureId[0],
484
539
  }
485
- const ck = this.connectivityKnowledge.find(ck => ck.id === result.id);
540
+ const ck = this.connectivityKnowledge.find((ck) => ck.id === result.id)
486
541
  if (entry.ready) {
487
- result['nerve-label'] = entry['nerve-label'] || ck['nerve-label'];
542
+ result['nerve-label'] = entry['nerve-label'] || ck['nerve-label']
488
543
  }
489
544
  if (ck && ck['long-label']) {
490
545
  result['long-label'] = ck['long-label'];
@@ -507,8 +562,8 @@ export default {
507
562
 
508
563
  if (this.connectivityExplorerClicked.length) {
509
564
  // only remove clicked if not placeholder entry
510
- if (this.connectivityEntry.every(entry => entry.ready)) {
511
- this.connectivityExplorerClicked.pop();
565
+ if (this.connectivityEntry.every((entry) => entry.ready)) {
566
+ this.connectivityExplorerClicked.pop()
512
567
  }
513
568
  } else {
514
569
  // click on the flatmap paths/features directly
@@ -548,50 +603,50 @@ export default {
548
603
  }
549
604
 
550
605
  if (this.$refs.sideBar) {
551
- this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' });
552
- this.$refs.sideBar.setDrawerOpen(true);
606
+ this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' })
607
+ this.$refs.sideBar.setDrawerOpen(true)
553
608
  }
554
609
  }
555
610
  },
556
611
  openAnnotation: function (payload) {
557
- this.annotationEntry = payload.annotationEntry;
612
+ this.annotationEntry = payload.annotationEntry
558
613
  // If drawing, `entry.models` may be undefined; use an empty array instead of [undefined]
559
614
  // to prevent errors on highlight
560
- this.annotationHighlight = this.annotationEntry.map(entry => entry.models).filter(Boolean);
615
+ this.annotationHighlight = this.annotationEntry.map((entry) => entry.models).filter(Boolean)
561
616
  if (payload.commitCallback) {
562
- this.annotationCallback = markRaw(payload.commitCallback);
617
+ this.annotationCallback = markRaw(payload.commitCallback)
563
618
  }
564
619
  if (!payload.createData) {
565
- this.createData = markRaw({});
620
+ this.createData = markRaw({})
566
621
  } else {
567
- this.createData = markRaw(payload.createData);
622
+ this.createData = markRaw(payload.createData)
568
623
  }
569
624
  if (payload.confirmCreate) {
570
- this.confirmCreateCallback = markRaw(payload.confirmCreate);
625
+ this.confirmCreateCallback = markRaw(payload.confirmCreate)
571
626
  }
572
627
  if (payload.cancelCreate) {
573
- this.cancelCreateCallback = markRaw(payload.cancelCreate);
628
+ this.cancelCreateCallback = markRaw(payload.cancelCreate)
574
629
  }
575
630
  if (payload.confirmDelete) {
576
- this.confirmDeleteCallback = markRaw(payload.confirmDelete);
631
+ this.confirmDeleteCallback = markRaw(payload.confirmDelete)
577
632
  }
578
633
  if (payload.confirmComment) {
579
- this.confirmCommentCallback = markRaw(payload.confirmComment);
634
+ this.confirmCommentCallback = markRaw(payload.confirmComment)
580
635
  }
581
636
  if (this.$refs.sideBar) {
582
- this.$refs.sideBar.tabClicked({id: 3, type: 'annotation'});
583
- this.$refs.sideBar.setDrawerOpen(true);
637
+ this.$refs.sideBar.tabClicked({ id: 3, type: 'annotation' })
638
+ this.$refs.sideBar.setDrawerOpen(true)
584
639
  }
585
640
  },
586
641
  onShowReferenceConnectivities: function (refSource) {
587
- EventBus.emit('show-reference-connectivities', refSource);
642
+ EventBus.emit('show-reference-connectivities', refSource)
588
643
  },
589
644
  onConnectivityHovered: function (data) {
590
- EventBus.emit('connectivity-hovered', data);
645
+ EventBus.emit('connectivity-hovered', data)
591
646
  },
592
647
  onConnectivitySourceChange: function (data) {
593
- this.connectivityExplorerClicked.push(true);
594
- EventBus.emit('connectivity-source-change', data);
648
+ this.connectivityExplorerClicked.push(true)
649
+ EventBus.emit('connectivity-source-change', data)
595
650
  },
596
651
  onShowConnectivityGraph: function (data) {
597
652
  const previousPrimaryId = this.splitFlowStore.customLayout?.['pane-1']?.id;
@@ -607,7 +662,7 @@ export default {
607
662
  this.splitFlowStore.updateActiveView({
608
663
  view: '2vertpanel',
609
664
  entries: this.entries,
610
- }, false);
665
+ }, true, false);
611
666
 
612
667
  if (previousPrimaryId && previousPrimaryId !== connectivityGraphId) {
613
668
  this.splitFlowStore.assignOrSwapPaneWithIds({
@@ -626,141 +681,149 @@ export default {
626
681
  this.splitFlowStore.updateSplitPanels();
627
682
  },
628
683
  hoverChanged: function (data) {
629
- let hoverAnatomies = [], hoverOrgans = [], hoverDOI = '', hoverConnectivity = [];
684
+ let hoverAnatomies = [],
685
+ hoverOrgans = [],
686
+ hoverDOI = '',
687
+ hoverConnectivity = []
630
688
  if (data.tabType === 'dataset') {
631
- hoverAnatomies = data.anatomy ? data.anatomy : [];
632
- hoverOrgans = data.organs ? data.organs : [];
633
- hoverDOI = data.doi ? data.doi : '';
689
+ hoverAnatomies = data.anatomy ? data.anatomy : []
690
+ hoverOrgans = data.organs ? data.organs : []
691
+ hoverDOI = data.doi ? data.doi : ''
634
692
  } else if (data.tabType === 'connectivity') {
635
- hoverConnectivity = data.id ? [data.id] : this.connectivityHighlight;
636
- hoverOrgans = data['nerve-label'] ? data['nerve-label'].flatMap(nerve => nerve.subNerves) : [];
693
+ hoverConnectivity = data.id ? [data.id] : this.connectivityHighlight
694
+ hoverOrgans = data['nerve-label'] ? data['nerve-label'].flatMap((nerve) => nerve.subNerves) : []
637
695
  } else if (data.tabType === 'annotation') {
638
- hoverConnectivity = data.models ? [data.models] : this.annotationHighlight;
696
+ hoverConnectivity = data.models ? [data.models] : this.annotationHighlight
639
697
  }
640
- this.settingsStore.updateHoverFeatures(hoverAnatomies, hoverOrgans, hoverDOI, hoverConnectivity);
641
- EventBus.emit("hoverUpdate", { connectivityProcessed: this.connectivityProcessed });
698
+ this.settingsStore.updateHoverFeatures(hoverAnatomies, hoverOrgans, hoverDOI, hoverConnectivity)
699
+ EventBus.emit('hoverUpdate', { connectivityProcessed: this.connectivityProcessed })
642
700
  },
643
701
  searchChanged: function (data) {
644
702
  if (data.tabType === 'dataset') {
645
- if (data && data.type == "reset-update") {
646
- this.settingsStore.updateAppliedFacets([]);
703
+ if (data && data.type == 'reset-update') {
704
+ this.settingsStore.updateAppliedFacets([])
647
705
  }
648
- if (data && data.type == "query-update") {
649
- this.search = data.value;
706
+ if (data && data.type == 'query-update') {
707
+ this.search = data.value
650
708
  if (this.search && !this.filterTriggered) {
651
709
  // GA Tagging
652
710
  // Event tracking for map action search/filter data
653
711
  Tagging.sendEvent({
654
- 'event': 'interaction_event',
655
- 'event_name': 'portal_maps_action_search',
656
- 'category': this.search,
657
- 'location': 'map_sidebar_dataset_search'
658
- });
712
+ event: 'interaction_event',
713
+ event_name: 'portal_maps_action_search',
714
+ category: this.search,
715
+ location: 'map_sidebar_dataset_search',
716
+ })
659
717
  }
660
- this.filterTriggered = false; // reset for next action
718
+ this.filterTriggered = false // reset for next action
661
719
  }
662
- if (data && data.type == "filter-update") {
663
- this.settingsStore.updateFacets(data.value);
720
+ if (data && data.type == 'filter-update') {
721
+ this.settingsStore.updateFacets(data.value)
664
722
  // Remove filter event from maps' popup
665
723
  if (!this.filterTriggered) {
666
- const filterValuesArray = data.value.filter((val) => {
667
- return val.facet && val.facet.toLowerCase() !== 'show all';
668
- }).map((val) => val.facet);
669
- const labels = filterValuesArray.map((val) => val.toLowerCase());
670
- const newFacets = [...new Set([...labels])];
671
- this.settingsStore.updateAppliedFacets(newFacets);
672
- const filterValues = filterValuesArray.join(', ');
724
+ const filterValuesArray = data.value
725
+ .filter((val) => {
726
+ return val.facet && val.facet.toLowerCase() !== 'show all'
727
+ })
728
+ .map((val) => val.facet)
729
+ const labels = filterValuesArray.map((val) => val.toLowerCase())
730
+ const newFacets = [...new Set([...labels])]
731
+ this.settingsStore.updateAppliedFacets(newFacets)
732
+ const filterValues = filterValuesArray.join(', ')
673
733
  // GA Tagging
674
734
  // Event tracking for map action search/filter data
675
735
  Tagging.sendEvent({
676
- 'event': 'interaction_event',
677
- 'event_name': 'portal_maps_action_filter',
678
- 'category': filterValues || 'filter_reset',
679
- 'location': 'map_sidebar_dataset_filter'
680
- });
736
+ event: 'interaction_event',
737
+ event_name: 'portal_maps_action_filter',
738
+ category: filterValues || 'filter_reset',
739
+ location: 'map_sidebar_dataset_filter',
740
+ })
681
741
  }
682
- this.filterTriggered = false; // reset for next action
742
+ this.filterTriggered = false // reset for next action
683
743
  }
684
744
  } else if (data.tabType === 'connectivity') {
685
- if (data && data.type == "reset-update") {
686
- const activeFlatmaps = this.getActiveFlatmaps();
745
+ if (data && data.type == 'reset-update') {
746
+ const activeFlatmaps = this.getActiveFlatmaps()
687
747
  activeFlatmaps.forEach((activeFlatmap) => {
688
- activeFlatmap.resetConnectivityfilters(data.value);
689
- });
748
+ activeFlatmap.resetConnectivityfilters(data.value)
749
+ })
690
750
  } else {
691
- this.expanded = '';
692
- this.connectivityEntry = [];
751
+ this.expanded = ''
752
+ this.connectivityEntry = []
693
753
  // update connectivity filters in flatmap
694
- const activeFlatmaps = this.getActiveFlatmaps();
754
+ const activeFlatmaps = this.getActiveFlatmaps()
695
755
  activeFlatmaps.forEach((activeFlatmap) => {
696
- activeFlatmap.updateConnectivityFilters(data.filter);
697
- });
698
- EventBus.emit("connectivity-query-filter", data);
756
+ activeFlatmap.updateConnectivityFilters(data.filter)
757
+ })
758
+ EventBus.emit('connectivity-query-filter', data)
699
759
 
700
- const filterValues = data.filter.filter(f => (f.facet && f.facet.toLowerCase() !== 'show all'))
760
+ const filterValues = data.filter
761
+ .filter((f) => f.facet && f.facet.toLowerCase() !== 'show all')
701
762
  .map((f) => f.tagLabel)
702
- .join(', ');
703
- const searchValue = data.query;
763
+ .join(', ')
764
+ const searchValue = data.query
704
765
 
705
766
  if (filterValues) {
706
767
  Tagging.sendEvent({
707
- 'event': 'interaction_event',
708
- 'event_name': 'portal_maps_action_filter',
709
- 'category': filterValues,
710
- 'location': 'map_sidebar_connectivity_filter'
711
- });
768
+ event: 'interaction_event',
769
+ event_name: 'portal_maps_action_filter',
770
+ category: filterValues,
771
+ location: 'map_sidebar_connectivity_filter',
772
+ })
712
773
  }
713
774
 
714
775
  if (searchValue) {
715
776
  Tagging.sendEvent({
716
- 'event': 'interaction_event',
717
- 'event_name': 'portal_maps_action_search',
718
- 'category': searchValue,
719
- 'location': 'map_sidebar_connectivity_search'
720
- });
777
+ event: 'interaction_event',
778
+ event_name: 'portal_maps_action_search',
779
+ category: searchValue,
780
+ location: 'map_sidebar_connectivity_search',
781
+ })
721
782
  }
722
783
  }
723
784
  }
724
785
  },
725
786
  updateMarkers: function (data) {
726
- this.settingsStore.updateMarkers(data);
727
- EventBus.emit("markerUpdate");
787
+ this.settingsStore.updateMarkers(data)
788
+ EventBus.emit('markerUpdate')
728
789
  },
729
790
  updateScaffoldMarkers: function (data) {
730
- this.settingsStore.updateNumberOfDatasetsForFacets(data);
791
+ this.settingsStore.updateNumberOfDatasetsForFacets(data)
731
792
  },
732
- getNewEntryId: function() {
793
+ getNewEntryId: function () {
733
794
  if (this.entries.length) {
734
- return (this.entries[this.entries.length - 1]).id + 1;
795
+ return this.entries[this.entries.length - 1].id + 1
735
796
  }
736
- return 1;
797
+ return 1
737
798
  },
738
799
  /**
739
800
  * Add new entry which will sequentially create a
740
801
  * new dialog.
741
802
  */
742
- createNewEntry: function (data) {
743
- let newEntry = {};
744
- newEntry.viewUrl = undefined;
745
- newEntry.state = undefined;
746
- Object.assign(newEntry, data);
747
- newEntry.mode = "normal";
748
- newEntry.id = this.getNewEntryId();
749
- newEntry.discoverId = data.discoverId;
750
- this.entriesStore.addNewEntry(newEntry);
751
- this.splitFlowStore.setIdToPrimaryPane(newEntry.id);
803
+ createNewEntry: function (data, pane = 'pane-1') {
804
+ let newEntry = {}
805
+ newEntry.viewUrl = undefined
806
+ newEntry.state = undefined
807
+ Object.assign(newEntry, data)
808
+ if (newEntry.type === "Protocol") {
809
+ newEntry.type = "Simulation"
810
+ }
811
+ newEntry.mode = 'normal'
812
+ newEntry.id = this.getNewEntryId()
813
+ newEntry.discoverId = data.discoverId
814
+ this.entriesStore.addNewEntry(newEntry)
815
+ this.splitFlowStore.setIdToPane(newEntry.id, pane)
752
816
  //close sidebar on entry creation to see the context card
753
817
  if (this.$refs.sideBar) {
754
- this.$refs.sideBar.setDrawerOpen(false);
818
+ this.$refs.sideBar.setDrawerOpen(false)
755
819
  }
756
-
757
- return newEntry.id;
820
+ return newEntry.id
758
821
  },
759
822
  openNewMap: async function (type) {
760
- const entry = await getNewMapEntry(type, this.settingsStore.sparcApi);
761
- this.createNewEntry(entry);
823
+ const entry = await getNewMapEntry(type, this.settingsStore.sparcApi)
824
+ this.createNewEntry(entry)
762
825
  if (entry.contextCard) {
763
- EventBus.emit("contextUpdate", entry.contextCard);
826
+ EventBus.emit('contextUpdate', entry.contextCard)
764
827
  }
765
828
  },
766
829
  openSearch: function (facets, query) {
@@ -769,40 +832,37 @@ export default {
769
832
  // this.settingsStore.facets.species.forEach(e => {
770
833
  // facets.push({facet: e, facetPropPath: 'organisms.primary.species.name', term:'species'});
771
834
  // });
772
- this.search = query;
773
- this._facets = facets;
835
+ this.search = query
836
+ this._facets = facets
774
837
  if (this.$refs && this.$refs.sideBar) {
775
- this.$refs.sideBar.openSearch(facets, query);
776
- this.$refs.sideBar.tabClicked({id: 1, type: 'datasetExplorer'});
838
+ this.$refs.sideBar.openSearch(facets, query)
839
+ this.$refs.sideBar.tabClicked({ id: 1, type: 'datasetExplorer' })
777
840
  }
778
- this.startUp = false;
841
+ this.startUp = false
779
842
  },
780
843
  onFullscreen: function (val) {
781
- this.$emit("onFullscreen", val);
844
+ this.$emit('onFullscreen', val)
782
845
  },
783
846
  resetApp: function () {
784
- this.setState(initialDefaultState());
785
- },
786
- setIdToPrimaryPane: function (id) {
787
- this.splitFlowStore.setIdToPrimaryPane(id);
847
+ this.setState(initialDefaultState())
788
848
  },
789
849
  restoreConnectivityEntries: function (connectivityEntries) {
790
- const activeFlatmaps = this.getActiveFlatmaps();
850
+ const activeFlatmaps = this.getActiveFlatmaps()
791
851
  activeFlatmaps.forEach((activeFlatmap) => {
792
852
  const featureIds = connectivityEntries.map((entry) => {
793
- const featureId = activeFlatmap.mapImp.modelFeatureIds(entry)[0];
794
- const feature = activeFlatmap.mapImp.featureProperties(featureId);
853
+ const featureId = activeFlatmap.mapImp.modelFeatureIds(entry)[0]
854
+ const feature = activeFlatmap.mapImp.featureProperties(featureId)
795
855
  const data = {
796
856
  resource: [feature.models],
797
857
  feature: feature,
798
858
  label: feature.label,
799
859
  provenanceTaxonomy: feature.taxons,
800
860
  alert: feature.alert,
801
- };
802
- return data;
803
- });
861
+ }
862
+ return data
863
+ })
804
864
  activeFlatmap.checkAndCreatePopups(featureIds, true)
805
- });
865
+ })
806
866
  },
807
867
  restoreSidebarState: function (state) {
808
868
  // Restore sidebar state only if
@@ -810,269 +870,269 @@ export default {
810
870
  // - sidebar component is loaded
811
871
  // - connectivity knowledge is loaded
812
872
  // - if sidebar state is not restored yet
813
- const sidebarState = state?.sidebar;
873
+ const sidebarState = state?.sidebar
814
874
  if (!this.sidebarStateRestored && sidebarState && this.$refs.sideBar && this.connectivityKnowledge?.length) {
815
875
  if (sidebarState.connectivityEntries?.length) {
816
- this.restoreConnectivityEntries(sidebarState.connectivityEntries);
876
+ this.restoreConnectivityEntries(sidebarState.connectivityEntries)
817
877
  } else if (sidebarState.annotationEntries?.length && state.annotationId) {
818
878
  // Restore annotation state only if the state has annotationId
819
- this.restoreConnectivityEntries(sidebarState.annotationEntries);
820
- this.sidebarAnnotationState = true;
879
+ this.restoreConnectivityEntries(sidebarState.annotationEntries)
880
+ this.sidebarAnnotationState = true
821
881
  } else {
822
- this.$refs.sideBar.setState(sidebarState);
882
+ this.$refs.sideBar.setState(sidebarState)
823
883
  }
824
- this.sidebarStateRestored = true;
884
+ this.sidebarStateRestored = true
825
885
  }
826
886
  },
827
887
  setState: function (state) {
828
- this.entriesStore.setAll(state.entries);
888
+ this.entriesStore.setAll(state.entries)
829
889
  //Support both old and new permalink.
830
890
  if (state.splitFlow) {
831
- this.splitFlowStore.setState(state.splitFlow);
832
- }
833
- else {
834
- this.entries.forEach(entry => this.splitFlowStore.setIdToPrimaryPane(entry.id));
891
+ this.splitFlowStore.setState(state.splitFlow)
892
+ } else {
893
+ this.entries.forEach((entry) => this.splitFlowStore.setIdToPane(entry.id))
835
894
  }
836
895
 
837
- this.restoreSidebarState(state);
838
- this.updateGlobalSettingsFromState(state);
896
+ this.restoreSidebarState(state)
897
+ this.updateGlobalSettingsFromState(state)
839
898
  },
840
899
  getState: function (anonymousAnnotations = false) {
841
- let state = JSON.parse(JSON.stringify(this.entriesStore.$state));
842
- let splitdialog = this.$refs.splitdialog;
843
- let dialogStates = splitdialog.getContentsState();
900
+ let state = JSON.parse(JSON.stringify(this.entriesStore.$state))
901
+ let splitdialog = this.$refs.splitdialog
902
+ let dialogStates = splitdialog.getContentsState()
844
903
  if (state.entries.length === dialogStates.length) {
845
904
  for (let i = 0; i < dialogStates.length; i++) {
846
- const entry = state.entries[i];
847
- entry.state = dialogStates[i];
905
+ const entry = state.entries[i]
906
+ entry.state = dialogStates[i]
848
907
  //We do not want to serialise the following properties
849
- if (entry.type === "Scaffold" && "viewUrl" in entry)
850
- delete entry.viewUrl;
851
- if (entry.type === "MultiFlatmap" && "uberonId" in entry)
852
- delete entry.uberonId;
908
+ if (entry.type === 'Scaffold' && 'viewUrl' in entry) delete entry.viewUrl
909
+ if (entry.type === 'MultiFlatmap' && 'uberonId' in entry) delete entry.uberonId
853
910
  if (anonymousAnnotations === false) {
854
- if (entry.type === "Scaffold" && entry?.state?.offlineAnnotations) {
855
- delete entry.state.offlineAnnotations;
911
+ if (entry.type === 'Scaffold' && entry?.state?.offlineAnnotations) {
912
+ delete entry.state.offlineAnnotations
856
913
  } else if (entry?.state?.state?.offlineAnnotations) {
857
- delete entry.state.state.offlineAnnotations;
914
+ delete entry.state.state.offlineAnnotations
858
915
  }
859
916
  }
860
917
  }
861
918
  }
862
- state.splitFlow = this.splitFlowStore.getState();
863
- state.globalSettings = this.settingsStore.getGlobalSettings();
919
+ state.splitFlow = this.splitFlowStore.getState()
920
+ state.globalSettings = this.settingsStore.getGlobalSettings()
864
921
  if (this.$refs.sideBar) {
865
- state.sidebar = this.$refs.sideBar.getState();
922
+ state.sidebar = this.$refs.sideBar.getState()
866
923
  }
867
- return state;
924
+ return state
868
925
  },
869
926
  removeEntry: function (id) {
870
- let index = this.entriesStore.findIndexOfId(id);
871
- this.entriesStore.destroyEntry(index);
927
+ let index = this.entriesStore.findIndexOfId(id)
928
+ this.entriesStore.destroyEntry(index)
872
929
  },
873
930
  resourceSelected: function (result) {
874
- this.$emit("resource-selected", result);
931
+ this.$emit('resource-selected', result)
875
932
  },
876
933
  speciesChanged: function (species) {
877
934
  if (this.$refs.sideBar) {
878
935
  // Use to update the connectivity when switch species
879
936
  // Wait for provenance info with uuid update
880
937
  this.$nextTick(() => {
881
- EventBus.emit('species-layout-connectivity-update');
882
- this.$refs.sideBar.close();
938
+ EventBus.emit('species-layout-connectivity-update')
939
+ this.$refs.sideBar.close()
883
940
  })
884
941
  }
885
942
  },
886
943
  contextUpdate: function (payload) {
887
- EventBus.emit("contextUpdate", payload);
944
+ EventBus.emit('contextUpdate', payload)
888
945
  },
889
946
  datalinkClicked: function (payload) {
890
947
  // payload is dataset URL
891
- const datasetURL = payload || '';
892
- const substringA = 'datasets/';
893
- const substringB = '?type=dataset';
948
+ const datasetURL = payload || ''
949
+ const substringA = 'datasets/'
950
+ const substringB = '?type=dataset'
894
951
  const datasetId = datasetURL.substring(
895
952
  datasetURL.indexOf(substringA) + substringA.length,
896
953
  datasetURL.indexOf(substringB)
897
- );
954
+ )
898
955
 
899
956
  // GA Tagging
900
957
  // Event tracking for map sidebar gallery dataset click
901
958
  Tagging.sendEvent({
902
- 'event': 'interaction_event',
903
- 'event_name': 'portal_maps_gallery_click',
904
- 'category': datasetURL,
905
- 'location': 'map_sidebar_gallery',
906
- 'dataset_id': datasetId || ''
907
- });
959
+ event: 'interaction_event',
960
+ event_name: 'portal_maps_gallery_click',
961
+ category: datasetURL,
962
+ location: 'map_sidebar_gallery',
963
+ dataset_id: datasetId || '',
964
+ })
908
965
  },
909
- onAnnotationSubmitted: function(annotation) {
966
+ onAnnotationSubmitted: function (annotation) {
910
967
  if (this.annotationCallback) {
911
- this.annotationCallback(annotation);
968
+ this.annotationCallback(annotation)
912
969
  } else if (this.confirmCommentCallback) {
913
970
  this.confirmCommentCallback(annotation)
914
971
  }
915
972
  },
916
- onConfirmCreate: function(payload) {
973
+ onConfirmCreate: function (payload) {
917
974
  if (this.confirmCreateCallback) {
918
- this.confirmCreateCallback(payload);
975
+ this.confirmCreateCallback(payload)
919
976
  }
920
977
  },
921
- onCancelCreate: function() {
978
+ onCancelCreate: function () {
922
979
  if (this.cancelCreateCallback) {
923
- this.cancelCreateCallback();
980
+ this.cancelCreateCallback()
924
981
  }
925
982
  },
926
- onConfirmDelete: function(payload) {
983
+ onConfirmDelete: function (payload) {
927
984
  if (this.confirmDeleteCallback) {
928
- this.confirmDeleteCallback(payload);
985
+ this.confirmDeleteCallback(payload)
929
986
  }
930
987
  },
931
988
  onSidebarTabClicked: function (tab) {
932
- let globalSettings = { ...this.settingsStore.globalSettings };
989
+ let globalSettings = { ...this.settingsStore.globalSettings }
933
990
 
934
991
  if ('interactiveMode' in globalSettings) {
935
992
  if (tab.id === 1 && tab.type === 'datasetExplorer') {
936
- globalSettings.interactiveMode = 'dataset';
993
+ globalSettings.interactiveMode = 'dataset'
937
994
  } else if (tab.id === 2 && tab.type === 'connectivityExplorer') {
938
- globalSettings.interactiveMode = 'connectivity';
995
+ globalSettings.interactiveMode = 'connectivity'
939
996
  }
940
- this.settingsStore.updateGlobalSettings(globalSettings);
997
+ this.settingsStore.updateGlobalSettings(globalSettings)
941
998
  }
942
999
 
943
- this.$refs.dialogToolbar.loadGlobalSettings();
1000
+ this.$refs.dialogToolbar.loadGlobalSettings()
944
1001
  },
945
1002
  onSidebarTabClosed: function (tab) {
946
- if (tab.id === 3 && tab.type === "annotation") {
947
- EventBus.emit('sidebar-annotation-close');
1003
+ if (tab.id === 3 && tab.type === 'annotation') {
1004
+ EventBus.emit('sidebar-annotation-close')
948
1005
  }
949
1006
  },
950
1007
  updateGlobalSettingsFromState: function (state) {
951
1008
  if (state?.globalSettings) {
952
- this.settingsStore.updateGlobalSettings(state.globalSettings);
1009
+ this.settingsStore.updateGlobalSettings(state.globalSettings)
953
1010
  }
954
1011
  },
955
1012
  trackEvent: function (data) {
956
- Tagging.sendEvent(data);
1013
+ Tagging.sendEvent(data)
957
1014
  },
958
1015
  updateFlatmapMinimap: function () {
959
- const splitdialog = this.$refs.splitdialog;
1016
+ const splitdialog = this.$refs.splitdialog
960
1017
 
961
1018
  if (splitdialog) {
962
- splitdialog.updateFlatmapMinimap();
1019
+ splitdialog.updateFlatmapMinimap()
963
1020
  }
964
1021
  },
965
1022
  },
966
1023
  created: function () {
967
- this._facets = [];
968
- this._externalStateSet = false;
1024
+ this._facets = []
1025
+ this._externalStateSet = false
969
1026
  },
970
1027
  mounted: function () {
971
- EventBus.on("CreateNewEntry", newView => {
972
- this.createNewEntry(newView);
973
- });
974
- EventBus.on("RemoveEntryRequest", id => {
975
- this.removeEntry(id);
976
- });
977
- EventBus.on("PopoverActionClick", payload => {
978
- this.actionClick(payload);
979
- });
980
- EventBus.on('annotation-open', payload => {
981
- this.openAnnotation(payload);
982
- });
1028
+ EventBus.on('CreateNewEntry', (newView) => {
1029
+ this.createNewEntry(newView)
1030
+ })
1031
+ EventBus.on('RemoveEntryRequest', (id) => {
1032
+ this.removeEntry(id)
1033
+ })
1034
+ EventBus.on('PopoverActionClick', (payload) => {
1035
+ this.actionClick(payload)
1036
+ })
1037
+ EventBus.on('simulation-open-clicked', (payload) => {
1038
+ this.actionClick(payload)
1039
+ })
1040
+ EventBus.on('annotation-open', (payload) => {
1041
+ this.openAnnotation(payload)
1042
+ })
983
1043
  EventBus.on('sidebar-annotation-close', () => {
984
- const globalSettings = { ...this.settingsStore.globalSettings };
985
- const { interactiveMode, viewingMode } = globalSettings;
1044
+ const globalSettings = { ...this.settingsStore.globalSettings }
1045
+ const { interactiveMode, viewingMode } = globalSettings
986
1046
 
987
1047
  // Sidebar annotation close event emits whenever viewing mode is changed.
988
1048
  // if annotation state is being restored on first load for annotation viewing mode,
989
1049
  // open the anootation tab and return.
990
1050
  if (this.sidebarAnnotationState && viewingMode === 'Annotation') {
991
- this.sidebarAnnotationState = false;
992
- this.$refs.sideBar.tabClicked({id: 3, type: 'annotation'});
993
- return;
1051
+ this.sidebarAnnotationState = false
1052
+ this.$refs.sideBar.tabClicked({ id: 3, type: 'annotation' })
1053
+ return
994
1054
  }
995
1055
 
996
- this.annotationEntry = [];
997
- this.createData = {};
1056
+ this.annotationEntry = []
1057
+ this.createData = {}
998
1058
 
999
1059
  if (this.$refs.sideBar) {
1000
- if (interactiveMode === "dataset") {
1001
- this.$refs.sideBar.tabClicked({id: 1, type: 'datasetExplorer'});
1002
- } else if (interactiveMode === "connectivity") {
1003
- this.$refs.sideBar.tabClicked({id: 2, type: 'connectivityExplorer'});
1060
+ if (interactiveMode === 'dataset') {
1061
+ this.$refs.sideBar.tabClicked({ id: 1, type: 'datasetExplorer' })
1062
+ } else if (interactiveMode === 'connectivity') {
1063
+ this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' })
1004
1064
  }
1005
1065
 
1006
- this.$refs.sideBar.closeConnectivity();
1007
- EventBus.emit('connectivity-item-close');
1066
+ this.$refs.sideBar.closeConnectivity()
1067
+ EventBus.emit('connectivity-item-close')
1008
1068
  }
1009
- });
1069
+ })
1010
1070
  EventBus.on('update-offline-annotation-enabled', (payload) => {
1011
- this.settingsStore.updateOfflineAnnotationEnabled(payload);
1012
- });
1013
- EventBus.on('connectivity-info-open', payload => {
1014
- this.openConnectivityInfo(payload);
1015
- });
1016
- EventBus.on('connectivity-info-close', payload => {
1071
+ this.settingsStore.updateOfflineAnnotationEnabled(payload)
1072
+ })
1073
+ EventBus.on('connectivity-info-open', (payload) => {
1074
+ this.openConnectivityInfo(payload)
1075
+ })
1076
+ EventBus.on('connectivity-info-close', (payload) => {
1017
1077
  if (this.$refs.sideBar) {
1018
- this.connectivityProcessed = false;
1019
- this.$refs.sideBar.resetConnectivitySearch();
1078
+ this.connectivityProcessed = false
1079
+ this.$refs.sideBar.resetConnectivitySearch()
1020
1080
  }
1021
- });
1022
- EventBus.on('connectivity-error', payload => {
1081
+ })
1082
+ EventBus.on('connectivity-error', (payload) => {
1023
1083
  if (this.$refs.sideBar) {
1024
- this.$refs.sideBar.updateConnectivityError(payload.data);
1084
+ this.$refs.sideBar.updateConnectivityError(payload.data)
1025
1085
  }
1026
- });
1027
- EventBus.on('neuron-connection-feature-click', payload => {
1086
+ })
1087
+ EventBus.on('neuron-connection-feature-click', (payload) => {
1028
1088
  if (this.$refs.sideBar) {
1029
- const { filters, search } = payload;
1030
- this.$refs.sideBar.openConnectivitySearch(filters, search);
1031
- this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' });
1032
- this.$refs.sideBar.setDrawerOpen(true);
1089
+ const { filters, search } = payload
1090
+ this.$refs.sideBar.openConnectivitySearch(filters, search)
1091
+ this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' })
1092
+ this.$refs.sideBar.setDrawerOpen(true)
1033
1093
  }
1034
- });
1035
- EventBus.on("OpenNewMap", type => {
1036
- this.updateFlatmapMinimap();
1037
- this.openNewMap(type);
1038
- });
1039
- EventBus.on("startHelp", () => {
1094
+ })
1095
+ EventBus.on('OpenNewMap', (type) => {
1096
+ this.updateFlatmapMinimap()
1097
+ this.openNewMap(type)
1098
+ })
1099
+ EventBus.on('startHelp', () => {
1040
1100
  if (this.$refs.sideBar) {
1041
- this.$refs.sideBar.close();
1101
+ this.$refs.sideBar.close()
1042
1102
  }
1043
- });
1044
- EventBus.on("connectivity-knowledge", payload => {
1045
- this.connectivityKnowledge = payload.data;
1046
- this.connectivityHighlight = payload.highlight;
1047
- this.connectivityProcessed = payload.processed;
1103
+ })
1104
+ EventBus.on('connectivity-knowledge', (payload) => {
1105
+ this.connectivityKnowledge = payload.data
1106
+ this.connectivityHighlight = payload.highlight
1107
+ this.connectivityProcessed = payload.processed
1048
1108
 
1049
1109
  // Restore sidebar state if it exists and not restored yet
1050
1110
  // after loading connectivity knowledge
1051
- this.restoreSidebarState(this.state);
1111
+ this.restoreSidebarState(this.state)
1052
1112
  })
1053
- EventBus.on("modeUpdate", payload => {
1054
- if (payload === "dataset") {
1055
- this.$refs.sideBar.tabClicked({id: 1, type: 'datasetExplorer'});
1056
- } else if (payload === "connectivity") {
1057
- this.$refs.sideBar.tabClicked({id: 2, type: 'connectivityExplorer'});
1113
+ EventBus.on('modeUpdate', (payload) => {
1114
+ if (payload === 'dataset') {
1115
+ this.$refs.sideBar.tabClicked({ id: 1, type: 'datasetExplorer' })
1116
+ } else if (payload === 'connectivity') {
1117
+ this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' })
1058
1118
  }
1059
1119
  })
1060
- EventBus.on("connectivity-filter-options", payload => {
1061
- this.filterOptions = payload;
1120
+ EventBus.on('connectivity-filter-options', (payload) => {
1121
+ this.filterOptions = payload
1062
1122
  })
1063
1123
  this.$nextTick(() => {
1064
- if (this.search === "" && this._facets.length === 0) {
1124
+ if (this.search === '' && this._facets.length === 0) {
1065
1125
  if (this.$refs.sideBar) {
1066
- this.$refs.sideBar.close();
1126
+ this.$refs.sideBar.close()
1067
1127
  }
1068
1128
  setTimeout(() => {
1069
- this.startUp = false;
1070
- }, 2000);
1071
- } else this.openSearch(this._facets, this.search);
1072
- });
1129
+ this.startUp = false
1130
+ }, 2000)
1131
+ } else this.openSearch(this._facets, this.search)
1132
+ })
1073
1133
  },
1074
1134
  computed: {
1075
- ...mapStores(useEntriesStore, useSettingsStore, useSplitFlowStore, useConnectivitiesStore),
1135
+ ...mapStores(useEntriesStore, useSettingsStore, useSimulationPlotStore, useSplitFlowStore, useConnectivitiesStore),
1076
1136
  envVars: function () {
1077
1137
  return {
1078
1138
  API_LOCATION: this.settingsStore.sparcApi,
@@ -1082,13 +1142,14 @@ export default {
1082
1142
  PENNSIEVE_API_LOCATION: this.settingsStore.pennsieveApi,
1083
1143
  ROOT_URL: this.settingsStore.rootUrl,
1084
1144
  FLATMAPAPI_LOCATION: this.settingsStore.flatmapAPI,
1085
- };
1145
+ TEST_DATA_LOCATION: this.settingsStore.testDataLocation,
1146
+ }
1086
1147
  },
1087
- entries: function() {
1088
- return this.entriesStore.entries;
1148
+ entries: function () {
1149
+ return this.entriesStore.entries
1089
1150
  },
1090
1151
  },
1091
- };
1152
+ }
1092
1153
  </script>
1093
1154
 
1094
1155
  <style scoped lang="scss">
@@ -1128,5 +1189,4 @@ export default {
1128
1189
  }
1129
1190
  }
1130
1191
  }
1131
-
1132
1192
  </style>