@abi-software/map-side-bar 2.0.0-response.1 → 2.0.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.
Files changed (45) hide show
  1. package/.eslintrc.js +12 -0
  2. package/.postcssrc.json +6 -0
  3. package/README.md +49 -27
  4. package/dist/favicon.ico +0 -0
  5. package/dist/map-side-bar.js +21143 -0
  6. package/dist/map-side-bar.umd.cjs +462 -0
  7. package/dist/style.css +1 -0
  8. package/package.json +48 -45
  9. package/src/App.vue +121 -55
  10. package/src/algolia/algolia.js +36 -9
  11. package/src/algolia/utils.js +45 -13
  12. package/src/assets/styles.scss +0 -1
  13. package/src/components/BadgesGroup.vue +56 -80
  14. package/src/components/DatasetCard.vue +143 -143
  15. package/src/components/EventBus.js +2 -2
  16. package/src/components/ImageGallery.vue +184 -228
  17. package/src/components/SearchFilters.vue +687 -296
  18. package/src/components/SearchHistory.vue +175 -0
  19. package/src/components/SideBar.vue +183 -97
  20. package/src/components/SidebarContent.vue +233 -241
  21. package/src/components/Tabs.vue +24 -24
  22. package/src/components.d.ts +35 -0
  23. package/src/main.js +6 -5
  24. package/src/mixins/S3Bucket.vue +6 -0
  25. package/vite.config.js +56 -0
  26. package/vuese-generator.js +65 -0
  27. package/babel.config.js +0 -14
  28. package/dist/demo.html +0 -10
  29. package/dist/fonts/element-icons.535877f5.woff +0 -0
  30. package/dist/fonts/element-icons.732389de.ttf +0 -0
  31. package/dist/img/missing-image.1878d8b8.svg +0 -1
  32. package/dist/map-side-bar.common.js +0 -7794
  33. package/dist/map-side-bar.common.js.map +0 -1
  34. package/dist/map-side-bar.css +0 -1
  35. package/dist/map-side-bar.umd.js +0 -7804
  36. package/dist/map-side-bar.umd.js.map +0 -1
  37. package/dist/map-side-bar.umd.min.js +0 -2
  38. package/dist/map-side-bar.umd.min.js.map +0 -1
  39. package/package-lock.json +0 -14428
  40. package/public/index.html +0 -17
  41. package/src/components/Cascader.vue +0 -49
  42. package/src/components/ContextCard.vue +0 -397
  43. package/src/components/hardcoded-context-info.js +0 -80
  44. package/src/demo/AlternateResponse.js +0 -141
  45. package/vue.config.js +0 -21
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <div class="dataset-card-container" ref="container">
3
- <div class="dataset-card" ref="card">
2
+ <div class="dataset-card-container" ref="container">
3
+ <div class="dataset-card" ref="card">
4
4
  <div class="seperator-path"></div>
5
- <div v-loading="loading" class="card" >
5
+ <div v-loading="loading" class="card">
6
6
  <span class="card-left">
7
- <image-gallery v-if="!loading && datasetId"
8
- :datasetId="datasetId"
7
+ <ImageGallery
8
+ v-if="!loading && discoverId"
9
+ :datasetId="discoverId"
9
10
  :datasetVersion="version"
10
- :dataLocation="dataLocation"
11
11
  :entry="entry"
12
12
  :envVars="envVars"
13
13
  :label="label"
@@ -15,19 +15,31 @@
15
15
  :dataset-biolucida="biolucidaData"
16
16
  :category="currentCategory"
17
17
  @card-clicked="galleryClicked"
18
- :key="datasetId"
19
18
  />
20
19
  </span>
