5
5
<template #dynamic =" { tab } " >
6
6
<LogViewer v-if =" logViewerIcons.includes(tab.icon)" :data =" tab.data" @mounted =" onMounted" @options =" onOptionsChanged" />
7
7
<component v-else-if =" tab.data.component" :is =" tab.data.component" v-on =" tab.data.events" v-bind =" tab.data.props" @mounted =" onMounted" @options =" onOptionsChanged" /> <!-- for file formats -->
8
+ <MetadataViewer v-if =" tab.icon === 'fa-info'" :data =" tab.data" @mounted =" onMounted" @options =" onOptionsChanged" /> <!-- for STAC metadata -->
8
9
<MapViewer v-else-if =" tab.icon === 'fa-map'" :data =" tab.data" :removableLayers =" isCollectionPreview(tab.data)" @mounted =" onMounted" @options =" onOptionsChanged" /> <!-- for services -->
9
10
<div class =" unsupported" v-else >
10
11
Sorry, the viewer doesn't support showing this type of data.
@@ -35,7 +36,8 @@ export default {
35
36
TableViewer : () => import (' ./viewer/TableViewer.vue' ),
36
37
ImageViewer : () => import (' ./viewer/ImageViewer.vue' ),
37
38
LogViewer : () => import (' ./viewer/LogViewer.vue' ),
38
- MapViewer : () => import (' ./viewer/MapViewer.vue' )
39
+ MapViewer : () => import (' ./viewer/MapViewer.vue' ),
40
+ MetadataViewer : () => import (' ./viewer/MetadataViewer.vue' )
39
41
},
40
42
mounted () {
41
43
this .listen (' viewSyncResult' , this .showSyncResults );
@@ -84,7 +86,7 @@ export default {
84
86
this .showWebService (service);
85
87
}
86
88
else {
87
- this .showJobResults (this .appMode .data , null , this .appMode .title );
89
+ this .showJobResults (this .appMode .data , null , this .appMode .title , true );
88
90
if (typeof this .appMode .expires === ' string' ) {
89
91
const expires = Formatters .formatTimestamp (this .appMode .expires );
90
92
Utils .info (this , ` The shared data is available until ${ expires} ` );
@@ -181,7 +183,7 @@ export default {
181
183
}
182
184
});
183
185
},
184
- showJobResults (stac , job = null , title = null ) {
186
+ showJobResults (stac , job = null , title = null , showMetadata = false ) {
185
187
if (title === null ) {
186
188
if (stac .title ) {
187
189
title = stac .title ;
@@ -205,6 +207,9 @@ export default {
205
207
else if (files .length > 5 && ! Utils .confirmOpenAll (files)) {
206
208
return ;
207
209
}
210
+ if (showMetadata) {
211
+ this .showMetadataViewer (stac, id, title);
212
+ }
208
213
this .showViewer (files, title, file => ` ${ id} -${ file .getUrl ()} ` , true )
209
214
.catch (error => Utils .exception (this , error));
210
215
},
@@ -232,6 +237,20 @@ export default {
232
237
onClose
233
238
);
234
239
},
240
+ showMetadataViewer (resource , id = null , title = null ) {
241
+ if (! title) {
242
+ title = Utils .getResourceTitle (resource, true );
243
+ }
244
+ if (! id) {
245
+ id = this .nextTabId ;
246
+ this .tabIdCounter ++ ;
247
+ }
248
+ this .$refs .tabs .addTab (
249
+ title, " fa-info" , resource, id, true , true ,
250
+ tab => this .onShow (tab),
251
+ tab => this .onHide (tab)
252
+ );
253
+ },
235
254
addToMapChooser ({asset, context}) {
236
255
const openMapTabs = this .$refs .tabs .tabs .filter (tab => tab .icon === ' fa-map' );
237
256
const maps = [
0 commit comments