@abi-software/map-side-bar 2.6.2 → 2.6.3-acupoints.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.
@@ -60,6 +60,7 @@
60
60
  <script>
61
61
  /* eslint-disable no-alert, no-console */
62
62
  import { View as ElIconView } from '@element-plus/icons-vue'
63
+ import { Base64 } from 'js-base64';
63
64
  import BadgesGroup from './BadgesGroup.vue'
64
65
  import {
65
66
  ElButton as Button,
@@ -236,7 +237,7 @@ export default {
236
237
  this.discoverId = data.id
237
238
  this.version = data.version
238
239
  this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
239
- this.getBiolucidaInfo(this.discoverId)
240
+ this.getBiolucidaInfo()
240
241
  this.loading = false
241
242
  this.updateCopyContent();
242
243
  })
@@ -251,15 +252,30 @@ export default {
251
252
  lastName: function (fullName) {
252
253
  return fullName.split(',')[0]
253
254
  },
254
- getBiolucidaInfo: function (id) {
255
- let apiLocation = this.envVars.API_LOCATION
256
- let endpoint = apiLocation + 'image_search/' + id
257
- // Add parameters if we are sent them
258
- fetch(endpoint)
259
- .then((response) => response.json())
260
- .then((data) => {
261
- if (data.status == 'success') this.biolucidaData = data
262
- })
255
+ getBiolucidaInfo: function () {
256
+ const dataset_images = [];
257
+ const biolucida2DItems = 'biolucida-2d' in this.entry ? this.entry['biolucida-2d'] :[];
258
+ const biolucida3DItems = 'biolucida-3d' in this.entry ? this.entry['biolucida-3d'] :[];
259
+ // We use information from SciCrunch to create the sharelink
260
+ biolucida2DItems.concat(biolucida3DItems).forEach((bObject) => {
261
+ const image_id = bObject.biolucida?.identifier;
262
+ if (image_id) {
263
+ const sourcepkg_id = 'identifier' in bObject ? bObject['identifier'] : "";
264
+ // The encoded string is in the following format -
265
+ // ${image_id}-col-${collection_id}, collection id can be any valid collection id
266
+ // and 260 is used for now.
267
+ const code = encodeURIComponent(Base64.encode(`${image_id}-col-260`));
268
+ const share_link = `https://sparc.biolucida.net/image?c=${code}`
269
+ dataset_images.push({
270
+ share_link,
271
+ image_id,
272
+ sourcepkg_id,
273
+ });
274
+ }
275
+ });
276
+ if (dataset_images.length > 0) {
277
+ this.biolucidaData = { dataset_images };
278
+ }
263
279
  },
264
280
  updateCopyContent: function () {
265
281
  const contentArray = [];
@@ -33,7 +33,7 @@ import GalleryHelper from '@abi-software/gallery/src/mixins/GalleryHelpers.js'
33
33
  import Gallery from "@abi-software/gallery";
34
34
  import "@abi-software/gallery/dist/style.css";
35
35
  //provide the s3Bucket related methods and data.
36
- import S3Bucket from '../mixins/S3Bucket.vue'
36
+ import S3Bucket from '../mixins/S3Bucket.vue';
37
37
 
38
38
  export default {
39
39
  name: 'ImageGallery',
@@ -241,9 +241,12 @@ export default {
241
241
 
242
242
  // populate second level of options
243
243
  this.options[i].children.forEach((facetItem, j) => {
244
- this.options[i].children[j].label = convertReadableLabel(
245
- facetItem.label
246
- )
244
+ // Format labels except funding program
245
+ if (this.options[i].children[j].facetPropPath !== 'pennsieve.organization.name') {
246
+ this.options[i].children[j].label = convertReadableLabel(
247
+ facetItem.label
248
+ )
249
+ }
247
250
  this.options[i].children[j].value =
248
251
  this.createCascaderItemValue(facet.label, facetItem.label)
249
252
  if (
@@ -53,16 +53,24 @@
53
53
  @confirm-delete="$emit('confirm-delete', $event)"
54
54
  />
55
55
  </template>
56
+ <template v-else-if="tab.type === 'acupoints' && acupointsInfoList">
57
+ <acupoints-info-search
58
+ :ref="'acupointsTab_' + tab.id"
59
+ :entry="acupointsInfoList"
60
+ @on-acupoints-click="acupointClicked"
61
+ v-show="tab.id === activeTabId"
62
+ />
63
+ </template>
56
64
  <template v-else>
57
- <SidebarContent
58
- class="sidebar-content-container"
59
- v-show="tab.id === activeTabId"
60
- :contextCardEntry="tab.contextCard"
61
- :envVars="envVars"
62
- :ref="'searchTab_' + tab.id"
63
- @search-changed="searchChanged(tab.id, $event)"
64
- @hover-changed="hoverChanged($event)"
65
- />
65
+ <SidebarContent
66
+ class="sidebar-content-container"
67
+ v-show="tab.id === activeTabId"
68
+ :contextCardEntry="tab.contextCard"
69
+ :envVars="envVars"
70
+ :ref="'searchTab_' + tab.id"
71
+ @search-changed="searchChanged(tab.id, $event)"
72
+ @hover-changed="hoverChanged($event)"
73
+ />
66
74
  </template>
67
75
  </template>
68
76
  </div>
@@ -81,6 +89,7 @@ import { ElDrawer as Drawer, ElIcon as Icon } from 'element-plus'
81
89
  import SidebarContent from './SidebarContent.vue'
82
90
  import EventBus from './EventBus.js'
83
91
  import Tabs from './Tabs.vue'
92
+ import AcupointsInfoSearch from './AcupointsInfoSearch.vue'
84
93
  import AnnotationTool from './AnnotationTool.vue'
85
94
  import ConnectivityInfo from './ConnectivityInfo.vue'
86
95
 
@@ -149,6 +158,13 @@ export default {
149
158
  type: Object,
150
159
  default: null,
151
160
  },
161
+ /**
162
+ * The acupoints info to show in sidebar.
163
+ */
164
+ acupointsInfoList: {
165
+ type: Object,
166
+ default: null,
167
+ },
152
168
  /**
153
169
  * The annotation data to show in sidebar.
154
170
  */
@@ -174,6 +190,13 @@ export default {
174
190
  }
175
191
  },
176
192
  methods: {
193
+ /**
194
+ * This event is emitted with a mouse click on acupoint card
195
+ * @arg data
196
+ */
197
+ acupointClicked: function (data) {
198
+ this.$emit('acupoints-clicked', data)
199
+ },
177
200
  /**
178
201
  * This event is emitted when the mouse hover are changed.
179
202
  * @arg data
@@ -224,6 +247,22 @@ export default {
224
247
  searchTabRef.openSearch(facets, query);
225
248
  })
226
249
  },
250
+ getFirstTabRefIdByType: function(type) {
251
+ const tabObj = this.activeTabs.find((tab) => tab.type === type);
252
+ if (tabObj) {
253
+ let refIdPrefix = 'searchTab_'; // default to search tab
254
+ if (type === 'connectivity') {
255
+ refIdPrefix = 'connectivityTab_';
256
+ } else if (type === 'annotation') {
257
+ refIdPrefix = 'annotationTab_';
258
+ } else if (type === 'acupoints') {
259
+ refIdPrefix = 'acupointsTab_';
260
+ }
261
+ const tabRefId = refIdPrefix + tabObj.id;
262
+ return tabRefId;
263
+ }
264
+ return "";
265
+ },
227
266
  /**
228
267
  * Get the tab object by tab id and type.
229
268
  * If not found, return the first available tab.
@@ -244,6 +283,8 @@ export default {
244
283
  refIdPrefix = 'connectivityTab_';
245
284
  } else if (type === 'annotation') {
246
285
  refIdPrefix = 'annotationTab_';
286
+ } else if (type === 'acupoints') {
287
+ refIdPrefix = 'acupointsTab_';
247
288
  }
248
289
  const tabObj = this.getTabByIdAndType(id, type);
249
290
  const tabRefId = refIdPrefix + tabObj.id;
@@ -313,18 +354,38 @@ export default {
313
354
  updateConnectivityGraphError: function (errorInfo) {
314
355
  EventBus.emit('connectivity-graph-error', errorInfo);
315
356
  },
357
+ openAcupointsSearch: function (term) {
358
+ this.drawerOpen = true
359
+ // Because refs are in v-for, nextTick is needed here
360
+ this.$nextTick(() => {
361
+ const tabRefId = this.getFirstTabRefIdByType("acupoints");
362
+ if (tabRefId && this.$refs[tabRefId]) {
363
+ const tab = this.$refs[tabRefId][0];
364
+ tab.search(term);
365
+ }
366
+ })
367
+ },
316
368
  },
317
369
  computed: {
318
370
  activeTabs: function() {
319
- const tabs = [
320
- { id: 1, title: 'Search', type: 'search' }
321
- ];
322
- if (this.connectivityInfo) {
323
- tabs.push({ id: 2, title: 'Connectivity', type: 'connectivity' });
324
- }
325
- if (this.annotationEntry && Object.keys(this.annotationEntry).length > 0) {
326
- tabs.push({ id: 3, title: 'Annotation', type: 'annotation' });
327
- }
371
+ const tabs = []
372
+ this.tabs.forEach((tab) => {
373
+ if (tab.type === "search") {
374
+ tabs.push(tab)
375
+ } else if (tab.type === "connectivity") {
376
+ if (this.connectivityInfo) {
377
+ tabs.push(tab);
378
+ }
379
+ } else if (tab.type === "annotation") {
380
+ if (this.annotationEntry && Object.keys(this.annotationEntry).length > 0) {
381
+ tabs.push(tab);
382
+ }
383
+ } else if (tab.type === "acupoints") {
384
+ if (this.acupointsInfoList && Object.keys(this.acupointsInfoList).length > 0) {
385
+ tabs.push(tab);
386
+ }
387
+ }
388
+ })
328
389
  return tabs;
329
390
  },
330
391
  },
@@ -377,9 +438,14 @@ export default {
377
438
  this.$emit('actionClick', payLoad);
378
439
  })
379
440
 
380
- // Get available anatomy facets for the connectivity info
381
- EventBus.on('available-facets', (payLoad) => {
382
- this.availableAnatomyFacets = payLoad.find((facet) => facet.label === 'Anatomical Structure').children
441
+ // Emit acupoints clicked event
442
+ EventBus.on('acupoints-clicked', (payLoad) => {
443
+ this.$emit('acupoints-clicked', payLoad);
444
+ })
445
+
446
+ // Emit acupoints hovered event
447
+ EventBus.on('acupoints-hovered', (payLoad) => {
448
+ this.$emit('acupoints-hovered', payLoad);
383
449
  })
384
450
 
385
451
  },
@@ -7,6 +7,8 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
+ AcupointsCard: typeof import('./components/AcupointsCard.vue')['default']
11
+ AcupointsInfoSearch: typeof import('./components/AcupointsInfoSearch.vue')['default']
10
12
  AnnotationTool: typeof import('./components/AnnotationTool.vue')['default']
11
13
  BadgesGroup: typeof import('./components/BadgesGroup.vue')['default']
12
14
  ConnectivityInfo: typeof import('./components/ConnectivityInfo.vue')['default']
@@ -285,5 +285,6 @@ export default {
285
285
  "Homo sapiens",
286
286
  "Canis lupus familiaris",
287
287
  "Domestic Pig"
288
- ]
289
- }
288
+ ],
289
+ "knowledge-source": "sckan-2024-03-26-npo",
290
+ }