* Rename `putAllSync` to `writeSync`
* Extend `FileStorage` with functions to replace an entire state and return file path used to create it
* Add `updateJsonSchema` function
* Generate schema for the app config
* Always return a string from `createMockFileStorage().getFilePath()`
* Add missing license headers
* Rename 'teleport_connect_config_schema.json' to 'schema_app_config.json'
* Rename `getKeyboardShortcutDescription` to `getShortcutDesc`
* Rename `keyboardShortcutSchema` to `shortcutSchema`
* Update a valid shortcut message
* Rename `configJsonSchemaFile` to `jsonSchema`
* Simplify `updateJsonSchema`
* Set `$refStrategy` to none
* Add missing description for `usageReporting.enabled`
* Bump zod to the latest (improves TS performance)
* Move `configService` implementation to `configStore`
* Rename `configStore` to `configService`
* Move `updateJsonSchema` to `createConfigService`
* Move `validateStoredConfig` outside `createConfigService`
* Rename `createAppConfigSchema.ts` to `appConfigSchema.ts`, `getKeyboardShortcutSchema.ts` to `keyboardShortcutSchema.ts`
* Export `createKeyboardShortcutSchema`
* Add license header
* 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
* Update JS grpc-tools to 1.12.4
1.11.2 didn't have support for arm64 so we had to do all this extra stuff
in the Dockerfile.
1.11.3 added support for Darwin arm64 and 1.12.4 finally adds support for
Linux arm64. This means we can completely remove extra cruft and just
install grpc-tools 1.12.4 on all architectures.
* Add comment to ptyHostService.proto
* 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.
* notarize.js: Use app bundle ID from packager settings
The previous version used to always take build.appId as the app bundle ID.
This commit makes it so that if we overwrite the bundle ID by suppling
target-specific settings, notarize.js will pick up those changes.
* Add macOS category for Teleport Connect
* Remove custom entitlements
electron-builder adds some default ones if not specified and they're just
enough for us. On top of that, by letting electron-builder handle that
we make sure that they'll stay up to date in case they ever need to be
updated due to changes in Electron or Chromium. See [1] for an example.
[1] https://www.electronjs.org/blog/electron-6-0#electron-helper-rendererapp-electron-helper-gpuapp-and-electron-helper-pluginapp
* Refactor getTshBinaryPath and getBinDir into single function
One depended on the other and they both used different logic which was
different for packaged vs non-packaged app. Now they're encapsulated within
a single function that returns both paths.
* Move electron-builder config to a js file
* Remove unused `publish` key from electron-builder config
Calling `electron-builder install-app-deps` during `yarn
build-and-package-term` is unnecessary as `electron-builder build`
already does that.
The only time where you'd need to run `electron-builder
install-app-deps` is when you just cloned the repo and would like to run
the dev version of the app without building the prod version.
This reverts commit 3956e71664.
Turns out that for development, we need to use arm64 version of native
deps. The build server is going to use x64 anyway, as per the reverted
commit, but when making manual demo builds, we'll have to remember to
use x64 for Teleterm and tsh.
Our build system doesn't support arm64 for Mac releases yet (see issue
gravitational/teleport#4226 for more information). Because of that, for
the preview release we're likely going to have only the x64 version of
Teleterm.
This means that the shipped version of tsh should also be the x64 version.
I tried to change electron-builder's config to use x64 for macOS, but the
config options don't seem to work. I tried `mac.defaultArch` as well as
changing `mac.target` in various ways but `electron-builder install-app-deps`
just doesn't pick up those options. Both were set through
`packages/teleterm/package.json`
* first version
* Fix build
* Fix
* fixes
* add app context
* Add Navigator
* more screens
* add cluster
* grpc
* Add gateways
* add node-pty
* add tshd daemon
* add main process quick reload
* add tsh access
* Use default terminal shell and add context menu (#444)
* node-pty errors
* Fix build process and include `tsh` in the package (#451)
* Use single `package.json` config
* Include `tsh` in app package
* fix linux package target
* add global search
* fix tsc (errors) build step
* Add mocks
* Add logging to file (#455)
* minor cleanups
* Add keyboard shortcuts service (#462)
* add sync statuses for teleport resources
* add teleterm icon (#470)
* Fix dev reloads of main process
* minore bug fixes
* implement auth
* update webpack configs to v5 (#492)
* arrange the cards evenly depending on the available space & add drag and drop (#486)
* fix text truncation on tabs
* Add logout and cluster removal
* Add context menu to clusters (#500)
* Add tabs shortcuts & open new tab basing on active tab (#495)
* Make xterm understand resize sequence (#507)
* use `Immer` in teleterm store (#516)
* Add apps and kubes
* Teleterm bugfixes (#519)
* add command palette
* Replace Gateways with Connections
* add tc
* Clean up
* Add basic config service (#526)
* add fonts config (#528)
* Fix resize bug
* Minor teleterm fixes (#531)
* remove exit code checking before closing a tab
* prevent closing `home` tab
* Fix crashing errors
* Remove Roles and Activities
* Remove GlobalSearch
* Add context menu to tab items (#533)
* make quickIInput always visible on top
* Add workspace service (#538)
* Add recently opened documents to workspace (#547)
* add recently opened documents to workspace
* review fixes
* review fixes
* add `ClusterConnect` component
* remove the `close` item and electron help items from the app menu (#560)
* improve navigator behaviour (#565)
* improve navigator behaviour
* Add new connection handling
* Add username to gateways
* add kube connect command
* Gateway should render instructions per DB protocol
* Address design changes
Co-authored-by: gzdunek <gzdunek@users.noreply.github.com>