-
Notifications
You must be signed in to change notification settings - Fork 18
GDB-6329 - add new license is expired message #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
969805c
a5a3f7b
49288f8
599bc34
50e60b6
63e675e
0a7f487
3c1de4c
c896c2a
7e69fe8
f1df7b7
216c705
10a0d96
ae2dc56
d1c8185
c5ca9be
c9f9908
a0b5135
782fd89
19cf12a
c3210be
9d2117b
e66c90c
61a88dd
219de91
a415117
d10fdd0
dc93da6
fdafc31
5c007dc
09a5238
c484fde
7fb0f7f
fc9e823
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ function licenseService($rootScope, LicenseRestService, $translate) { | |
| that.loadingLicense = false; | ||
| updateProductType(that.license); | ||
| }); | ||
| }). finally(function () { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the extra space before |
||
| $rootScope.$broadcast('license.set') | ||
| }); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -419,4 +419,11 @@ repositories.service('$repositories', ['$http', 'toastr', '$rootScope', '$timeou | |
| that.init(); | ||
| } | ||
| }); | ||
|
|
||
| window.addEventListener('load', function () { | ||
| that.repository = { | ||
| id: localStorage.getItem(that.repositoryStorageName) || '', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the adapter from src/js/angular/utils/local-storage-adapter.js! You can also move the keys in there as constants. |
||
| location: localStorage.getItem(that.repositoryStorageLocationName) || '' | ||
| }; | ||
| }); | ||
| }]); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,20 +53,27 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
|
|
||
| let selectedGraph = allGraphs; | ||
|
|
||
| $scope.isLicenseValid = function () { | ||
| return $licenseService.isLicenseValid(); | ||
| }; | ||
|
|
||
| const initView = function () { | ||
| if (!$scope.getActiveRepository()) { | ||
| if (!$scope.getActiveRepository() || | ||
| !$licenseService.isLicenseValid()) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the method above |
||
| return; | ||
| } | ||
| return RDF4JRepositoriesRestService.resolveGraphs() | ||
| .success(function (graphsInRepo) { | ||
| $scope.graphsInRepo = graphsInRepo.results.bindings; | ||
| setSelectedGraphFromCache(); | ||
| }).error(function (data) { | ||
| $scope.repositoryError = getError(data); | ||
| toastr.error(getError(data), $translate.instant('graphexplore.error.getting.graphs')); | ||
| }); | ||
| $scope.repositoryError = getError(data); | ||
| toastr.error(getError(data), $translate.instant('graphexplore.error.getting.graphs')); | ||
| }); | ||
| }; | ||
|
|
||
| initView(); | ||
|
|
||
| const setSelectedGraphFromCache = function () { | ||
| const selGraphFromCache = LocalStorageAdapter.get(`classHierarchy-selectedGraph-${$repositories.getActiveRepository()}`); | ||
| if (selGraphFromCache !== null && $scope.graphsInRepo.some(graph => graph.contextID.uri === selGraphFromCache.contextID.uri)) { | ||
|
|
@@ -115,8 +122,6 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| $scope.instancesQueryObj.query = ""; | ||
| $scope.instancesFilterFunc = instancesFilterFunc; | ||
|
|
||
| initView(); | ||
|
|
||
| $scope.$watch('instancesObj.items', function () { | ||
| if ($scope.instancesObj.items.length > 0) { | ||
| $timeout(function () { | ||
|
|
@@ -156,7 +161,10 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| toastr.warning($translate.instant('graphexplore.disabling.animations', {classLimit: classLimit}), | ||
| $translate.instant('graphexplore.reducing.visual.effects')); | ||
| } else { | ||
| toastr.warning($translate.instant('graphexplore.browser.performance', {browser: bowser.name, classLimit: classLimit}), | ||
| toastr.warning($translate.instant('graphexplore.browser.performance', { | ||
| browser: bowser.name, | ||
| classLimit: classLimit | ||
| }), | ||
| $translate.instant('graphexplore.reducing.visual.effects')); | ||
| } | ||
| }; | ||
|
|
@@ -264,8 +272,8 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| .search("name", name); | ||
| } | ||
| }).error(function () { | ||
| toastr.error($translate.instant('graphexplore.error.request.failed', {name: name})); | ||
| }); | ||
| toastr.error($translate.instant('graphexplore.error.request.failed', {name: name})); | ||
| }); | ||
| } | ||
|
|
||
| function onGoToDomainRangeGraphView(event, selectedClass) { | ||
|
|
@@ -317,7 +325,7 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| _.each(response, function (value, key) { | ||
| const obj = {}; | ||
| // TODO extract in core function isTriple(str) | ||
| obj.type = (value.startsWith("<<") && value.endsWith(">>")) ? "triple": "uri"; | ||
| obj.type = (value.startsWith("<<") && value.endsWith(">>")) ? "triple" : "uri"; | ||
| obj.absUri = encodeURIComponent(value); | ||
| obj.absUriNonEncoded = value; | ||
| obj.resolvedUri = key; | ||
|
|
@@ -426,10 +434,8 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| } | ||
|
|
||
| let currentActiveRepository = $repositories.getActiveRepository(); | ||
|
|
||
| function onRepositoryIsSet() { | ||
| if (!$licenseService.isLicenseValid()) { | ||
| return; | ||
| } | ||
| if (currentActiveRepository === $repositories.getActiveRepository()) { | ||
| return; | ||
| } else { | ||
|
|
@@ -445,10 +451,12 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| } | ||
|
|
||
| function getClassHierarchyData() { | ||
|
|
||
| if (!$licenseService.isLicenseValid()) { | ||
| return; | ||
| } | ||
| refreshDiagramExternalElements(); | ||
|
|
||
| if (!$scope.isSystemRepository() && $scope.isLicenseValid()) { | ||
| if (!$scope.isSystemRepository()) { | ||
| $scope.hierarchyError = false; | ||
| $scope.loader = true; | ||
| GraphDataRestService.getClassHierarchyData(selectedGraph.contextID.uri) | ||
|
|
@@ -472,11 +480,6 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| return $scope.classHierarchyData.classCount && $scope.getActiveRepositoryNoError() && !$scope.isSystemRepository(); | ||
| }; | ||
|
|
||
| $scope.isLicenseValid = function () { | ||
| return $licenseService.isLicenseValid(); | ||
| }; | ||
|
|
||
|
|
||
| $scope.chosenGraph = function (graph) { | ||
| selectedGraph = graph; | ||
| getClassHierarchyData(); | ||
|
|
@@ -490,4 +493,10 @@ function RdfClassHierarchyCtlr($scope, $rootScope, $location, $repositories, $li | |
| $scope.isAllGraphsSelected = function () { | ||
| return $scope.getSelGraphValue() === 'all.graphs.label' | ||
| } | ||
|
|
||
| window.addEventListener('load', initView); | ||
|
|
||
| $scope.$on('$destroy', function (event) { | ||
| window.removeEventListener('load', initView); | ||
| }); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this method. As far as I can see the license status is loaded once and is stored in the license service, so in each $licenseService.isLicenseValid() call you get the same status. That being said, this additional method in each controller where you need to check the status is just meaningless and also using it in directive templates is quite overwhelming than using a plain variable binding.
So, can you consider resolving the license status in a boolean flag where you need it and use it instead of this method. @sava-savov-ontotext what do you think?