Skip to content

Commit 9a15e6c

Browse files
Pass federation info through to web components (#230)
This can already be used with the version of the js-client on the `federation-as-object` branch there.
1 parent 7600f8d commit 9a15e6c

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

src/components/Collection.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<VueCollection :data="data">
2+
<VueCollection :data="data" :federation="federation">
33
<template #spatial-extents="p">
44
<span v-if="p.worldwide" class="worldwide"><i class="fas fa-globe"></i> Worldwide</span>
55
<MapExtentViewer v-else class="map" :footprint="p.extents"></MapExtentViewer>
@@ -25,6 +25,7 @@ export default {
2525
},
2626
computed: {
2727
...Utils.mapState(['connection']),
28+
...Utils.mapState(['federation']),
2829
...Utils.mapGetters(['supports']),
2930
bbox() {
3031
try {

src/components/DiscoveryToolbar.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</label>
1616
</div>
1717
<div class="search-results">
18-
<Collections class="category" :collections="collections" :searchTerm="searchTerm" :offerDetails="false" :collapsed="collapsed" :hideDeprecated="!showDeprecated" :hideExperimental="!showExperimental">
18+
<Collections class="category" :collections="collections" :searchTerm="searchTerm" :offerDetails="false" :collapsed="collapsed" :hideDeprecated="!showDeprecated" :hideExperimental="!showExperimental" :federation="federation" :missing="federationMissing.collections">
1919
<template #summary="{ item }">
2020
<div class="discovery-entity" :draggable="supportsLoadCollection" @dragstart="onDrag($event, 'collection', item)">
2121
<div class="discovery-info" @click="showCollectionInfo(item.id)">
@@ -27,7 +27,7 @@
2727
</template>
2828
</Collections>
2929

30-
<Processes class="category" :processes="allProcesses" :searchTerm="searchTerm" :offerDetails="false" :collapsed="collapsed" :hideDeprecated="!showDeprecated" :hideExperimental="!showExperimental">
30+
<Processes class="category" :processes="allProcesses" :searchTerm="searchTerm" :offerDetails="false" :collapsed="collapsed" :hideDeprecated="!showDeprecated" :hideExperimental="!showExperimental" :federation="federation" :missing="federationMissing.processes">
3131
<template #summary="{ item }">
3232
<div class="discovery-entity" draggable="true" @dragstart="onDrag($event, 'process', item)">
3333
<div class="discovery-info" @click="showProcess(item)">
@@ -51,7 +51,7 @@
5151
</template>
5252
</UdfRuntimes>
5353

54-
<FileFormats class="category" :formats="fileFormats" :showInput="false" heading="Export File Formats" :searchTerm="searchTerm" :offerDetails="false" :collapsed="collapsed" :hideDeprecated="!showDeprecated" :hideExperimental="!showExperimental">
54+
<FileFormats class="category" :formats="fileFormats" :showInput="false" heading="Export File Formats" :searchTerm="searchTerm" :offerDetails="false" :collapsed="collapsed" :hideDeprecated="!showDeprecated" :hideExperimental="!showExperimental" :federation="federation" :missing="federationMissing.fileFormats">
5555
<template #summary="{ item }">
5656
<div class="discovery-entity" :draggable="supportsSaveResult" @dragstart="onDrag($event, 'fileformat', item)">
5757
<div class="discovery-info" @click="showFileFormatInfo(item)">
@@ -109,6 +109,7 @@ export default {
109109
computed: {
110110
...Utils.mapState(['collections', 'udfRuntimes']),
111111
...Utils.mapState('editor', ['discoverySearchTerm']),
112+
...Utils.mapState(['federation', 'federationMissing']),
112113
...Utils.mapGetters(['supports', 'fileFormats', 'processes']),
113114
supportsLoadCollection() {
114115
return this.processes.has('load_collection');

src/store/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ const getDefaultState = () => {
4545
collections: [],
4646
processNamespaces: Config.processNamespaces || [],
4747
pageLimit: Config.pageLimit,
48+
federation: null,
49+
federationMissing: {
50+
collections: [],
51+
processes: [],
52+
fileFormats: [],
53+
},
4854
};
4955
};
5056

@@ -174,6 +180,12 @@ export default new Vuex.Store({
174180
let errors = [];
175181
let capabilities = cx.state.connection.capabilities();
176182

183+
// Note down federation things from capabilities
184+
let federation = capabilities.listFederation();
185+
if (Object.keys(federation).length > 0) { // empty object = no federation -> don't commit (leaving default value)
186+
cx.commit('federation', federation);
187+
}
188+
177189
// Request collections
178190
if (capabilities.hasFeature('listCollections')) {
179191
promises.push(cx.state.connection.listCollections()
@@ -188,6 +200,7 @@ export default new Vuex.Store({
188200
// Request processes
189201
if (capabilities.hasFeature('listProcesses')) {
190202
promises.push(cx.state.connection.listProcesses()
203+
.then(data => cx.state.federationMissing.processes = data['federation:missing'])
191204
.catch(error => errors.push(error)));
192205
}
193206
else {
@@ -344,6 +357,7 @@ export default new Vuex.Store({
344357
},
345358
fileFormats(state, fileFormats) {
346359
state.fileFormats = fileFormats;
360+
state.federationMissing.fileFormats = fileFormats['federation:missing'];
347361
},
348362
serviceTypes(state, serviceTypes) {
349363
// Make keys uppercase for simplicity
@@ -390,6 +404,7 @@ export default new Vuex.Store({
390404
.map(c => StacMigrate.collection(c, false))
391405
.filter(c => (typeof c.id === 'string'))
392406
.sort(Utils.sortById);
407+
state.federationMissing.collections = data['federation:missing'];
393408
},
394409
setConnectionError(state, error) {
395410
state.connectionError = error;
@@ -418,6 +433,12 @@ export default new Vuex.Store({
418433
else {
419434
Vue.delete(state.beforeLogoutListener, key);
420435
}
436+
},
437+
federation(state, federation) {
438+
state.federation = federation;
439+
},
440+
federationMissing(state, federationMissing) {
441+
state.federationMissing = federationMissing;
421442
}
422443
}
423444
});

0 commit comments

Comments
 (0)