Commit Graph
279 Commits
Author SHA1 Message Date
2d387e179f Add docs for Connect config (#22898)
* Rename old "quick input" to the current "command bar" feature name

* Remove 'Droid Sans Fallback' from Linux fonts

* Add docs for config

* Link to the proper documentation section

* Apply suggestions from @ravicious and @ibeckermayer

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>

* Adjust property descriptions with the names used in User Interface

* Drop `Courier New`

* Simplify `$schema` description

* Fix lint issues

* Add a break line after each heading

Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>

* Schema should not be modified

* Config file is created on first launch

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
Co-authored-by: Isaiah Becker-Mayer <isaiah@goteleport.com>
Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>
2023-03-16 15:26:54 +00:00
Grzegorz Zdunek 513f874fab Update Electron to 22.3.2 (#23031) 2023-03-14 15:15:31 +00:00
Rafał Cieślak ffaa34390e Log Connect version on startup (#22966)
When users send us logs, we have to ask them which version they're using
anyway as we don't currently save this information anywhere in the logs.
2023-03-14 09:50:02 +00:00
Grzegorz ZdunekandRafał Cieślak af9e0ed438 Connect: Add "Open Config File" item to menu (#22730)
* Expose `openConfigFile` IPC

* Add "Open Config File" to `NavigationMenu`

* Make `NavigationMenu` more concise

* Remove unused imports

* Call "three dots" menu "More Options" to make it easier to refer to in the docs

* Show a notification with a config file path

* Render the icon component only in `NavigationItem`

* Render the separator only with access request items

* Use just `separator` string instead of an object

* Render `StyledListItem` as a button

* Shorten the notification

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-03-14 07:45:07 +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
Rafał Cieślak 328c4e8c7d Fix uncaught exception handling in Connect's shared process (#22962)
* Fix uncaught exception handling in Connect's shared process

Without this patch, an uncaught exception being thrown would result in
the following error due to how binding methods to class instances works:

C:\Users\rav\AppData\Local\Programs\teleport-connect\resources\app.asar\
build\app\dist\main\sharedProcess.js:73614
    this.getLogger().error(message, ...args);
         ^

TypeError: this.getLogger is not a function
    at process.error (C:\Users\rav\AppData\Local\Programs\teleport-connect\
       resources\app.asar\build\app\dist\main\sharedProcess.js:73614:10)
    at process.emit (node:events:513:28)
    at process._fatalException (node:internal/process/execution:167:25)

* Log the origin of the uncaught exception
2023-03-13 16:54:13 +00:00
Grzegorz ZdunekandRafał Cieślak 17ff6d6a8f Connect: Show config file errors (#22728)
* Add a function that returns error that might happen during loading the file

* Return validation and file loading errors from `ConfigService`

* Discard file storage updates when the file was not loaded correctly

* Do not show usage reporting dialog when the file was not loaded correctly

* Make title of notifications a little bit smaller, so longer titles do not look weird

* Get rid of sync fs functions wherever possible in file storage

* Move error handling code to `createFileStorage`

* Improve `getConfigError` comment

* Rename `discardUpdatesWhenLoadingFileFailed` to `discardUpdatesOnLoadError`

* Fix the error message in `notifyAboutConfigErrors`

* Revert "Make title of notifications a little bit smaller, so longer titles do not look weird"

* Make `writeSync` async too

* Return `unknown` from `FileStorage.get`

* Add a TODO comment about createFileStorage type

* Add "the" to "Using default config instead"

* Remove `toString()`

---------

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2023-03-13 15:52:01 +00:00
Grzegorz Zdunek f061f9da00 Connect: Provide prehog address for prod env (#22546)
* Provide prehog address for prod env

* Use Connect specific endpoints
2023-03-10 12:01:38 +00:00
Rafał Cieślak f43297f56a Connect: Remove leftovers from resource cache removal (#22772)
* Connect: Remove leftovers from resource cache removal

* GetAll* RPCs were used in the resource cache and are no longer used.
* ListApps was pretty much never actually used as we didn't ever list apps
  in Connect.
* ClusterContext.state.searchValue ceased to be used after we moved to
  fetching resources from the backend.

* Remove remaining leftovers from tshd client mock

* Remove unused imports
2023-03-10 10:05:18 +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
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
Grzegorz Zdunek 717c4fa55a Connect: Prepare keyboard shortcuts configuration (#22193)
* Make naming around keyboard shortcuts more consistent

Previously, we used words like: "key", "type", "shortcut" which were really confusing (and I wrote this code), because it was hard to tell what exactly they describe.
From now, we will use only "accelerator" (borrowed from Electron) and "action" words.
For example, in a shortcut "Command+1": "tab-1":
- "Command+1" is "accelerator"
- "tab-1" is "action"

* Use "+" instead of "-" as a separator

With "-" we are not able to use this symbol as a valid key code.

* Rename some config keys to follow the same naming pattern

* Rename keyboard shortcuts to match config keys

* Extract `mapAcceleratorsToActions` to a function

* Rename other "keyboard shortcuts" to "accelerators" and "actions"
2023-03-03 11:44:25 +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
Rafał Cieślak 6bd3cbac47 createPtyProcess: Return early on error (#22180)
Without this early return, createPtyProcess of PtyHostService would call
the callback twice on error. This doesn't have much negative implications
since the gRPC implementation will simply ignore the second call, however
it does pose some problems when trying to manually test PTY failures
by making `new PtyProcess` return an error.
2023-02-23 13:55:19 +00:00
Rafał Cieślak ff07b46f6e ClustersService: Remove internal logins when syncing root clusters (#22179) 2023-02-23 13:55:15 +00:00
Grzegorz Zdunek 8c08211353 Connect: Enable font configuration (#21965)
* Remove sans serif from config

* Pass 'fonts.monoFamily' as style prop

* Get rid of `getSansSerif` function

* Use mono font from theme

* Add 'terminal.fontFamily' and 'terminal.fontSize' config options

* Require 'terminal.fontSize' size to be int

* Revert unneeded changes to mono font usage

* Add comment with a link to `ctrl.ts`

* Allow 'terminal.fontSize' to be in the range 1-256
2023-02-22 09:30:02 +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
Rafał Cieślak 0cdfa0b0ef Connect: Use SSH server UUID instead of hostname for file transfer (#21913)
* Add ResourceURI.GetServerUUID

* Use server UUID when calling TeleportClient.TransferFiles

* Mark removed FileTransferRequest fields as reserved
2023-02-17 10:24:12 +00:00
Rafał Cieślak 05d18cc11d Update teleterm README (#21797)
* Update teleterm README

* Remove the Usage section in favor of linking to the docs.
* Mention that the OSS build is broken.
* Remove post-webapps-merge inconsistencies.

* Remove "Gravitational", align teleterm desc with teleport
2023-02-15 14:26:30 +00:00
Grzegorz Zdunek 45add5c484 Connect: Link to docs in UsageData dialog (#21709)
* Link to docs in `UsageData`

* Replace "documentation" with "our documentation" in link
2023-02-13 16:32:26 +00:00
Grzegorz Zdunek 9ed52c327d Ask for job role on the second launch (#21402)
* Ask for job role on the second run

* Add tests

* Call `onCancel` in mock
2023-02-10 14:16:27 +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
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
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 3ac5a0aedb Refactor prehog & teleterm protos to match project conventions (#20810)
* Adjust go_package of lib/prehog Go protobufs

This makes them follow the pattern set out by api/proto and proto.

* Adjust go_package of lib/teleterm Go protobufs

* Use single buf.gen.yaml to generate JS protos

This also entailed changing the location of lib/teleterm protos and changing
the value of their package specifier to match the conventions in other parts
of the codebase. This is a breaking change but that is fine for Connect
as the protos are used locally only and each build ships with matching
protobufs.

* Make web/packages/teleterm use protobufs from gen-proto-js

We used to copy protobufs over to web/packages/teleterm/src/services/tshd
since webapps used to be in a separate repo.

This is no longer the case, so we can just make teleterm use protobufs
from gen-proto-js.

* Move prehog & teleterm protos into proto/teleport/lib

* Generate JS protos to gen/proto/js

* Move lib/teleterm Go protobufs to gen/proto/go

* Move lib/prehog Go protobufs to gen/proto/go

* Rename lib/teleterm proto package

* Re-enable linter rules for teleterm & prehog

* Update prehogv1 path in usagereporter_test.go

* Use except instead of ignore_only to allow Google API-style responses

* Add UNARY_RPC to api/proto & proto

* Ignore gen/ when running addlicense

* buf-js.gen.yaml: Remove comment about lack of go_package for JS

* Move prehog protos to proto/prehog/v1alpha

* Adjust prehog's go_package to match proto package
2023-02-03 14:47:06 +00:00
Rafał Cieślak 641eeb1942 Connect: Check for existence of update-*-database in after-install (#21063) 2023-02-03 14:46:18 +00:00
Jeff Pihach 26f6022689 Initial pass at lint and test GHA for UI. (#21110)
* Initial pass at lint and test GHA for UI.

* Fix lint

* Add --frozen-lockfile

* Skip the e directory if it doesn't exist while linting.

* Update failing snapshots.

* use a more reasonable filter for eslint to support missing e

* ignore type check on e imports.

* ignore failing file that requires e teleterm file.

* fix lint

* quiet down the log output for prettier-write.
2023-02-02 22:56:55 +00:00
Grzegorz Zdunek ce86ad57ee Connect: fix "Connect a Cluster" screen flash (#20988)
* Render loading screen when initialization is in progress

* Wait with showing the window until it is ready to prevent "empty screen" flash

* Add comments
2023-02-01 08:21:41 +00:00
Grzegorz Zdunek 34e9b44880 Connect: add env file for dev/prod vars, use prehog staging only in dev environment (#20768)
* Create env file for dev/prod vars

* Rename `ENV` to `staticConfig`

* Simplify condition
2023-01-30 15:38:45 +00:00
Yassine Bounekhla 72bc16b3b4 fix lint error (#20827) 2023-01-27 16:54:14 +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
Grzegorz Zdunek 3a0fc94aa6 Connect: wait for process to exit before closing app (#20673) 2023-01-26 14:34:14 +00:00
Rafał Cieślak 6791b48da9 Remove grpc-teleterm Make target and Dockerfile-teleterm (#20032)
* Remove CLANG_FORMAT from Makefiles

It was used to format protos but we use Buf for that since v10.

* Move installing grpc_node_plugin into Dockerfile

This commit basically takes grpc_node_plugin compilation from
Dockerfile-teleterm and moves it to Dockerfile.

* Replace Dockerfile-teleterm with Dockerfile

After moving grpc_node_plugin compilation to Dockerfile, the only remaining
thing that Dockerfile-teleterm does is installing rpm so that we can make
an RPM package for Connect during tag builds.

Installing this package can be simply moved to Dockerfile.

* Remove grpc-teleterm Make target in favor of grpc

* Add updated protobufs

It looks like they're a result of someone changing protos in lib/prehog
without running `make grpc-teleterm` separately. Which is why we're getting
rid of grpc-teleterm as a separate Make target in the first place. ;)
2023-01-26 09:41:07 +01:00
Rafał Cieślak 9b7355cd20 Connect: Add useWorkspaceLoggedInUser (#20552) 2023-01-24 15:31:39 +00:00
Tiago Silva 10da451dd6 Add support for subResourceName to teleterm (#20541)
Initial support for `subResourceName` when listing resource access requests for `type=pod`.
2023-01-23 15:06:01 +00:00
Jeff Pihach 34f102bdeb Enable building teleport with the new UI location (#20361)
* Changes for merging webapps into teleport.
2023-01-18 22:22:25 +00:00
Grzegorz Zdunek 834cf0e059 Connect: Ask for user job role (#1491) 2023-01-13 16:10:35 +01:00
Grzegorz Zdunek 53da3a19c4 Connect: Collect usage events (#1451) 2023-01-10 18:29:23 +01:00
Rafał Cieślak f2a05c9187 Update Electron to 22.0.0 (#1498) 2023-01-09 10:28:04 +00:00
Rafał Cieślak 87ffebf7f8 Make bundled tsh available outside of Connect (#1445)
* Rename assets to build_resources

* Add resources\bin to Path during installation on Windows

* Adjust docs related to USE_SYSTEM_FPM

It turns out you need that for deb packages too.

* Create symlink to bundled tsh on Linux targets

* after-install: Get rid of old symlink removal

* Expand story for QuickInput

* Make command suggestions stay in place

* Align suggestion icons to the top rather than center

This makes it easier to tell when one suggestion ends and another starts.

* Add install & uninstall cmds to command bar

* Exclude new commands from OSes other than macOS

* Implement commands for symlinking tsh
2023-01-04 17:05:47 +00:00
Grzegorz Zdunek 4f037f0630 [Connect] Update protofiles to support authClusterId (#1483) 2023-01-04 15:12:27 +01:00
Rafał Cieślak 40b901a96e Connect: Add missing modal stories, misc modal fixes (#1479)
* Group all modal stories under ModalsHost

* Fix type of DialogClusterConnect, rename DialogBase to DialogNone
2023-01-04 10:15:17 +00:00
Michael 6e63d3658b [Connect] Update protofiles and webapps.e to support suggestedReviewers and requestableRoles (#1449) 2023-01-03 16:36:55 -06:00
Michael 80ed096f17 [Connect] Use resourcesList in review access request table (#1430) 2022-12-21 19:10:20 -06:00
Rafał Cieślak d171bf73e4 Connect: Use default config in main process fixtures (#1450)
This unbreaks some Connect stories which depend on keyboard shortcuts
config.

If we ever need to change the config in stories or tests, we should
revisit the mock. But it might be enough to call the `set` method on
the config service.
2022-12-21 11:41:07 +00:00
Grzegorz Zdunek 41020cc29c Connect: Store installation ID (#1443) 2022-12-20 18:55:12 +01:00
Grzegorz Zdunek ed135ae92a Connect: Add UsageData dialog (#1404) 2022-12-15 16:38:10 +01:00