* update storybook dependencies to resolve some dependabot issues.
* remove config that's already set to the default
* Resolve prettier issues after dep update.
* Pin x-default-browser version to resolve dependabot vulnerability.
* Use event.code for non A-z keys
Without this fix, shortcuts like "Shift+1" can't work, because the reported character is "!".
* Add Zod schema to validate keyboard shortcuts
* Render better formatted error notification, add a link to docs
* Notify about duplicated accelerators
* Improve the error message for re-parsing failure (it can happen when a default value does not pass validation)
* A bunch of renames
* Allow spaces in accelerators
* Rename `isContentAnObject`
* Allow `Notification` to render links and lists
* Split by optional whitespace and "+"
* Allow lowercase letters
* Require a modifier for non-function keys
* Move VALID_SHORTCUT_MESSAGE to `initUi`
* Always return from `getDuplicateAccelerators`
* Use 'Cmd' and 'Ctrl' for mac
* Add comments
* Fix notification not rendering content
* Add more comments, rename `getKeyCode` to `getKeyName`
* Fix incorrect size of <Link> text
* Remove "expected" prefix
* Revert `typeof content === 'object'` in `Notification`
* Remove a comment about disabled keys in `ConfigService`, add a note about `keymap.` prefix
* Improve `getKeyName` comment
* Extract an inline object to a variable in `getKeyName`
* Fix notification list padding
* Change text for doc link & description for config error
* Improve comment for `getKeyName`
* Remove special formatting for list === 1 in `Notification`
* Print valid modifiers
* Call `getKeyboardShortcutSchema()` once
* Collect issues from all validations, run `invalidModifiers` through a set
* Change error message for `missingModifierIssue`
* Convert duplicates warning to error
* Define ALLOWED_KEY_CODES in a more concise way
* Support both `IntlBackslash` and `Backquote`
* Restore modifiers for mac to full spelling, sort them in order recommended by platform guidelines
* Fix old comment about the shortcuts order
---------
Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
* Connect: Remove resource cache
This commit refactors parts of the Electron app which still depend on
the resource cache, that is cluster sync and `tsh ssh` executed from the
command bar.
A number of adjustments has been made to executing `tsh ssh` from the
command bar, namely the logic of resolving the hostname has been moved
from the command launcher to useDocumentTerminal. The UI was also
adjusted to allow the user to reconnect to an SSH server if resolving
the hostname fails. This has a nice benefit of also allowing them to
retry if the PTY couldn't be created for some reason.
---
Before gravitational/webapps#1307, Connect was pulling all resources
from the cluster on app start and cluster login. Then it'd show them to
you in tables if you opened a new tab with cluster resources. There were
at least two problems with this approach:
1. It was slow for big clusters as pagination, filtering and sorting
were all done client-side and blocked the main thread.
2. It wasn't possible to implement advanced search unless we copied the
implementation from the backend to tshd.
gravitational/webapps#1307 made it so that instead of depending on that
resource cache to show resource tables, Connect would pull paginated
resources from the backend.
However, the resource tables were not the only part of the app depending
on that cache. Due to time constraints, we weren't able to refactor all
of them. We managed to refactor autocomplete (gravitational/webapps#1406)
and the remaining places are listed in #21800.
This PR refactors those remaining places to not use the cache by either
not depending on resource details or by making a call to the proxy
instead.
* Add missing license
* Create new local util lib to replace lodash.
* Replace usage of isInteger and debounce from lodash with highbar.
* Create isObject and runOnce utility methods.
* remove use of at, isObject, and once lodash method usage.
* remove map and transform lodash calls.
* Add memoize function to highbar.
* remove memoize lodash usage.
* remove merge and isEqual lodash methods and update other missing refs to highbar.
* convert the throttle to debounce.
* add throttle method to highbar.
* use the new throttle method instead of debounce where necessary.
* Add mergeDeep function for init config merge.
* remove lodash from the build process.
* Fix introduced bug in workspacesService.
* Added tests for highbar mergeDeep and expanded its functionality to support arrays.
* review updates.
* Added types to mergeDeep function.
* Add missing MapCache prototype methods.
* Add license notices, types and missing hash code.
* First pass at compare an array objects function.
* use new compareArrayObjs fn
* Add missing not
* Added types to arrayObjectIsEqual
* Add tests for arrayObjectIsEqual and fix some edge case bugs.
* update util fn name
* [Backend]: allow more db fields to be updatable
* Add preventing duplicate keys for label creator
* Add sort compare fn helper
* Update db request update object
* Update CreateDatabase component
- Uncomment and touch up db service checker
- Fix db service label checking
- Allow user to make changes to updatable db fields
- Split defining db name and the other fields into
two views, to prevent user from changing the db name
which is not allowed with the update action
* Address CR: use nil value to determine CACert update
* Few more touch ups
- address CR: don't OR update db request field CACert
and use consistent camelCasing
- remove the skip button for deploying service since
we have the service checker now, which auto skips it
for user if detects service
- refactor label matching for both register database
and deploy service steps
* Address CR: make all fields updatable
* Update service polling after rebase
* Allow for inputs to be disabled
* Remove timeouts from the discover workflows
* Correct the resource type to be cleared on unmount
* Update test snapshots
* Rename useJoinToken to useJoinTokenSuspender
* Remove TODO
* Simplify usePoll
* Simplify the hint box code, add a shared hook
* Add the generte command button back to db flow
* Store the joinToken in PingTeleportContext state instead of using the hook
* Fix rebase diff mistake
* Fix bug with polling for result
- once we get the result, we set the result
back to null, so we can't proceed to next step
---------
Co-authored-by: Lisa Kim <lisa@goteleport.com>
* Create ToolTipInfo component
* Update FieldInput to accept optional tool tip content
* Temp fix for story viewing timed out polling state
* Support different informational texts depending on database
* Add database service checker to determine if we can skip next step
* Enable AWS RDS postgres flow
* tshd events: Wait for listeners before responding
When tshd is sending the relogin event, it needs to be able to know when
the Electron app has finished relogging the user. I wanted to implement
this by simply waiting for the response from the RPC.
I'm so glad we did not use gRPC streams for tshd events as this would be
much harder to implement with streams.
* Return a function from ModalsService.openDialog which closes dialog
With the introduction of important and regular modals, this will help us
close the specific dialog if need arises.
* Make tshd events listeners aware of request cancellation
This will be useful in the upcoming commits. Basically, tshd is going to
ask the Electron app to relogin the user, with a 1 minute timeout.
The Electron app will show a login modal but if the user doesn't submit
it within 1 minute, tshd is going to cancel the request.
In that situation, we need to be able to close the modal.
* Add support for passing reason in DialogClusterConnect
* Add support for important modals
This will let us show the relogin modal on expired cert, even if the user
was using some other modal at that moment.
* Remove title attr from notification text
The user can read more by expanding the notification. The title attribute
persisted even after expanding the notification, making reading it harder.
* Add WindowsManager.forceFocusWindow
* Use IAppContext instead of AppContext
The next commit is going to add a private method to AppContext.
IAppContext is an interface which enables us to pass a mocked version of
AppContext in tests. That mock is not going have that private method,
so any place accepting AppContext wouldn't be able to accept the mocked
AppContext.
Instead, classes & functions should accept IAppContext rather than AppContext.
* Implement handlers for new tshd events
tshd needs to be able to do two things:
- Ask the user to log in again.
- Forward errors from goroutines running gateways to the Electron app
in form of a notification. Otherwise those error would be visible
only in the logs.
* Don't restart gateways after logging in
Restarting the gateways on login was a workaround from times where gateways
didn't manage their own certs.
In the new flow, a gateway takes care of refreshing the certs itself
through the middleware passed to alpnproxy.LocalProxy.
syncRootClusterAndRestartClusterGatewaysAndCatchErrors used to call two
functions:
- syncRootClusterAndCatchErrors
- restartClusterGatewaysAndCatchErrors
The second function is no longer necessary, so we can make any place that
was calling syncRootClusterAndRestartClusterGatewaysAndCatchErrors
call just syncRootClusterAndCatchErrors instead.
* Create user trait hook and setup access wrapper
- create a reusable hook related to setup access and user traits
- create a setup access wrapper that dedups repeated logic
- rename and added more yaml readers
* Create SetupAccess screen for database
* Refactor SetupAccess for kube
* Refactor SetupAccess for server
* Add database json vals and prevent infinite rendering from
dependency array
There are three ways we determine if use of private key is enabled:
-Cluster config: this setting won't render the login form,
it will just direct user to login with other supported methods
- 'privateKeyPolicyEnabled' flag: only returned with a 200 for resets
and invites. This flag was required so that we can additionally render
recovery codes if any (only for Teleport Cloud)
- Checking if the error returned contains the backend hard coded
keywords ('hardware_key' or 'hardware_key_touch'). Role configs
will require an attempt (either logging in or assuming an access request)
before the backend checks if this user requires use of private keys.
* Refactor `DocumentGateway`
* Update protobuf files
* Do not hide port input on reconnect
* Update port of gateway connection when doc gets updated
Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
* add import order lint rule.
* auto fix import order and spacing.
* prettier fix.
* manual fix of import order.
* update failing snapshots.
* bump e submodule for import order fixes.
* Show error when auth settings return `u2f` second factor option
- Handles `u2f` cfg returned from v9
- Push users to use webauthn
* Conditionally render adding passwordless device based on if pwdless is enabled
* Fix brief flash rendering of buttons before attempt success state
* Add soft warning for firefox users for passwordless login or register
* Create Pill component for Label manager component.
* Fixed some styling issues when using the Pill component.
* Initial layout for the Label Selector component.
* Add basic new label input scaffold
* Added label format validation and error message.
* When hitting enter or clicking add, add a label to the list.
* Added tooltip to add labels header.
* Support dismissing labels and focus the input when opening.
* Create clickoutside hook and use it in the label picker.
* Create and use a onescape hook in the label picker.
* Remove the temp ability to pass in existing labels.
* added tests for LabelSelector component
* fix validation regex to allow numbers hyphens and periods.
* remove incorrectly added component instance.
* do not use default imports and other tweaks.
* use flexbox instead of floats for label input labels.
* use utility methods for tests to make it easier to understand.
* remove remaining floats and some review cleanup.
* added missing license messages.
* Move useCallback usage into parent component from hook.
* Create/Use buttons for text button so users can focus with keyboard
* Various small tweaks
- Add a refocus indicator to FieldInput
- Tweaked StepSlider to handle edge cases like growing height
from error dialogues on initial render
- Pass on deviceName to reset endpoints
* Update e-ref