21
- <div class="card-right" >
22
- <div class="title" @click="cardClicked">{{entry.name}}</div>
23
- <div class="details">{{contributors}} {{entry.publishDate ? `(${publishYear})` : ''}}</div>
24
- <div class="details">{{samples}}</div>
25
- <div v-if="!entry.detailsReady" class="details loading-icon" v-loading="!entry.detailsReady"></div>
20
+ <div class="card-right">
21
+ <div class="title" @click="cardClicked">{{ entry.name }}</div>
22
+ <div class="details">
23
+ {{ contributors }} {{ entry.publishDate ? `(${publishYear})` : '' }}
24
+ </div>
25
+ <div class="details">{{ samples }}</div>
26
+ <div
27
+ v-if="!entry.detailsReady"
28
+ class="details loading-icon"
29
+ v-loading="!entry.detailsReady"
30
+ ></div>
26
31
  <div>
27
- <el-button v-if="entry.simulation" @click="openRepository" size="mini" class="button" icon="el-icon-view">View repository</el-button>
32
+ <el-button
33
+ v-if="entry.simulation"
34
+ @click="openRepository"
35
+ size="small"
36
+ class="button"
37
+ :icon="ElIconView"
38
+ >View repository</el-button
39
+ >
28
40
  </div>
29
41
  <div class="badges-container">
30
- <badges-group
42
+ <BadgesGroup
31
43
  :entry="entry"
32
44
  :dataset-biolucida="biolucidaData"
33
45
  @categoryChanged="categoryChanged"
@@ -39,29 +51,31 @@
39
51
  </div>
40
52
  </template>
41
53
 
42
-
43
54
  <script>
44
55
  /* eslint-disable no-alert, no-console */
45
- import Vue from "vue";
46
- import BadgesGroup from "./BadgesGroup.vue";
47
- import { Button, Icon } from "element-ui";
48
- import lang from "element-ui/lib/locale/lang/en";
49
- import locale from "element-ui/lib/locale";
50
- import EventBus from "./EventBus"
51
- import speciesMap from "./species-map";
52
- import ImageGallery from "./ImageGallery.vue";
53
-
54
- locale.use(lang);
55
- Vue.use(Button);
56
- Vue.use(Icon);
56
+ import { View as ElIconView } from '@element-plus/icons-vue'
57
+ import BadgesGroup from './BadgesGroup.vue'
58
+ import {
59
+ ElButton as Button,
60
+ ElIcon as Icon
61
+ } from 'element-plus'
62
+ import EventBus from './EventBus.js'
63
+ import speciesMap from './species-map.js'
64
+ import ImageGallery from './ImageGallery.vue'
65
+ import MissingImage from '@/../assets/missing-image.svg'
57
66
 
