@abi-software/flatmapvuer 1.6.1-isan.2 → 1.6.2-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.6.1-isan.2",
3
+ "version": "1.6.2-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@abi-software/flatmap-viewer": "^3.2.8",
47
- "@abi-software/map-utilities": "^1.2.1",
47
+ "@abi-software/map-utilities": "^1.2.2-beta.0",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
50
50
  "@element-plus/icons-vue": "^2.3.1",
package/src/App.vue CHANGED
@@ -290,10 +290,6 @@ export default {
290
290
  taxo: 'FunctionalConnectivity',
291
291
  displayWarning: true,
292
292
  },
293
- "pmr:CardiovascularModelWithFeedback": {
294
- flatmapId: "pmr:CardiovascularModelWithFeedback",
295
- displayWarning: true,
296
- }
297
293
  },
298
294
  tooltipContent: undefined,
299
295
  tStyle: {
@@ -311,9 +307,8 @@ export default {
311
307
  mapSettings: [],
312
308
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
313
309
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
314
- //flatmapAPI: "https://mapcoe-demo.org/current/flatmap/v3/",
315
- //flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
316
- flatmapAPI: 'https://mapcore-demo.org/isan/flatmap/',
310
+ //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/",
311
+ flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
317
312
  //flatmapAPI: 'https://mapcore-demo.org/curation/flatmap/',
318
313
  //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
319
314
  //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
@@ -152,7 +152,6 @@ Please use `const` to assign meaningful names to them...
152
152
  class: '.maplibregl-canvas',
153
153
  }"
154
154
  :toolbarOptions="toolbarOptions"
155
- :drawnType="drawnType"
156
155
  :activeDrawTool="activeDrawTool"
157
156
  :activeDrawMode="activeDrawMode"
158
157
  :newlyDrawnEntry="drawnCreatedEvent"
@@ -454,44 +453,22 @@ Please use `const` to assign meaningful names to them...
454
453
  </template>
455
454
  </div>
456
455
  <el-row class="viewing-mode-description">
457
- {{ viewingModes[viewingMode] }}
456
+ {{ modeDescription }}
458
457
  </el-row>
459
458
  </el-row>
460
459
  <template v-if="viewingMode === 'Annotation' && userInformation">
461
- <el-row class="backgroundText">Drawn By*</el-row>
460
+ <el-row class="backgroundText">Annotations From</el-row>
462
461
  <el-row class="backgroundControl">
463
462
  <el-select
464
463
  :teleported="false"
465
- v-model="drawnType"
464
+ v-model="annotationFrom"
466
465
  placeholder="Select"
467
466
  class="select-box"
468
467
  popper-class="flatmap_dropdown"
469
- @change="setDrawnType"
468
+ @change="setAnnotationFrom"
470
469
  >
471
470
  <el-option
472
- v-for="item in drawnTypes"
473
- :key="item"
474
- :label="item"
475
- :value="item"
476
- >
477
- <el-row>
478
- <el-col :span="12">{{ item }}</el-col>
479
- </el-row>
480
- </el-option>
481
- </el-select>
482
- </el-row>
483
- <el-row class="backgroundText">Annotated By*</el-row>
484
- <el-row class="backgroundControl">
485
- <el-select
486
- :teleported="false"
487
- v-model="annotatedType"
488
- placeholder="Select"
489
- class="select-box"
490
- popper-class="flatmap_dropdown"
491
- @change="setAnnotatedType"
492
- >
493
- <el-option
494
- v-for="item in annotatedTypes"
471
+ v-for="item in annotatedSource"
495
472
  :key="item"
496
473
  :label="item"
497
474
  :value="item"
@@ -885,8 +862,7 @@ export default {
885
862
  }
886
863
  this.doubleClickedFeature = false
887
864
  }
