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>
This commit is contained in:
Grzegorz Zdunek 2023-03-16 16:26:54 +01:00 committed by GitHub
parent 4cbbc0c583
commit 2d387e179f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 31 deletions

View file

@ -158,27 +158,74 @@ installation directory to the `Path` user environment variable.
</TabItem>
</Tabs>
## Configuration
Teleport Connect can be configured by editing the `app_config.json` file, which it creates on first launch.
To open it, click the More Options icon `⋮` -> Open Config File.
The file will open in your default editor.
<Admonition
type="note"
title="Note"
>
Any changes to the config file will take effect at the next launch.
</Admonition>
Below is the list of the supported config properties.
| Property | Default | Description |
|-------------------------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| `usageReporting.enabled` | `false` | Enables collecting anonymous usage data (see [Telemetry](#telemetry)). |
| `keymap.tab1` - `keymap.tab9` | `Command+1` - `Command+9` on macOS <br/> `Ctrl+1` - `Ctrl+9` on Windows<br/>`Alt+1` - `Alt+9` on Linux | Shortcut to open tab 19. |
| `keymap.closeTab` | `Command+W` on macOS<br/>`Ctrl+W` on Windows/Linux | Shortcut to close a tab. |
| `keymap.newTab` | `Command+T` on macOS<br/>`Ctrl+T` on Windows/Linux | Shortcut to open a new tab. |
| `keymap.previousTab` | `Shift+Command+Tab` on macOS<br/>`Ctrl+Shift+Tab` on Windows/Linux | Shortcut to go to the previous tab. |
| `keymap.nextTab` | `Command+Tab` on macOS<br/>`Ctrl+Tab` on Windows/Linux | Shortcut to go to the next tab. |
| `keymap.openConnections` | `Command+P` on macOS<br/>`Ctrl+P` on Windows/Linux | Shortcut to open the connection list. |
| `keymap.openClusters` | `Command+E` on macOS<br/>`Ctrl+E` on Windows/Linux | Shortcut to open the cluster selector. |
| `keymap.openProfiles` | `Command+I` on macOS<br/>`Ctrl+I` on Windows/Linux | Shortcut to open the profile selector. |
| `keymap.openCommandBar` | `Command+K` on macOS<br/>`Ctrl+K` on Windows/Linux | Shortcut to open the command bar. |
| `terminal.fontFamily` | `Menlo, Monaco, monospace` on macOS<br/>`Consolas, monospace` on Windows<br/>`'Droid Sans Mono', monospace` on Linux | Font family for the terminal. |
| `terminal.fontSize` | 15 | Font size for the terminal. |
<Admonition
type="note"
title="Note"
>
The additional `$schema` property present in the config file allows text editors to provide autocompletion.
It should not be modified.
</Admonition>
### Configuring keyboard shortcuts
A valid shortcut contains at least one modifier and a single key code, for example `Shift+Tab`.
Function keys such as `F1` do not require a modifier.
Modifiers and a key code must be combined by the `+` character.
Available modifiers:
- `Control`, `Option`, `Shift`, `Command` on macOS.
- `Ctrl`, `Alt`, `Shift` on Windows and Linux.
Available key codes:
- `0` to `9`
- `A` to `Z`
- `F1` to `F24`
- `,`, `.`, `/`, `\`, `` ` ``, `-`, `=`, `;`, `'`, `[`, `]`
- `Space`, `Tab`, `CapsLock`, `NumLock`, `ScrollLock`, `Backspace`, `Delete`, `Insert`, `Enter`, `Up`, `Down`, `Left`, `Right`, `Home`, `End`, `PageUp`, `PageDown`, `Escape`, `IntlBackslash`
## Telemetry
(!docs/pages/includes/teleport-connect-telemetry.mdx!)
### Disabling telemetry
If you initially agreed to share telemetry data, but now want to opt out, you need to update the `app_config.json` file:
If you initially agreed to share telemetry data, but now want to opt out, you need to set `usageReporting.enabled` in the config to `false` (see [Configuration](#configuration)):
```json
"usageReporting.enabled": false
```
<Tabs>
<TabItem label="macOS">
The Teleport Connect configuration file is located at `~/Library/Application Support/Teleport Connect/app_config.json`.
</TabItem>
<TabItem label="Linux">
The Teleport Connect configuration file is located at `~/.config/Teleport Connect/app_config.json`.
</TabItem>
<TabItem label="Windows">
The Teleport Connect configuration file is located at `C:\Users\%UserName%\AppData\Roaming\Teleport Connect\app_config.json`.
</TabItem>
</Tabs>
The changes will take effect at the next launch.

View file

@ -76,15 +76,15 @@ export const createAppConfigSchema = (platform: Platform) => {
.describe(getShortcutDesc('go to the next tab')),
'keymap.openConnections': shortcutSchema
.default(defaultKeymap['openConnections'])
.describe(getShortcutDesc('open the connection panel')),
.describe(getShortcutDesc('open the connection list')),
'keymap.openClusters': shortcutSchema
.default(defaultKeymap['openClusters'])
.describe(getShortcutDesc('open the clusters panel')),
.describe(getShortcutDesc('open the cluster selector')),
'keymap.openProfiles': shortcutSchema
.default(defaultKeymap['openProfiles'])
.describe(getShortcutDesc('open the profiles panel')),
'keymap.openQuickInput': shortcutSchema
.default(defaultKeymap['openQuickInput'])
.describe(getShortcutDesc('open the profile selector')),
'keymap.openCommandBar': shortcutSchema
.default(defaultKeymap['openCommandBar'])
.describe(getShortcutDesc('open the command bar')),
/**
* This value can be provided by the user and is unsanitized. This means that it cannot be directly interpolated
@ -120,7 +120,7 @@ export type KeyboardShortcutAction =
| 'newTab'
| 'previousTab'
| 'nextTab'
| 'openQuickInput'
| 'openCommandBar'
| 'openConnections'
| 'openClusters'
| 'openProfiles';
@ -142,7 +142,7 @@ const getDefaultKeymap = (platform: Platform) => {
newTab: 'Ctrl+T',
previousTab: 'Ctrl+Shift+Tab',
nextTab: 'Ctrl+Tab',
openQuickInput: 'Ctrl+K',
openCommandBar: 'Ctrl+K',
openConnections: 'Ctrl+P',
openClusters: 'Ctrl+E',
openProfiles: 'Ctrl+I',
@ -162,7 +162,7 @@ const getDefaultKeymap = (platform: Platform) => {
newTab: 'Ctrl+T',
previousTab: 'Ctrl+Shift+Tab',
nextTab: 'Ctrl+Tab',
openQuickInput: 'Ctrl+K',
openCommandBar: 'Ctrl+K',
openConnections: 'Ctrl+P',
openClusters: 'Ctrl+E',
openProfiles: 'Ctrl+I',
@ -182,7 +182,7 @@ const getDefaultKeymap = (platform: Platform) => {
newTab: 'Command+T',
previousTab: 'Control+Shift+Tab',
nextTab: 'Control+Tab',
openQuickInput: 'Command+K',
openCommandBar: 'Command+K',
openConnections: 'Command+P',
openClusters: 'Command+E',
openProfiles: 'Command+I',
@ -193,11 +193,11 @@ const getDefaultKeymap = (platform: Platform) => {
function getDefaultTerminalFont(platform: Platform) {
switch (platform) {
case 'win32':
return "'Consolas', 'Courier New', monospace";
return 'Consolas, monospace';
case 'linux':
return "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'";
return "'Droid Sans Mono', monospace";
case 'darwin':
return "Menlo, Monaco, 'Courier New', monospace";
return 'Menlo, Monaco, monospace';
}
}

View file

@ -74,7 +74,7 @@ export default function useQuickInput() {
const hasSuggestions =
suggestionsAttempt.status === 'success' &&
suggestionsAttempt.data.length > 0;
const openQuickInputShortcutAction: KeyboardShortcutAction = 'openQuickInput';
const openCommandBarShortcutAction: KeyboardShortcutAction = 'openCommandBar';
const { getAccelerator } = useKeyboardShortcutFormatters();
const onFocus = (e: any) => {
@ -163,7 +163,7 @@ export default function useQuickInput() {
};
useKeyboardShortcuts({
[openQuickInputShortcutAction]: () => {
[openCommandBarShortcutAction]: () => {
quickInputService.show();
},
});
@ -194,7 +194,7 @@ export default function useQuickInput() {
onInputChange: quickInputService.setInputValue,
onHide: quickInputService.hide,
onShow: quickInputService.show,
keyboardShortcut: getAccelerator(openQuickInputShortcutAction),
keyboardShortcut: getAccelerator(openCommandBarShortcutAction),
};
}

View file

@ -69,7 +69,7 @@ function getTestSetup({ documents }: { documents: Document[] }) {
return {
closeTab: 'Command-W',
newTab: 'Command-T',
openQuickInput: 'Command-K',
openCommandBar: 'Command-K',
openConnections: 'Command-P',
openClusters: 'Command-E',
openProfiles: 'Command-I',

View file

@ -77,8 +77,7 @@ function notifyAboutConfigErrors(
isKeymapError &&
'A valid shortcut contains at least one modifier and a single key code, for example "Shift+Tab".\nFunction keys do not require a modifier.',
link: {
// TODO(gzdunek): point to the properer section
href: 'https://goteleport.com/docs/connect-your-client/teleport-connect/',
href: 'https://goteleport.com/docs/connect-your-client/teleport-connect/#configuration',
text: 'See the config file documentation',
},
});

View file

@ -57,7 +57,7 @@ export class KeyboardShortcutsService {
previousTab: this.configService.get('keymap.previousTab').value,
nextTab: this.configService.get('keymap.nextTab').value,
newTab: this.configService.get('keymap.newTab').value,
openQuickInput: this.configService.get('keymap.openQuickInput').value,
openCommandBar: this.configService.get('keymap.openCommandBar').value,
openConnections: this.configService.get('keymap.openConnections').value,
openClusters: this.configService.get('keymap.openClusters').value,
openProfiles: this.configService.get('keymap.openProfiles').value,