Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: remove "something went wrong" text for watching a workspace
This text wasn't useful to a customer anyways, because we don't get
an error from EventSource. This can happen if you close your laptop
and open it again, so it's better if we don't display it.
  • Loading branch information
kylecarbs committed Mar 9, 2023
commit 513f09a56f0d6b4ed880c061bfbe74a1f9d27c08
10 changes: 0 additions & 10 deletions site/src/components/Workspace/Workspace.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@ GetBuildsError.args = {
},
}

export const GetResourcesError = Template.bind({})
GetResourcesError.args = {
...Running.args,
workspaceErrors: {
[WorkspaceErrors.GET_RESOURCES_ERROR]: Mocks.makeMockApiError({
message: "There is a problem fetching workspace resources.",
}),
},
}

export const CancellationError = Template.bind({})
CancellationError.args = {
...Failed.args,
Expand Down
22 changes: 0 additions & 22 deletions site/src/components/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { WorkspaceDeletedBanner } from "../WorkspaceDeletedBanner/WorkspaceDelet
import { WorkspaceScheduleButton } from "../WorkspaceScheduleButton/WorkspaceScheduleButton"
import { WorkspaceStats } from "../WorkspaceStats/WorkspaceStats"
import { AlertBanner } from "../AlertBanner/AlertBanner"
import { useTranslation } from "react-i18next"
import {
ActiveTransition,
WorkspaceBuildProgress,
Expand All @@ -26,11 +25,9 @@ import { AgentRow } from "components/Resources/AgentRow"
import { Avatar } from "components/Avatar/Avatar"

export enum WorkspaceErrors {
GET_RESOURCES_ERROR = "getResourcesError",
GET_BUILDS_ERROR = "getBuildsError",
BUILD_ERROR = "buildError",
CANCELLATION_ERROR = "cancellationError",
WORKSPACE_REFRESH_WARNING = "refreshWorkspaceWarning",
}

export interface WorkspaceProps {
Expand Down Expand Up @@ -88,7 +85,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
templateParameters,
quota_budget,
}) => {
const { t } = useTranslation("workspacePage")
const styles = useStyles()
const navigate = useNavigate()
const serverVersion = buildInfo?.version || ""
Expand All @@ -111,16 +107,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
/>
)

const workspaceRefreshWarning = Boolean(
workspaceErrors[WorkspaceErrors.WORKSPACE_REFRESH_WARNING],
) && (
<AlertBanner
severity="warning"
text={t("warningsAndErrors.workspaceRefreshWarning")}
dismissible
/>
)

let transitionStats: TypesGen.TransitionStats | undefined = undefined
if (template !== undefined) {
transitionStats = ActiveTransition(template, workspace)
Expand Down Expand Up @@ -187,7 +173,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
>
{buildError}
{cancellationError}
{workspaceRefreshWarning}

<WorkspaceDeletedBanner
workspace={workspace}
Expand All @@ -207,13 +192,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
/>
)}

{Boolean(workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR]) && (
<AlertBanner
severity="error"
error={workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR]}
/>
)}

{typeof resources !== "undefined" && resources.length > 0 && (
<Resources
resources={resources}
Expand Down
2 changes: 0 additions & 2 deletions site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const WorkspaceReadyPage = ({
workspace,
template,
templateParameters,
refreshWorkspaceWarning,
builds,
getBuildsError,
buildError,
Expand Down Expand Up @@ -119,7 +118,6 @@ export const WorkspaceReadyPage = ({
hideSSHButton={featureVisibility["browser_only"]}
hideVSCodeDesktopButton={featureVisibility["browser_only"]}
workspaceErrors={{
[WorkspaceErrors.GET_RESOURCES_ERROR]: refreshWorkspaceWarning,
[WorkspaceErrors.GET_BUILDS_ERROR]: getBuildsError,
[WorkspaceErrors.BUILD_ERROR]: buildError,
[WorkspaceErrors.CANCELLATION_ERROR]: cancellationError,
Expand Down
18 changes: 5 additions & 13 deletions site/src/xServices/workspace/workspaceXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export interface WorkspaceContext {
templateParameters?: TypesGen.TemplateVersionParameter[]
build?: TypesGen.WorkspaceBuild
getWorkspaceError?: Error | unknown
// these are labeled as warnings because they don't make the page unusable
refreshWorkspaceWarning?: Error | unknown
getTemplateWarning: Error | unknown
getTemplateParametersWarning: Error | unknown
// Builds
Expand Down Expand Up @@ -278,18 +276,15 @@ export const workspaceMachine = createMachine(
},
on: {
REFRESH_WORKSPACE: {
actions: [
"refreshWorkspace",
"clearRefreshWorkspaceWarning",
],
actions: ["refreshWorkspace"],
},
EVENT_SOURCE_ERROR: {
target: "error",
},
},
},
error: {
entry: "assignRefreshWorkspaceWarning",
entry: "logWatchWorkspaceWarning",
after: {
"2000": {
target: "gettingEvents",
Expand Down Expand Up @@ -586,12 +581,9 @@ export const workspaceMachine = createMachine(
refreshWorkspace: assign({
workspace: (_, event) => event.data,
}),
assignRefreshWorkspaceWarning: assign({
refreshWorkspaceWarning: (_, event) => event,
}),
clearRefreshWorkspaceWarning: assign({
refreshWorkspaceWarning: (_) => undefined,
}),
logWatchWorkspaceWarning: (_, event) => {
console.error("Watch workspace error:", event)
},
assignGetTemplateWarning: assign({
getTemplateWarning: (_, event) => event.data,
}),
Expand Down