diff --git a/web-ui/src/main/resources/catalog/components/common/alert/AlertDirective.js b/web-ui/src/main/resources/catalog/components/common/alert/AlertDirective.js index 449f8563f6d..f1406c99c4f 100644 --- a/web-ui/src/main/resources/catalog/components/common/alert/AlertDirective.js +++ b/web-ui/src/main/resources/catalog/components/common/alert/AlertDirective.js @@ -69,6 +69,12 @@ } } }; + + this.closeAlerts = function () { + if (gnAlertValue.length) { + gnAlertValue.splice(0, gnAlertValue.length); + } + }; } ]); diff --git a/web-ui/src/main/resources/catalog/components/common/map/mapService.js b/web-ui/src/main/resources/catalog/components/common/map/mapService.js index 9c6ebc03599..a2af666d1f6 100644 --- a/web-ui/src/main/resources/catalog/components/common/map/mapService.js +++ b/web-ui/src/main/resources/catalog/components/common/map/mapService.js @@ -1390,7 +1390,7 @@ } else { gnAlertService.addAlert({ msg: $translate.instant("layerCRSNotFound"), - delay: 5000, + delay: 5, type: "warning" }); } @@ -1400,7 +1400,7 @@ msg: $translate.instant("layerNotAvailableInMapProj", { proj: mapProjection }), - delay: 5000, + delay: 5, type: "warning" }); } @@ -1981,7 +1981,7 @@ type: "wmts", url: encodeURIComponent(url) }), - delay: 20000, + delay: 20, type: "warning" }); var o = { @@ -2079,7 +2079,7 @@ type: "wfs", url: encodeURIComponent(url) }), - delay: 20000, + delay: 20, type: "warning" }); var o = { @@ -2159,7 +2159,7 @@ } catch (e) { gnAlertService.addAlert({ msg: $translate.instant("wmtsLayerNoUsableMatrixSet"), - delay: 5000, + delay: 5, type: "danger" }); return; diff --git a/web-ui/src/main/resources/catalog/components/search/resultsview/SelectionDirective.js b/web-ui/src/main/resources/catalog/components/search/resultsview/SelectionDirective.js index 500ece65fd0..ae8fedf50bb 100644 --- a/web-ui/src/main/resources/catalog/components/search/resultsview/SelectionDirective.js +++ b/web-ui/src/main/resources/catalog/components/search/resultsview/SelectionDirective.js @@ -99,7 +99,7 @@ function (r) { gnAlertService.addAlert({ msg: r.data.message || r.data.description, - delay: 20000, + delay: 20, type: "danger" }); if (r.id) { diff --git a/web-ui/src/main/resources/catalog/components/search/searchmanager/LocationService.js b/web-ui/src/main/resources/catalog/components/search/searchmanager/LocationService.js index c04e9b9ff4b..7d1a9c252e4 100644 --- a/web-ui/src/main/resources/catalog/components/search/searchmanager/LocationService.js +++ b/web-ui/src/main/resources/catalog/components/search/searchmanager/LocationService.js @@ -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 () { diff --git a/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js b/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js index cb6f63ed0fe..150d12bf1a4 100644 --- a/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js +++ b/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js @@ -255,7 +255,7 @@ }), type: "success" }, - 5000 + 5 ); } }, @@ -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 diff --git a/web-ui/src/main/resources/catalog/components/viewer/wmsimport/WmsImportDirective.js b/web-ui/src/main/resources/catalog/components/viewer/wmsimport/WmsImportDirective.js index bdc1eb1f285..9d4dec15053 100644 --- a/web-ui/src/main/resources/catalog/components/viewer/wmsimport/WmsImportDirective.js +++ b/web-ui/src/main/resources/catalog/components/viewer/wmsimport/WmsImportDirective.js @@ -105,7 +105,7 @@ }), type: "success" }, - 4 + 15 ); gnMap.feedLayerMd(layer); return layer; diff --git a/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js b/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js index 280d0e27e36..3baa7a89bd0 100644 --- a/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js +++ b/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js @@ -455,7 +455,7 @@ .then(refreshEntriesInfo, function (e) { gnAlertService.addAlert({ msg: $translate.instant("directoryEntry-removeError-referenced"), - delay: 5000, + delay: 5, type: "danger" }); }); diff --git a/web-ui/src/main/resources/catalog/views/default/module.js b/web-ui/src/main/resources/catalog/views/default/module.js index a3e72354245..74a74fc1c7a 100644 --- a/web-ui/src/main/resources/catalog/views/default/module.js +++ b/web-ui/src/main/resources/catalog/views/default/module.js @@ -412,7 +412,7 @@ msg: $translate.instant("layerProtocolNotSupported", { type: link.protocol }), - delay: 20000, + delay: 20, type: "warning" }); return; @@ -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) @@ -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("#");