diff --git a/web/packages/teleport/src/DesktopSession/DesktopSession.tsx b/web/packages/teleport/src/DesktopSession/DesktopSession.tsx index 051026cad56a2..4c421a7d6e403 100644 --- a/web/packages/teleport/src/DesktopSession/DesktopSession.tsx +++ b/web/packages/teleport/src/DesktopSession/DesktopSession.tsx @@ -23,7 +23,7 @@ import { ButtonSecondary, ButtonPrimary, } from 'design'; -import { Danger } from 'design/Alert'; +import { Danger, Info } from 'design/Alert'; import Dialog, { DialogHeader, DialogTitle, @@ -86,7 +86,7 @@ export function DesktopSession(props: State) { const computeErrorDialog = () => { // Websocket is closed but we haven't - // closed it on purpose or registered a fatal tdp error. + // closed it on purpose or registered a fatal TDP error. const unknownConnectionError = wsConnection === 'closed' && !disconnected && @@ -96,7 +96,7 @@ export function DesktopSession(props: State) { if (fetchAttempt.status === 'failed') { errorText = fetchAttempt.statusText || 'fetch attempt failed'; } else if (tdpConnection.status === 'failed') { - errorText = tdpConnection.statusText || 'tdp connection failed'; + errorText = tdpConnection.statusText || 'TDP connection failed'; } else if (tdpConnection.status === '') { errorText = tdpConnection.statusText || 'encountered a non-fatal error'; } else if (unknownConnectionError) { @@ -112,10 +112,15 @@ export function DesktopSession(props: State) { } const open = errorText !== ''; - return { open, text: errorText }; + return { + open, + text: errorText, + isError: unknownConnectionError || errorText === 'RDP connection failed', + }; }; const errorDialog = computeErrorDialog(); + const Alert = errorDialog.isError ? Danger : Info; if (errorDialog.open) { return ( @@ -126,12 +131,14 @@ export function DesktopSession(props: State) { open={errorDialog.open} > - Error + + {errorDialog.isError ? 'Error' : 'Disconnected'} + <> - {errorDialog.text}} /> - Refresh the page to try again. + {errorDialog.text}} /> + Refresh the page to reconnect. diff --git a/web/packages/teleport/src/DesktopSession/__snapshots__/DesktopSession.story.test.tsx.snap b/web/packages/teleport/src/DesktopSession/__snapshots__/DesktopSession.story.test.tsx.snap index 5735526ab4edc..ddbf5707a14b8 100644 --- a/web/packages/teleport/src/DesktopSession/__snapshots__/DesktopSession.story.test.tsx.snap +++ b/web/packages/teleport/src/DesktopSession/__snapshots__/DesktopSession.story.test.tsx.snap @@ -874,7 +874,7 @@ exports[`connection error 1`] = ` overflow: auto; word-break: break-word; line-height: 1.5; - background: #FF6257; + background: #039be5; color: #000000; } @@ -985,7 +985,7 @@ exports[`connection error 1`] = ` class="c5" color="text.main" > - Error + Disconnected
some connection error
- Refresh the page to try again. + Refresh the page to reconnect.
- Error + Disconnected
some fetch error
- Refresh the page to try again. + Refresh the page to reconnect.
- Error + Disconnected
The application has detected an invalid internal application state. Please file a bug report for this issue at https://github.com/gravitational/teleport/issues/new?assignees=&labels=bug&template=bug_report.md
- Refresh the page to try again. + Refresh the page to reconnect.
Session disconnected for an unknown reason.
- Refresh the page to try again. + Refresh the page to reconnect.