Skip to content

chore(site): rename deletion cue components #9876

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 1 commit into from
Sep 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Link from "@mui/material/Link";
import { Link as RouterLink } from "react-router-dom";
import styled from "@emotion/styled";
import { Workspace } from "api/typesGenerated";
import { displayImpendingDeletion } from "./utils";
import { displayDormantDeletion } from "./utils";
import { useDashboard } from "components/Dashboard/DashboardProvider";

export const ImpendingDeletionStat = ({
export const DormantDeletionStat = ({
workspace,
}: {
workspace: Workspace;
Expand All @@ -21,7 +21,7 @@ export const ImpendingDeletionStat = ({

return (
<Maybe
condition={displayImpendingDeletion(
condition={displayDormantDeletion(
workspace,
allowAdvancedScheduling,
allowWorkspaceActions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Workspace } from "api/typesGenerated";
import { displayImpendingDeletion } from "./utils";
import { displayDormantDeletion } from "./utils";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import styled from "@emotion/styled";
import { Theme as MaterialUITheme } from "@mui/material/styles";

export const ImpendingDeletionText = ({
export const DormantDeletionText = ({
workspace,
}: {
workspace: Workspace;
Expand All @@ -17,7 +17,7 @@ export const ImpendingDeletionText = ({
const allowWorkspaceActions = experiments.includes("workspace_actions");

if (
!displayImpendingDeletion(
!displayDormantDeletion(
workspace,
allowAdvancedScheduling,
allowWorkspaceActions,
Expand Down
6 changes: 3 additions & 3 deletions site/src/components/WorkspaceDeletion/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./ImpendingDeletionStat";
export * from "./ImpendingDeletionText";
export * from "./ImpendingDeletionBanner";
export * from "./DormantDeletionStat";
export * from "./DormantDeletionText";
export * from "./DormantWorkspaceBanner";
6 changes: 3 additions & 3 deletions site/src/components/WorkspaceDeletion/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as TypesGen from "api/typesGenerated";
import * as Mocks from "testHelpers/entities";
import { displayImpendingDeletion } from "./utils";
import { displayDormantDeletion } from "./utils";

describe("displayImpendingDeletion", () => {
describe("displayDormantDeletion", () => {
const today = new Date();
it.each<[string, boolean, boolean, boolean]>([
[
Expand Down Expand Up @@ -45,7 +45,7 @@ describe("displayImpendingDeletion", () => {
deleting_at,
};
expect(
displayImpendingDeletion(
displayDormantDeletion(
workspace,
allowAdvancedScheduling,
allowWorkspaceActions,
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/WorkspaceDeletion/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const IMPENDING_DELETION_DISPLAY_THRESHOLD = 14; // 14 days
* @param {TypesGen.Workspace} workspace
* @returns {boolean}
*/
export const displayImpendingDeletion = (
export const displayDormantDeletion = (
workspace: Workspace,
allowAdvancedScheduling: boolean,
allowWorkspaceActions: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FC, PropsWithChildren } from "react";
import { makeStyles } from "@mui/styles";
import { combineClasses } from "utils/combineClasses";
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
import { ImpendingDeletionText } from "components/WorkspaceDeletion";
import { DormantDeletionText } from "components/WorkspaceDeletion";
import { getDisplayWorkspaceStatus } from "utils/workspace";
import Tooltip, { TooltipProps, tooltipClasses } from "@mui/material/Tooltip";
import { styled } from "@mui/material/styles";
Expand Down Expand Up @@ -63,9 +63,9 @@ export const WorkspaceStatusText: FC<

return (
<ChooseOne>
{/* <ImpendingDeletionText/> determines its own visibility */}
<Cond condition={Boolean(ImpendingDeletionText({ workspace }))}>
<ImpendingDeletionText workspace={workspace} />
{/* <DormantDeletionText/> determines its own visibility */}
<Cond condition={Boolean(DormantDeletionText({ workspace }))}>
<DormantDeletionText workspace={workspace} />
</Cond>
<Cond>
<span
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacePage/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
/>
</Cond>
<Cond>
{/* <ImpendingDeletionBanner/> determines its own visibility */}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the classic "comment doesn't get updated even though it was right next to the code 😂

{/* <DormantWorkspaceBanner/> determines its own visibility */}
<DormantWorkspaceBanner
workspaces={[workspace]}
shouldRedisplayBanner={
Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/WorkspacePage/WorkspaceStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Popover from "@mui/material/Popover";
import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";
import { WorkspaceStatusText } from "components/WorkspaceStatusBadge/WorkspaceStatusBadge";
import { ImpendingDeletionStat } from "components/WorkspaceDeletion";
import { DormantDeletionStat } from "components/WorkspaceDeletion";

const Language = {
workspaceDetails: "Workspace Details",
Expand Down Expand Up @@ -75,7 +75,7 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
label="Status"
value={<WorkspaceStatusText workspace={workspace} />}
/>
<ImpendingDeletionStat workspace={workspace} />
<DormantDeletionStat workspace={workspace} />
<StatsItem
className={styles.statsItem}
label={Language.templateLabel}
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacesPage/WorkspacesPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const WorkspacesPageView: FC<
<Maybe condition={hasError(error) && !isApiValidationError(error)}>
<ErrorAlert error={error} />
</Maybe>
{/* <ImpendingDeletionBanner/> determines its own visibility */}
{/* <DormantWorkspaceBanner/> determines its own visibility */}
<DormantWorkspaceBanner
workspaces={dormantWorkspaces}
shouldRedisplayBanner={hasDormantWorkspace}
Expand Down