58
67
  export default {
59
- name: "DatasetCard",
60
- components: { BadgesGroup, ImageGallery },
61
- inject: {
62
- 'alternateSearch' : {
63
- default: undefined,
64
- },
68
+ data() {
69
+ return {
70
+ ElIconView,
71
+ }
72
+ },
73
+ name: 'DatasetCard',
74
+ components: {
75
+ BadgesGroup,
76
+ ImageGallery,
77
+ Button,
78
+ Icon
65
79
  },
66
80
  props: {
67
81
  /**
@@ -70,115 +84,120 @@ export default {
70
84
  */
71
85
  entry: {
72
86
  type: Object,
73
- default: () => {}
87
+ default: () => {},
74
88
  },
75
89
  envVars: {
76
90
  type: Object,
77
- default: () => {}
91
+ default: () => {},
78
92
  },
79
93
  },
80
94
  data: function () {
81
95
  return {
82
- thumbnail: require('@/../assets/missing-image.svg'),
96
+ thumbnail: MissingImage,
83
97
  dataLocation: this.entry.doi,
84
- datasetId: undefined,
98
+ discoverId: undefined,
85
99
  loading: true,
86
100
  version: 1,
87
101
  lastDoi: undefined,
88
102
  biolucidaData: undefined,
89
- currentCategory: "All"
90
- };
103
+ currentCategory: 'All',
104
+ }
91
105
  },
92
106
  computed: {
93
- contributors: function() {
94
- let text = "";
107
+ contributors: function () {
108
+ let text = ''
95
109
  if (this.entry.contributors) {
96
110
  if (this.entry.contributors.length === 1) {
97
- text = this.lastName(this.entry.contributors[0].name);
111
+ text = this.lastName(this.entry.contributors[0].name)
98
112
  } else if (this.entry.contributors.length === 2) {
99
- text = this.lastName(this.entry.contributors[0].name) + " & " + this.lastName(this.entry.contributors[1].name);
113
+ text =
114
+ this.lastName(this.entry.contributors[0].name) +
115
+ ' & ' +
116
+ this.lastName(this.entry.contributors[1].name)
100
117
  } else if (this.entry.contributors.length > 2) {
101
- text = this.lastName(this.entry.contributors[0].name) + " et al.";
118
+ text = this.lastName(this.entry.contributors[0].name) + ' et al.'
102
119
  }
103
120
  }
104
- return text;
121
+ return text
105
122
  },
106
- samples: function() {
107
- let text = "";
123
+ samples: function () {
124
+ let text = ''
108
125
  if (this.entry.species) {
109
- if (this.entry.species.length > 0 &&
110
- speciesMap[this.entry.species[0].toLowerCase()]) {
111
- text = `${speciesMap[this.entry.species[0].toLowerCase()]}`;
126
+ if (speciesMap[this.entry.species[0].toLowerCase()]) {
127
+ text = `${speciesMap[this.entry.species[0].toLowerCase()]}`
112
128
  } else {
113
- text = `${this.entry.species}`;
129
+ text = `${this.entry.species}`
114
130
  }
115
131
  }
116
132
  if (this.entry.numberSamples > 0) {
117
- text += " (";
133
+ text += ' ('
118
134
  if (this.entry.numberSamples === 1) {
119
- text += `${this.entry.numberSamples} sample`;
135
+ text += `${this.entry.numberSamples} sample`
120
136
  } else if (this.entry.numberSamples > 1) {
121
- text += `${this.entry.numberSamples} samples`;
137
+ text += `${this.entry.numberSamples} samples`
122
138
  }
123
139
  if (this.entry.numberSubjects === 1) {
124
- text += ` from ${this.entry.numberSubjects} subject`;
140
+ text += ` from ${this.entry.numberSubjects} subject`
125
141
  } else if (this.entry.numberSamples > 1) {
126
- text += ` from ${this.entry.numberSubjects} subjects`;
142
+ text += ` from ${this.entry.numberSubjects} subjects`
127
143
  }
128
- text += ")";
144
+ text += ')'
129
145
  }
130
146
 
131
- return text;
147
+ return text
132
148
  },
133
- label: function(){
149
+ label: function () {
134
150
  return this.entry.organs ? this.entry.organs[0] : this.entry.name
135
151
  },
136
- publishYear: function() {
152
+ publishYear: function () {
137
153
  return this.entry.publishDate.split('-')[0]
138
- }
154
+ },
139
155
  },
140
156
  methods: {
141
- cardClicked: function(){
157
+ cardClicked: function () {
142
158
  this.openDataset()
143
159
  },
144
- categoryChanged: function(name) {
145
- this.currentCategory = name;
160
+ categoryChanged: function (name) {
161
+ this.currentCategory = name
146
162
  },
147
- galleryClicked: function(payload) {
163
+ galleryClicked: function (payload) {
148
164
  this.propogateCardAction(payload)
149
165
  },
150
- openDataset: function(){
151
- window.open(this.dataLocation,'_blank');
166
+ openDataset: function () {
167
+ window.open(this.dataLocation, '_blank')
152
168
  },
153
- openRepository: function() {
154
- let apiLocation = this.envVars.API_LOCATION;
155
- this.entry.additionalLinks.forEach(function(el) {
156
- if (el.description == "Repository") {
157
- let xmlhttp = new XMLHttpRequest();
158
- xmlhttp.open("POST", apiLocation + "/pmr_latest_exposure", true);
159
- xmlhttp.setRequestHeader("Content-type", "application/json");
169
+ openRepository: function () {
170
+ let apiLocation = this.envVars.API_LOCATION
171
+ this.entry.additionalLinks.forEach(function (el) {
172
+ if (el.description == 'Repository') {
173
+ let xmlhttp = new XMLHttpRequest()
174
+ xmlhttp.open('POST', apiLocation + '/pmr_latest_exposure', true)
175
+ xmlhttp.setRequestHeader('Content-type', 'application/json')
160
176
  xmlhttp.onreadystatechange = () => {
161
177
  if (xmlhttp.readyState === 4) {
162
- let url = "";
178
+ let url = ''
163
179
  if (xmlhttp.status === 200) {
164
- url = JSON.parse(xmlhttp.responseText)["url"];
180
+ url = JSON.parse(xmlhttp.responseText)['url']
165
181
  }
166
- if (url === "") {
167
- url = el.uri;
182
+ if (url === '') {
183
+ url = el.uri
168
184
  }
169
- window.open(url,'_blank');
185
+ window.open(url, '_blank')
170
186
  }
171
- };
172
- xmlhttp.send(JSON.stringify({workspace_url: el.uri}));
187
+ }
188
+ xmlhttp.send(JSON.stringify({ workspace_url: el.uri }))
173
189
  }
174
- });
190
+ })
175
191
  },
176
- propogateCardAction: function(action){
177
- EventBus.$emit("PopoverActionClick", action)
178
- this.$emit('contextUpdate', action)
192
+ propogateCardAction: function (action) {
193
+ EventBus.emit('PopoverActionClick', action)
194
+ EventBus.emit('contextUpdate', action) // Pass to mapintegratedvuer
179
195
  },
180
- splitDOI: function(doi){
181
- return [doi.split('/')[doi.split('/').length-2], doi.split('/')[doi.split('/').length-1]]
196
+ splitDOI: function (doi) {
197
+ return [
198
+ doi.split('/')[doi.split('/').length - 2],
199
+ doi.split('/')[doi.split('/').length - 1],
200
+ ]
182
201
  },
183
202
  getBanner: function () {
184
203
  // Only load banner if card has changed
@@ -186,9 +205,11 @@ export default {
186
205
  this.lastDoi = this.entry.doi
187
206
  this.loading = true
188
207
  let doi = this.splitDOI(this.entry.doi)
189
- fetch(`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`)
190
- .then((response) =>{
191
- if (!response.ok){
208
+ fetch(
209
+ `${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${doi[0]}/${doi[1]}`
210
+ )
211
+ .then((response) => {
212
+ if (!response.ok) {
192
213
  throw Error(response.statusText)
193
214
  } else {
194
215
  return response.json()
@@ -196,73 +217,52 @@ export default {
196
217
  })
197
218
  .then((data) => {
198
219
  this.thumbnail = data.banner
199
- this.datasetId = data.id
220
+ this.discoverId = data.id
200
221
  this.version = data.version
201
- this.dataLocation = `${this.envVars.ROOT_URL}/datasets/${data.id}?type=dataset`
202
- this.getBiolucidaInfo(this.datasetId)
222
+ this.dataLocation = `https://sparc.science/datasets/${data.id}?type=dataset`
223
+ this.getBiolucidaInfo(this.discoverId)
203
224
  this.loading = false
204
225
  })
205
226
  .catch(() => {
206
227
  //set defaults if we hit an error
207
- this.thumbnail = require('@/../assets/missing-image.svg')
208
- this.datasetId = Number(this.entry.datasetId)
228
+ this.thumbnail = MissingImage
229
+ this.discoverId = Number(this.entry.datasetId)
209
230
  this.loading = false
210
- });
211
- }
212
-
213
- },
214
- initialise: function() {
215
- if (!this.alternateSearch) {
216
- this.getBanner();
217
- } else {
218
- this.dataLocation = this.entry.data_url;
219
- this.datasetId = this.entry.datasetId;
220
- if (this.entry.scaffoldViews.length > 0) {
221
- this.thumbnail = this.entry.scaffoldViews[0].image_url;
222
- } else if (this.entry.thumbnails.length > 0) {
223
- this.thumbnail = this.entry.thumbnails[0].image_url;
224
- } else {
225
- this.thumbnail = require("@/../assets/missing-image.svg");
226
- }
227
- this.loading = false;
231
+ })
228
232
  }
229
233
  },
230
- lastName: function(fullName){
234
+ lastName: function (fullName) {
231
235
  return fullName.split(',')[0]
232
236
  },
233
- getBiolucidaInfo: function(id) {
234
- let apiLocation = this.envVars.API_LOCATION;
235
- let endpoint = apiLocation + "image_search/" + id;
237
+ getBiolucidaInfo: function (id) {
238
+ let apiLocation = this.envVars.API_LOCATION
239
+ let endpoint = apiLocation + 'image_search/' + id
236
240
  // Add parameters if we are sent them
237
241
  fetch(endpoint)
238
- .then(response => response.json())
239
- .then(data => {
240
- if (data.status == "success")
241
- this.biolucidaData = data;
242
- });
243
- }
242
+ .then((response) => response.json())
243
+ .then((data) => {
244
+ if (data.status == 'success') this.biolucidaData = data
245
+ })
246
+ },
244
247
  },
245
- created: function() {
246
- this.initialise();
248
+ created: function () {
249
+ this.getBanner()
247
250
  },
248
251
  watch: {
249
252
  // currently not using card overflow
250
- 'entry.datasetId': function() { // watch it
251
- this.initialise();
252
- }
253
+ 'entry.description': function () {
254
+ // watch it
255
+ this.getBanner()
256
+ },
253
257
  },
254
- };
258
+ }
255
259
  </script>
256
260
 
257
- <!-- Add "scoped" attribute to limit CSS to this component only -->
258
- <style scoped lang="scss">
259
- @import "~element-ui/packages/theme-chalk/src/col";
260
- @import "~element-ui/packages/theme-chalk/src/loading";
261
-
261
+ <style lang="scss" scoped>
262
262
  .dataset-card {
263
- padding-left: 16px;
263
+ padding-left: 15px;
264
264
  position: relative;
265
- min-height:17rem;
265
+ min-height: 17rem;
266
266
  }
267
267
 
268
268
  .title {
@@ -283,7 +283,7 @@ export default {
283
283
  display: flex;
284
284
  }
285
285
 
286
- .card-left{
286
+ .card-left {
287
287
  flex: 1;
288
288
  }
289
289
 
@@ -292,7 +292,7 @@ export default {
292
292
  padding-left: 6px;
293
293
  }
294
294
 
295
- .button{
295
+ .button {
296
296
  z-index: 10;
297
297
  font-family: Asap;
298
298
  font-size: 14px;
@@ -320,7 +320,7 @@ export default {
320
320
  background-color: #ffffff;
321
321
  cursor: pointer;
322
322
  }
323
- .details{
323
+ .details {
324
324
  font-family: Asap;
325
325
  font-size: 14px;
326
326
  font-weight: normal;
@@ -332,7 +332,7 @@ export default {
332
332
  }
333
333
 
334
334
  .badges-container {
335
- margin-top:0.75rem;
335
+ margin-top: 0.75rem;
336
336
  }
337
337
 
338
338
  .loading-icon {
@@ -342,11 +342,11 @@ export default {
342
342
  left: 80px;
343
343
  }
344
344
 
345
- .loading-icon ::v-deep .el-loading-mask {
346
- background-color: rgba(117, 190, 218, 0.0) !important;
345
+ .loading-icon :deep(.el-loading-mask) {
346
+ background-color: rgba(117, 190, 218, 0) !important;
347
347
  }
348
348
 
349
- .loading-icon ::v-deep .el-loading-spinner .path {
349
+ .loading-icon :deep(.el-loading-spinner .path) {
350
350
  stroke: $app-primary-color;
351
351
  }
352
352
  </style>
@@ -1,3 +1,3 @@
1
- import Vue from 'vue';
2
- const EventBus = new Vue();
1
+ import mitt from 'mitt';
2
+ const EventBus = new mitt();
3
3
  export default EventBus;