Skip to content

Commit

Permalink
Zoom to map popup remains active on non-map pages. (#8267)
Browse files Browse the repository at this point in the history
* Zoom to map popup remains active on non-map pages. Fixes #8260

Fixes also wrong values for add alert delay, provided in some pages in milliseconds, but the method expects seconds.

* Zoom to map popup remains active on non-map pages - remove alerts only when switching from the map

* Increase timeout to hide layer added popup to 15 seconds
  • Loading branch information
josegar74 authored Jul 25, 2024
1 parent f78fda5 commit f9d8f0d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
}
}
};

this.closeAlerts = function () {
if (gnAlertValue.length) {
gnAlertValue.splice(0, gnAlertValue.length);
}
};
}
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@
} else {
gnAlertService.addAlert({
msg: $translate.instant("layerCRSNotFound"),
delay: 5000,
delay: 5,
type: "warning"
});
}
Expand All @@ -1400,7 +1400,7 @@
msg: $translate.instant("layerNotAvailableInMapProj", {
proj: mapProjection
}),
delay: 5000,
delay: 5,
type: "warning"
});
}
Expand Down Expand Up @@ -1981,7 +1981,7 @@
type: "wmts",
url: encodeURIComponent(url)
}),
delay: 20000,
delay: 20,
type: "warning"
});
var o = {
Expand Down Expand Up @@ -2079,7 +2079,7 @@
type: "wfs",
url: encodeURIComponent(url)
}),
delay: 20000,
delay: 20,
type: "warning"
});
var o = {
Expand Down Expand Up @@ -2159,7 +2159,7 @@
} catch (e) {
gnAlertService.addAlert({
msg: $translate.instant("wmtsLayerNoUsableMatrixSet"),
delay: 5000,
delay: 5,
type: "danger"
});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
function (r) {
gnAlertService.addAlert({
msg: r.data.message || r.data.description,
delay: 20000,
delay: 20,
type: "danger"
});
if (r.id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@
return p.indexOf(this.METADATA) == 0 || p.indexOf(this.DRAFT) == 0;
};

this.isMap = function () {
return $location.path() == this.MAP;
this.isMap = function (path) {
var p = path || $location.path();
return p == this.MAP;
};

this.isHome = function () {
return $location.path() == this.HOME;
this.isHome = function (path) {
var p = path || $location.path();
return p == this.HOME;
};

this.isUndefined = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
}),
type: "success"
},
5000
5
);
}
},
Expand Down Expand Up @@ -293,7 +293,7 @@
url: config.url,
extent: extent ? extent.join(",") : ""
}),
delay: 5000,
delay: 5,
type: "warning"
});
// TODO: You may want to add more than one time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
}),
type: "success"
},
4
15
);
gnMap.feedLayerMd(layer);
return layer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
.then(refreshEntriesInfo, function (e) {
gnAlertService.addAlert({
msg: $translate.instant("directoryEntry-removeError-referenced"),
delay: 5000,
delay: 5,
type: "danger"
});
});
Expand Down
13 changes: 11 additions & 2 deletions web-ui/src/main/resources/catalog/views/default/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
msg: $translate.instant("layerProtocolNotSupported", {
type: link.protocol
}),
delay: 20000,
delay: 20,
type: "warning"
});
return;
Expand Down Expand Up @@ -536,7 +536,7 @@
setActiveTab();
$scope.$on("$locationChangeSuccess", setActiveTab);

$scope.$on("$locationChangeSuccess", function (next, current) {
$scope.$on("$locationChangeSuccess", function (event, next, current) {
if (
gnSearchLocation.isSearch() &&
(!angular.isArray(searchMap.getSize()) || searchMap.getSize()[0] < 0)
Expand All @@ -545,6 +545,15 @@
searchMap.updateSize();
}, 0);
}

// Changing from the map to search pages, hide alerts
var currentUrlHash =
current.indexOf("#") > -1 ? current.slice(current.indexOf("#") + 1) : "";
if (gnSearchLocation.isMap(currentUrlHash)) {
setTimeout(function () {
gnAlertService.closeAlerts();
}, 0);
}
});

var sortConfig = gnSearchSettings.sortBy.split("#");
Expand Down

0 comments on commit f9d8f0d

Please sign in to comment.