@abi-software/map-side-bar 2.7.2 → 2.7.3-beta.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.
@@ -1,11 +1,47 @@
1
1
  <template>
2
- <div v-if="entry" class="main" v-loading="loading">
2
+ <div v-if="entry" class="main">
3
+ <div v-if="connectivityEntry.length > 1 && !entryId" class="toggle-button">
4
+ <el-popover
5
+ width="auto"
6
+ trigger="hover"
7
+ :teleported="false"
8
+ >
9
+ <template #reference>
10
+ <el-button
11
+ class="button"
12
+ @click="previous"
13
+ :disabled="this.entryIndex === 0"
14
+ >
15
+ Previous
16
+ </el-button>
17
+ </template>
18
+ <span>{{ previousLabel }}</span>
19
+ </el-popover>
20
+ <el-popover
21
+ width="auto"
22
+ trigger="hover"
23
+ :teleported="false"
24
+ >
25
+ <template #reference>
26
+ <el-button
27
+ class="button"
28
+ @click="next"
29
+ :disabled="this.entryIndex === this.connectivityEntry.length - 1"
30
+ >
31
+ Next
32
+ </el-button>
33
+ </template>
34
+ <span>{{ nextLabel }}</span>
35
+ </el-popover>
36
+ </div>
3
37
  <!-- Connectivity Info Title -->
4
38
  <div class="connectivity-info-title">
5
39
  <div class="title-content">
6
40
  <div class="block" v-if="entry.title">
7
41
  <div class="title">
8
- {{ capitalise(entry.title) }}
42
+ <span @click="onConnectivityClicked({id: entry.featureId[0]})">
43
+ {{ capitalise(entry.title) }}
44
+ </span>
9
45
  <template v-if="entry.featuresAlert">
10
46
  <el-popover
11
47
  width="250"
@@ -22,13 +58,7 @@
22
58
  </el-popover>
23
59
  </template>
24
60
  </div>
25
- <div
26
- v-if="
27
- entry.provenanceTaxonomyLabel &&
28
- entry.provenanceTaxonomyLabel.length > 0
29
- "
30
- class="subtitle"
31
- >
61
+ <div v-if="hasProvenanceTaxonomyLabel" class="subtitle">
32
62
  {{ provSpeciesDescription }}
33
63
  </div>
34
64
  </div>
@@ -44,8 +74,8 @@
44
74
  popper-class="popover-map-pin"
45
75
  >
46
76
  <template #reference>
47
- <el-button class="button-circle" circle @click="showConnectivity(entry)">
48
- <el-icon color="white">
77
+ <el-button class="button-circle secondary" circle @click="showConnectivity">
78
+ <el-icon color="#8300bf">
49
79
  <el-icon-location />
50
80
  </el-icon>
51
81
  </el-button>
@@ -55,178 +85,101 @@
55
85
  </span>
56
86
  </el-popover>
57
87
  <CopyToClipboard :content="updatedCopyContent" />
58
- </div>
59
- </div>
60
-
61
- <div class="content-container population-display">
62
- <div class="block attribute-title-container">
63
- <span class="attribute-title">Population Display</span>
64
- </div>
65
- <div class="block buttons-row">
66
- <el-button
67
- :class="activeView === 'listView' ? 'button' : 'el-button-secondary'"
68
- @click="switchConnectivityView('listView')"
69
- >
70
- List view
71
- </el-button>
72
- <el-button
73
- :class="activeView === 'graphView' ? 'button' : 'el-button-secondary'"
74
- @click="switchConnectivityView('graphView')"
75
- >
76
- Graph view
77
- </el-button>
78
- </div>
79
- </div>
80
-
81
- <div class="content-container content-container-connectivity" v-show="activeView === 'listView'">
82
- {{ entry.paths }}
83
- <div v-if="entry.origins && entry.origins.length > 0" class="block">
84
- <div class="attribute-title-container">
85
- <span class="attribute-title">Origin</span>
88
+ <template v-if="withCloseButton">
86
89
  <el-popover
87
- width="250"
90
+ width="auto"
88
91
  trigger="hover"
89
92
  :teleported="false"
90
- popper-class="popover-origin-help"
93
+ popper-class="popover-map-pin"
91
94
  >
92
95
  <template #reference>
93
- <el-icon class="info"><el-icon-warning /></el-icon>
96
+ <el-button class="button-circle" circle @click="closeConnectivity">
97
+ <el-icon color="white">
98
+ <el-icon-close />
99
+ </el-icon>
100
+ </el-button>
94
101
  </template>
