@abi-software/map-side-bar 1.1.17 → 1.1.18-fixes-3

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/map-side-bar",
3
- "version": "1.1.17",
3
+ "version": "1.1.18-fixes-3",
4
4
  "main": "./dist/map-side-bar.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -0,0 +1,28 @@
1
+ {
2
+ "description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
3
+ "heading": "Mapped ICN samples",
4
+ "id": "sparc.science.context_data",
5
+ "samples": [
6
+ {
7
+ "annotation": "",
8
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
9
+ "doi": "",
10
+ "heading": "ICNS from subject M54-8",
11
+ "id": "Sample 1",
12
+ "path": "",
13
+ "view": "View 1",
14
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
15
+ },
16
+ {
17
+ "annotation": "",
18
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
19
+ "doi": "",
20
+ "heading": "ICNS from subject M54-5",
21
+ "id": "Sample 2",
22
+ "path": "",
23
+ "view": "View 2",
24
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
25
+ }
26
+ ],
27
+ "version": "0.1.0",
28
+ }
@@ -3,14 +3,38 @@
3
3
  <div v-show="showContextCard">
4
4
  <div v-show="showDetails" class="hide" @click="showDetails = !showDetails">Hide information<i class="el-icon-arrow-up"></i></div>
5
5
  <div v-show="!showDetails" class="hide" @click="showDetails = !showDetails">Show information<i class="el-icon-arrow-down"></i></div>
6
- <el-card v-if="showDetails && Object.keys(contextData).length !== 0" class="context-card card" >
7
- <img :src="entry.banner" class="context-image card-left">
6
+ <el-card v-if="showDetails && Object.keys(contextData).length !== 0" v-loading="loading" class="context-card card" >
7
+ <div class="card-left">
8
+ <img :src="entry.banner" class="context-image">
9
+ </div>
8
10
  <div class="card-right">
9
11
  <div class="title">{{contextData.heading}}</div>
10
12
  <div>{{contextData.description}}</div>
13
+ <br/>
14
+ <div v-if="contextData.views" class="subtitle">Scaffold Views</div>
11
15
  <template v-for="(view, i) in contextData.views">
16
+ <span v-bind:key="i+'_1'" @click="openViewFile(view)" class="context-card-item">
17
+ <img class="key-image" :src="getFileFromPath(view.thumbnail)">
18
+ {{view.description}}
19
+ </span>
12
20
  <br v-bind:key="i"/>
13
- <span v-bind:key="i+'_1'" @click="openViewFile(view)" class="scaffold-view"><img :src="getFileFromPath(view.thumbnail)"> {{view.description}}</span>
21
+ </template>
22
+ <div style="margin-bottom: 16px;"/>
23
+ <div v-if="contextData.samples && contextData.samples.length > 0" class="subtitle">Samples on Scaffold</div>
24
+ <template v-for="(sample, i) in contextData.samples">
25
+ <span v-bind:key="i+'_3'" class="context-card-item" @click="toggleSampleDetails(i)">
26
+ <div v-bind:key="i+'_6'" style="display: flex">
27
+ <div v-if="sample.color" class="color-box" :style="'background-color:'+ sample.color"></div>
28
+ <img class="key-image" v-else-if="sample.thumbnail" :src="getFileFromPath(sample.thumbnail)">
29
+ {{sample.heading}}
30
+ <i class="el-icon-warning-outline info"></i>
31
+ </div>
32
+ </span>
33
+ <div v-bind:key="i+'_4'" v-if="sampleDetails[i]">
34
+ {{sample.description}}
35
+ <a v-bind:key="i+'_5'" v-if="sampleDetails[i]" :href="generateFileLink(sample.path)" target="_blank">View Source</a>
36
+ </div>
37
+ <br v-bind:key="i+'_2'"/>
14
38
  </template>
15
39
  </div>
16
40
  </el-card>
@@ -26,6 +50,7 @@ import { Link, Icon, Card, Button, Select, Input } from "element-ui";
26
50
  import lang from "element-ui/lib/locale/lang/en";
