Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard: Support temporal dimensions with values #305

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
30 changes: 29 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,33 @@ export default {
value: {
type: Array,
default: null
},
options: {
type: Array,
default: null
}
},
computed: {
selectOptions() {
if (!Array.isArray(this.options)) {
return [];
}
let options = 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
}
});
options.unshift({id: null, label: "All"});
return options;
},
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