Skip to content

Commit e00fb40

Browse files
committed
Wizard: Support temporal dimensions with values
1 parent f00da97 commit e00fb40

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

src/components/wizards/Download.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ChooseBoundingBox v-model="spatial_extent" :max="max_spatial_extent" />
88
</WizardTab>
99
<WizardTab :pos="2" :parent="parent" title="Temporal Coverage" :beforeChange="() => temporal_extent !== null">
10-
<ChooseTime v-model="temporal_extent" />
10+
<ChooseTime v-model="temporal_extent" :options="temporal_values" />
1111
</WizardTab>
1212
<WizardTab :pos="3" :parent="parent" title="File Format" :beforeChange="() => format !== null">
1313
<ChooseFormat v-model="format" />
@@ -48,7 +48,8 @@ export default {
4848
mode: "",
4949
spatial_extent: null,
5050
max_spatial_extent: null,
51-
temporal_extent: null
51+
temporal_extent: null,
52+
temporal_values: null
5253
};
5354
},
5455
computed: {
@@ -63,6 +64,17 @@ export default {
6364
}
6465
if (this.collection !== id || this.temporal_extent == null) {
6566
this.temporal_extent = defaults.temporal_extent;
67+
68+
if (Utils.isObject(defaults.dimensions)) {
69+
let t = Object.values(defaults.dimensions).find(dim => dim.type === 'temporal');
70+
if (t && Array.isArray(t.values) && t.values.length > 0) {
71+
this.temporal_values = t.values;
72+
this.temporal_extent = null;
73+
}
74+
else {
75+
this.temporal_values = null;
76+
}
77+
}
6678
}
6779
}
6880
this.collection = id;

src/components/wizards/tabs/ChooseTime.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div class="step choose-time">
3-
<p>Please select the days for which you want to download data for.</p>
3+
<p>{{ description }}</p>
4+
<SelectBox :options="selectOptions" :value="value" @input="v => $emit('input', v)" />
45
<TemporalPicker type="temporal-interval" intervalType="date" :value="value" @input="v => $emit('input', v)" />
56
</div>
67
</template>
@@ -17,6 +18,31 @@ export default {
1718
value: {
1819
type: Array,
1920
default: null
21+
},
22+
options: {
23+
type: Array,
24+
default: null
25+
}
26+
},
27+
computed: {
28+
selectOptions() {
29+
if (!Array.isArray(this.options)) {
30+
return [];
31+
}
32+
return this.options.map(value => {
33+
return {
34+
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)
35+
label: value
36+
}
37+
});
38+
},
39+
description() {
40+
if (this.options) {
41+
return 'Please select the timestamp for which you want to donwload data for.';
42+
}
43+
else {
44+
return 'Please select the days for which you want to download data for.'
45+
}
2046
}
2147
}
2248
}

src/store/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ export default new Vuex.Store({
100100
temporal_extent[1] = null;
101101
}
102102
} catch (error) {}
103+
104+
var dimensions = {};
105+
try {
106+
dimensions = collection.summaries['cube:dimensions']
107+
} catch (error) {}
103108

104109
var bands = null;
105-
return {id, spatial_extent, temporal_extent, bands};
110+
return {id, spatial_extent, temporal_extent, bands, dimensions};
106111
},
107112
processes: (state) => {
108113
let registry

0 commit comments

Comments
 (0)