Skip to content

Commit

Permalink
Merge pull request #47 from lossyrob/feature/rde/collection-assets
Browse files Browse the repository at this point in the history
Add collection assets and summaries
  • Loading branch information
lossyrob authored Oct 20, 2020
2 parents cb72d81 + d4d7f1a commit 3c0bd84
Show file tree
Hide file tree
Showing 11 changed files with 5,366 additions and 1,537 deletions.
5,919 changes: 4,811 additions & 1,108 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"spdx-license-ids": "^3.0.5",
"spdx-to-html": "^0.3.2",
"v-clipboard": "^2.2.2",
"vue": "^2.6.10",
"vue": "^2.6.12",
"vue-async-computed": "^3.7.0",
"vue-hot-reload-api": "^2.3.4",
"vue-meta": "^2.2.2",
Expand All @@ -60,7 +60,7 @@
"git-exec-and-restage": "^1.1.1",
"husky": "^3.0.5",
"lint-staged": "^9.3.0",
"netlify-cli": "^2.15.0",
"netlify-cli": "^2.53.0",
"parcel-bundler": "^1.12.3",
"prettier": "^1.18.2",
"vue-template-compiler": "^2.6.10"
Expand Down
48 changes: 48 additions & 0 deletions src/components/AssetTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<b-tab
title="Assets"
:active="active"
key="assets"
>
<div class="table-responsive assets">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th v-if="hasBands > 0">Band(s)</th>
<th>Roles</th>
<th>Content-Type</th>
</tr>
</thead>
<tbody>
<tr v-for="asset in assets" :key="asset.key">
<td>
<!-- eslint-disable-next-line vue/max-attributes-per-line vue/no-v-html -->
<a
:href="asset.href"
:title="asset.key"
v-html="asset.label"
/>
</td>
<td v-if="hasBands">{{ asset.bandNames }}</td>
<td>
<code>{{ asset.roleNames }}</code>
</td>
<td>
<code>{{ asset.type }}</code>
</td>
</tr>
</tbody>
</table>
</div>
</b-tab>
</template>

<script>
export default {
name: "AssetTab",
props: ["assets", "bands", "active", "hasBands"]
};
</script>
114 changes: 35 additions & 79 deletions src/components/Catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<b-alert v-if="errored" variant="danger" show>
<p>{{ _entity.message }}</p>
<p>Please note that some servers don't allow external access via web browsers (e.g., when CORS headers are not present).</p>
<p>Errored URL: {{ url }}</p>
<p><a href="#" @click="$router.go(-1)">Go back</a></p>
</b-alert>
<b-spinner v-else-if="!loaded" label="Loading..."></b-spinner>
Expand Down Expand Up @@ -124,6 +125,13 @@
striped
/>
</b-tab>
<AssetTab
v-if="visibleTabs.includes('assets')"
:assets="assets"
:bands="bands"
:hasBands="hasBands"
:active="false"
></AssetTab>
</b-tabs>
</b-col>
<b-col
Expand All @@ -132,79 +140,15 @@
>
<b-card bg-variant="light">
<div v-if="spatialExtent" id="locator-map" />
<div class="table-responsive metadata">
<table class="table">
<tbody>
<tr>
<td class="group" colspan="2">
<h4>Metadata</h4>
</td>
</tr>
<tr>
<td class="title">STAC Version</td>
<td>{{ stacVersion }}</td>
</tr>
<tr v-if="keywords">
<td class="title">Keywords</td>
<td>{{ keywords }}</td>
</tr>
<tr v-if="license">
<td class="title">License</td>
<!-- eslint-disable-next-line vue/no-v-html -->
<td v-html="license" />
</tr>
<tr v-if="temporalExtent">
<td class="title">Temporal Extent</td>
<td>{{ temporalExtent }}</td>
</tr>
<template v-for="(props, ext) in propertyList">
<tr v-if="ext" :key="ext">
<td class="group" colspan="2">
<h4>{{ ext }}</h4>
</td>
</tr>
<tr v-for="prop in props" :key="prop.key">
<td class="title">
<!-- eslint-disable-next-line vue/no-v-html -->
<span :title="prop.key" v-html="prop.label" />
</td>
<!-- eslint-disable-next-line vue/no-v-html -->
<td v-html="prop.value" />
</tr>
</template>
<template v-if="providers">
<tr>
<td colspan="2" class="group">
<h4>
<template v-if="providers.length === 1">
Provider
</template>
<template v-if="providers.length !== 1">
Providers
</template>
</h4>
</td>
</tr>
<template v-for="(provider, index) in providers">
<tr :key="provider.url + index">
<td colspan="2" class="provider">
<a :href="provider.url">{{ provider.name }}</a>
<em v-if="provider.roles"
>({{(Array.isArray(provider.roles) ? provider.roles : []).join(", ") }})</em
>
<!-- eslint-disable-next-line vue/no-v-html vue/max-attributes-per-line -->
<div
v-if="provider.description"
class="description"
v-html="provider.description"
/>
</td>
</tr>
</template>
</template>
</tbody>
</table>
</div>
<MetadataSidebar
:properties="properties"
:summaries="summaries"
:stacVersion="stacVersion"
:keywords="keywords"
:license="license"
:temporalExtent="temporalExtent"
:providers="providers"
/>
</b-card>
</b-col>
</b-row>
Expand All @@ -227,6 +171,10 @@ import Leaflet from "leaflet";
import { mapActions, mapGetters } from "vuex";
import common from "./common";
import AssetTab from './AssetTab.vue'
import MetadataSidebar from './MetadataSidebar.vue'
import { transformCatalog } from "../migrate"
const ITEMS_PER_PAGE = 25;
Expand Down Expand Up @@ -259,6 +207,7 @@ export default {
required: true
}
},
components: { AssetTab, MetadataSidebar },
data() {
return {
externalItemCount: 0,
Expand Down Expand Up @@ -359,6 +308,9 @@ export default {
computed: {
...common.computed,
...mapGetters(["getEntity"]),
_entity() {
return transformCatalog(this.getEntity(this.url));
},
_description() {
return this.catalog.description;
},
Expand Down Expand Up @@ -595,6 +547,9 @@ export default {
return dataCatalog;
},
properties() {
return this._properties;
},
spatialExtent() {
const { spatial } = this.extent;
Expand All @@ -611,9 +566,8 @@ export default {
return bbox;
},
stacVersion() {
// REQUIRED
return this.catalog.stac_version;
summaries() {
return this.catalog.summaries;
},
tabIndex: {
get: function() {
Expand Down Expand Up @@ -654,7 +608,9 @@ export default {
return [
this.childCount > 0 && "catalogs",
(this.hasExternalItems || this.itemCount > 0) && "items",
this.bands.length > 0 && "bands"
this.bands.length > 0 && "bands",
this.summaries && "summaries",
this.assets && this.assets.length > 0 && "assets"
].filter(x => x != null && x !== false);
}
},
Expand Down Expand Up @@ -771,8 +727,8 @@ export default {
},
syncWithQueryState(qs) {
this.selectedTab = qs.t;
this.currentChildPage = Number(qs.cp) || this.currentChildPage;
this.currentItemPage = Number(qs.ip) || this.currentItemPage;
this.currentChildPage = Number(qs.cp) || 1;
this.currentItemPage = Number(qs.ip) || 1;
// If we have external items, the b-table needs to "stay" on page 1 as
// the items list only contains the number of items we want to show.
Expand Down
Loading

0 comments on commit 3c0bd84

Please sign in to comment.