Skip to content

Commit 79812fd

Browse files
committed
menu fix
1 parent 888e95f commit 79812fd

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

src/app/Services/API/Requests/index.ts

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -806,29 +806,49 @@ export class RequestApi extends Http {
806806
}
807807

808808
const p = Promise.all(reqs).then(x => {
809-
let configs = x[0];
810-
let combs = x[1].combinations;
809+
// reconstruct configuration-parameters
810+
const configs = x[0];
811+
const combs = x[1].combinations;
812+
const trans = x[1].translations;
811813

812814
let possibleValues = this.extractPossibleValues(combs);
813815
console.log(possibleValues);
814816

815817
let fconfigs: any[] = [];
816818

817-
for (let config of configs) {
818-
if (
819-
Object.keys(possibleValues).indexOf(config.name) >= 0 &&
820-
possibleValues[config.name].length > 0
821-
) {
822-
config.allowed_values = config.allowed_values.filter(x => {
823-
return possibleValues[config.name].indexOf(x.name) >= 0;
819+
const pv = { ...possibleValues };
820+
821+
for (let k in pv) {
822+
let titm = {
823+
name: k,
824+
};
825+
let avs: any[] = [];
826+
for (let x of pv[k]) {
827+
let tk = {};
828+
if (
829+
[
830+
'climatological_variable',
831+
'measure',
832+
'aggregation_period',
833+
].indexOf(k) >= 0
834+
)
835+
tk = trans[k];
836+
else tk = trans['other_parameters'][k];
837+
avs.push({
838+
name: x,
839+
display_name_english: tk[x]['name']['en'],
840+
display_name_italian: tk[x]['name']['en'],
841+
description_english: tk[x]['description']['en'],
842+
description_italian: tk[x]['description']['en'],
824843
});
825-
fconfigs.push(config);
826844
}
845+
titm['allowed_values'] = [...avs];
846+
fconfigs.push(titm);
827847
}
828848

829849
console.log(fconfigs);
830850

831-
localStorage.setItem('configs', JSON.stringify(configs));
851+
localStorage.setItem('configs', JSON.stringify(fconfigs));
832852
localStorage.setItem('combs::' + mode, JSON.stringify(combs));
833853
return {
834854
items: fconfigs,

src/app/components/TimeSeriesDialog/TSDataContainerHistoric.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ const TSDataContainerHistoric = (props: TSDataContainerProps) => {
9292
forecast_parameters[listKey]?.find(item => item.id === key)?.name || ''
9393
);
9494
};
95-
const baseValue: number = 1992;
95+
const baseValue: number = 1990;
96+
const yeardelta: number = 2;
9697

9798
const {
9899
selected_map,

0 commit comments

Comments
 (0)