@abi-software/mapintegratedvuer 1.16.3-simulation.1 → 1.17.0

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