Open ianwallen opened 4 years ago
I was mistaken.
At the time data-gn-active-tb-item="{{gnCfg.mods.admin.appUrl}}#/organization/users?userOrGroup={{user.username}}
is processed the user object still contains the default value {}
and it is not loaded until after this statement is executed so {{user.username}}
ends up being null.
So how do we ensure that the user object is fully loaded before the data-gn-active-tb-item is processed?
@MichelGabriel, There seems to be an Angular issue with the {{user}} variable not loaded correctly before executing the top-toolbar.html page. It is causing all the {{user.}} variable/objects to be empty in the data- attributes. And for the admin users this is causing the url to go to/organization/users?userOrGroup=
instead of /organization/users?userOrGroup=admin
.
I'm not very good with Angular - would you know what is causing this?
I see that the object is initialized here. https://github.com/geonetwork/core-geonetwork/blob/a60c7d7e7498214a8686f339d2d4bf993395b5a8/web-ui/src/main/resources/catalog/js/CatController.js#L606
And seems to be assigned here https://github.com/geonetwork/core-geonetwork/blob/a60c7d7e7498214a8686f339d2d4bf993395b5a8/web-ui/src/main/resources/catalog/js/CatController.js#L766-L767
If I output the results of {{user}} here I can see that it is set to the default "{}". So it seems to be calling the page before $scope.user is set. https://github.com/geonetwork/core-geonetwork/blob/a60c7d7e7498214a8686f339d2d4bf993395b5a8/web-ui/src/main/resources/catalog/templates/top-toolbar.html#L183-L190
Describe the bug data-gn-active-tb-item url is not getting parsed correctly. It is causing the wrong links to be generated.
To Reproduce One example of the issue. Login to GN. Click on user account This will go to a url similar to the following. http://localhost/geonetwork/srv/eng/admin.console#/organization/users?userOrGroup=
Expected behavior Expecting url to be the following http://localhost/geonetwork/srv/eng/admin.console#/organization/users?userOrGroup=admin So that it show the admin profile.
Desktop (please complete the following information):
Additional context attrs.gnActiveTbItem is not getting the proper url.
Expecting
data-gn-active-tb-item="{{gnCfg.mods.admin.appUrl}}#/organization/users?userOrGroup={{user.username}}
To create the following href attribute.href="../../srv/eng/admin.console#/organization/users?userOrGroup=admin"
But getting the following
href="../../srv/eng/admin.console#/organization/users?userOrGroup="
Issues seems to be that the link is not retreived correctly in the following code. https://github.com/geonetwork/core-geonetwork/blob/master/web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js#L1303
This issues was raised in the following pull request. https://github.com/geonetwork/core-geonetwork/pull/4774