95
- <span style="word-break: keep-all">
96
- <i>Origin</i> {{ originDescription }}
97
- </span>
98
-
102
+ <span>Close</span>
99
103
  </el-popover>
100
- </div>
101
- <div
102
- v-for="(origin, i) in entry.origins"
103
- class="attribute-content"
104
- :origin-item-label="origin"
105
- :key="origin"
106
- @mouseenter="toggleConnectivityTooltip(origin, {show: true})"
107
- @mouseleave="toggleConnectivityTooltip(origin, {show: false})"
108
- >
109
- {{ capitalise(origin) }}
110
- </div>
111
- <el-button
112
- v-show="
113
- entry.originsWithDatasets && entry.originsWithDatasets.length > 0 &&
114
- shouldShowExploreButton(entry.originsWithDatasets)
115
- "
116
- class="button"
117
- id="open-dendrites-button"
118
- @click="openDendrites"
119
- >
120
- Explore origin data
121
- </el-button>
104
+ </template>
122
105
  </div>
123
- <div
124
- v-if="entry.components && entry.components.length > 0"
125
- class="block"
126
- >
127
- <div class="attribute-title-container">
128
- <span class="attribute-title">Components</span>
129
- <el-popover
130
- width="250"
131
- trigger="hover"
132
- :teleported="false"
133
- popper-class="popover-origin-help"
134
- >
135
- <template #reference>
136
- <el-icon class="info"><el-icon-warning /></el-icon>
137
- </template>
138
- <span style="word-break: keep-all">
139
- The list is not in any specific order.<br>
140
- Specific paths can be viewed using Graph View.
141
- </span>
142
- </el-popover>
143
- </div>
144
- <div
145
- v-for="(component, i) in entry.components"
146
- class="attribute-content"
147
- :component-item-label="component"
148
- :key="component"
149
- @mouseenter="toggleConnectivityTooltip(component, {show: true})"
150
- @mouseleave="toggleConnectivityTooltip(component, {show: false})"
106
+ </div>
107
+
108
+ <div
109
+ class="content-container population-display"
110
+ :class="dualConnectionSource ? 'population-display-toolbar' : ''"
111
+ >
112
+ <div class="block attribute-title-container">
113
+ <span class="attribute-title">Population Display</span>
114
+ <el-popover
115
+ v-if="activeView === 'listView'"
116
+ width="250"
117
+ trigger="hover"
118
+ :teleported="false"
119
+ popper-class="popover-origin-help"
151
120
  >
152
- {{ capitalise(component) }}
153
- </div>
121
+ <template #reference>
122
+ <el-icon class="info"><el-icon-warning /></el-icon>
123
+ </template>
124
+ <span style="word-break: keep-all">
125
+ This list is ordered alphabetically,
126
+ switch to graph view for path details.
127
+ </span>
128
+ </el-popover>
154
129
  </div>
155
- <div
156
- v-if="entry.destinations && entry.destinations.length > 0"
157
- class="block"
158
- >
159
- <div class="attribute-title-container">
160
- <span class="attribute-title">Destination</span>
161
- <el-popover
162
- width="250"
163
- trigger="hover"
164
- :teleported="false"
165
- popper-class="popover-origin-help"
166
- >
167
- <template #reference>
168
- <el-icon class="info"><el-icon-warning /></el-icon>
169
- </template>
170
- <span style="word-break: keep-all">
171
- <i>Destination</i> is where the axons terminate
172
- </span>
173
- </el-popover>
130
+ <div class="block buttons-row">
131
+ <div v-if="dualConnectionSource">
132
+ <span>Connectivity from:</span>
133
+ <el-radio-group v-model="connectivitySource" @change="onConnectivitySourceChange">
134
+ <el-radio value="map">Map</el-radio>
135
+ <el-radio value="sckan">SCKAN</el-radio>
136
+ </el-radio-group>
174
137
  </div>
175
- <div
176
- v-for="(destination, i) in entry.destinations"
177
- class="attribute-content"
178
- :destination-item-label="destination"
179
- :key="destination"
180
- @mouseenter="toggleConnectivityTooltip(destination, {show: true})"
181
- @mouseleave="toggleConnectivityTooltip(destination, {show: false})"
182
- >
183
- {{ capitalise(destination) }}
138
+ <div>
139
+ <el-button
140
+ :class="activeView === 'listView' ? 'button' : 'el-button-secondary'"
141
+ @click="switchConnectivityView('listView')"
142
+ >
143
+ List view
144
+ </el-button>
145
+ <el-button
146
+ :class="activeView === 'graphView' ? 'button' : 'el-button-secondary'"
147
+ @click="switchConnectivityView('graphView')"
148
+ >
149
+ Graph view
150
+ </el-button>
184
151
  </div>
