@abi-software/map-side-bar 1.3.37 → 2.0.0-response.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/dist/map-side-bar.common.js +419 -268
- package/dist/map-side-bar.common.js.map +1 -1
- package/dist/map-side-bar.css +1 -1
- package/dist/map-side-bar.umd.js +419 -268
- package/dist/map-side-bar.umd.js.map +1 -1
- package/dist/map-side-bar.umd.min.js +1 -1
- package/dist/map-side-bar.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/App.vue +6 -1
- package/src/components/BadgesGroup.vue +5 -1
- package/src/components/DatasetCard.vue +36 -12
- package/src/components/ImageGallery.vue +85 -27
- package/src/components/SearchFilters.vue +60 -38
- package/src/components/SideBar.vue +9 -0
- package/src/components/SidebarContent.vue +52 -24
- package/src/demo/AlternateResponse.js +141 -0
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
<el-button @click="keywordSearch">keyword search</el-button>
|
|
13
13
|
<SideBar :envVars="envVars" class="side-bar" ref="sideBar" :visible="sideBarVisibility"
|
|
14
14
|
:tabs="tabs" :activeId="activeId" @tabClicked="tabClicked"
|
|
15
|
-
@search-changed="searchChanged($event)" @actionClick="action"
|
|
15
|
+
@search-changed="searchChanged($event)" @actionClick="action"
|
|
16
|
+
:alternate-search="mySearch"/>
|
|
16
17
|
</div>
|
|
17
18
|
</template>
|
|
18
19
|
|
|
@@ -20,7 +21,9 @@
|
|
|
20
21
|
/* eslint-disable no-alert, no-console */
|
|
21
22
|
// optionally import default styles
|
|
22
23
|
import SideBar from './components/SideBar'
|
|
24
|
+
import { mySearch } from './demo/AlternateResponse.js'
|
|
23
25
|
|
|
26
|
+
console.log(mySearch)
|
|
24
27
|
// let testContext = {
|
|
25
28
|
// "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.",
|
|
26
29
|
// "heading": "Digital tracings of enteric plexus",
|
|
@@ -95,6 +98,8 @@ export default {
|
|
|
95
98
|
ROOT_URL: process.env.VUE_APP_ROOT_URL,
|
|
96
99
|
},
|
|
97
100
|
activeId: 1,
|
|
101
|
+
mySearch: mySearch,
|
|
102
|
+
//mySearch: undefined,
|
|
98
103
|
}
|
|
99
104
|
},
|
|
100
105
|
methods:{
|
|
@@ -75,7 +75,10 @@ export default {
|
|
|
75
75
|
categoryClicked: function(name) {
|
|
76
76
|
this.active = name;
|
|
77
77
|
this.$emit("categoryChanged", name);
|
|
78
|
-
}
|
|
78
|
+
},
|
|
79
|
+
resetCategory: function() {
|
|
80
|
+
this.categories = { All: { size: 1 }, Dataset: { size: 1 } };
|
|
81
|
+
},
|
|
79
82
|
},
|
|
80
83
|
watch: {
|
|
81
84
|
datasetBiolucida: {
|
|
@@ -91,6 +94,7 @@ export default {
|
|
|
91
94
|
deep: true,
|
|
92
95
|
immediate: true,
|
|
93
96
|
handler: function () {
|
|
97
|
+
this.resetCategory();
|
|
94
98
|
this.addToCategories(this.entry.scaffolds, 'Scaffolds');
|
|
95
99
|
this.addToCategories(this.entry.segmentation, 'Segmentations');
|
|
96
100
|
this.addToCategories(this.entry.plots, 'Plots');
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
<div class="seperator-path"></div>
|
|
5
5
|
<div v-loading="loading" class="card" >
|
|
6
6
|
<span class="card-left">
|
|
7
|
-
<image-gallery v-if="!loading &&
|
|
8
|
-
:datasetId="
|
|
7
|
+
<image-gallery v-if="!loading && datasetId"
|
|
8
|
+
:datasetId="datasetId"
|
|
9
9
|
:datasetVersion="version"
|
|
10
|
+
:dataLocation="dataLocation"
|
|
10
11
|
:entry="entry"
|
|
11
12
|
:envVars="envVars"
|
|
12
13
|
:label="label"
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
:dataset-biolucida="biolucidaData"
|
|
15
16
|
:category="currentCategory"
|
|
16
17
|
@card-clicked="galleryClicked"
|
|
18
|
+
:key="datasetId"
|
|
17
19
|
/>
|
|
18
20
|
</span>
|
|
19
21
|
<div class="card-right" >
|
|
@@ -56,6 +58,11 @@ Vue.use(Icon);
|
|
|
56
58
|
export default {
|
|
57
59
|
name: "DatasetCard",
|
|
58
60
|
components: { BadgesGroup, ImageGallery },
|
|
61
|
+
inject: {
|
|
62
|
+
'alternateSearch' : {
|
|
63
|
+
default: undefined,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
59
66
|
props: {
|
|
60
67
|
/**
|
|
61
68
|
* Object containing information for
|
|
@@ -74,7 +81,7 @@ export default {
|
|
|
74
81
|
return {
|
|
75
82
|
thumbnail: require('@/../assets/missing-image.svg'),
|
|
76
83
|
dataLocation: this.entry.doi,
|
|
77
|
-
|
|
84
|
+
datasetId: undefined,
|
|
78
85
|
loading: true,
|
|
79
86
|
version: 1,
|
|
80
87
|
lastDoi: undefined,
|
|
@@ -99,7 +106,8 @@ export default {
|
|
|
99
106
|
samples: function() {
|
|
100
107
|
let text = "";
|
|
101
108
|
if (this.entry.species) {
|
|
102
|
-
if (
|
|
109
|
+
if (this.entry.species.length > 0 &&
|
|
110
|
+
speciesMap[this.entry.species[0].toLowerCase()]) {
|
|
103
111
|
text = `${speciesMap[this.entry.species[0].toLowerCase()]}`;
|
|
104
112
|
} else {
|
|
105
113
|
text = `${this.entry.species}`;
|
|
@@ -188,21 +196,37 @@ export default {
|
|
|
188
196
|
})
|
|
189
197
|
.then((data) => {
|
|
190
198
|
this.thumbnail = data.banner
|
|
191
|
-
this.
|
|
199
|
+
this.datasetId = data.id
|
|
192
200
|
this.version = data.version
|
|
193
|
-
this.dataLocation =
|
|
194
|
-
this.getBiolucidaInfo(this.
|
|
201
|
+
this.dataLocation = `${this.envVars.ROOT_URL}/datasets/${data.id}?type=dataset`
|
|
202
|
+
this.getBiolucidaInfo(this.datasetId)
|
|
195
203
|
this.loading = false
|
|
196
204
|
})
|
|
197
205
|
.catch(() => {
|
|
198
206
|
//set defaults if we hit an error
|
|
199
207
|
this.thumbnail = require('@/../assets/missing-image.svg')
|
|
200
|
-
this.
|
|
208
|
+
this.datasetId = Number(this.entry.datasetId)
|
|
201
209
|
this.loading = false
|
|
202
210
|
});
|
|
203
211
|
}
|
|
204
212
|
|
|
205
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;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
206
230
|
lastName: function(fullName){
|
|
207
231
|
return fullName.split(',')[0]
|
|
208
232
|
},
|
|
@@ -219,12 +243,12 @@ export default {
|
|
|
219
243
|
}
|
|
220
244
|
},
|
|
221
245
|
created: function() {
|
|
222
|
-
this.
|
|
246
|
+
this.initialise();
|
|
223
247
|
},
|
|
224
248
|
watch: {
|
|
225
249
|
// currently not using card overflow
|
|
226
|
-
'entry.
|
|
227
|
-
this.
|
|
250
|
+
'entry.datasetId': function() { // watch it
|
|
251
|
+
this.initialise();
|
|
228
252
|
}
|
|
229
253
|
},
|
|
230
254
|
};
|
|
@@ -257,7 +281,7 @@ export default {
|
|
|
257
281
|
}
|
|
258
282
|
|
|
259
283
|
.card-left{
|
|
260
|
-
flex: 1
|
|
284
|
+
flex: 1;
|
|
261
285
|
}
|
|
262
286
|
|
|
263
287
|
.card-right {
|
|
@@ -37,6 +37,11 @@ import "@abi-software/gallery/dist/gallery.css";
|
|
|
37
37
|
export default {
|
|
38
38
|
name: "ImageGallery",
|
|
39
39
|
components: { Gallery },
|
|
40
|
+
inject: {
|
|
41
|
+
'alternateSearch' : {
|
|
42
|
+
default: undefined,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
40
45
|
mixins: [GalleryHelper, S3Bucket],
|
|
41
46
|
props: {
|
|
42
47
|
datasetBiolucida: {
|
|
@@ -59,9 +64,10 @@ export default {
|
|
|
59
64
|
return [];
|
|
60
65
|
},
|
|
61
66
|
},
|
|
62
|
-
datasetId:
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
datasetId: [String, Number],
|
|
68
|
+
dataLocation: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "",
|
|
65
71
|
},
|
|
66
72
|
datasetVersion: {
|
|
67
73
|
type: Number,
|
|
@@ -117,9 +123,10 @@ export default {
|
|
|
117
123
|
this.$emit('card-clicked', payload);
|
|
118
124
|
},
|
|
119
125
|
createSciCurnchItems: function () {
|
|
120
|
-
this.updateS3Bucket(this.entry.s3uri);
|
|
126
|
+
if (this.entry.s3uri) this.updateS3Bucket(this.entry.s3uri);
|
|
121
127
|
this.createDatasetItem();
|
|
122
|
-
this.
|
|
128
|
+
if (this.alternateSearch) this.createScaffoldViewItems();
|
|
129
|
+
else this.createScaffoldItems();
|
|
123
130
|
this.createSimulationItems();
|
|
124
131
|
this.createPlotItems();
|
|
125
132
|
this.createSegmentationItems();
|
|
@@ -129,13 +136,17 @@ export default {
|
|
|
129
136
|
*/
|
|
130
137
|
},
|
|
131
138
|
createDatasetItem: function () {
|
|
132
|
-
const link =
|
|
139
|
+
const link = this.dataLocation;
|
|
140
|
+
let name = String(this.datasetId);
|
|
141
|
+
if (name.length <= 5) name = `Dataset ${name}`;
|
|
142
|
+
else name = "Dataset";
|
|
143
|
+
|
|
133
144
|
if (this.datasetThumbnail) {
|
|
134
145
|
this.items['Dataset'].push({
|
|
135
146
|
id: -1,
|
|
136
147
|
//Work around gallery requires a truthy string
|
|
137
148
|
title: " ",
|
|
138
|
-
type:
|
|
149
|
+
type: name,
|
|
139
150
|
thumbnail: this.datasetThumbnail,
|
|
140
151
|
link,
|
|
141
152
|
hideType: true,
|
|
@@ -164,28 +175,44 @@ export default {
|
|
|
164
175
|
this.entry.plots.forEach((plot) => {
|
|
165
176
|
const filePath = plot.dataset.path;
|
|
166
177
|
const id = plot.identifier;
|
|
167
|
-
const thumbnail = this.getThumbnailForPlot(plot, this.entry.thumbnails);
|
|
168
178
|
let thumbnailURL = undefined;
|
|
169
179
|
let mimetype = '';
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
datasetVersion: this.datasetVersion,
|
|
175
|
-
file_path: thumbnail.dataset.path,
|
|
176
|
-
s3Bucket: this.s3Bucket,
|
|
177
|
-
});
|
|
178
|
-
mimetype = thumbnail.mimetype.name;
|
|
179
|
-
}
|
|
180
|
+
let supplementalData = [];
|
|
181
|
+
let sourceUrl = "";
|
|
182
|
+
let metadata = undefined;
|
|
183
|
+
let filePathPrefix = ""; `${this.envVars.API_LOCATION}/s3-resource/${this.datasetId}/${this.datasetVersion}/files/`;
|
|
180
184
|
const plotAnnotation = plot.datacite;
|
|
181
|
-
const filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.datasetId}/${this.datasetVersion}/files/`;
|
|
182
|
-
const sourceUrl = filePathPrefix + plot.dataset.path + this.getS3Args();
|
|
183
185
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
if (!this.alternateSearch) {
|
|
187
|
+
const thumbnail = this.getThumbnailForPlot(plot, this.entry.thumbnails);
|
|
188
|
+
if (thumbnail) {
|
|
189
|
+
thumbnailURL = this.getImageURLFromS3(this.envVars.API_LOCATION, {
|
|
190
|
+
id,
|
|
191
|
+
datasetId: this.datasetId,
|
|
192
|
+
datasetVersion: this.datasetVersion,
|
|
193
|
+
file_path: thumbnail.dataset.path,
|
|
194
|
+
s3Bucket: this.s3Bucket,
|
|
195
|
+
});
|
|
196
|
+
mimetype = thumbnail.mimetype.name;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
filePathPrefix = `${this.envVars.API_LOCATION}/s3-resource/${this.datasetId}/${this.datasetVersion}/files/`;
|
|
200
|
+
sourceUrl = filePathPrefix + plot.dataset.path + this.getS3Args();
|
|
201
|
+
metadata = JSON.parse(
|
|
202
|
+
plotAnnotation.supplemental_json_metadata.description
|
|
203
|
+
);
|
|
204
|
+
} else {
|
|
205
|
+
thumbnailURL = this.datasetThumbnail;
|
|
206
|
+
mimetype = plot.additional_mimetype.name;
|
|
207
|
+
sourceUrl = this.entry.source_url_prefix + plot.dataset.path;
|
|
208
|
+
metadata = plotAnnotation.supplemental_json_metadata.description;
|
|
209
|
+
if (metadata !== "") {
|
|
210
|
+
metadata = JSON.parse(
|
|
211
|
+
plotAnnotation.supplemental_json_metadata.description.replaceAll("'", '"'));
|
|
212
|
+
}
|
|
213
|
+
filePathPrefix = this.entry.source_url_prefix;
|
|
214
|
+
}
|
|
187
215
|
|
|
188
|
-
let supplementalData = [];
|
|
189
216
|
if (plotAnnotation.isDescribedBy) {
|
|
190
217
|
supplementalData.push({
|
|
191
218
|
url: filePathPrefix + plotAnnotation.isDescribedBy.path
|
|
@@ -204,7 +231,7 @@ export default {
|
|
|
204
231
|
s3uri: this.entry.s3uri,
|
|
205
232
|
title: "View plot",
|
|
206
233
|
type: "Plot",
|
|
207
|
-
discoverId: this.
|
|
234
|
+
discoverId: this.datasetId,
|
|
208
235
|
version: this.datasetVersion,
|
|
209
236
|
};
|
|
210
237
|
this.items['Plots'].push({
|
|
@@ -267,6 +294,37 @@ export default {
|
|
|
267
294
|
});
|
|
268
295
|
}
|
|
269
296
|
},
|
|
297
|
+
createScaffoldViewItems: function() {
|
|
298
|
+
if (this.entry.scaffoldViews) {
|
|
299
|
+
// let index = 0;
|
|
300
|
+
this.entry.scaffoldViews.forEach((scaffold) => {
|
|
301
|
+
const filePath = scaffold.dataset.path;
|
|
302
|
+
const id = scaffold.identifier;
|
|
303
|
+
let thumbnailURL = scaffold.image_url;
|
|
304
|
+
let action = {
|
|
305
|
+
label: capitalise(this.label),
|
|
306
|
+
resource:
|
|
307
|
+
this.entry.source_url_prefix + scaffold.datacite.isDerivedFrom.path,
|
|
308
|
+
viewUrl: this.entry.source_url_prefix + scaffold.dataset.path,
|
|
309
|
+
title: "View 3D scaffold",
|
|
310
|
+
type: "Scaffold",
|
|
311
|
+
discoverId: this.datasetId,
|
|
312
|
+
apiLocation: this.envVars.API_LOCATION,
|
|
313
|
+
version: this.datasetVersion,
|
|
314
|
+
banner: this.datasetThumbnail,
|
|
315
|
+
// contextCardUrl: this.getContextCardUrl(i),
|
|
316
|
+
};
|
|
317
|
+
this.items["Scaffolds"].push({
|
|
318
|
+
id,
|
|
319
|
+
title: baseName(filePath),
|
|
320
|
+
type: "Scaffold",
|
|
321
|
+
thumbnail: thumbnailURL,
|
|
322
|
+
userData: action,
|
|
323
|
+
hideType: true,
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
},
|
|
270
328
|
createSegmentationItems: function () {
|
|
271
329
|
if (this.entry.segmentation) {
|
|
272
330
|
this.entry.segmentation.forEach((segmentation) => {
|
|
@@ -363,8 +421,8 @@ export default {
|
|
|
363
421
|
let contextIndex = this.entry['abi-contextual-information'].length == this.entry.scaffolds.length ? scaffoldIndex : 0
|
|
364
422
|
return `${this.envVars.API_LOCATION}s3-resource/${this.datasetId}/${this.datasetVersion}/files/${this.entry.contextualInformation[contextIndex]}${this.getS3Args()}`
|
|
365
423
|
}
|
|
366
|
-
}
|
|
367
|
-
|
|
424
|
+
},
|
|
425
|
+
},
|
|
368
426
|
computed: {
|
|
369
427
|
galleryItems() {
|
|
370
428
|
if (this.resetIndex) {
|
|
@@ -92,6 +92,8 @@ const convertReadableLabel = function (original) {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
|
|
96
|
+
|
|
95
97
|
export default {
|
|
96
98
|
name: "SearchFilters",
|
|
97
99
|
components: {
|
|
@@ -110,6 +112,11 @@ export default {
|
|
|
110
112
|
default: ()=>{}
|
|
111
113
|
},
|
|
112
114
|
},
|
|
115
|
+
inject: {
|
|
116
|
+
'alternateSearch' : {
|
|
117
|
+
default: undefined,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
113
120
|
data: function () {
|
|
114
121
|
return {
|
|
115
122
|
cascaderIsReady: false,
|
|
@@ -125,7 +132,6 @@ export default {
|
|
|
125
132
|
cascadeSelectedWithBoolean: [],
|
|
126
133
|
numberShown: 10,
|
|
127
134
|
filters: [],
|
|
128
|
-
facets: ["Species", "Gender", "Organ", "Datasets"],
|
|
129
135
|
numberDatasetsShown: ["10", "20", "50"],
|
|
130
136
|
props: { multiple: true },
|
|
131
137
|
options: [
|
|
@@ -147,43 +153,64 @@ export default {
|
|
|
147
153
|
if (facet) return term + ">" + facet;
|
|
148
154
|
else return term;
|
|
149
155
|
},
|
|
150
|
-
|
|
156
|
+
populateCascaderOptions: function(data) {
|
|
157
|
+
this.options = data;
|
|
158
|
+
// create top level of options in cascader
|
|
159
|
+
this.options.forEach((facet, i) => {
|
|
160
|
+
this.options[i].label = convertReadableLabel(facet.label);
|
|
161
|
+
this.options[i].value = this.createCascaderItemValue(
|
|
162
|
+
facet.key,
|
|
163
|
+
undefined
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
// put "Show all" as first option
|
|
167
|
+
this.options[i].children.unshift({
|
|
168
|
+
value: this.createCascaderItemValue("Show all"),
|
|
169
|
+
label: "Show all",
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// populate second level of options
|
|
173
|
+
this.options[i].children.forEach((facetItem, j) => {
|
|
174
|
+
this.options[i].children[j].label = convertReadableLabel(
|
|
175
|
+
facetItem.label
|
|
176
|
+
);
|
|
177
|
+
this.options[i].children[j].value =
|
|
178
|
+
this.createCascaderItemValue(facet.label, facetItem.label);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
populateDefaultCascader: function() {
|
|
151
183
|
return new Promise((resolve) => {
|
|
152
184
|
// Algolia facet serach
|
|
153
185
|
this.algoliaClient.getAlgoliaFacets(facetPropPathMapping)
|
|
154
186
|
.then((data) => {
|
|
155
|
-
this.
|
|
156
|
-
this.options = data;
|
|
157
|
-
|
|
158
|
-
// create top level of options in cascader
|
|
159
|
-
this.options.forEach((facet, i) => {
|
|
160
|
-
this.options[i].label = convertReadableLabel(facet.label);
|
|
161
|
-
this.options[i].value = this.createCascaderItemValue(
|
|
162
|
-
facet.key,
|
|
163
|
-
undefined
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
// put "Show all" as first option
|
|
167
|
-
this.options[i].children.unshift({
|
|
168
|
-
value: this.createCascaderItemValue("Show all"),
|
|
169
|
-
label: "Show all",
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// populate second level of options
|
|
173
|
-
this.options[i].children.forEach((facetItem, j) => {
|
|
174
|
-
this.options[i].children[j].label = convertReadableLabel(
|
|
175
|
-
facetItem.label
|
|
176
|
-
);
|
|
177
|
-
this.options[i].children[j].value =
|
|
178
|
-
this.createCascaderItemValue(facet.label, facetItem.label);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
187
|
+
this.populateCascaderOptions(data);
|
|
181
188
|
})
|
|
182
189
|
.finally(() => {
|
|
183
190
|
resolve();
|
|
184
191
|
});
|
|
185
192
|
});
|
|
186
193
|
},
|
|
194
|
+
setCascaderReady:function() {
|
|
195
|
+
this.cascaderIsReady = true;
|
|
196
|
+
this.checkShowAllBoxes();
|
|
197
|
+
this.setCascader(this.entry.filterFacets);
|
|
198
|
+
this.makeCascadeLabelsClickable();
|
|
199
|
+
this.$emit("cascaderReady");
|
|
200
|
+
},
|
|
201
|
+
alternateSearchCB: function(payload) {
|
|
202
|
+
this.populateCascaderOptions(payload.data);
|
|
203
|
+
this.setCascaderReady();
|
|
204
|
+
},
|
|
205
|
+
populateCascader: function () {
|
|
206
|
+
if (this.alternateSearch) {
|
|
207
|
+
this.alternateSearch({requestType: 'getFacets'}, this.alternateSearchCB);
|
|
208
|
+
} else {
|
|
209
|
+
this.populateDefaultCascader().then(() => {
|
|
210
|
+
this.setCascaderReady();
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
},
|
|
187
214
|
tagsChangedCallback: function (presentTags) {
|
|
188
215
|
if (presentTags.length > 0) {
|
|
189
216
|
this.showFiltersText = false;
|
|
@@ -216,7 +243,6 @@ export default {
|
|
|
216
243
|
}
|
|
217
244
|
})
|
|
218
245
|
|
|
219
|
-
|
|
220
246
|
this.$emit('loading', true) // let sidebarcontent wait for the requests
|
|
221
247
|
|
|
222
248
|
this.$emit("filterResults", filters); // emit filters for apps above sidebar
|
|
@@ -417,15 +443,11 @@ export default {
|
|
|
417
443
|
},
|
|
418
444
|
},
|
|
419
445
|
mounted: function () {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.setCascader(this.entry.filterFacets);
|
|
426
|
-
this.makeCascadeLabelsClickable();
|
|
427
|
-
this.$emit("cascaderReady");
|
|
428
|
-
});
|
|
446
|
+
if (!this.alternateSearch) {
|
|
447
|
+
this.algoliaClient = new AlgoliaClient(this.envVars.ALGOLIA_ID, this.envVars.ALGOLIA_KEY, this.envVars.PENNSIEVE_API_LOCATION);
|
|
448
|
+
this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX);
|
|
449
|
+
}
|
|
450
|
+
this.populateCascader();
|
|
429
451
|
},
|
|
430
452
|
};
|
|
431
453
|
</script>
|
|
@@ -75,6 +75,10 @@ export default {
|
|
|
75
75
|
openAtStart: {
|
|
76
76
|
type: Boolean,
|
|
77
77
|
default: false
|
|
78
|
+
},
|
|
79
|
+
alternateSearch: {
|
|
80
|
+
type: Function,
|
|
81
|
+
default: undefined
|
|
78
82
|
}
|
|
79
83
|
},
|
|
80
84
|
data: function () {
|
|
@@ -82,6 +86,11 @@ export default {
|
|
|
82
86
|
drawerOpen: false,
|
|
83
87
|
}
|
|
84
88
|
},
|
|
89
|
+
provide: function() {
|
|
90
|
+
return {
|
|
91
|
+
alternateSearch: this.alternateSearch
|
|
92
|
+
}
|
|
93
|
+
},
|
|
85
94
|
methods: {
|
|
86
95
|
searchChanged: function (id, data) {
|
|
87
96
|
this.$emit("search-changed", {...data, id: id});
|