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
Next Next commit
feat(site): show workspace favorite status in list and detail
  • Loading branch information
johnstcn committed Jan 29, 2024
commit 1848b884c6c27dfbcc73e19ba4cd142c9a9309d2
8 changes: 8 additions & 0 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1688,3 +1688,11 @@ export const updateHealthSettings = async (
);
return response.data;
};

export const putFavoriteWorkspace = async(workspaceID: string) => {
await axios.put(`/api/v2/workspaces/${workspaceID}/favorite`);
}

export const deleteFavoriteWorkspace = async(workspaceID: string) => {
await axios.delete(`/api/v2/workspaces/${workspaceID}/favorite`);
}
4 changes: 4 additions & 0 deletions site/src/pages/WorkspacePage/WorkspaceTopbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import DeleteOutline from "@mui/icons-material/DeleteOutline";
import PersonOutline from "@mui/icons-material/PersonOutline";
import ArrowBackOutlined from "@mui/icons-material/ArrowBackOutlined";
import ScheduleOutlined from "@mui/icons-material/ScheduleOutlined";
import Star from "@mui/icons-material/Star";
import { useTheme } from "@emotion/react";
import { type FC } from "react";
import { useQuery } from "react-query";
Expand Down Expand Up @@ -148,6 +149,9 @@ export const WorkspaceTopbar: FC<WorkspaceProps> = ({
>
<TopbarAvatar src={workspace.template_icon} />
<span css={{ fontWeight: 500 }}>{workspace.name}</span>
{workspace.favorite && (
<Star css={{width: 16, height: 16}}/>
)}
</span>
</PopoverTrigger>

Expand Down
4 changes: 4 additions & 0 deletions site/src/pages/WorkspacesPage/WorkspacesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import TableRow from "@mui/material/TableRow";
import Checkbox from "@mui/material/Checkbox";
import Skeleton from "@mui/material/Skeleton";
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
import Star from "@mui/icons-material/Star";
import { useTheme } from "@emotion/react";
import { type FC, type ReactNode } from "react";
import { useNavigate } from "react-router-dom";
Expand Down Expand Up @@ -150,6 +151,9 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
alignItems="center"
>
{workspace.name}
{workspace.favorite && (
<Star css={{width: 16, height: 16}}/>
)}
{workspace.outdated && (
<WorkspaceOutdatedTooltip
templateName={workspace.template_name}
Expand Down