diff --git a/src/js/angular/core/directives.js b/src/js/angular/core/directives.js index 7ba3034cd2..66d4b98bfc 100644 --- a/src/js/angular/core/directives.js +++ b/src/js/angular/core/directives.js @@ -267,9 +267,9 @@ function multiRequired() { const SEARCH_DISPLAY_TYPE = {table: 'table', visual: 'visual'}; -searchResourceInput.$inject = ['$location', 'toastr', 'ClassInstanceDetailsService', 'AutocompleteRestService', '$rootScope', '$q', '$sce', 'LocalStorageAdapter', 'LSKeys', '$repositories', '$translate', 'GuidesService', '$licenseService']; +searchResourceInput.$inject = ['$location', 'toastr', 'ClassInstanceDetailsService', 'AutocompleteRestService', '$rootScope', '$q', '$sce', 'LocalStorageAdapter', 'LSKeys', '$repositories', '$translate', 'GuidesService']; -function searchResourceInput($location, toastr, ClassInstanceDetailsService, AutocompleteRestService, $rootScope, $q, $sce, LocalStorageAdapter, LSKeys, $repositories, $translate, GuidesService, $licenseService) { +function searchResourceInput($location, toastr, ClassInstanceDetailsService, AutocompleteRestService, $rootScope, $q, $sce, LocalStorageAdapter, LSKeys, $repositories, $translate, GuidesService) { return { restrict: 'EA', scope: { @@ -333,7 +333,7 @@ function searchResourceInput($location, toastr, ClassInstanceDetailsService, Aut }; $scope.$watch('namespacespromise', function () { - if (angular.isDefined($scope.namespacespromise) && $licenseService.isLicenseValid()) { + if (angular.isDefined($scope.namespacespromise)) { $scope.namespacespromise.success(function (data) { element.namespaces = data.results.bindings.map(function (e) { return { diff --git a/src/js/angular/core/services/license.service.js b/src/js/angular/core/services/license.service.js index c88ec16146..a03a28351c 100644 --- a/src/js/angular/core/services/license.service.js +++ b/src/js/angular/core/services/license.service.js @@ -23,8 +23,6 @@ function licenseService($rootScope, LicenseRestService, $translate) { that.loadingLicense = false; updateProductType(that.license); }); - }).finally(function () { - $rootScope.$broadcast('license.set'); }); }; diff --git a/src/js/angular/explore/controllers.js b/src/js/angular/explore/controllers.js index bc9ec9c3ec..85a1b9878d 100644 --- a/src/js/angular/explore/controllers.js +++ b/src/js/angular/explore/controllers.js @@ -534,7 +534,6 @@ function EditResourceCtrl($scope, $http, $location, toastr, $repositories, $uibM }; $scope.newResource = false; $scope.datatypeOptions = StatementsService.getDatatypeOptions(); - $scope.isLicenseValid = $licenseService.isLicenseValid(); $scope.activeRepository = function () { return $repositories.getActiveRepository(); }; @@ -586,7 +585,7 @@ function EditResourceCtrl($scope, $http, $location, toastr, $repositories, $uibM $scope.$watch(function () { return $repositories.getActiveRepository(); }, function () { - if ($licenseService.isLicenseValid() && $scope.activeRepository()) { + if ($scope.activeRepository()) { $scope.getClassInstancesDetails(); } }); diff --git a/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js b/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js index 3dd3f31b88..f4cc09f95a 100644 --- a/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js +++ b/src/js/angular/graphexplore/controllers/graphs-visualizations.controller.js @@ -1189,16 +1189,12 @@ function GraphsVisualizationsCtrl( return $repositories.getActiveRepository(); }; - $scope.isLicenseValid = function () { - return $licenseService.isLicenseValid(); - }; - // This method may be called twice - once by us explicitly and once by the repositoryInit event. // In some race conditions getActiveRepository() will be already set when we enter it the first // time but then we'll be called again by the event, so we need the above flag to avoid double // initialization and weirdness. function initForRepository(newRepo) { - if (!$scope.isLicenseValid() || !$repositories.getActiveRepository() || $scope.hasInitedRepository && !newRepo) { + if (!$licenseService.isLicenseValid() || !$repositories.getActiveRepository() || $scope.hasInitedRepository && !newRepo) { return; } @@ -1226,7 +1222,7 @@ function GraphsVisualizationsCtrl( } function checkAutocompleteStatus() { - if ($scope.isLicenseValid()) { + if ($licenseService.isLicenseValid()) { $scope.getAutocompletePromise = AutocompleteRestService.checkAutocompleteStatus(); } } diff --git a/src/js/angular/graphexplore/controllers/rdf-class-hierarchy.controller.js b/src/js/angular/graphexplore/controllers/rdf-class-hierarchy.controller.js index ed03d684b5..3825c1c2fa 100644 --- a/src/js/angular/graphexplore/controllers/rdf-class-hierarchy.controller.js +++ b/src/js/angular/graphexplore/controllers/rdf-class-hierarchy.controller.js @@ -57,7 +57,7 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li let selectedGraph = allGraphs; const initView = function () { - if (!$scope.getActiveRepository() && !$licenseService.isLicenseValid()) { + if (!$scope.getActiveRepository() || !$licenseService.isLicenseValid()) { return; } return RDF4JRepositoriesRestService.resolveGraphs($repositories.getActiveRepository()) @@ -452,12 +452,9 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li } function getClassHierarchyData() { - if (!$licenseService.isLicenseValid()) { - return; - } refreshDiagramExternalElements(); - if (!$scope.isSystemRepository()) { + if (!$scope.isSystemRepository() && $licenseService.isLicenseValid()) { $scope.hierarchyError = false; $scope.loader = true; GraphDataRestService.getClassHierarchyData(selectedGraph.contextID.uri) diff --git a/src/js/angular/graphexplore/directives/rdf-class-hierarchy.directive.js b/src/js/angular/graphexplore/directives/rdf-class-hierarchy.directive.js index 1eb76f246c..36e6a395d9 100644 --- a/src/js/angular/graphexplore/directives/rdf-class-hierarchy.directive.js +++ b/src/js/angular/graphexplore/directives/rdf-class-hierarchy.directive.js @@ -107,7 +107,7 @@ function classHierarchyDirective($rootScope, $location, GraphDataRestService, $w var g = appendMainGroup(); - if (!scope.classHierarchyData.classCount && $repositories.getActiveRepository() && !$repositories.isSystemRepository()) { + if (!scope.classHierarchyData.classCount && $repositories.getActiveRepository() && !$repositories.isSystemRepository() && $licenseService.isLicenseValid()) { $rootScope.loader = true; $rootScope.hierarchyError = false; const selGraphFromCache = LocalStorageAdapter.get(`classHierarchy-selectedGraph-${$repositories.getActiveRepository()}`); @@ -124,9 +124,6 @@ function classHierarchyDirective($rootScope, $location, GraphDataRestService, $w }).error(function (response) { $rootScope.loader = false; - if (!$licenseService.isLicenseValid()) { - return; - } $rootScope.hierarchyError = getError(response); toastr.error($translate.instant('graphexplore.error.request.failed', {name: ROOT_OBJ_NAME, error: getError(response)})); }); diff --git a/src/js/angular/jdbc/controllers.js b/src/js/angular/jdbc/controllers.js index 9c67221da4..f17f776bd6 100644 --- a/src/js/angular/jdbc/controllers.js +++ b/src/js/angular/jdbc/controllers.js @@ -25,14 +25,14 @@ angular.module('graphdb.framework.jdbc.controllers', modules, [ .controller('JdbcListCtrl', JdbcListCtrl) .controller('JdbcCreateCtrl', JdbcCreateCtrl); -JdbcListCtrl.$inject = ['$scope', '$repositories', 'JdbcRestService', 'toastr', 'ModalService', '$translate']; +JdbcListCtrl.$inject = ['$scope', '$repositories', 'JdbcRestService', 'toastr', 'ModalService', '$translate', '$licenseService']; -function JdbcListCtrl($scope, $repositories, JdbcRestService, toastr, ModalService, $translate) { +function JdbcListCtrl($scope, $repositories, JdbcRestService, toastr, ModalService, $translate, $licenseService) { $scope.getSqlConfigurations = function () { // Only do this if there is an active repo that isn't an Ontop or FedX repo. // Ontop and FedX repos don't support JDBC. - if ($scope.isLicenseValid() + if ($licenseService.isLicenseValid() && $repositories.getActiveRepository() && !$repositories.isActiveRepoOntopType() && !$repositories.isActiveRepoFedXType()) { @@ -85,7 +85,8 @@ JdbcCreateCtrl.$inject = [ 'ModalService', '$translate', '$languageService', - 'EventEmitterService']; + 'EventEmitterService', + '$licenseService']; function JdbcCreateCtrl( $q, @@ -103,7 +104,8 @@ function JdbcCreateCtrl( ModalService, $translate, $languageService, - EventEmitterService) { + EventEmitterService, + $licenseService) { $scope.emptySparqlResponse = "{\"head\": {\"vars\": []},\"results\": {\"bindings\": []}}"; $scope.getSuggestionSqlType = ''; @@ -128,6 +130,10 @@ function JdbcCreateCtrl( // Public functions // ========================= + $scope.isLicenseValid = function () { + return $licenseService.isLicenseValid(); + }; + $scope.saveJdbcConfiguration = () => { $scope.saveOrUpdateExecuted = true; @@ -316,7 +322,7 @@ function JdbcCreateCtrl( }; const init = (prefixes, jdbcConfiguration = new JdbcConfigurationInfo()) => { - if (!$scope.isLicenseValid()) { + if (!$licenseService.isLicenseValid()) { return; } $scope.jdbcConfigurationInfo.columns = jdbcConfiguration.columns; diff --git a/src/js/angular/namespaces/controllers.js b/src/js/angular/namespaces/controllers.js index 603f5dbe74..921e21728d 100644 --- a/src/js/angular/namespaces/controllers.js +++ b/src/js/angular/namespaces/controllers.js @@ -41,6 +41,10 @@ namespaces.controller('NamespacesCtrl', ['$scope', '$http', '$repositories', 'to $scope.pageSize = $scope.pageSizeOptions[0]; $scope.displayedNamespaces = []; + $scope.isLicenseValid = function () { + return $licenseService.isLicenseValid(); + }; + $scope.getNamespaces = function () { if (!$licenseService.isLicenseValid() || !$repositories.getActiveRepository()) { return; diff --git a/src/js/angular/plugins/controllers.js b/src/js/angular/plugins/controllers.js index a5824992df..c880d68ab9 100644 --- a/src/js/angular/plugins/controllers.js +++ b/src/js/angular/plugins/controllers.js @@ -25,6 +25,10 @@ function PluginsCtrl($scope, $interval, toastr, $repositories, $licenseService, getPlugins(); }; + $scope.isLicenseValid = function () { + return $licenseService.isLicenseValid(); + }; + $scope.clear = function () { $scope.searchPluginsTerm = ''; $scope.plugins = []; diff --git a/src/js/angular/queries/controllers.js b/src/js/angular/queries/controllers.js index 8b6b654188..da38b5691f 100644 --- a/src/js/angular/queries/controllers.js +++ b/src/js/angular/queries/controllers.js @@ -8,8 +8,8 @@ const queriesCtrl = angular.module('graphdb.framework.jmx.queries.controllers', ]); queriesCtrl.controller('QueriesCtrl', ['$scope', '$uibModal', 'toastr', '$interval', '$repositories', '$jwtAuth', 'ModalService', - 'MonitoringRestService', '$translate', 'AuthTokenService', - function ($scope, $uibModal, toastr, $interval, $repositories, $jwtAuth, ModalService, MonitoringRestService, $translate, AuthTokenService) { + 'MonitoringRestService', '$translate', 'AuthTokenService', '$licenseService', + function ($scope, $uibModal, toastr, $interval, $repositories, $jwtAuth, ModalService, MonitoringRestService, $translate, AuthTokenService, $licenseService) { $scope.loader = true; $scope.stringLimit = 500; @@ -140,6 +140,10 @@ queriesCtrl.controller('QueriesCtrl', ['$scope', '$uibModal', 'toastr', '$interv $scope.toggleQueryExpanded = function (queryId) { $scope.expanded[queryId] = !$scope.expanded[queryId]; }; + + $scope.isLicenseValid = function () { + return $licenseService.isLicenseValid(); + }; }]); diff --git a/src/js/angular/sparql-editor/controllers.js b/src/js/angular/sparql-editor/controllers.js index 735f70e80c..99233c9c3f 100644 --- a/src/js/angular/sparql-editor/controllers.js +++ b/src/js/angular/sparql-editor/controllers.js @@ -43,7 +43,8 @@ SparqlEditorCtrl.$inject = [ 'GuidesService', 'ModalService', 'MonitoringRestService', - 'EventEmitterService']; + 'EventEmitterService', + '$licenseService']; function SparqlEditorCtrl($rootScope, $scope, @@ -60,7 +61,8 @@ function SparqlEditorCtrl($rootScope, GuidesService, ModalService, MonitoringRestService, - EventEmitterService) { + EventEmitterService, + $licenseService) { this.repository = ''; const QUERY_EDITOR_ID = '#query-editor'; @@ -99,6 +101,10 @@ function SparqlEditorCtrl($rootScope, }; }; + $scope.isLicenseValid = function () { + return $licenseService.isLicenseValid(); + }; + $scope.getActiveRepositoryNoError = () => { return $repositories.getActiveRepository(); };