-
Notifications
You must be signed in to change notification settings - Fork 22
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 to <HawtioLogin> to allow for plugin to provide customisations #607
Conversation
Is a dependency of hawtio/hawtio-online#155 |
Test Results 8 files ±0 8 suites ±0 1h 0m 26s ⏱️ + 2m 3s For more details on these failures, see this check. Results for commit 9abd083. ± Comparison against base commit 6bcaec8. ♻️ This comment has been updated with latest results. |
Test resultsRun attempt: 609
|
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.
thanks! there is only one comment I'd like to be cleared.
Please fix lint error too. |
* HawtioLogin.tsx * Looks at HawtConfig for title * Checks if there is an active login plugin available and substitutes its component for the login form * Should no plugin be available then the default HawtioLoginForm is loaded * Awaits on all plugins being loaded since otherwise the plugins array from usePlugins() will be empty * HawtioLoginForm.tsx * Default delegate form that a user populate with user/password * core.ts * Adds isLogin property to the Plugin interface to flag the plugin as a login plugin * HawtioPage.tsx * Ensures that the login plugins are filtered out of the page plugins
* During jmx plugin resolution, its isActive() function tries to load the tree but listing nodes from the jolokiaService. Seems that even though it waits on the userService.isLogin(), it then gets stuck after if not logged-in. This now results in the plugin never reporting itself as loaded and 'plugins' in usePlugins() hook remains empty. * By not just awaiting but observing the isLogin() return value, this can be avoided by returning a null url and so causing the jolokiaService to create a DummyJolokia tree instead. This makes sense since no list of nodes can possibly be made if not logged-in.
* [rbac|jolokia]-service / workspace * Services constructed on load cannot have jolokia-related functions executed in their constructors. Doing so prior to userService.fetchUser() being called will now result in an error being thrown that the user is not logged in. * Each public function from the services is therefore provided with an init() function which does the job of the constructor, ensuring the jolokia-related members are initialised correctly, once it has been established that the user is logged-in. * core.ts * Plugins should only be activated if the user has been logged-in with the exception of those plugins, specifically advertising themselves as 'isLogin' type plugins, ie. plugins providing a custom login form. * Only if the user is logged-in will other plugins determine if they can be activated by calling their isActive() functions.
* Locally, executing the unit tests causes numerous errors with auth/globals.ts/Logger being 'undefined'. * Due to inclusion of userService in core.ts the auth and core packages are circular associated via the userService and Logger
…wtio#594 * Since tests make use of services, such as workspace, it is now essential that the userService is initialised by them to ensure the environment is correctly setup for the test to execute.
5ba4cb8
to
9abd083
Compare
There are a few issues that need to be addressed in the latest fix. But instead of running another cycle of commit & review, I can take care of them after merging it. Feel free to turn it to "ready for merge" and merge it. |
While most changes concern updating the UI of the
<HawtioLogin/>
to support a customised child login form, a necessary change is also included for theJolokiaService
. Specifically, the use-case concerns what happens when logging-out occurs.When the logging-out button is clicked, the app routes back to
/login
but was stuck on displaying the waiting symbol.Analysis showed that because
<HawtioLogin>
is now using theusePlugins
hook, the component waits on thepluginsLoaded
flag. This was never returningtrue
indicating that the plugins were never completing resolution. Digging in further indicated that despite not being logged-in theJMX
plugin was, as a result of itsisActive()
plugin function, still trying to list nodes from thejolokiaService
yet this process was hanging.This has been resolved by, since the service was already waiting for the
userService.isLogin()
to return, taking the result ofisLogin()
and iffalse
then returning anull
jolokia url. This causes a dummy tree to be created and theJMX
plugin to resolve satisfactorily.