Skip to content

Commit

Permalink
UI tweaks, SpaceNet-driven guards
Browse files Browse the repository at this point in the history
  • Loading branch information
mojodna committed Jan 26, 2019
1 parent a0f5697 commit e333767
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 35 deletions.
99 changes: 67 additions & 32 deletions src/components/Catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,8 @@
</p>
<!-- eslint-disable-next-line vue/no-v-html vue/max-attributes-per-line -->
<div v-if="description" v-html="description"/>
<template v-if="providers != null && providers.length > 0">
<h2>Provider
<template v-if="providers.length > 1">s</template>
</h2>
<dl>
<template v-for="provider in providers">
<dt :key="provider.url">
<a :href="provider.url">{{ provider.name }}</a> (
<em>{{ (provider.roles || []).join(", ") }}</em>)
</dt>
<!-- eslint-disable-next-line vue/no-v-html vue/max-attributes-per-line -->
<dd :key="provider.name" v-html="provider.description"/>
</template>
</dl>
</template>

<template v-if="children.length > 0">
<hr>

<h3>Catalogs</h3>
<ul class="links">
<li v-for="child in children" :key="child.path">
Expand All @@ -58,11 +41,35 @@
</template>
</b-col>
<b-col v-if="keywords.length > 0 || license != null" md="4">
<b-card title="Catalog Information" bg-variant="light" class="float-right">
<b-card title="Catalog Information" bg-variant="light">
<div v-if="spatialExtent" id="locator-map"/>
<div class="table-responsive">
<table class="table">
<tbody>
<template v-if="providers != null && providers.length > 0">
<tr>
<th colspan="2">
<h3>
<template v-if="providers.length === 1">Provider</template>
<template v-if="providers.length !== 1">Providers</template>
</h3>
</th>
</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>({{ (provider.roles || []).join(", ") }})</em>
</td>
</tr>
<!-- eslint-disable-next-line vue/no-v-html vue/max-attributes-per-line -->
<tr
v-if="provider.description"
:key="provider.name + index"
v-html="provider.description"
/>
</template>
</template>
<tr>
<td class="title">STAC Version</td>
<td>{{ stacVersion }}</td>
Expand All @@ -78,7 +85,7 @@
</tr>
<tr v-if="spatialExtent">
<td class="title">Spatial Extent</td>
<td>{{ spatialExtent }}</td>
<td>{{ spatialExtent.join(", ") }}</td>
</tr>
<tr v-if="temporalExtent">
<td class="title">Temporal Extent</td>
Expand All @@ -91,9 +98,8 @@
</b-col>
</b-row>

<b-row v-if="items.length > 0">
<b-row v-if="items.length > 0" class="items">
<b-col md="12">
<h3>Items</h3>
<b-pagination
v-model="currentPage"
:total-rows="itemCount"
Expand Down Expand Up @@ -255,7 +261,11 @@ export default {
return this.catalog.id;
},
extent() {
return this.catalog.extent || this.rootCatalog.extent || {};
return (
this.catalog.extent ||
(this.rootCatalog && this.rootCatalog.extent) ||
{}
);
},
itemCount() {
return this.links.filter(x => x.rel === "item").length;
Expand Down Expand Up @@ -403,13 +413,20 @@ export default {
return dataCatalog;
},
_keywords() {
return this.catalog.keywords || this.rootCatalog.keywords;
// [].concat() is a work-around for catalogs where keywords is a string (SpaceNet)
return [].concat(
this.catalog.keywords ||
(this.rootCatalog && this.rootCatalog.keywords) ||
[]
);
},
keywords() {
return (this._keywords || []).join(", ");
},
_license() {
return this.catalog.license || this.rootCatalog.license;
return (
this.catalog.license || (this.rootCatalog && this.rootCatalog.license)
);
},
license() {
return spdxToHTML(this._license);
Expand All @@ -419,14 +436,16 @@ export default {
return this.catalog.links;
},
providers() {
return (this.catalog.providers || this.rootCatalog.providers || []).map(
x => ({
...x,
description: MARKDOWN_WRITER.render(
MARKDOWN_READER.parse(x.description || "")
)
})
);
return (
this.catalog.providers ||
(this.rootCatalog && this.rootCatalog.providers) ||
[]
).map(x => ({
...x,
description: MARKDOWN_WRITER.render(
MARKDOWN_READER.parse(x.description || "")
)
}));
},
rootCatalog() {
const rootLink = this.links.find(x => x.rel === "root");
Expand Down Expand Up @@ -589,8 +608,20 @@ h4 {
font-weight: bold;
}
.table th {
border-top: none;
border-bottom: 1px solid #dee2e6;
}
td.provider {
border: none;
padding-top: 0;
padding-bottom: 0;
}
td.title {
font-weight: bold;
width: 40%;
}
ul.links,
Expand All @@ -604,6 +635,10 @@ ul.items {
background-color: #262626;
}
.row.items {
margin-top: 25px;
}
#locator-map {
height: 200px;
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default {
this._license && `https://spdx.org/licenses/${this._license}.html`,
isBasedOn: this.url,
url: this.path,
includedInDataCatalog: [this.collectionLink, this.parentLink].map(
includedInDataCatalog: [this.collectionLink, this.parentLink].filter(x => !!x).map(
l => ({
isBasedOn: l.href,
url: l.slug
Expand All @@ -281,7 +281,7 @@ export default {
"@type": "Place",
geo: {
"@type": "GeoShape",
box: this.item.bbox.join(" ")
box: (this.item.bbox || []).join(" ")
}
},
temporalCoverage: this.properties.datetime,
Expand Down
5 changes: 4 additions & 1 deletion src/lib/stac/dictionary.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,8 @@
},
"cbers:data_type": "Data type",
"cbers:path": "CBERS Path",
"cbers:row": "CBERS Row"
"cbers:row": "CBERS Row",
"dg:catalog_id": "DigitalGlobe ID",
"dg:platform": "Platform",
"dg:product_level": "Product level"
}

0 comments on commit e333767

Please sign in to comment.