Skip to content

Commit

Permalink
Wizard: Support temporal dimensions with values
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed May 10, 2023
1 parent f00da97 commit e00fb40
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/components/wizards/Download.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ChooseBoundingBox v-model="spatial_extent" :max="max_spatial_extent" />
</WizardTab>
<WizardTab :pos="2" :parent="parent" title="Temporal Coverage" :beforeChange="() => temporal_extent !== null">
<ChooseTime v-model="temporal_extent" />
<ChooseTime v-model="temporal_extent" :options="temporal_values" />
</WizardTab>
<WizardTab :pos="3" :parent="parent" title="File Format" :beforeChange="() => format !== null">
<ChooseFormat v-model="format" />
Expand Down Expand Up @@ -48,7 +48,8 @@ export default {
mode: "",
spatial_extent: null,
max_spatial_extent: null,
temporal_extent: null
temporal_extent: null,
temporal_values: null
};
},
computed: {
Expand All @@ -63,6 +64,17 @@ export default {
}
if (this.collection !== id || this.temporal_extent == null) {
this.temporal_extent = defaults.temporal_extent;
if (Utils.isObject(defaults.dimensions)) {
let t = Object.values(defaults.dimensions).find(dim => dim.type === 'temporal');
if (t && Array.isArray(t.values) && t.values.length > 0) {
this.temporal_values = t.values;
this.temporal_extent = null;
}
else {
this.temporal_values = null;
}
}
}
}
this.collection = id;
Expand Down
28 changes: 27 additions & 1 deletion src/components/wizards/tabs/ChooseTime.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="step choose-time">
<p>Please select the days for which you want to download data for.</p>
<p>{{ description }}</p>
<SelectBox :options="selectOptions" :value="value" @input="v => $emit('input', v)" />
<TemporalPicker type="temporal-interval" intervalType="date" :value="value" @input="v => $emit('input', v)" />
</div>
</template>
Expand All @@ -17,6 +18,31 @@ export default {
value: {
type: Array,
default: null
},
options: {
type: Array,
default: null
}
},
computed: {
selectOptions() {
if (!Array.isArray(this.options)) {
return [];
}
return this.options.map(value => {
return {
id: [value, value], // todo: This will fail if the actual values are not just years, dates or date-time (e.g. "2020-01" would fail)
label: value
}
});
},
description() {
if (this.options) {
return 'Please select the timestamp for which you want to donwload data for.';
}
else {
return 'Please select the days for which you want to download data for.'
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ export default new Vuex.Store({
temporal_extent[1] = null;
}
} catch (error) {}

var dimensions = {};
try {
dimensions = collection.summaries['cube:dimensions']
} catch (error) {}

var bands = null;
return {id, spatial_extent, temporal_extent, bands};
return {id, spatial_extent, temporal_extent, bands, dimensions};
},
processes: (state) => {
let registry
Expand Down

0 comments on commit e00fb40

Please sign in to comment.