This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v9] Backport Teleport Connect (5 of 5) (#766)
* Bring back native scrollbar as the styled one causes content to jump when it becomes visible * Use new colors for theme * Fix not clickable notifications when displayed over xterm * Close `Identity` popover after selecting an option (#741) * Fix getting cwd in presence of lsof warnings (#745) lsof uses stderr to print out warnings. This caused the previous version of ptyProcess to throw an error, even though the exit code of lsof was 0. The existing code already handles non-zero exit codes (asyncExec will reject the promise). Since we don't know why stderr was inspected in the first place, let's just remove the check for it. * Change connections shortcut to `Command/Ctrl-P` (#747) * Resolve issues on logout (#740) * Change app name to `Teleport Connect` (#753) * 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 <[email protected]> * 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 <[email protected]> * Fix check for the --insecure flag (#758) Fixes gravitational/webapps.e#147. * Remove state related to a cluster when removing it (#755) * Teleport Connect: Add dropdown for database name (#757) * Add required prop to MenuLogin This will be needed for the db name dropdown, where the value is optional. * Update proto files * Include targetSubresourceName when creating a gateway * Set better title for gateway tab * Fix long document titles breaking connection tracker's UI Co-authored-by: Grzegorz Zdunek <[email protected]> Co-authored-by: Grzegorz Zdunek <[email protected]>
- Loading branch information
1 parent
3d58fd8
commit 2aa1d3c
Showing
82 changed files
with
1,466 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { render, fireEvent, waitFor } from 'design/utils/testing'; | ||
import { MenuLogin } from './MenuLogin'; | ||
|
||
test('does not accept an empty value when required is set to true', async () => { | ||
const onSelect = jest.fn(); | ||
const { findByText, findByPlaceholderText } = render( | ||
<MenuLogin | ||
placeholder="MenuLogin input" | ||
required={true} | ||
getLoginItems={() => []} | ||
onSelect={() => onSelect()} | ||
/> | ||
); | ||
|
||
fireEvent.click(await findByText('CONNECT')); | ||
await waitFor(async () => | ||
fireEvent.keyPress(await findByPlaceholderText('MenuLogin input'), { | ||
key: 'Enter', | ||
keyCode: 13, | ||
}) | ||
); | ||
|
||
expect(onSelect).toHaveBeenCalledTimes(0); | ||
}); | ||
|
||
test('accepts an empty value when required is set to false', async () => { | ||
const onSelect = jest.fn(); | ||
const { findByText, findByPlaceholderText } = render( | ||
<MenuLogin | ||
placeholder="MenuLogin input" | ||
required={false} | ||
getLoginItems={() => []} | ||
onSelect={() => onSelect()} | ||
/> | ||
); | ||
|
||
fireEvent.click(await findByText('CONNECT')); | ||
await waitFor(async () => | ||
fireEvent.keyPress(await findByPlaceholderText('MenuLogin input'), { | ||
key: 'Enter', | ||
keyCode: 13, | ||
}) | ||
); | ||
|
||
expect(onSelect).toHaveBeenCalledTimes(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.