Commit Graph
125 Commits
Author SHA1 Message Date
Michael 3f0c74b845 Allow webauthn to be passed when issuing certs for web-based scp (#22864)
* Allow webauthn to be passed when issuing certs for web-based scp

* Remove extra line
2023-03-16 02:03:37 +00:00
Grzegorz Zdunek 2a2b08dbfd Use 13px font size in a Notification (#22842) 2023-03-10 10:08:15 +00:00
Yassine Bounekhla f8c5cd0441 fix select box sizing (#21212) 2023-03-06 22:59:54 +00:00
Jeff Pihach 016141c1ea Resolve dependabot CVE issues (#22605)
* 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.
2023-03-03 23:45:17 +00:00
Grzegorz ZdunekandRafał Cieślak 4830ea16e5 Connect: Enable keyboard shortcuts configuration (#22194)
* 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>
2023-03-03 14:05:38 +00:00
Yassine Bounekhla 10ca00a1a3 [Web] Refactor serverside filtering and pagination (#20823)
* refactor filtering

* stash

* fix errors

* tweaks

* fixes

* address comments

* fix missing searchAsRoles query param

* temp

* temp

* rename ClientSidePager

* temp

* rename

* update eref

* manually type returntype

* address comments

* type useServersidePagination

* revert default pageSize

* update snapshots

* remove useless act in test

* remove unused import

* address comment

* fixes

* update snapshot

* revert e

* revert e
2023-02-27 22:17:41 +00:00
Rafał Cieślak 6578af1efd Connect: Remove resource cache (#21964)
* 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
2023-02-27 15:32:19 +00:00
Yassine Bounekhla 8d44d15fb8 [Web] Add custom element support to SearchPanel (#22186)
* fix apps totalCount and add support for custom elements in panel

* export kinds function

* revert totalcount change
2023-02-24 21:27:15 +00:00
Jeff Pihach 5eafe86fa4 Remove usage of lodash methods (#21567)
* 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
2023-02-21 17:25:36 +00:00
Jeff Pihach 3f75acb163 Add license headers to web files that were missing it. (#21315)
* Lint the web files but not node_modules or vendored files.

* Add license headers to web files that were missing it.

* Add missing licenses.
2023-02-07 16:27:31 +00:00
Rafał Cieślak 644e85336c Move Connect-specific MenuLogin story out of shared package (#21157)
* Move Connect-specific MenuLogin story out of shared package

* Copyright 2019 -> Copyright 2023
2023-02-07 10:24:27 +00:00
Lisa Kim 8aefef1ae6 [Web:Discover] Bring back db service checker (#21062)
* [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
2023-02-06 18:44:39 +00:00
Ryan ClarkandLisa Kim 9a605331f3 Remove timeouts from discover flows, fix desktop discovery (#20829)
* 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>
2023-02-06 17:52:30 +00:00
Grzegorz Zdunek 3a0fc94aa6 Connect: wait for process to exit before closing app (#20673) 2023-01-26 14:34:14 +00:00
Ryan Clark 42ec01c88a Refactor features, implement new design for navigation & user menu (#20553) 2023-01-25 17:53:59 +00:00
Lisa Kim e38f665de5 [Discover] Add database service checker and various db tweaks (#1481)
* 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
2023-01-05 06:47:22 +00:00
Rafał Cieślak de66460718 Notifications: Add showcase story, fix types & icon alignment (#1474) 2023-01-04 09:50:10 +00:00
Michael cfa7941f34 [Connect] Async autocomplete (#1406) 2022-12-08 10:38:19 -06:00
Rafał Cieślak eafdaf04a4 Connect: Implement tshd event handlers for db cert renewal (#1383)
* 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.
2022-12-06 12:31:15 +01:00
Rafał Cieślak c6be949085 useAsync: Add support for abort signal (#1377) 2022-12-01 16:47:50 -06:00
Isaiah Becker-Mayer 9d3ff66b88 Fixes onRemove console error (#1387) 2022-11-29 22:36:46 +00:00
Michael 48fa737a78 [Connect] Use server side search in resource tables (Advanced Search) (#1307)
Adds serverside search and pagination to the resource tables in Connect
2022-11-24 10:04:45 +09:00
Isaiah Becker-Mayer b0b5c3c930 Adds support for TDP Notifications, shows "warning" level notifications in a dismissible dropdown rather than a fullscreen modal (#1333) 2022-11-16 04:16:13 +00:00
Ryan Clark 83aa06791f Code split routes, reduce the initial bundle size + loading times (#1277) 2022-11-15 10:15:06 +00:00
Lisa Kim a1187d146a [Discover] Refactor SetupAccess Screens (#1310)
* 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
2022-11-08 16:23:49 +00:00
Lisa Kim 6b08ee907d Handle private key policy errors and config (#1298)
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.
2022-10-28 14:38:04 -07:00
Rafał Cieślak 7e9aa52653 Connect: Fix filtering internal logins (#1292) 2022-10-24 10:29:58 +00:00
Lisa Kim eb1e69b60e [Discover] Implement Kube Flow Day 1 (#1268)
* In addition set up msw lib for storybook with suspense
2022-10-21 16:21:17 +00:00
Grzegorz Zdunek 0a27881238 File Transfer UI fixes (#1276) 2022-10-21 16:01:10 +02:00
Grzegorz Zdunek 985bda8d58 Assumed roles bar improvements (#1274) 2022-10-21 15:12:09 +02:00
MichaelandGrzegorz Zdunek fe004fc158 [Connect] Add Document Access Requests (#1203)
* init webapps.e ref

* update web.e

* added imported components

* udpated to correct imported types

* webapps.e update

* readme update and lint fix

* removed extra console logs

* sub head fix for webe

* reattached webape head

* fixed tests

* added access request change confirm dialog

* null check

* webappe

* count to accessRequestSerivce, import/export names, small fixes

* fixed imports and createrequest params

* updated imports from removed containers in teleterm-e

* optional params for reuse outside of ClusterLogout

* webapps.e ref update

* update webapps.e ref

* webapps.e ref update

* webapps.e ref update and navigation item update

* webapps.e update

* align sync button center to match access request size

* added accessRequestsSerice tests

* updating webapps.e

* created accessRequests object on workspace type and cleanup

* added requestId to documentaccessrequest type and webapps.e update

* protobuf updates changing created/expires from string to timestamppb

* webappse update and review feedback

* updated protos with comments

* changing delete/review access request responses to void

* updated getaccessrequests to not include ID

* protobuf updates

* webappse update

* update to resource tables styles

* update to standard access_request_id field in RPCs

* webappse upddate

* updated tests and added types

* updated webappse

* clusterService method for getrequestableroles, retryWithRelogin for fetch, webappse update

* webappse update

* story fixes

* added kubes support to tsh

* proto files

* update webappse

* Provide `WorkspaceContext` for documents in each workspace

* updating webappse

* webappse update

* accessrequestservice fix for resoruces

* updated webapps.e after master merge

* removed extra data from persisted state for assumed access requests

* update webappse

* protobuf files

* lint fixes

* adding getWorkspaces stub to fix tests

* webappse update

* webappse snapshots update

* protobuf updates

Co-authored-by: Grzegorz Zdunek <grzegorz.zdunek@goteleport.com>
2022-10-11 18:53:57 -05:00
Grzegorz Zdunek e16340c5fe Add file transfer to Connect (#1225) 2022-10-10 18:38:42 +02:00
Ryan Clark 503d099edb [Discover] Desktop Setup Flow (#1172) 2022-09-23 22:22:14 +00:00
jkaczmarkiewiczandRyan Clark 09f08ab93e Enforce react-testing-library eslint rules (#1150)
* Add `eslint-plugin-{jest-dom,testing-library}`

* Enable `eslint-plugin-{jest-dom,testing-library}` rules

* Run `eslint --fix`

* refactor: apply eslint hints in FormPassword.test.tsx

* refactor: fix test in Table.test.tsx

* refactor: apply eslint hints in Table.test.tsx

* refactor: apply eslint hints in multiplefiles

* refactor: apply eslint hints in multiple files

* refactor: allow direct node access

* test: fix

* refactor: ButtonSso FileldInput

* refactor: FieldSelect

* refactor: FieldSelect

* refactor: MenuAction

* refactor: ShareFeedback

* refactor: FormLogin

* refactor: LabelSelector

* refactor: Welcome

* refactor: useUrlFiltering

* refactor: Login

* refactor: LoginTrait

* refactor: apply eslint hints in multiple files

* refactor: apply eslint hints in multiple files

* refactor: apply eslint hints in MenageDevices

* refactor: Indicator and FieldSelect tests

* refactor: Portal tests

* fix: use @testing-library/react instead of react-test-renderer

* refactor: use find without assertion

* fix: add webapps.e

* refactor: find by instead of get by+wait for

* fix: remove unused waitFor

* test: LoginTrait checkboxes count

* test: SlideTabs check tabs len

Co-authored-by: Ryan Clark <ryan@ryanclark.me>
2022-08-29 10:57:55 +02:00
Lisa Kim 91afcd3ad2 [Connect] Refactor FormLogin and add passwordless capabilities (#1019)
* Make SSO buttons be more noticeable on focus/hover state
2022-08-05 17:33:47 +00:00
Grzegorz Zdunek e9875a6966 Refactor input focusing after transition (#1071) 2022-08-03 18:05:04 +02:00
Grzegorz Zdunek 6d26558262 Move focus to active document (#1070) 2022-08-03 17:04:06 +02:00
Grzegorz ZdunekandRafał Cieślak bd4866d5a4 Add ability to change port for db proxy (#900)
* 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>
2022-07-29 11:09:21 +02:00
Jeff Pihach 991856e137 Added eslint rule to enforce the order of file imports (#1030)
* 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.
2022-07-25 16:21:23 -06:00
Ryan Clark a35e7efbf3 Add source maps and type checking to Webpack, config improvements (#985) 2022-07-25 16:57:07 +01:00
Isaiah Becker-Mayer eb10a9afc1 SharedDirectoryInfoRequest (#966) 2022-07-19 01:01:07 -04:00
Lisa Kim b86c9bcdfe [2/3] Prettify shared, build, and teleport packages (#955)
* Update prettier ignore
2022-07-06 14:57:40 +00:00
Lisa Kim 631aa2f6e2 [1/3] Prettify Design Package (#953)
* Update snapshots
* Add prettier ignore file
* Update e-ref
2022-07-06 14:35:42 +00:00
Grzegorz Zdunek b1b8e141fb Add default username for Redis (#919) 2022-06-28 11:05:48 +02:00
Grzegorz Zdunek fb8d6e6ee4 Add ability to change db name for db proxy (#883) 2022-06-27 15:54:19 +02:00
Grzegorz Zdunek f2c8477a89 Add TextArea and FieldTextArea components (#870) 2022-06-14 11:07:27 +02:00
Lisa Kim d584ab4980 Various small fixes and touch ups (#876)
* 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
2022-06-09 16:26:07 +00:00
Rafał Cieślak 7a4296733b Retry with relogin on errors related to expired certs (#846)
* useAsync: Handle rejections with non-Errors

* Add initial implementation of retryWithRelogin

* Add missing properties to IAppContext

* Make ClustersService.syncCluster propagate errors

* ClustersService: Improve notification titles
2022-06-03 10:13:37 +00:00
Jeff Pihach 4417d755cb Create a LabelPicker component (#823)
* 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.
2022-05-24 10:02:29 -06:00
Lisa Kim b3398d0884 Refactor Teleport Reset/Invite Flow (#818)
* 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
2022-05-12 10:17:28 -07:00