Skip to content

Commit

Permalink
Adapt to openEO API 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jul 21, 2020
1 parent c573a7f commit c45bebe
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 41 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Visualizes a collection following the STAC-based collection description.
- `collection-after-summary`
- `collection-before-details`
- `collection-after-details`
- `collection-spatial-extent` - Custom HTML to display the spatial extent, e.g. a map. The variable `extent` is provides an array containing four elements (west, south, east, north) with the WGS84 coordinates.
- `collection-temporal-extent` - Custom HTML to display the temporal extent. The variable `extent` is provides an array with two elements (start, end). Each is a RFC3339 compatible `date-time` or `null` to indicate an open range.
- `collection-spatial-extents` - Custom HTML to display the spatial extents, e.g. a map. The variable `extents` provides an array of arrays, each containing four elements (west, south, east, north) with the WGS84 coordinates.
- `collection-temporal-extents` - Custom HTML to display the temporal extents. The variable `extents` provides an array of arrays, each with two elements (start, end). Both are RFC3339 compatible `date-time`, or `null` to indicate an open range.


### `Description`
Expand Down
43 changes: 22 additions & 21 deletions components/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,25 @@
<span class="value" v-else>{{ collection.license }}</span>
</section>

<section class="extent" v-if="temporalInterval || boundingBox">
<template v-if="temporalInterval">
<section class="extent" v-if="temporalIntervals.length || boundingBoxes.length">
<template v-if="temporalIntervals.length">
<h3>Temporal Extent</h3>
<slot name="collection-temporal-extent" :extent="temporalInterval">
<p>{{ stac.formatTemporalExtent(temporalInterval) }}</p>
<slot name="collection-temporal-extents" :extents="temporalIntervals">
<ul v-for="(interval, i) in temporalIntervals" :key="i">
<li>{{ stac.formatTemporalExtent(interval) }}</li>
</ul>
</slot>
</template>

<template v-if="boundingBox">
<template v-if="boundingBoxes.length">
<h3>Spatial Extent</h3>
<slot name="collection-spatial-extent" :extent="boundingBox">
<slot name="collection-spatial-extents" :extents="boundingBoxes">
<div :id="'map-' + collection.id" class="map" ref="mapContainer">
<ul v-if="!map">
<li>North: {{boundingBox[3]}}</li>
<li>South: {{boundingBox[1]}}</li>
<li>East: {{boundingBox[2]}}</li>
<li>West: {{boundingBox[0]}}</li>
</ul>
<template v-if="!map">
<ul v-for="(bbox, i) in boundingBoxes" :key="i">
<li>Latitudes: {{ bbox[1] }} / {{ bbox[3] }}, Longitudes: {{ bbox[0] }} / {{ bbox[2] }}</li>
</ul>
</template>
</div>
</slot>
</template>
Expand Down Expand Up @@ -205,19 +206,19 @@ export default {
}
},
computed: {
temporalInterval() {
temporalIntervals() {
let e = this.collection.extent;
if (CommonUtils.isObject(e) && CommonUtils.isObject(e.temporal) && CommonUtils.size(e.temporal.interval) > 0 && e.temporal.interval[0].length >= 2) {
return e.temporal.interval[0];
if (CommonUtils.isObject(e) && CommonUtils.isObject(e.temporal) && CommonUtils.size(e.temporal.interval) > 0) {
return e.temporal.interval.filter(interval => interval.length >= 2);
}
return null;
return [];
},
boundingBox() {
boundingBoxes() {
let e = this.collection.extent;
if (CommonUtils.isObject(e) && CommonUtils.isObject(e.spatial) && CommonUtils.size(e.spatial.bbox) > 0 && e.spatial.bbox[0].length >= 4) {
return e.spatial.bbox[0];
if (CommonUtils.isObject(e) && CommonUtils.isObject(e.spatial) && CommonUtils.size(e.spatial.bbox) > 0) {
return e.spatial.bbox.filter(bbox => bbox.length >= 4);
}
return null;
return [];
},
leafletOptions() {
return { // keep in sync with Readme
Expand Down Expand Up @@ -288,7 +289,7 @@ export default {
return Array.isArray(asset.roles) && asset.roles.includes('thumbnail') && IMAGE_MEDIA_TYPES.includes(asset.type);
},
initMap() {
if (!!this.$slots['collection-spatial-extent'] || this.map !== null) {
if (!!this.$slots['collection-spatial-extents'] || this.map !== null) {
return;
}
try {
Expand Down
2 changes: 1 addition & 1 deletion components/Process.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<section class="examples" v-if="hasElements(process.examples)">
<h3>Examples</h3>
<ProcessExample v-for="(example, key) in process.examples" :key="key" :id="key" :example="example" :processId="process.id" :processParameters="process.parameters" :processReferenceParser="processReferenceParser" />
<LinkList :links="exampleLinks" heading="More examples (full processes)" headingTag="h4" />
<LinkList :links="exampleLinks" heading="Processes" headingTag="h4" />
</section>

<section class="links">
Expand Down
15 changes: 1 addition & 14 deletions components/ProcessExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
<div class="content">
<Description v-if="example.description" :description="example.description" :preprocessor="processReferenceParser" />

<div class="process-graph" v-if="example.process_graph">
<Description :description="renderedGraph()" />
</div>
<div class="arguments" v-if="example.arguments">
<code v-html="renderedArguments()"></code>
<code v-html="renderedArguments"></code>
</div>
</div>
</div>
Expand Down Expand Up @@ -39,16 +36,6 @@ export default {
},
title() {
return this.example.title ? this.example.title + " (" + this.identifier + ")" : "Example " + this.identifier;
}
},
methods: {
// deprecated
renderedGraph() {
var md = "##### Process Graph\n```json\n" + JSON.stringify(this.example.process_graph, null, 2) + "\n```";
if (typeof this.example.returns !== 'undefined') {
md += "\n##### Result\n```json\n" + JSON.stringify(this.example.returns, null, 2) + "\n```";
}
return md;
},
renderedArguments() {
var params = [];
Expand Down
2 changes: 1 addition & 1 deletion components/UdfRuntime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default {
return this.runtimeData.title || this.runtimeId;
},
isDocker() {
return Boolean(this.runtimeData.docker && this.runtimeData.tags);
return Boolean(this.runtimeData.type === 'docker' || (this.runtimeData.docker && this.runtimeData.tags));
},
selectVersion() {
if ((Utils.isObject(this.runtimeData.versions) && this.runtimeData.versions[this.runtimeVersion]) || (Array.isArray(this.runtimeData.tags) && this.runtimeData.tags[this.runtimeVersion])) {
Expand Down
4 changes: 2 additions & 2 deletions components/UdfRuntimes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<strong>{{ name }}</strong>
<template v-if="env.title"> - {{ env.title }}</template>
<ul class="badges small">
<template v-if="env.docker">
<li class="badge docker">Docker</li>
<template v-if="env.type === 'docker' || (env.docker && env.tags)">
<li class="badge docker">Docker: {{ env.docker }}</li>
<li class="badge version" :class="{default: tag === env.default}" v-for="tag in env.tags" :key="tag">{{ tag }}</li>
</template>
<template v-else>
Expand Down

0 comments on commit c45bebe

Please sign in to comment.