185
- <el-button
186
- v-show="
187
- entry.destinationsWithDatasets &&
188
- entry.destinationsWithDatasets.length > 0 &&
189
- shouldShowExploreButton(entry.destinationsWithDatasets)
190
- "
191
- class="button"
192
- @click="openAxons"
193
- >
194
- Explore destination data
195
- </el-button>
196
- </div>
197
- <div
198
- v-show="
199
- entry.componentsWithDatasets &&
200
- entry.componentsWithDatasets.length > 0 &&
201
- shouldShowExploreButton(entry.componentsWithDatasets)
202
- "
203
- class="block"
204
- >
205
- <el-button
206
- class="button"
207
- @click="openAll"
208
- >
209
- Search for data on components
210
- </el-button>
211
152
  </div>
153
+ </div>
212
154
 
213
- <div class="connectivity-error-container">
214
- <div class="connectivity-error" v-if="connectivityError">
215
- <strong v-if="connectivityError.errorConnectivities">
216
- {{ connectivityError.errorConnectivities }}
217
- </strong>
218
- {{ connectivityError.errorMessage }}
219
- </div>
220
- </div>
155
+ <div class="content-container content-container-connectivity" v-show="activeView === 'listView'">
156
+ <connectivity-list
157
+ v-loading="connectivityLoading"
158
+ :key="`${connectivityKey}list`"
159
+ :entry="entry"
160
+ :origins="origins"
161
+ :components="components"
162
+ :destinations="destinations"
163
+ :originsWithDatasets="originsWithDatasets"
164
+ :componentsWithDatasets="componentsWithDatasets"
165
+ :destinationsWithDatasets="destinationsWithDatasets"
166
+ :availableAnatomyFacets="availableAnatomyFacets"
167
+ :connectivityError="connectivityError"
168
+ @connectivity-hovered="onConnectivityHovered"
169
+ @connectivity-clicked="onConnectivityClicked"
170
+ @connectivity-action-click="onConnectivityActionClick"
171
+ />
221
172
  </div>
222
173
 
223
- <div class="content-container" v-show="activeView === 'graphView'">
174
+ <div class="content-container content-container-connectivity" v-show="activeView === 'graphView'">
224
175
  <template v-if="graphViewLoaded">
225
176
  <connectivity-graph
226
- :key="entry.featureId[0]"
177
+ v-loading="connectivityLoading"
178
+ :key="`${connectivityKey}graph`"
227
179
  :entry="entry.featureId[0]"
228
- :mapServer="envVars.FLATMAPAPI_LOCATION"
180
+ :mapServer="flatmapApi"
229
181
  :sckanVersion="sckanVersion"
182
+ :connectivityFromMap="connectivityFromMap"
230
183
  @tap-node="onTapNode"
231
184
  ref="connectivityGraphRef"
232
185
  />
@@ -234,22 +187,22 @@
234
187
  </div>
235
188
 
236
189
  <div class="content-container content-container-references" v-if="resources.length">
237
- <external-resource-card
190
+ <ExternalResourceCard
238
191
  :resources="resources"
239
192
  @references-loaded="onReferencesLoaded"
240
193
  @show-reference-connectivities="onShowReferenceConnectivities"
241
- ></external-resource-card>
194
+ />
242
195
  </div>
243
196
  </div>
244
197
  </template>
245
198
 
246
199
  <script>
200
+ /* eslint-disable no-alert, no-console */
247
201
  import {
248
- ArrowUp as ElIconArrowUp,
249
- ArrowDown as ElIconArrowDown,
250
202
  Warning as ElIconWarning,
203
+ Location as ElIconLocation,
204
+ Search as ElIconSearch,
251
205
  } from '@element-plus/icons-vue'
