Commit Graph
35 Commits
Author SHA1 Message Date
Grzegorz Zdunek 513f874fab Update Electron to 22.3.2 (#23031) 2023-03-14 15:15:31 +00:00
Rafał Cieślak a5fa148070 Fix unresponsive terminal in Connect on Windows Server 2019 (#22971)
* Update node-pty to 0.11.0-beta29

* Do not use ConPTY
2023-03-13 17:23:36 +00:00
Grzegorz Zdunek 99671496a0 Connect: Generate json schema for app config (#22538)
* 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
2023-03-07 14:39:49 +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
Rafał Cieślak 94ec267823 Update JS grpc-tools to 1.12.4 (#21452)
* 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
2023-02-09 07:40:45 +00:00
Rafał Cieślak 6e1a59bc25 Remove web/package.json, move scripts to package.json (#21134)
* Remove web/package.json, move scripts to package.json

Removed scripts:

Leftovers from webapps Dockerfile and CI on GCB:
- package-term-ci
- build-and-package-term-ci
- build-and-package-term
- nop

Leftovers from webapps Makefile, presumably:
- build-oss
- build-e

* Add back nop script

* Remove build-teleport* scripts
2023-02-03 15:34:57 +00:00
Rafał Cieślak ea1fc22045 Connect update xterm to 5.1.0 and xterm-addon-fit to 0.7.0 (#20767)
This makes teleterm match the versions used by teleport.
2023-01-27 12:10:37 +01:00
Rafał Cieślak f2a05c9187 Update Electron to 22.0.0 (#1498) 2023-01-09 10:28:04 +00:00
Grzegorz Zdunek 5267ae8dba Connect: Add config file (#1403) 2022-12-15 15:50:54 +01: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
Grzegorz Zdunek f91b33205e Update to Electron 21 (#1351) 2022-11-16 14:19:32 +01:00
Grzegorz Zdunek 972353f11a Connect testing fixes (#1269) 2022-10-17 11:18:56 +02:00
Grzegorz Zdunek 07032095cc Improve Linux support (#1098) 2022-08-18 18:20:33 +02:00
Rafał Cieślak b5a19bc3d8 Move electron-builder to a JS file (#1111)
* 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
2022-08-17 08:58:59 +00:00
Rafał Cieślak e895f1dea2 Remove building native deps from yarn build-term (#1058)
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.
2022-08-12 11:49:40 +02:00
Grzegorz Zdunek fdafe6de2b Use .ico for Windows (#1097) 2022-08-12 10:20:00 +02:00
Grzegorz Zdunek 4d06be9ffe Show Connect icon in better quality (#1091) 2022-08-09 12:23:34 +02:00
Grzegorz Zdunek a0f246592e Add dash to Windows artifact name (#1039) 2022-07-27 16:37:06 +02:00
Grzegorz Zdunek fb5e35846f Add Windows support for Connect (#971) 2022-07-26 16:24:28 +02:00
Ryan Clark a35e7efbf3 Add source maps and type checking to Webpack, config improvements (#985) 2022-07-25 16:57:07 +01:00
Grzegorz Zdunek 0197a4c799 Change app name to Teleport Connect (#869) 2022-06-07 16:28:57 +02:00
Grzegorz Zdunek b4f706099b Capture tshd logs (#853) 2022-06-03 11:47:00 +02:00
Rafał Cieślak bf903f7a40 Use only dmg target for Teleport Connect (#855)
By default, electron-builder uses both dmg and zip. The latter is made for
Squirrel.Mac, which we don't use at the moment.
2022-05-31 15:10:02 +02:00
Rafał Cieślak c700b8dcf1 Upgrade Electron to 19.0.0 (#830)
* Upgrade Electron to 19.0.0

* Bump Teleport Connect version to 1.0.2
2022-05-24 16:26:13 +02:00
Grzegorz Zdunek 25543c67d1 Add gRPC files generation and logging to shared process (#821) 2022-05-19 16:51:06 +02:00
Grzegorz Zdunek dd28b2bcf0 Update Electron & add shared process (#819) 2022-05-19 16:03:53 +02:00
Rafał Cieślak fde2f3dcd6 Bump Teleport Connect version to 1.0.1 (#796) 2022-04-29 17:51:50 +02:00
Reed Loden 23d16fdeb5 Update author and owner in package.json to be Gravitational (#792) 2022-04-29 09:37:36 +02:00
Rafał Cieślak 50f759c974 Prepend PATH with bundled tsh (#769) 2022-04-27 12:41:13 +00:00
Zac Bergquist 9dbca93f9d Add support for notarization (#770)
Notarization is performed via electron-notarize when the
APPLE_USERNAME and APPLE_PASSWORD environment variables are set.
2022-04-26 09:52:26 -06:00
Grzegorz Zdunek 4468a45286 Change app name to Teleport Connect (#753) 2022-04-21 13:42:34 +02:00
Rafał Cieślak 6deab67a06 Revert "Use x64 arch when building & packaging Teleterm"
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.
2022-03-31 13:51:35 +02:00
Rafał Cieślak 3956e71664 Use x64 arch when building & packaging Teleterm
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`
2022-03-31 11:21:07 +02:00
Grzegorz Zdunek 30a4bb390c Update to electron@13.6.9 (#703) 2022-03-30 12:32:55 +02:00
Alexey Kontsevoyandgzdunek b55dd4f2f1 Teleterm Preview (beta) (#590)
* 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>
2022-02-08 18:40:28 -05:00