Commit Graph
7 Commits
Author SHA1 Message Date
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
Michael cfa7941f34 [Connect] Async autocomplete (#1406) 2022-12-08 10:38:19 -06:00
Rafał Cieślak c6be949085 useAsync: Add support for abort signal (#1377) 2022-12-01 16:47:50 -06: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
Grzegorz Zdunek fb8d6e6ee4 Add ability to change db name for db proxy (#883) 2022-06-27 15:54:19 +02: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
Rafał CieślakandGrzegorz Zdunek 6f48403327 Show database username suggestions in Teleport Connect (#754)
* Move useAsync to the shared package, add docs

* Add async variant of MenuLogin

* Add Teleport Connect version of MenuLogin to its story

* Update gRPC files

* Show database username suggestions

* Use JSdoc in useAsync

Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>

* Convert useAsync to a named export

* Refactor MenuLogin to use useAsync underneath

* Rewrite useAsync to use a promise instead of async

The Web UI currently doesn't support `async`. To do this, we'd need to
configure polyfills there, but we don't have time for that right now.

* Replace async with promise in MenuLogin

Co-authored-by: Grzegorz Zdunek <gzdunek@users.noreply.github.com>
2022-04-22 12:56:33 +02:00