252
- /* eslint-disable no-alert, no-console */
253
206
  import {
254
207
  ElButton as Button,
255
208
  ElContainer as Container,
@@ -260,6 +213,7 @@ import EventBus from './EventBus.js'
260
213
  import {
261
214
  CopyToClipboard,
262
215
  ConnectivityGraph,
216
+ ConnectivityList,
263
217
  ExternalResourceCard,
264
218
  } from '@abi-software/map-utilities';
265
219
  import '@abi-software/map-utilities/dist/style.css';
@@ -283,26 +237,22 @@ export default {
283
237
  Button,
284
238
  Container,
285
239
  Icon,
286
- ElIconArrowUp,
287
- ElIconArrowDown,
288
240
  ElIconWarning,
241
+ ElIconLocation,
242
+ ElIconSearch,
289
243
  ExternalResourceCard,
290
244
  CopyToClipboard,
291
245
  ConnectivityGraph,
246
+ ConnectivityList,
292
247
  },
293
248
  props: {
294
- entry: {
295
- type: Object,
296
- default: () => ({
297
- destinations: [],
298
- origins: [],
299
- components: [],
300
- destinationsWithDatasets: [],
301
- originsWithDatasets: [],
302
- componentsWithDatasets: [],
303
- resource: undefined,
304
- featuresAlert: undefined,
305
- }),
249
+ connectivityEntry: {
250
+ type: Array,
251
+ default: [],
252
+ },
253
+ entryId: {
254
+ type: String,
255
+ default: "",
306
256
  },
307
257
  envVars: {
308
258
  type: Object,
@@ -312,126 +262,139 @@ export default {
312
262
  type: Array,
313
263
  default: () => [],
314
264
  },
265
+ withCloseButton: {
266
+ type: Boolean,
267
+ default: false,
268
+ },
315
269
  },
316
270
  data: function () {
317
271
  return {
318
- controller: undefined,
319
- activeSpecies: undefined,
320
- pubmedSearchUrl: '',
321
- loading: false,
272
+ entryIndex: 0,
273
+ updatedCopyContent: '',
322
274
  activeView: 'listView',
323
- facetList: [],
324
- showToolip: false,
325
- showDetails: false,
326
- originDescriptions: {
327
- motor: 'is the location of the initial cell body of the circuit',
328
- sensory: 'is the location of the initial cell body in the PNS circuit',
329
- },
330
- componentsWithDatasets: [],
331
- uberons: [{ id: undefined, name: undefined }],
332
- connectivityError: null,
333
275
  timeoutID: undefined,
276
+ connectivityLoading: false,
277
+ dualConnectionSource: false,
278
+ connectivitySource: 'sckan',
279
+ connectivityError: null,
334
280
  graphViewLoaded: false,
335
- updatedCopyContent: '',
336
- sckanVersion: '',
337
- }
338
- },
339
- watch: {
340
- availableAnatomyFacets: {
341
- handler: function (val) {
342
- this.convertFacetsToList(val)
343
- },
344
- immediate: true,
345
- deep: true,
346
- },
281
+ connectivityFromMap: null,
282
+ };
347
283
  },
348
284
  computed: {
349
- resources: function () {
350
- let resources = [];
351
- if (this.entry && this.entry.hyperlinks) {
352
- resources = this.entry.hyperlinks;
285
+ entry: function () {
286
+ if (this.entryId) {
287
+ return this.connectivityEntry.filter((entry) => {
288
+ return entry.featureId[0] === this.entryId;
289
+ })[this.entryIndex];
353
290
  }
354
- return resources;
291
+ return this.connectivityEntry[this.entryIndex];
355
292
  },
356
- originDescription: function () {
357
- if (
358
- this.entry &&
359
- this.entry.title &&
360
- this.entry.title.toLowerCase().includes('motor')
361
- ) {
362
- return this.originDescriptions.motor
363
- } else {
364
- return this.originDescriptions.sensory
293
+ previousLabel: function () {
294
+ if (this.entryIndex === 0) {
295
+ return "This is the first item. Click 'Next' to see more information.";
365
296
  }
297
+ return this.connectivityEntry[this.entryIndex - 1].title;
298
+ },
299
+ nextLabel: function () {
300
+ if (this.entryIndex === this.connectivityEntry.length - 1) {
301
+ return "This is the last item. Click 'Previous' to see more information.";
302
+ }
303
+ return this.connectivityEntry[this.entryIndex + 1].title;
304
+ },
305
+ hasProvenanceTaxonomyLabel: function () {
306
+ return (
307
+ this.entry.provenanceTaxonomyLabel &&
308
+ this.entry.provenanceTaxonomyLabel.length > 0
309
+ );
366
310
  },
367
311
  provSpeciesDescription: function () {
368
- let text = 'Studied in'
312
+ let text = "Studied in";
369
313
  this.entry.provenanceTaxonomyLabel.forEach((label) => {
370
- text += ` ${label},`
371
- })
372
- text = text.slice(0, -1) // remove last comma
373
- text += ' species'
374
- return text
314
+ text += ` ${label},`;
315
+ });
316
+ text = text.slice(0, -1); // remove last comma
317
+ text += " species";
318
+ return text;
375
319
  },
376
- },
377
- methods: {
378
- titleCase: function (title) {
379
- return titleCase(title)
320
+ connectivityKey: function () {
321
+ return this.entry.featureId[0] + this.entry.connectivitySource;
380
322
  },
381
- capitalise: function (text) {
382
- return capitalise(text)
323
+ origins: function () {
324
+ return this.entry.origins;
325
+ },
326
+ components: function () {
327
+ return this.entry.components;
383
328
  },
384
- openUrl: function (url) {
385
- window.open(url, '_blank')
329
+ destinations: function () {
330
+ return this.entry.destinations;
386
331
  },
387
- openAll: function () {
388
- EventBus.emit('onConnectivityActionClick', {
389
- type: 'Facets',
390
- labels: this.entry.componentsWithDatasets.map((a) => a.name.toLowerCase()),
391
- })
332
+ originsWithDatasets: function () {
333
+ return this.entry.originsWithDatasets;
392
334
  },
393
- openAxons: function () {
394
- EventBus.emit('onConnectivityActionClick', {
395
- type: 'Facets',
396
- labels: this.entry.destinationsWithDatasets.map((a) => a.name.toLowerCase()),
397
- })
335
+ componentsWithDatasets: function () {
336
+ return this.entry.componentsWithDatasets;
398
337
  },
399
- // shouldShowExploreButton: Checks if the feature is in the list of available anatomy facets
400
- shouldShowExploreButton: function (features) {
401
- for (let i = 0; i < features.length; i++) {
402
- if (this.facetList.includes(features[i].name.toLowerCase())) {
403
- return true
338
+ destinationsWithDatasets: function () {
339
+ return this.entry.destinationsWithDatasets;
340
+ },
341
+ resources: function () {
342
+ return this.entry.hyperlinks;
343
+ },
344
+ sckanVersion: function () {
345
+ return this.entry.knowledgeSource;
346
+ },
347
+ flatmapApi: function () {
348
+ return this.envVars.FLATMAPAPI_LOCATION;
349
+ },
350
+ },
351
+ watch: {
352
+ entry: {
353
+ deep: true,
354
+ immediate: true,
355
+ handler: function (newVal, oldVal) {
356
+ if (newVal !== oldVal) {
357
+ this.connectivityLoading = true;
358
+ this.activeView = localStorage.getItem('connectivity-active-view') || this.activeView;
359
+ if (this.activeView === 'graphView') {
360
+ this.graphViewLoaded = true;
361
+ }
362
+
363
+ this.checkAndUpdateDualConnection();
364
+ this.connectivitySource = this.entry.connectivitySource;
365
+ this.updateGraphConnectivity();
366
+ this.connectivityLoading = false;
367
+ this.$emit('loaded');
404
368
  }
369
+ },
370
+ },
371
+ },
372
+ methods: {
373
+ previous: function () {
374
+ if (this.entryIndex !== 0) {
375
+ this.entryIndex = this.entryIndex - 1;
405
376
  }
406
- return false
407
377
  },
408
- // convertFacetsToList: Converts the available anatomy facets to a list for easy searching
409
- convertFacetsToList: function (facets) {
410
- facets.forEach((facet) => {
411
- if(facet.children) {
412
- this.convertFacetsToList(facet.children)
413
- } else {
414
- this.facetList.push(facet.label.toLowerCase())
415
- }
416
- })
378
+ next: function () {
379
+ if (this.entryIndex !== this.connectivityEntry.length - 1) {
380
+ this.entryIndex = this.entryIndex + 1;
381
+ }
417
382
  },
418
- openDendrites: function () {
419
- EventBus.emit('onConnectivityActionClick', {
420
- type: 'Facets',
421
- labels: this.entry.originsWithDatasets.map((a) => a.name.toLowerCase()),
422
- })
383
+ titleCase: function (title) {
384
+ return titleCase(title)
423
385
  },
424
- pubmedSearchUrlUpdate: function (val) {
425
- this.pubmedSearchUrl = val
386
+ capitalise: function (text) {
387
+ return capitalise(text)
426
388
  },
427
- showConnectivity: function (entry) {
389
+ showConnectivity: function () {
428
390
  // move the map center to highlighted area
429
- const featureIds = entry.featureId || [];
391
+ const featureIds = this.entry.featureId || [];
430
392
  // connected to flatmapvuer > moveMap(featureIds) function
431
393
  this.$emit('show-connectivity', featureIds);
432
394
  },
433
395
  switchConnectivityView: function (val) {
434
396
  this.activeView = val;
397
+ localStorage.setItem('connectivity-active-view', this.activeView);
435
398
 
436
399
  if (val === 'graphView' && !this.graphViewLoaded) {
437
400
  // to load the connectivity graph only after the container is in view
@@ -443,7 +406,7 @@ export default {
443
406
  onTapNode: function (data) {
444
407
  // save selected state for list view
445
408
  const name = data.map(t => t.label).join(', ');
446
- this.toggleConnectivityTooltip(name, {show: true});
409
+ this.onConnectivityHovered(name);
447
410
  },
448
411
  onShowReferenceConnectivities: function (refSource) {
449
412
  this.$emit('show-reference-connectivities', refSource);
@@ -514,28 +477,28 @@ export default {
514
477
  }
515
478
 
516
479
  // Origins
517
- if (this.entry.origins?.length) {
480
+ if (this.origins?.length) {
518
481
  const title = 'Origin';
519
- const origins = this.entry.origins;
520
- const originsWithDatasets = this.entry.originsWithDatasets;
482
+ const origins = this.origins;
483
+ const originsWithDatasets = this.originsWithDatasets;
521
484
  const transformedOrigins = transformData(title, origins, originsWithDatasets);
522
485
  contentArray.push(transformedOrigins);
523
486
  }
524
487
 
525
488
  // Components
526
- if (this.entry.components?.length) {
489
+ if (this.components?.length) {
527
490
  const title = 'Components';
528
- const components = this.entry.components;
529
- const componentsWithDatasets = this.entry.componentsWithDatasets;
491
+ const components = this.components;
492
+ const componentsWithDatasets = this.componentsWithDatasets;
530
493
  const transformedComponents = transformData(title, components, componentsWithDatasets);
531
494
  contentArray.push(transformedComponents);
532
495
  }
533
496
 
534
497
  // Destination
535
- if (this.entry.destinations?.length) {
498
+ if (this.destinations?.length) {
536
499
  const title = 'Destination';
537
- const destinations = this.entry.destinations;
538
- const destinationsWithDatasets = this.entry.destinationsWithDatasets;
500
+ const destinations = this.destinations;
501
+ const destinationsWithDatasets = this.destinationsWithDatasets;
539
502
  const transformedDestinations = transformData(title, destinations, destinationsWithDatasets);
540
503
  contentArray.push(transformedDestinations);
541
504
  }
@@ -553,31 +516,42 @@ export default {
553
516
 
554
517
  return contentArray.join('\n\n<br>');
555
518
  },
556
- toggleConnectivityTooltip: function (name, option) {
519
+ getConnectivityDatasets: function (label) {
557
520
  const allWithDatasets = [
558
- ...this.entry.componentsWithDatasets,
559
- ...this.entry.destinationsWithDatasets,
560
- ...this.entry.originsWithDatasets,
521
+ ...this.componentsWithDatasets,
522
+ ...this.destinationsWithDatasets,
523
+ ...this.originsWithDatasets,
561
524
  ];
562
- const names = name.split(','); // some features have more than one value
563
- const data = [];
564
- if (option.show) {
565
- names.forEach((n) => {
566
- const foundData = allWithDatasets.find((a) =>
567
- a.name.toLowerCase().trim() === n.toLowerCase().trim()
568
- );
569
-
570
- if (foundData) {
571
- data.push({
572
- id: foundData.id,
573
- label: foundData.name
574
- });
575
- }
576
- });
577
- }
578
-
525
+ const names = label.split(','); // some features have more than one value
526
+ let data = [];
527
+ names.forEach((n) => {
528
+ const foundData = allWithDatasets.find((a) =>
529
+ a.name.toLowerCase().trim() === n.toLowerCase().trim()
530
+ );
531
+ if (foundData) {
532
+ data.push({
533
+ id: foundData.id,
534
+ label: foundData.name
535
+ });
536
+ }
537
+ });
538
+ return data
539
+ },
540
+ onConnectivityHovered: function (label) {
541
+ const payload = {
542
+ connectivityInfo: this.entry,
543
+ data: label ? this.getConnectivityDatasets(label) : [],
544
+ };
579
545
  // type: to show error only for click event
580
- this.$emit('connectivity-component-click', data);
546
+ this.$emit('connectivity-hovered', payload);
547
+ },
548
+ onConnectivityClicked: function (data) {
549
+ let payload = {
550
+ query: data.id,
551
+ filter: [],
552
+ data: data.label ? this.getConnectivityDatasets(data.label) : [],
553
+ };
554
+ this.$emit('connectivity-clicked', payload);
581
555
  },
582
556
  getErrorConnectivities: function (errorData) {
583
557
  const errorDataToEmit = [...new Set(errorData)];
@@ -633,10 +607,70 @@ export default {
633
607
  this.connectivityError = null;
634
608
  }, ERROR_TIMEOUT);
635
609
  },
610
+ onConnectivitySourceChange: function (connectivitySource) {
611
+ const { featureId } = this.entry;
612
+
613
+ this.connectivityLoading = true;
614
+
615
+ if (this.activeView !== 'graphView') {
616
+ this.graphViewLoaded = false;
617
+ }
618
+
619
+ this.checkAndUpdateDualConnection();
620
+ this.updateGraphConnectivity();
621
+
622
+ EventBus.emit('connectivity-source-change', {
623
+ featureId: featureId,
624
+ connectivitySource: connectivitySource,
625
+ });
626
+ },
627
+ updateGraphConnectivity: function () {
628
+ if (this.connectivitySource === "map") {
629
+ this.getConnectionsFromMap().then((response) => {
630
+ this.connectivityFromMap = response;
631
+ this.connectivityLoading = false;
632
+ });
633
+ } else {
634
+ this.connectivityFromMap = null;
635
+ this.connectivityLoading = false;
636
+ }
637
+ },
638
+ getConnectionsFromMap: async function () {
639
+ const url =
640
+ this.flatmapApi +
641
+ `flatmap/${this.entry.mapuuid}/connectivity/${this.entry.featureId[0]}`;
642
+
643
+ try {
644
+ const response = await fetch(url);
645
+ if (!response.ok) {
646
+ throw new Error(`Response status: ${response.status}`);
647
+ }
648
+
649
+ return await response.json();
650
+ } catch (error) {
651
+ throw new Error(error);
652
+ }
653
+ },
654
+ onConnectivityActionClick: function (data) {
655
+ EventBus.emit('onConnectivityActionClick', data);
656
+ },
657
+ closeConnectivity: function () {
658
+ this.$emit('close-connectivity');
659
+ },
660
+ checkAndUpdateDualConnection: async function () {
661
+ const response = await this.getConnectionsFromMap()
662
+
663
+ if (response?.connectivity?.length) {
664
+ this.dualConnectionSource = true;
665
+ } else {
666
+ this.dualConnectionSource = false;
667
+ this.connectivitySource = 'sckan';
668
+ }
669
+ },
636
670
  },
637
671
  mounted: function () {
638
- this.sckanVersion = this.entry['knowledge-source'];
639
672
  this.updatedCopyContent = this.getUpdateCopyContent();
673
+
640
674
  EventBus.on('connectivity-graph-error', (errorInfo) => {
641
675
  this.pushConnectivityError(errorInfo);
642
676
  });
@@ -645,12 +679,6 @@ export default {
645
679
  </script>
646
680
 
647
681
  <style lang="scss" scoped>
648
-
649
- .display {
650
- width: 44px;
651
- word-break: normal;
652
- }
653
-
654
682
  .connectivity-info-title {
655
683
  padding: 0;
656
684
  display: flex;
@@ -664,15 +692,30 @@ export default {
664
692
  }
665
693
  }
666
694
 
695
+ .toggle-button {
696
+ display: flex;
697
+ justify-content: space-between;
698
+
699
+ .is-disabled {
700
+ color: #fff !important;
701
+ background-color: #ac76c5 !important;
702
+ border: 1px solid #ac76c5 !important;
703
+ }
704
+ }
705
+
667
706
  .title {
668
707
  text-align: left;
669
708
  // width: 16em;
670
709
  line-height: 1.3em !important;
671
710
  font-size: 18px;
672
- font-family: Helvetica;
711
+ // font-family: Helvetica;
673
712
  font-weight: bold;
674
713
  padding-bottom: 8px;
675
714
  color: $app-primary-color;
715
+
716
+ span:hover {
717
+ cursor: pointer;
718
+ }
676
719
  }
677
720
 
678
721
  .block + .block {
@@ -691,43 +734,14 @@ export default {
691
734
  background-color: $app-primary-color;
692
735
  border-color: $app-primary-color;
693
736
  }
694
- }
695
-
696
- .icon {
697
- right: 0px;
698
- position: absolute;
699
- top: 10px;
700
- }
701
-
702
- .icon:hover {
703
- cursor: pointer;
704
- }
705
737
 
706
- :deep(.popover-origin-help.el-popover) {
707
- text-transform: none !important; // need to overide the tooltip text transform
708
- border: 1px solid $app-primary-color;
709
- font-weight: 400;
710
- font-family: Asap, sans-serif, Helvetica;
711
-
712
- .el-popper__arrow {
713
- &:before {
714
- border-color: $app-primary-color;
715
- background-color: #ffffff;
716
- }
738
+ &.secondary {
739
+ background-color: white;
717
740
  }
718
741
  }
719
742
 
720
- .info,
721
743
  .alert {
722
744
  color: #8300bf;
723
- }
724
-
725
- .info {
726
- transform: rotate(180deg);
727
- margin-left: 8px;
728
- }
729
-
730
- .alert {
731
745
  margin-left: 5px;
732
746
  vertical-align: text-bottom;
733
747
 
@@ -776,6 +790,12 @@ export default {
776
790
  padding: 1rem;
777
791
  }
778
792
 
793
+ .info {
794
+ color: #8300bf;
795
+ transform: rotate(180deg);
796
+ margin-left: 8px;
797
+ }
798
+
779
799
  .attribute-title-container {
780
800
  margin-bottom: 0.5em;
781
801
  }
@@ -787,39 +807,6 @@ export default {
787
807
  text-transform: uppercase;
788
808
  }
789
809
 
790
- .attribute-content {
791
- font-size: 14px;
792
- font-weight: 500;
793
- transition: color 0.25s ease;
794
- position: relative;
795
- cursor: default;
796
-
797
- &:hover {
798
- color: $app-primary-color;
799
- }
800
-
801
- + .attribute-content {
802
- &::before {
803
- content: "";
804
- width: 90%;
805
- height: 1px;
806
- background-color: var(--el-border-color);
807
- position: absolute;
808
- top: 0;
809
- left: 0;
810
- }
811
- }
812
-
813
- &:last-of-type {
814
- margin-bottom: 0.5em;
815
- }
816
- }
817
-
818
- .popover-container {
819
- height: 100%;
820
- width: 100%;
821
- }
822
-
823
810
  .main {
824
811
  .el-button.is-round {
825
812
  border-radius: 4px;
@@ -876,6 +863,25 @@ export default {
876
863
  margin-top: 0 !important;
877
864
  margin-left: 10px !important;
878
865
  }
866
+
867
+ > div:first-child {
868
+ display: flex;
869
+ align-items: center;
870
+ gap: 0.5rem;
871
+ }
872
+ }
873
+
874
+ .neuron-connection-button {
875
+ display: flex;
876
+ flex: 1 1 auto !important;
877
+ flex-direction: row !important;
878
+ align-items: center;
879
+ justify-content: space-between;
880
+
881
+ .el-button + .el-button {
882
+ margin-top: 0 !important;
883
+ margin-left: 10px !important;
884
+ }
879
885
  }
880
886
 
881
887
  .population-display {
@@ -886,6 +892,23 @@ export default {
886
892
  justify-content: space-between;
887
893
  border-bottom: 1px solid $app-primary-color;
888
894
  padding-bottom: 0.5rem !important;
895
+
896
+ &.population-display-toolbar {
897
+ flex-direction: column !important;
898
+ align-items: start;
899
+
900
+ .buttons-row {
901
+ display: flex;
902
+ flex-direction: row;
903
+ align-items: center;
904
+ justify-content: space-between;
905
+ width: 100%;
906
+ }
907
+ }
908
+
909
+ .el-radio {
910
+ margin-right: 1rem;
911
+ }
889
912
  }
890
913
 
891
914
  .tooltip-container {
@@ -981,6 +1004,10 @@ export default {
981
1004
  border-radius: 50%;
982
1005
  }
983
1006
  }
1007
+
1008
+ .el-button + .el-button {
1009
+ margin-left: 0 !important;
1010
+ }
984
1011
  }
985
1012
 
986
1013
  :deep(.el-popper.popover-map-pin) {
@@ -1007,25 +1034,4 @@ export default {
1007
1034
  margin-top: -1.25rem;
1008
1035
  }
1009
1036
  }
1010
-
1011
- .connectivity-error-container {
1012
- position: sticky;
1013
- bottom: 0.5rem;
1014
- width: 100%;
1015
- min-height: 31px; // placeholder
1016
- margin-top: -10px !important;
1017
- display: flex;
1018
- flex-direction: row;
1019
- align-items: center;
1020
- justify-content: center;
1021
- }
1022
-
1023
- .connectivity-error {
1024
- width: fit-content;
1025
- font-size: 12px;
1026
- padding: 0.25rem 0.5rem;
1027
- background-color: var(--el-color-error-light-9);
1028
- border-radius: var(--el-border-radius-small);
1029
- border: 1px solid var(--el-color-error);
1030
- }
1031
1037
  </style>