27
51
  import locale from "element-ui/lib/locale";
28
52
  import EventBus from "./EventBus"
53
+ import hardcoded_info from './hardcoded-context-info'
29
54
 
30
55
  locale.use(lang);
31
56
  Vue.use(Link);
@@ -36,7 +61,6 @@ Vue.use(Select);
36
61
  Vue.use(Input);
37
62
 
38
63
 
39
-
40
64
  export default {
41
65
  name: "contextCard",
42
66
  props: {
@@ -50,15 +74,22 @@ export default {
50
74
  return {
51
75
  contextData: {},
52
76
  showDetails: true,
53
- showContextCard: true
77
+ showContextCard: true,
78
+ sampleDetails: {},
79
+ loading: false
54
80
  };
55
81
  },
56
82
  watch: {
57
83
  'entry.contextCardUrl': {
58
84
  handler(val){
59
85
  if (val) {
60
- this.getContextFile(val)
61
- this.showContextCard = true
86
+ // used for hardcoding data
87
+ if (val === true){
88
+ this.contextData = hardcoded_info[this.entry.discoverId]
89
+ } else {
90
+ this.getContextFile(val)
91
+ this.showContextCard = true
92
+ }
62
93
  } else {
63
94
  this.showContextCard = false
64
95
  }
@@ -68,6 +99,7 @@ export default {
68
99
  },
69
100
  methods: {
70
101
  getContextFile: function (contextFileUrl) {
102
+ this.loading = true
71
103
  fetch(contextFileUrl)
72
104
  .then((response) =>{
73
105
  if (!response.ok){
@@ -78,24 +110,42 @@ export default {
78
110
  })
79
111
  .then((data) => {
80
112
  this.contextData = data
113
+ console.log(data)
114
+ this.loading = false
81
115
  })
82
116
  .catch(() => {
83
117
  //set defaults if we hit an error
84
118
  this.thumbnail = require('@/../assets/missing-image.svg')
85
119
  this.discoverId = undefined
120
+ this.loading = false
86
121
  });
87
122
  },
88
123
  removeDoubleFilesPath: function(path){
89
- if (path.includes('files/files/')){
90
- return path.replace('files/files/', 'files/')
124
+ if (path.includes('files/')){
125
+ return path.replace('files/', '')
91
126
  } else {
92
127
  return path
93
128
  }
94
129
  },
130
+ toggleSampleDetails: function(i){
131
+ if (this.sampleDetails[i] === undefined){
132
+ Vue.set(this.sampleDetails, i, true)
133
+ } else {
134
+ Vue.set(this.sampleDetails, i, !this.sampleDetails[i])
135
+ }
136
+ },
95
137
  getFileFromPath: function(path){
138
+ // for hardcoded data
139
+ if(this.entry.contextCardUrl === true){
140
+ return path
141
+ }
96
142
  path = this.removeDoubleFilesPath(path)
97
143
  return `${this.entry.apiLocation}s3-resource/${this.entry.discoverId}/${this.entry.version}/files/${path}`
98
144
  },
145
+ generateFileLink(path){
146
+ return `https://sparc.science/file/${this.entry.discoverId}/${this.entry.version}?path=${encodeURI(path)}`
147
+
148
+ },
99
149
  openViewFile: function(view){
100
150
 
101
151
  // note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
@@ -117,6 +167,19 @@ export default {
117
167
 
118
168
  .context-card{
119
169
  background-color: white;
170
+ max-height: 10 50px;
171
+ padding: 8px;
172
+ font-size: 14px;
173
+ }
174
+
175
+ .context-card-item{
176
+ cursor: pointer;
177
+ padding-bottom: 8px;
178
+ }
179
+
180
+ .key-image {
181
+ width: 25px;
182
+ height: auto;
120
183
  }
121
184
 
122
185
  .context-card >>> .el-card__body {
@@ -126,15 +189,25 @@ export default {
126
189
  }
127
190
 
128
191
  .context-image{
129
- width: 250px
192
+ width: 250px;
193
+ height: auto;
194
+ }
195
+
196
+ .color-box {
197
+ width: 16px;
198
+ height: 16px;
199
+ border: solid 1px #8300bf;
200
+ border-radius: 2px;
201
+ margin-right: 8px;
130
202
  }
131
203
 
132
204
  .card {
133
- padding-top: 18px;
134
205
  margin-bottom: 18px;
135
206
  position: relative;
136
207
  border: solid 1px #e4e7ed;
137
208
  display: flex;
209
+ width: 500px;
210
+ max-height: 480px;
138
211
  }
139
212
 
140
213
  .card-left{
@@ -151,7 +224,17 @@ export default {
151
224
  height: 25px;
152
225
  }
153
226
 
227
+ .info{
228
+ transform: rotate(180deg);
229
+ color: #8300bf;
230
+ margin-left: 8px;
231
+ }
232
+
154
233
  .title{
155
234
  font-weight: bold;
156
235
  }
236
+
237
+ .subtitle{
238
+ font-weight: bold;
239
+ }
157
240
  </style>
@@ -43,11 +43,13 @@ import lang from "element-ui/lib/locale/lang/en";
43
43
  import locale from "element-ui/lib/locale";
44
44
  import EventBus from "./EventBus"
45
45
  import speciesMap from "./species-map";
46
+ import hardcoded_info from './hardcoded-context-info'
46
47
 
47
48
  locale.use(lang);
48
49
  Vue.use(Button);
49
50
  Vue.use(Icon);
50
51
 
52
+
51
53
  const capitalise = function(string){
52
54
  return string.replace(/\b\w/g, v => v.toUpperCase());
53
55
  }
@@ -144,6 +146,9 @@ export default {
144
146
  contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
145
147
  banner: this.thumbnail
146
148
  }
149
+ if (hardcoded_info[this.discoverId]){
150
+ action.contextCardUrl = true
151
+ }
147
152
  this.propogateCardAction(action)
148
153
  },
149
154
  openPlot: function(){
@@ -203,6 +208,7 @@ export default {
203
208
  dataset: this.dataLocation,
204
209
  apiLocation: this.envVars.API_LOCATION,
205
210
  version: this.version,
211
+ discoverId: this.discoverId,
206
212
  contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
207
213
  banner: this.thumbnail,
208
214
  title: "View simulation",
@@ -210,14 +216,11 @@ export default {
210
216
  description: this.entry.description,
211
217
  type: "Simulation"
212
218
  }
213
- EventBus.$emit("PopoverActionClick", action)
219
+ this.propogateCardAction(action)
214
220
  },
215
221
  propogateCardAction: function(action){
216
222
  EventBus.$emit("PopoverActionClick", action)
217
- if (action.contextCardUrl) {
218
- this.$emit('contextUpdate', action)
219
- }
220
-
223
+ this.$emit('contextUpdate', action)
221
224
  },
222
225
  getScaffoldPath: function(discoverId, version, scaffoldPath){
223
226
  let id = discoverId
@@ -103,7 +103,7 @@ var initial_state = {
103
103
  hasSearched: false,
104
104
  sciCrunchError: false,
105
105
  contextCardEntry: undefined,
106
- contextCardEnabled: false
106
+ contextCardEnabled: true,
107
107
  };
108
108
 
109
109
  export default {
@@ -152,7 +152,7 @@ export default {
152
152
  },
153
153
  methods: {
154
154
  contextCardUpdate: function(val){
155
- this.contextCardEntry = val
155
+ this.contextCardEntry = val
156
156
  },
157
157
  openSearch: function(filter, search='') {
158
158
  this.searchInput = search;
@@ -0,0 +1,80 @@
1
+ export default {
2
+
3
+ }
4
+ // //Uncomment the code below to add in hardcoded data
5
+ // export default {
6
+ // 77: {
7
+ // "description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
8
+ // "heading": "Mapped ICN samples",
9
+ // "id": "sparc.science.context_data",
10
+ // "samples": [
11
+ // {
12
+ // "annotation": "",
13
+ // "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
14
+ // "doi": "",
15
+ // "heading": "ICNS from subject M54-8",
16
+ // "id": "Sample 1",
17
+ // "path": "",
18
+ // "view": "View 1",
19
+ // "color": "#FFFF00",
20
+ // "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
21
+ // },
22
+ // {
23
+ // "annotation": "",
24
+ // "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
25
+ // "doi": "",
26
+ // "heading": "ICNS from subject M54-5",
27
+ // "id": "Sample 2",
28
+ // "path": "",
29
+ // "view": "View 2",
30
+ // "color": "#FFA500",
31
+ // "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
32
+ // }
33
+ // ],
34
+ // "version": "0.1.0",
35
+ // },
36
+ // 221: {
37
+ // "description": "3D digital tracings of the enteric plexus obtained from seven subjects (M11, M16, M162, M163, M164, M168) are mapped randomly on mouse proximal colon. The data depicts individual neural wiring patterns in enteric microcircuits, and revealed both neuron and fiber units wired in a complex organization.",
38
+ // "heading": "Digital tracings of enteric plexus",
39
+ // "id": "sparc.science.context_data",
40
+ // "samples": [
41
+ // {
42
+ // "annotation": "",
43
+ // "description": "Neuronal soma and fibers in a myenteric ganglion in this subject are annotated into the following groups to highlight their interactions:\n\nNeuron1,2,3 Connex: Connections between 3 neurons and cross-ganglionic fibers\n\nNeuron4_Connex: A small neuron contacts fibers passing the ganglion\n\nNeuron5: Multiple projections of a neuron in an myenteric ganglion\n\nNeuron5,3,7 Connex: Connections between 3 neurons, nerve fibers, IGNEx (complex type of intraganglionic nerve endings) and fibers in the circular muscles.\n\nNeuron8,9,10 Connex: Connections of 3 neurons with each other and with long passing fibers. \n\nIntraganglionic Nerve Ending (IGNE): Digital traces of neurites consist of complex intraganglionic nerve endings. The blue fiber has branched terminals, more likely the afferent nerve endings; the violet and cyan terminals also interweave into the fiber nest; the orange, pink and peach fibers and one process of the neuron cross the IGNE to make 1-2 conjunctions. \n",
44
+ // "doi": "",
45
+ // "heading": "Digital tracing for subject M11",
46
+ // "id": "Sample 1",
47
+ // "path": "files/derivative/sub-M11/sam-pCm11/digital-traces/pC PHPS XFP M11 20XZ 180425_180713_2_NL_20.xml",
48
+ // "view": "View 1"
49
+ // },
50
+ // {
51
+ // "annotation": "",
52
+ // "description": "This digital trace demonstrates some types of wiring. A long process of the green neuron terminates in the intraganglionic nerve endings (IGNE) while in contact with a nerve fiber (cyan), soma of a neuron (peach) and processes of 3 neurons (magenta, yellow and red). Two neurons and one fiber are traced to an IGNE. ",
53
+ // "doi": "",
54
+ // "heading": "Digital tracing for subject M16",
55
+ // "id": "Sample 2",
56
+ // "path": "files/derivative/sub-M16/sam-pCm16/digital-traces/pC PHPS XFP M16 20XZ 180425_180524.xml",
57
+ // "view": "View 2"
58
+ // }
59
+ // ],
60
+ // "version": "0.1.0",
61
+ // "views": [
62
+ // {
63
+ // "annotation": "--",
64
+ // "description": "Digital tracing of neurons for subject M11.",
65
+ // "id": "View 1",
66
+ // "path": "files/derivative/Scaffolds/M11_view.json",
67
+ // "sample": "Sample 1",
68
+ // "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M11_thumbnail.jpeg"
69
+ // },
70
+ // {
71
+ // "annotation": "--",
72
+ // "description": "Digital tracing of neurons for subject M16.",
73
+ // "id": "View 2",
74
+ // "path": "files/derivative/Scaffolds/M16_view.json",
75
+ // "sample": "Sample 2",
76
+ // "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M16_thumbnail.jpeg"
77
+ // }
78
+ // ]
79
+ // }
80
+ // }