Skip to content

Commit 01eb8a5

Browse files
committed
map background fix
1 parent 729536d commit 01eb8a5

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,10 @@ export class RequestApi extends Http {
182182
// @ts-ignore
183183
lastCities = JSON.parse(localStorage.getItem('lastCities'));
184184
}
185-
console.log(cities, lastCities);
186185
let fcities = cities.filter(city => {
187186
let found = false;
188187
for (let c of lastCities) {
189188
if (c) {
190-
console.log(c);
191189
//@ts-ignore
192190
if (c.label === city.label) found = true;
193191
}
@@ -468,11 +466,14 @@ export class RequestApi extends Http {
468466
} else {
469467
// Fetch only the main data configuration
470468
return this.instance.get<any>(conf.url).then(response => {
471-
//@ts-ignore
472-
response.wms_main_layer_name = conf.wms_main_layer_name;
473-
//@ts-ignore
474-
response.wms_secondary_layer_name = conf.wms_secondary_layer_name;
475-
469+
if (conf.wms_main_layer_name) {
470+
//@ts-ignore
471+
response.wms_main_layer_name = conf.wms_main_layer_name;
472+
}
473+
if (conf.wms_secondary_layer_name) {
474+
//@ts-ignore
475+
response.wms_secondary_layer_name = conf.wms_secondary_layer_name;
476+
}
476477
localStorage.setItem(conf.url, JSON.stringify(response));
477478
console.log('getLayerConf: Fetched only main data');
478479
console.log(response);

src/app/components/Map/index.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -158,29 +158,29 @@ const Map = (props: MapProps) => {
158158
setShowUncertainty(true);
159159
console.log('getting capabilities for ', currentLayer);
160160

161-
if (layerConf.wms_secondary_layer_name) {
162-
if (layerConf.wms_secondary_layer_name.indexOf('{')) {
163-
for (let j of Object.keys(currentMap)) {
164-
layerConf.wms_secondary_layer_name =
165-
layerConf.wms_secondary_layer_name.replaceAll(
166-
'{' + j + '}',
167-
currentMap[j],
168-
);
169-
}
170-
}
171-
}
172-
173-
if (layerConf.wms_main_layer_name) {
174-
if (layerConf.wms_main_layer_name.indexOf('{')) {
175-
for (let j of Object.keys(currentMap)) {
176-
layerConf.wms_main_layer_name =
177-
layerConf.wms_main_layer_name.replaceAll(
178-
'{' + j + '}',
179-
currentMap[j],
180-
);
181-
}
182-
}
183-
}
161+
//if (layerConf.wms_secondary_layer_name) {
162+
// if (layerConf.wms_secondary_layer_name.indexOf('{')) {
163+
// for (let j of Object.keys(currentMap)) {
164+
// layerConf.wms_secondary_layer_name =
165+
// layerConf.wms_secondary_layer_name.replaceAll(
166+
// '{' + j + '}',
167+
// currentMap[j],
168+
// );
169+
// }
170+
// }
171+
//}
172+
//
173+
//if (layerConf.wms_main_layer_name) {
174+
// if (layerConf.wms_main_layer_name.indexOf('{')) {
175+
// for (let j of Object.keys(currentMap)) {
176+
// layerConf.wms_main_layer_name =
177+
// layerConf.wms_main_layer_name.replaceAll(
178+
// '{' + j + '}',
179+
// currentMap[j],
180+
// );
181+
// }
182+
// }
183+
//}
184184

185185
api.getCapabilities(currentLayer).then((x: string) => {
186186
let xml = x;
@@ -386,7 +386,7 @@ const Map = (props: MapProps) => {
386386
layer={layerConf.wms_base_url}
387387
opacity={opacity}
388388
show={
389-
showUncertainty
389+
showUncertainty || data !== 'forecast'
390390
? layerConf.wms_main_layer_name
391391
: layerConf.wms_secondary_layer_name
392392
}

src/app/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ withTolgee(i18n, tolgee)
4343
.init({
4444
//lng: 'en', // or use i18next language detector
4545
supportedLngs: ['it', 'en'],
46+
debug: false,
4647
});
4748

4849
export function App() {

0 commit comments

Comments
 (0)