Skip to content

feat(site): show favorite workspaces in ui #11875

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 9 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add stories
  • Loading branch information
johnstcn committed Jan 29, 2024
commit a1887cac3645601990c474f0d1422a9b7fc3e6b6
7 changes: 7 additions & 0 deletions site/src/pages/WorkspacePage/Workspace.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export const Running: Story = {
},
};

export const Favorite: Story = {
args: {
...Running.args,
workspace: Mocks.MockFavoriteWorkspace,
},
};

export const WithoutUpdateAccess: Story = {
args: {
...Running.args,
Expand Down
11 changes: 11 additions & 0 deletions site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ export const AllStates: Story = {
},
};

export const AllStatesWithFavorites: Story = {
args: {
workspaces: allWorkspaces.map((workspace, i) => ({
...workspace,
// NOTE: testing sort order is not relevant here.
favorite: i % 2 === 0,
})),
count: allWorkspaces.length,
},
};

const icons = [
"/icon/code.svg",
"/icon/aws.svg",
Expand Down
8 changes: 7 additions & 1 deletion site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type DeploymentConfig,
} from "api/api";
import { FieldError } from "api/errors";
import type * as TypesGen from "api/typesGenerated";
import * as TypesGen from "api/typesGenerated";
import range from "lodash/range";
import type { Permissions } from "contexts/auth/permissions";
import { TemplateVersionFiles } from "utils/templateVersion";
Expand Down Expand Up @@ -1020,6 +1020,12 @@ export const MockWorkspace: TypesGen.Workspace = {
},
automatic_updates: "never",
allow_renames: true,
favorite: false,
};

export const MockFavoriteWorkspace: TypesGen.Workspace = {
...MockWorkspace,
id: "test-favorite-workspace",
favorite: true,
};

Expand Down