feat: add commands support and make logout searchable #1659
+108
−63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements LIBS-735
Description
This PR is an attempt to start the work on adding commands to the command palette, which means users can search for them too.
The current implementation:
logout
command functionality.useCommands
hook, which are then passed to theheaderbar
component making them available and searchable. (In this case, only thelogout
command has been added)(TBD: whether commands are fetched from the backend or defined in the UI here)
This PR also handles:
useActions
hook to have an action attribute with its associated action handler, for example, forBrowse Apps
, its action is a function to switch views to theall apps list view
.useNavigation
hook to simplify theEnter
key logic.Enter
key down logic by utilising the app'sdefaultAction(url)
attribute to open it in a new window, and the commands/actionsaction
attribute to trigger its attached handler.Conclusion: Users can search for the logout command across the command palette.
Checklist
All points above should be relevant for feature PRs. For bugfixes, some points might not be relevant. In that case, just check them anyway to signal the work is done.
Screenshots
Logout Search Results
![logout results](https://private-user-images.githubusercontent.com/31903212/408994057-941d0c46-887a-4af0-b7e1-f5056450cdb4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzUxODQsIm5iZiI6MTczOTE3NDg4NCwicGF0aCI6Ii8zMTkwMzIxMi80MDg5OTQwNTctOTQxZDBjNDYtODg3YS00YWYwLWI3ZTEtZjUwNTY0NTBjZGI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA4MDgwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg2OTQyZWY0NmJkZTA4ZGY1MjM3YzUzY2RmYjY5YTkwMzAzMTU3MzI5Y2UzNzU4OGM1MWFkNTA5MTdhMDRkZmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0pqc2RaHkVyNJYY5MtlGZjpwJl4mJhQX5Sa2V7IQ4Xs)
All Commands View
![browse cmds](https://private-user-images.githubusercontent.com/31903212/408994124-8942e9e5-cb43-4f0f-9778-09e64340b364.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzUxODQsIm5iZiI6MTczOTE3NDg4NCwicGF0aCI6Ii8zMTkwMzIxMi80MDg5OTQxMjQtODk0MmU5ZTUtY2I0My00ZjBmLTk3NzgtMDllNjQzNDBiMzY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA4MDgwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJjZjlmNzc5NDk2OGYyZmEzZmExMWJmNjczMzkwNjM5OGM4OTNkMTA4ZTU5ODRkMTFlNTFlZjk2YzI2MmE5NDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mL4NxmYh5QJ1urAn2B5lg6uaxcCMBJ4UIjBwBahU9EQ)