diff --git a/src/js/angular/controllers.js b/src/js/angular/controllers.js index 3bff6b90f..c709d8726 100644 --- a/src/js/angular/controllers.js +++ b/src/js/angular/controllers.js @@ -74,8 +74,9 @@ function homeCtrl($scope, $rootScope, $http, $repositories, $jwtAuth, $licenseSe function refreshRepositoryInfo() { if ($scope.getActiveRepository()) { $scope.getNamespacesPromise = RDF4JRepositoriesRestService.getNamespaces($scope.getActiveRepository()) - .success(function () { + .then(function(result) { checkAutocompleteStatus(); + return result; }); // Getting the repository size should not be related to license $scope.getActiveRepositorySize(); diff --git a/src/js/angular/core/directives.js b/src/js/angular/core/directives.js index 670cbdc0c..d111e1ea6 100644 --- a/src/js/angular/core/directives.js +++ b/src/js/angular/core/directives.js @@ -325,28 +325,29 @@ function searchResourceInput($location, toastr, ClassInstanceDetailsService, Aut $scope.$watch('namespacespromise', function () { if (angular.isDefined($scope.namespacespromise)) { - $scope.namespacespromise.success(function (data) { - element.namespaces = data.results.bindings.map(function (e) { + $scope.namespacespromise.then(function({data}) { + element.namespaces = data.results.bindings.map(function(e) { return { prefix: e.prefix.value, uri: e.namespace.value }; }); - }).error(function (data) { + }).catch(function(data) { const msg = getError(data); toastr.error(msg, $translate.instant('error.getting.namespaces.for.repo')); }); } }); - $scope.$watch('autocompletepromisestatus', function () { + $scope.$watch('autocompletepromisestatus', function() { if (!$repositories.isActiveRepoFedXType() && angular.isDefined($scope.autocompletepromisestatus)) { - $scope.autocompletepromisestatus.success(function (response) { + $scope.autocompletepromisestatus.then(function(response) { element.autoCompleteStatus = !!response; if ($scope.searchInput !== '') { $scope.onChange(); } - }).error(function () { + return response; + }).catch(function () { toastr.error($translate.instant('explore.error.autocomplete')); }); } diff --git a/src/js/angular/core/directives/rdfresourcesearch/rdf-resource-search.directive.js b/src/js/angular/core/directives/rdfresourcesearch/rdf-resource-search.directive.js index 92e46248a..02b2f9621 100644 --- a/src/js/angular/core/directives/rdfresourcesearch/rdf-resource-search.directive.js +++ b/src/js/angular/core/directives/rdfresourcesearch/rdf-resource-search.directive.js @@ -20,10 +20,10 @@ function rdfResourceSearchDirective($rootScope, $timeout, function refreshRepositoryInfo() { if ($scope.getActiveRepository()) { - $scope.getNamespacesPromise = RDF4JRepositoriesRestService.getNamespaces( - $scope.getActiveRepository()) - .success(function () { + $scope.getNamespacesPromise = RDF4JRepositoriesRestService.getNamespaces($scope.getActiveRepository()) + .then(function (result) { checkAutocompleteStatus(); + return result; }); } } diff --git a/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js b/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js index 4bc038d0f..ef6e9f878 100644 --- a/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js +++ b/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js @@ -1124,7 +1124,8 @@ function GraphsVisualizationsCtrl($scope, $rootScope, $repositories, $licenseSer // Inits namespaces for repo $scope.getNamespacesPromise = RDF4JRepositoriesRestService.getNamespaces($scope.getActiveRepository()) - .success(function (data) { + .then(function (result) { + const {data} = result; const nss = _.map(data.results.bindings, function (o) { return {"uri": o.namespace.value, "prefix": o.prefix.value}; }); @@ -1133,7 +1134,8 @@ function GraphsVisualizationsCtrl($scope, $rootScope, $repositories, $licenseSer }); checkAutocompleteStatus(); - }).error(function (data) { + return result; + }).catch(function (data) { toastr.error(getError(data), $translate.instant('graphexplore.error.view.will.not.work')); }); } diff --git a/src/js/angular/repositories/controllers.js b/src/js/angular/repositories/controllers.js index 932ab3696..64fcb6b0f 100644 --- a/src/js/angular/repositories/controllers.js +++ b/src/js/angular/repositories/controllers.js @@ -157,6 +157,7 @@ function LocationsAndRepositoriesCtrl($scope, $rootScope, $uibModal, toastr, $re return $repositories.getLocations(getLocationsAbortRequestPromise) .then((locations) => { $scope.locations = locations; + return locations; }) .finally(() => $scope.loader = false); } diff --git a/src/js/angular/similarity/controllers/similarity-list.controller.js b/src/js/angular/similarity/controllers/similarity-list.controller.js index b94b6f137..564d3c724 100644 --- a/src/js/angular/similarity/controllers/similarity-list.controller.js +++ b/src/js/angular/similarity/controllers/similarity-list.controller.js @@ -102,7 +102,8 @@ function SimilarityCtrl($scope, $interval, toastr, $repositories, $licenseServic // Don't try to get namespaces for ontop or fedx repository if ($scope.getActiveRepository() && !$scope.isActiveRepoOntopType() && !$scope.isActiveRepoFedXType()) { $scope.getNamespacesPromise = RDF4JRepositoriesRestService.getNamespaces($scope.getActiveRepository()) - .success(function (data) { + .then(function (result) { + const {data} = result; checkAutocompleteStatus(); $scope.usedPrefixes = {}; data.results.bindings.forEach(function (e) { @@ -120,7 +121,8 @@ function SimilarityCtrl($scope, $interval, toastr, $repositories, $licenseServic hideHeader: true, pluginsOptions: YasrUtils.getYasrConfiguration() }); - }).error(function (data) { + return result; + }).catch(function (data) { toastr.error(getError(data), $translate.instant('get.namespaces.error.msg')); }); }