@@ -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 ,
0 commit comments