From 9dcfcb7a63dc438f78bde4c8e44804e22533c79d Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Wed, 10 May 2023 13:02:28 +0200 Subject: [PATCH] Wizard: Support temporal dimensions with values --- src/components/wizards/Download.vue | 16 ++++++++++-- src/components/wizards/tabs/ChooseTime.vue | 30 +++++++++++++++++++++- src/store/index.js | 7 ++++- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/components/wizards/Download.vue b/src/components/wizards/Download.vue index d51229829..200f265ef 100644 --- a/src/components/wizards/Download.vue +++ b/src/components/wizards/Download.vue @@ -7,7 +7,7 @@ - + @@ -48,7 +48,8 @@ export default { mode: "", spatial_extent: null, max_spatial_extent: null, - temporal_extent: null + temporal_extent: null, + temporal_values: null }; }, computed: { @@ -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; diff --git a/src/components/wizards/tabs/ChooseTime.vue b/src/components/wizards/tabs/ChooseTime.vue index 0f113ca1a..4522d2bb4 100644 --- a/src/components/wizards/tabs/ChooseTime.vue +++ b/src/components/wizards/tabs/ChooseTime.vue @@ -1,6 +1,7 @@ @@ -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.' + } } } } diff --git a/src/store/index.js b/src/store/index.js index f2c514e3b..9719bd7f9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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