Skip to content

chore: remove workspace_actions experiment #10030

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 5 commits into from
Oct 5, 2023
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
remove experiment enabled helper fn
  • Loading branch information
sreya committed Oct 5, 2023
commit a949d39ba871fc35effd6666b7582ea6bd4b448e
9 changes: 0 additions & 9 deletions site/src/components/Dashboard/DashboardProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,3 @@ export const useDashboard = (): DashboardProviderValue => {

return context;
};

export const useIsWorkspaceActionsEnabled = (): boolean => {
const { entitlements } = useDashboard();
const allowAdvancedScheduling =
entitlements.features["advanced_template_scheduling"].enabled;
// This check can be removed when https://github.com/coder/coder/milestone/19
// is merged up
return allowAdvancedScheduling;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Workspace } from "api/typesGenerated";
import { useIsWorkspaceActionsEnabled } from "components/Dashboard/DashboardProvider";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import { Alert } from "components/Alert/Alert";
import { formatDistanceToNow } from "date-fns";
import Link from "@mui/material/Link";
Expand All @@ -21,7 +21,9 @@ export const DormantWorkspaceBanner = ({
shouldRedisplayBanner: boolean;
count?: Count;
}): JSX.Element | null => {
const experimentEnabled = useIsWorkspaceActionsEnabled();
const { entitlements } = useDashboard();
const schedulingEnabled =
entitlements.features["advanced_template_scheduling"].enabled;

if (!workspaces) {
return null;
Expand All @@ -37,7 +39,7 @@ export const DormantWorkspaceBanner = ({

if (
// Only show this if the experiment is included.
!experimentEnabled ||
!schedulingEnabled ||
!hasDormantWorkspaces ||
// Banners should be redisplayed after dismissal when additional workspaces are newly scheduled for deletion
!shouldRedisplayBanner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ const meta: Meta<typeof GeneralSettingsPageView> = {
description:
"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.",
flag: "experiments",
value: [
"*",
"moons",
"workspace_actions",
"single_tailnet",
"deployment_health_page",
],
value: ["*", "moons", "single_tailnet", "deployment_health_page"],
flag_shorthand: "",
hidden: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type Story = StoryObj<typeof TemplateSchedulePageView>;

const defaultArgs = {
allowAdvancedScheduling: true,
allowWorkspaceActions: true,
template: MockTemplate,
onSubmit: action("onSubmit"),
onCancel: action("cancel"),
Expand Down
15 changes: 7 additions & 8 deletions site/src/pages/WorkspacesPage/WorkspacesPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { usePagination } from "hooks/usePagination";
import { Workspace } from "api/typesGenerated";
import {
useDashboard,
useIsWorkspaceActionsEnabled,
} from "components/Dashboard/DashboardProvider";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import { type FC, useEffect, useState } from "react";
import { Helmet } from "react-helmet-async";
import { pageTitle } from "utils/page";
Expand Down Expand Up @@ -54,13 +51,16 @@ const WorkspacesPage: FC = () => {
query: filterProps.filter.query,
});

const experimentEnabled = useIsWorkspaceActionsEnabled();
const { entitlements } = useDashboard();
const schedulingEnabled =
entitlements.features["advanced_template_scheduling"].enabled;

// If workspace actions are enabled we need to fetch the dormant
// workspaces as well. This lets us determine whether we should
// show a banner to the user indicating that some of their workspaces
// are at risk of being deleted.
useEffect(() => {
if (experimentEnabled) {
if (schedulingEnabled) {
const includesDormant = filterProps.filter.query.includes("dormant_at");
const dormantQuery = includesDormant
? filterProps.filter.query
Expand All @@ -82,12 +82,11 @@ const WorkspacesPage: FC = () => {
// like dormant workspaces don't exist.
setDormantWorkspaces([]);
}
}, [experimentEnabled, data, filterProps.filter.query]);
}, [schedulingEnabled, data, filterProps.filter.query]);
const updateWorkspace = useWorkspaceUpdate(queryKey);
const [checkedWorkspaces, setCheckedWorkspaces] = useState<Workspace[]>([]);
const [isDeletingAll, setIsDeletingAll] = useState(false);
const [urlSearchParams] = searchParamsResult;
const { entitlements } = useDashboard();
const canCheckWorkspaces =
entitlements.features["workspace_batch_actions"].enabled;

Expand Down
7 changes: 5 additions & 2 deletions site/src/pages/WorkspacesPage/filter/filter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FC } from "react";
import Box from "@mui/material/Box";
import { useIsWorkspaceActionsEnabled } from "components/Dashboard/DashboardProvider";
import { useDashboard } from "components/Dashboard/DashboardProvider";

import { Avatar, AvatarProps } from "components/Avatar/Avatar";
import { Palette, PaletteColor } from "@mui/material/styles";
import { TemplateFilterMenu, StatusFilterMenu } from "./menus";
Expand Down Expand Up @@ -68,7 +69,9 @@ export const WorkspacesFilter = ({
error,
menus,
}: WorkspaceFilterProps) => {
const actionsEnabled = useIsWorkspaceActionsEnabled();
const { entitlements } = useDashboard();
const actionsEnabled =
entitlements.features["advanced_template_scheduling"].enabled;
const presets = actionsEnabled ? PRESET_FILTERS : PRESETS_WITH_DORMANT;

return (
Expand Down