888
- }
889
- if (this.activeDrawMode === 'Delete') {
865
+ } else if (this.activeDrawMode === 'Delete') {
890
866
  this.changeAnnotationDrawMode({
891
867
  mode: 'simple_select',
892
868
  options: { featureIds: [data.feature.feature.id] }
@@ -1015,12 +991,6 @@ export default {
1015
991
  let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
1016
992
  // The annotator has `resource` and `features` fields
1017
993
  if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
1018
- // Use to switch the displayed feature type
1019
- if (this.drawnType !== 'All tools') {
1020
- drawnFeatures = drawnFeatures.filter((feature) => {
1021
- return feature.geometry.type === this.drawnType
1022
- })
1023
- }
1024
994
  return drawnFeatures
1025
995
  },
1026
996
  /**
@@ -1030,21 +1000,19 @@ export default {
1030
1000
  addAnnotationFeature: async function () {
1031
1001
  if (this.mapImp) {
1032
1002
  if (!this.featureAnnotationSubmitted) this.clearAnnotationFeature()
1033
- if (this.drawnType !== 'None') {
1034
- if (!this.featureAnnotationSubmitted) this.loading = true
1035
- const userId = this.annotatedType === 'Anyone' ?
1036
- undefined : this.userInformation.orcid ?
1037
- this.userInformation.orcid : '0000-0000-0000-0000'
1038
- const participated = this.annotatedType === 'Anyone' ?
1039
- undefined : this.annotatedType === 'Me' ?
1040
- true : false
1041
- const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1042
- this.existDrawnFeatures = drawnFeatures
1043
- this.loading = false
1044
- if (!this.featureAnnotationSubmitted) {
1045
- for (const feature of drawnFeatures) {
1046
- this.mapImp.addAnnotationFeature(feature)
1047
- }
1003
+ if (!this.featureAnnotationSubmitted) this.loading = true
1004
+ const userId = this.annotationFrom === 'Anyone' ?
1005
+ undefined : this.userInformation.orcid ?
1006
+ this.userInformation.orcid : '0000-0000-0000-0000'
1007
+ const participated = this.annotationFrom === 'Anyone' ?
1008
+ undefined : this.annotationFrom === 'Me' ?
1009
+ true : false
1010
+ const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
1011
+ this.existDrawnFeatures = drawnFeatures
1012
+ this.loading = false
1013
+ if (!this.featureAnnotationSubmitted) {
1014
+ for (const feature of drawnFeatures) {
1015
+ this.mapImp.addAnnotationFeature(feature)
1048
1016
  }
1049
1017
  }
1050
1018
  }
@@ -1062,26 +1030,13 @@ export default {
1062
1030
  this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
1063
1031
  }
1064
1032
  },
1065
- /**
1066
- * @public
1067
- * Function to switch the type of annotation.
1068
- * @arg {Boolean} `flag`
1069
- */
1070
- setDrawnType: function (flag) {
1071
- this.drawnType = flag
1072
- if (this.mapImp) {
1073
- this.manualAbortedOnClose()
1074
- this.addAnnotationFeature()
1075
- this.initialiseDrawing()
1076
- }
1077
- },
1078
1033
  /**
1079
1034
  * @public
1080
1035
  * Function to switch the type of person who annotated.
1081
1036
  * @arg {Boolean} `flag`
1082
1037
  */
1083
- setAnnotatedType: function (flag) {
1084
- this.annotatedType = flag
1038
+ setAnnotationFrom: function (flag) {
1039
+ this.annotationFrom = flag
1085
1040
  if (this.mapImp) {
1086
1041
  this.manualAbortedOnClose()
1087
1042
  this.addAnnotationFeature()
@@ -1589,7 +1544,7 @@ export default {
1589
1544
  this.annotationEntry = {}
1590
1545
  } else if (data.type === 'modeChanged') {
1591
1546
  if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
1592
- if (this.annotationSidebar && data.feature.mode === 'simple_select') {
1547
+ if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
1593
1548
  this.annotationEventCallback({}, { type: 'aborted' })
1594
1549
  }
1595
1550
  } else if (data.type === 'selectionChanged') {
@@ -1624,6 +1579,7 @@ export default {
1624
1579
  if (data.type === 'created') this.drawnCreatedEvent = payload
1625
1580
  else this.checkAndCreatePopups(payload)
1626
1581
  }
1582
+ if (data.type === 'updated') this.previousEditEvent = data
1627
1583
  if (data.type === 'deleted') this.previousDeletedEvent = data
1628
1584
  else this.previousDeletedEvent = {}
1629
1585
  },
@@ -1647,7 +1603,6 @@ export default {
1647
1603
  const label = data.label
1648
1604
  const resource = [data.models]
1649
1605
  const taxonomy = this.entry
1650
- const flatmapId = this.flatmapId
1651
1606
  const biologicalSex = this.biologicalSex
1652
1607
  let taxons = undefined
1653
1608
  if (data.taxons) {
@@ -1661,7 +1616,6 @@ export default {
1661
1616
  const payload = {
1662
1617
  dataset: data.dataset,
1663
1618
  biologicalSex: biologicalSex,
1664
- flatmapId: flatmapId,
1665
1619
  taxonomy: taxonomy,
1666
1620
  resource: resource,
1667
1621
  label: label,
@@ -1713,6 +1667,14 @@ export default {
1713
1667
  !this.activeDrawTool
1714
1668
  ) {
1715
1669
  this.checkAndCreatePopups(payload)
1670
+ if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
1671
+ this.annotationEntry = {
1672
+ ...this.previousEditEvent,
1673
+ resourceId: this.serverURL
1674
+ }
1675
+ this.annotationEventCallback({}, { type: 'aborted' })
1676
+ }
1677
+ this.previousEditEvent = {}
1716
1678
  }
1717
1679
  this.$emit('resource-selected', payload)
1718
1680
  } else {
@@ -1872,12 +1834,8 @@ export default {
1872
1834
  if (data.feature.featureId && data.feature.models) {
1873
1835
  this.displayTooltip(data.feature.models)
1874
1836
  } else if (data.feature.feature) {
1875
- // in drawing or edit/delete mode is on or has connectivity
1876
- if (
1877
- this.activeDrawTool ||
1878
- this.activeDrawMode ||
1879
- Object.keys(this.connectionEntry).length > 0
1880
- ) {
1837
+ // in drawing or edit/delete mode is on or valid drawn
1838
+ if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
1881
1839
  this.featureAnnotationSubmitted = false
1882
1840
  this.annotationEntry.featureId = data.feature.feature.id
1883
1841
  if (this.activeDrawTool) {
@@ -2180,8 +2138,7 @@ export default {
2180
2138
  !this.disableUI && (
2181
2139
  (
2182
2140
  this.viewingMode === 'Annotation' &&
2183
- !this.annotationSidebar &&
2184
- this.userInformation
2141
+ !this.annotationSidebar
2185
2142
  ) ||
2186
2143
  (
2187
2144
  this.viewingMode === 'Exploration' &&
@@ -2195,7 +2152,6 @@ export default {
2195
2152
  this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
2196
2153
  this.popUpCssHacks();
2197
2154
  });
2198
-
2199
2155
  }
2200
2156
  },
2201
2157
  hasTooltipEntry: function () {
@@ -2342,7 +2298,6 @@ export default {
2342
2298
  if (this.mapImp) {
2343
2299
  let state = {
2344
2300
  entry: this.entry,
2345
- flatmapId: this.flatmapId,
2346
2301
  viewport: this.mapImp.getState(),
2347
2302
  }
2348
2303
  const identifier = this.mapImp.getIdentifier()
@@ -2370,8 +2325,8 @@ export default {
2370
2325
  if (state) {
2371
2326
  if (
2372
2327
  this.mapImp &&
2373
- ((state.entry && this.entry == state.entry) ||
2374
- (state.flatmapId && this.flatmapId == state.flatmapId)) &&
2328
+ state.entry &&
2329
+ this.entry == state.entry &&
2375
2330
  (!state.biologicalSex || state.biologicalSex === this.biologicalSex)
2376
2331
  ) {
2377
2332
  this.restoreMapState(state)
@@ -2465,32 +2420,22 @@ export default {
2465
2420
  // @arg identifier.uuid {string} The unique uuid the flatmap. If given then this exact map will
2466
2421
  // be loaded, overriding ``taxon`` and ``biologicalSex``.
2467
2422
 
2468
- let identifier = {}
2469
- if (this.entry) {
2470
- identifier.taxon = this.entry
2471
- } else if (this.flatmapId) {
2472
- identifier.id = this.flatmapId
2473
- }
2423
+ let identifier = { taxon: this.entry }
2474
2424
  if (this.uuid) {
2475
2425
  identifier.uuid = this.uuid
2476
2426
  }
2477
- //This now handles the uses of uuid when resuming states
2427
+ //This now handle the uses of uuid when resuming states
2478
2428
  if (state) {
2479
2429
  if (state.uuid) {
2480
2430
  identifier = { uuid: state.uuid }
2481
- } else if (state.entry || state.flatmapId) {
2482
- if (state.entry) {
2483
- identifier.taxon = state.entry
2484
- } else if (state.flatmapId) {
2485
- identifier.id = state.flatmapId
2486
- }
2487
-
2488
- if (state.biologicalSex) {
2489
- identifier['biologicalSex'] = state.biologicalSex
2490
- } else if (identifier.taxon === 'NCBITaxon:9606') {
2491
- //For backward compatibility
2492
- identifier['biologicalSex'] = 'PATO:0000384'
2493
- }
2431
+ } else if (state.entry) {
2432
+ identifier.taxon = state.entry
2433
+ }
2434
+ if (state.biologicalSex) {
2435
+ identifier['biologicalSex'] = state.biologicalSex;
2436
+ } else if (identifier.taxon === 'NCBITaxon:9606') {
2437
+ //For backward compatibility
2438
+ identifier['biologicalSex'] = 'PATO:0000384';
2494
2439
  }
2495
2440
  } else {
2496
2441
  // Set the bioloicalSex now if map is not resumed from
@@ -2499,9 +2444,6 @@ export default {
2499
2444
  identifier['biologicalSex'] = this.biologicalSex
2500
2445
  }
2501
2446
  }
2502
- if (!identifier.taxon && !identifier.uuid) {
2503
- identifier = identifier.id;
2504
- }
2505
2447
 
2506
2448
  let promise1 = this.mapManagerRef.loadMap(
2507
2449
  identifier,
@@ -2698,13 +2640,10 @@ export default {
2698
2640
  /**
2699
2641
  * The taxon identifier of the species represented by the map.
2700
2642
  */
2701
- entry: String,
2702
- /**
2703
- * The ``id`` of the flatmap.
2704
- * If given then this exact map will be loaded,
2705
- * overriding ``taxon`` and ``biologicalSex``.
2706
- */
2707
- flatmapId: String,
2643
+ entry: {
2644
+ type: String,
2645
+ required: true,
2646
+ },
2708
2647
  /**
2709
2648
  * The unique ``uuid`` of the flatmap.
2710
2649
  * If given then this exact map will be loaded,
@@ -2972,12 +2911,10 @@ export default {
2972
2911
  viewingModes: {
2973
2912
  'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
2974
2913
  'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
2975
- 'Annotation': 'View internal identifiers of features'
2914
+ 'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
2976
2915
  },
2977
- drawnType: 'All tools',
2978
- drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
2979
- annotatedType: 'Anyone',
2980
- annotatedTypes: ['Anyone', 'Me', 'Others'],
2916
+ annotationFrom: 'Anyone',
2917
+ annotatedSource: ['Anyone', 'Me', 'Others'],
2981
2918
  openMapRef: undefined,
2982
2919
  backgroundIconRef: undefined,
2983
2920
  toolbarOptions: [
@@ -2994,6 +2931,7 @@ export default {
2994
2931
  activeDrawTool: undefined,
2995
2932
  featureAnnotationSubmitted: false,
2996
2933
  drawnCreatedEvent: {},
2934
+ previousEditEvent: {},
2997
2935
  previousDeletedEvent: {},
2998
2936
  connectionEntry: {},
2999
2937
  existDrawnFeatures: [], // Store all exist drawn features
@@ -3048,7 +2986,17 @@ export default {
3048
2986
  }
3049
2987
  this.drawerOpen = false
3050
2988
  return true
3051
- }
2989
+ },
2990
+ modeDescription: function () {
2991
+ let description = this.viewingModes[this.viewingMode]
2992
+ if (this.viewingMode === 'Annotation') {
2993
+ if (this.userInformation) {
2994
+ return description[1]
2995
+ }
2996
+ return description[0]
2997
+ }
2998
+ return description
2999
+ },
3052
3000
  },
3053
3001
  watch: {
3054
3002
  entry: function () {
@@ -49,7 +49,6 @@
49
49
  :key="key"
50
50
  v-show="activeSpecies == key"
51
51
  :entry="item.taxo"
52
- :flatmapId="item.flatmapId"
53
52
  :uuid="item.uuid"
54
53
  :biologicalSex="item.biologicalSex"
55
54
  :displayWarning="item.displayWarning"
@@ -160,15 +159,13 @@ export default {
160
159
  .then((data) => {
161
160
  //Check each key in the provided availableSpecies against the one
162
161
  Object.keys(this.availableSpecies).forEach((key) => {
163
- // First look through the uuid
162
+ // FIrst look through the uuid
164
163
  const uuid = this.availableSpecies[key].uuid
165
164
  if (uuid && data.map((e) => e.uuid).indexOf(uuid) > 0) {
166
165
  this.speciesList[key] = this.availableSpecies[key]
167
166
  } else {
168
167
  for (let i = 0; i < data.length; i++) {
169
- if ((this.availableSpecies[key].taxo && this.availableSpecies[key].taxo === data[i].taxon) ||
170
- (this.availableSpecies[key].flatmapId && this.availableSpecies[key].flatmapId === data[i].id))
171
- {
168
+ if (this.availableSpecies[key].taxo === data[i].taxon) {
172
169
  if (this.availableSpecies[key].biologicalSex) {
173
170
  if (
174
171
  data[i].biologicalSex &&
@@ -8,7 +8,7 @@ import { defineStore } from 'pinia'
8
8
  export const useMainStore = defineStore('main', {
9
9
  state: () => ({
10
10
  userProfile: {
11
- token: ''
11
+ token: 'eyJraWQiOiJ1UUMzRDl1RGpTTlhoNzZJRW1ldExcL05uOGRMazFyaU1LWSt5T2ZTUytHaz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjNDhmZDkyOS0wYjIwLTQxNjEtOTEyZi03NTBmMGZiY2VkNWQiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJzY29wZSI6Im9wZW5pZCIsImF1dGhfdGltZSI6MTczMzEwMDk1OSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfRlZMaEo3Q1FBIiwiZXhwIjoxNzMzMTA0NTU5LCJpYXQiOjE3MzMxMDA5NTksInZlcnNpb24iOjIsImp0aSI6IjQyYWE3OTk2LTI0M2QtNDdhYy05MzRjLTEyYmRkOTQxYjg1YSIsImNsaWVudF9pZCI6IjcwM2xtNWQ4b2RjY3UyMXBhZ2NmamtlYWVhIiwidXNlcm5hbWUiOiJjNDhmZDkyOS0wYjIwLTQxNjEtOTEyZi03NTBmMGZiY2VkNWQifQ.BmymFWRhSHRcYaLOxEuhIndcWeVoGJ_vlbFAJMOz2CxzU_23oYVeTTiJCfGw5zCa5OfHHGZfd95hQktuhBUTv0D5UMCfIKM89Zu3-3sVfRYyEHjcn70QyerXhnbrsKdAUfovsc74v9Ko9udtreZFlURfC9vHoiMHExxpnzXv39icZsZlvUc2qmrFGS1iScF8FWy5uwgHtqKwUi7dVvb1Kb84HHBmmaqujVW2R5eXliWZqZM-EEdV_AjZks0G6EBuRza7CXdPCQKztxX-UGqiUKyMLvACrThlYsFFNjy0s9FEI0_maAl5G13ieR874zTgcdijAq4gDvAXWWrvih3a-A'
12
12
  },
13
13
  }),
14
14
  getters: {