Skip to content

refactor(site): refactor workspace notifications #11520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0b28628
Refactor outdated warning
BrunoQuaresma Jan 9, 2024
ab96aab
Move unhealthy warning
BrunoQuaresma Jan 9, 2024
38f213e
Move dormant notification
BrunoQuaresma Jan 9, 2024
9ec5952
Remove mutation errors from alerts
BrunoQuaresma Jan 9, 2024
17ecf0e
Move pending in queue notification
BrunoQuaresma Jan 9, 2024
c969df5
Move deprecated notification
BrunoQuaresma Jan 9, 2024
8f6040d
Move outdated to notifications array
BrunoQuaresma Jan 9, 2024
691c028
Move unhealthy to notifications array
BrunoQuaresma Jan 9, 2024
706bbd5
Fix permissions for restart workspace
BrunoQuaresma Jan 9, 2024
d3e68fb
Move dormant notifications to notifications array
BrunoQuaresma Jan 9, 2024
2f1ac83
Structure notification pills
BrunoQuaresma Jan 9, 2024
c334031
Minor style adjustments
BrunoQuaresma Jan 9, 2024
a78d4cf
Remove bottom bar from workspace page
BrunoQuaresma Jan 9, 2024
24c7552
Display notifications under the pills
BrunoQuaresma Jan 9, 2024
b711018
Improve canAutoStart check
BrunoQuaresma Jan 11, 2024
121005c
Move css into a style
BrunoQuaresma Jan 11, 2024
3234d49
Move css into a style
BrunoQuaresma Jan 11, 2024
b30dc44
Remove unecessary boolean
BrunoQuaresma Jan 11, 2024
04994a4
Refactor props
BrunoQuaresma Jan 11, 2024
5ba0765
Improve semantics
BrunoQuaresma Jan 11, 2024
3d0d70b
Merge branch 'bq/move-alert' of https://github.com/coder/coder into b…
BrunoQuaresma Jan 11, 2024
9299c68
Merge branch 'main' of https://github.com/coder/coder into bq/move-alert
BrunoQuaresma Jan 11, 2024
6d3148b
Merge branch 'main' of https://github.com/coder/coder into bq/move-alert
BrunoQuaresma Jan 12, 2024
45be26c
Add tests
BrunoQuaresma Jan 12, 2024
d21be38
Merge branch 'main' of https://github.com/coder/coder into bq/move-alert
BrunoQuaresma Jan 12, 2024
478a333
Fix storybook
BrunoQuaresma Jan 12, 2024
d62833c
Merge branch 'main' of https://github.com/coder/coder into bq/move-alert
BrunoQuaresma Jan 12, 2024
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
1 change: 1 addition & 0 deletions site/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function withQuery(Story, { parameters }) {
defaultOptions: {
queries: {
staleTime: Infinity,
retry: false,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion site/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ export const AppRouter: FC = () => {

{/* In order for the 404 page to work properly the routes that start with
top level parameter must be fully qualified. */}
<Route path="/:username/:workspace" element={<WorkspacePage />} />
<Route
path="/:username/:workspace/builds/:buildNumber"
element={<WorkspaceBuildPage />}
Expand Down Expand Up @@ -413,6 +412,7 @@ export const AppRouter: FC = () => {
</Route>

{/* Pages that don't have the dashboard layout */}
<Route path="/:username/:workspace" element={<WorkspacePage />} />
<Route
path="/templates/:template/versions/:version/edit"
element={<TemplateVersionEditorPage />}
Expand Down
2 changes: 1 addition & 1 deletion site/src/api/queries/workspaceQuota.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const workspaceQuota = (username: string) => {
};
};

const getWorkspaceResolveAutostartQueryKey = (workspaceId: string) => [
export const getWorkspaceResolveAutostartQueryKey = (workspaceId: string) => [
workspaceId,
"workspaceResolveAutostart",
];
Expand Down
76 changes: 0 additions & 76 deletions site/src/components/WorkspaceDeletion/DormantWorkspaceBanner.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions site/src/components/WorkspaceDeletion/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { type FC, type ReactNode } from "react";
import type { Workspace } from "api/typesGenerated";
import { Pill } from "components/Pill/Pill";
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
import { DormantDeletionText } from "components/WorkspaceDeletion";
import { DormantDeletionText } from "./DormantDeletionText";
import { getDisplayWorkspaceStatus } from "utils/workspace";
import { useClassName } from "hooks/useClassName";
import { formatDistanceToNow } from "date-fns";
Expand Down
92 changes: 13 additions & 79 deletions site/src/pages/WorkspacePage/Workspace.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ import EventSource from "eventsourcemock";
import { ProxyContext, getPreferredProxy } from "contexts/ProxyContext";
import { DashboardProviderContext } from "components/Dashboard/DashboardProvider";
import { WorkspaceBuildLogsSection } from "pages/WorkspacePage/WorkspaceBuildLogsSection";
import { WorkspacePermissions } from "./permissions";

const MockedAppearance = {
config: Mocks.MockAppearanceConfig,
isPreview: false,
setPreview: () => {},
};

const permissions: WorkspacePermissions = {
readWorkspace: true,
updateWorkspace: true,
updateTemplate: true,
viewDeploymentValues: true,
};

const meta: Meta<typeof Workspace> = {
title: "pages/WorkspacePage/Workspace",
args: { permissions },
component: Workspace,
decorators: [
(Story) => (
Expand Down Expand Up @@ -68,8 +77,6 @@ export const Running: Story = {
workspace: Mocks.MockWorkspace,
handleStart: action("start"),
handleStop: action("stop"),
canUpdateWorkspace: true,
workspaceErrors: {},
buildInfo: Mocks.MockBuildInfo,
template: Mocks.MockTemplate,
},
Expand All @@ -78,7 +85,10 @@ export const Running: Story = {
export const WithoutUpdateAccess: Story = {
args: {
...Running.args,
canUpdateWorkspace: false,
permissions: {
...permissions,
updateWorkspace: false,
},
},
};

Expand Down Expand Up @@ -110,18 +120,6 @@ export const Stopping: Story = {
},
};

export const Failed: Story = {
args: {
...Running.args,
workspace: Mocks.MockFailedWorkspace,
workspaceErrors: {
buildError: Mocks.mockApiError({
message: "A workspace build is already active.",
}),
},
},
};

export const FailedWithLogs: Story = {
args: {
...Running.args,
Expand Down Expand Up @@ -186,70 +184,6 @@ export const Canceled: Story = {
},
};

export const Outdated: Story = {
args: {
...Running.args,
workspace: Mocks.MockOutdatedWorkspace,
},
};

export const CantAutostart: Story = {
args: {
...Running.args,
canAutostart: false,
workspace: Mocks.MockOutdatedRunningWorkspaceRequireActiveVersion,
},
};

export const GetBuildsError: Story = {
args: {
...Running.args,
workspaceErrors: {
getBuildsError: Mocks.mockApiError({
message: "There is a problem fetching builds.",
}),
},
},
};

export const CancellationError: Story = {
args: {
...Failed.args,
workspaceErrors: {
cancellationError: Mocks.mockApiError({
message: "Job could not be canceled.",
}),
},
buildLogs: <WorkspaceBuildLogsSection logs={makeFailedBuildLogs()} />,
},
};

export const Deprecated: Story = {
args: {
...Running.args,
template: {
...Mocks.MockTemplate,
deprecated: true,
deprecation_message:
"Template deprecated due to reasons. [Learn more](#)",
},
},
};

export const Unhealthy: Story = {
args: {
...Running.args,
workspace: {
...Mocks.MockWorkspace,
latest_build: { ...Mocks.MockWorkspace.latest_build, status: "running" },
health: {
healthy: false,
failing_agents: [],
},
},
},
};

function makeFailedBuildLogs(): ProvisionerJobLog[] {
return [
{
Expand Down
Loading