diff --git a/web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js b/web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js index 91495553f00..8ad4d6483ea 100644 --- a/web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js +++ b/web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js @@ -2596,6 +2596,41 @@ } ]); + module.directive("gnInspireUsageDetails", [ + "$http", + function ($http) { + return { + restrict: "A", + replace: true, + scope: { + inspireApiUrl: "=gnInspireUsageDetails", + inspireApiKey: "=apiKey" + }, + templateUrl: "../../catalog/components/utility/partials/inspireapiusage.html", + link: function (scope, element, attrs) { + scope.inspireApiUsage = undefined; + if ( + scope.inspireApiUrl && + scope.inspireApiUrl.length > 0 && + scope.inspireApiKey && + scope.inspireApiKey.length > 0 + ) { + $http + .get(scope.inspireApiUrl + "/v2/Usages/" + scope.inspireApiKey + "/") + .then( + function (response) { + scope.inspireApiUsage = response.data; + }, + function (error) { + console.warn("Error while retrieving INSPIRE API quotas: ", error); + } + ); + } + } + }; + } + ]); + module.directive("gnSuggest", [ "gnMetadataManager", function (gnMetadataManager) { diff --git a/web-ui/src/main/resources/catalog/components/utility/partials/inspireapiusage.html b/web-ui/src/main/resources/catalog/components/utility/partials/inspireapiusage.html new file mode 100644 index 00000000000..14d3d044b21 --- /dev/null +++ b/web-ui/src/main/resources/catalog/components/utility/partials/inspireapiusage.html @@ -0,0 +1,15 @@ +
+ inspireApiQuotaCurrentValue
+ {{inspireApiUsage.body}} + + +
diff --git a/web-ui/src/main/resources/catalog/js/admin/SystemSettingsController.js b/web-ui/src/main/resources/catalog/js/admin/SystemSettingsController.js index 2d81d091a75..310ef2ad805 100644 --- a/web-ui/src/main/resources/catalog/js/admin/SystemSettingsController.js +++ b/web-ui/src/main/resources/catalog/js/admin/SystemSettingsController.js @@ -223,6 +223,9 @@ $scope.settings = data; angular.copy(data, $scope.initalSettings); + $scope.inspireApiUrl = undefined; + $scope.inspireApiKey = undefined; + for (var i = 0; i < $scope.settings.length; i++) { if ($scope.settings[i].name == "metadata/workflow/enable") { $scope.workflowEnable = $scope.settings[i].value == "true"; @@ -236,9 +239,19 @@ ) { $scope.isGroupPublicationNotificationLevel = $scope.settings[i].value === "recordGroupEmail"; - } else if ("system/localrating/notificationLevel") { + } else if ( + $scope.settings[i].name == "system/localrating/notificationLevel" + ) { $scope.isGroupLocalRatingNotificationLevel = $scope.settings[i].value === "recordGroupEmail"; + } else if ( + $scope.settings[i].name == "system/inspire/remotevalidation/url" + ) { + $scope.inspireApiUrl = $scope.settings[i].value; + } else if ( + $scope.settings[i].name == "system/inspire/remotevalidation/apikey" + ) { + $scope.inspireApiKey = $scope.settings[i].value; } var tokens = $scope.settings[i].name.split("/"); diff --git a/web-ui/src/main/resources/catalog/locales/en-v4.json b/web-ui/src/main/resources/catalog/locales/en-v4.json index 27163df800d..efb3d051c3c 100644 --- a/web-ui/src/main/resources/catalog/locales/en-v4.json +++ b/web-ui/src/main/resources/catalog/locales/en-v4.json @@ -130,6 +130,9 @@ "valid_inspire-0": "Invalid", "valid_inspire-3": "No rule applies", "valid_inspire--1": "Unknown", + "inspireApiQuotaCurrentValue": "JRC INSPIRE validator API usage information", + "inspireApiQuotaValidation": "Number of validation:", + "inspireApiQuotaRemaining": "Remaining:", "facet-OrgForResource": "Organizations", "facet-sourceCatalogue": "Catalogues", "facet-groupOwner": "Record groups", diff --git a/web-ui/src/main/resources/catalog/templates/admin/settings/system.html b/web-ui/src/main/resources/catalog/templates/admin/settings/system.html index a321dab04b3..841fa02afd6 100644 --- a/web-ui/src/main/resources/catalog/templates/admin/settings/system.html +++ b/web-ui/src/main/resources/catalog/templates/admin/settings/system.html @@ -626,27 +626,32 @@