mirror of
https://github.com/coder/coder.git
synced 2026-10-25 09:42:55 +08:00
chore: upgrade biome to v2 (#19362)
Guide for migration: https://biomejs.dev/guides/upgrade-to-biome-v2/
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
MockWorkspaceAgent,
|
||||
MockWorkspaceApp,
|
||||
} from "testHelpers/entities";
|
||||
import { SESSION_TOKEN_PLACEHOLDER, getAppHref } from "./apps";
|
||||
import { getAppHref, SESSION_TOKEN_PLACEHOLDER } from "./apps";
|
||||
|
||||
describe("getAppHref", () => {
|
||||
it("returns the URL without changes when external app has regular URL", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceBuild } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { BuildAvatar } from "./BuildAvatar";
|
||||
|
||||
const meta: Meta<typeof BuildAvatar> = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type Interpolation, type Theme, css } from "@emotion/react";
|
||||
import { css, type Interpolation, type Theme } from "@emotion/react";
|
||||
import { InlineMarkdown } from "components/Markdown/Markdown";
|
||||
import type { FC } from "react";
|
||||
import { readableForegroundColor } from "utils/colors";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { screen } from "@testing-library/react";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { renderWithAuth } from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { DashboardLayout } from "./DashboardLayout";
|
||||
|
||||
test("Show the new Coder version notification", async () => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Loader } from "components/Loader/Loader";
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { canViewAnyOrganization } from "modules/permissions";
|
||||
import { type FC, type PropsWithChildren, createContext } from "react";
|
||||
import { createContext, type FC, type PropsWithChildren } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { selectFeatureVisibility } from "./entitlements";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import {
|
||||
DeploymentHealthUnhealthy,
|
||||
MockDeploymentStats,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { DeploymentBannerView } from "./DeploymentBannerView";
|
||||
|
||||
const meta: Meta<typeof DeploymentBannerView> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CSSInterpolation } from "@emotion/css/dist/declarations/src/create-instance";
|
||||
import { type Interpolation, type Theme, css, useTheme } from "@emotion/react";
|
||||
import { css, type Interpolation, type Theme, useTheme } from "@emotion/react";
|
||||
import Button from "@mui/material/Button";
|
||||
import Link from "@mui/material/Link";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
@@ -16,13 +16,16 @@ import { VSCodeIcon } from "components/Icons/VSCodeIcon";
|
||||
import { Stack } from "components/Stack/Stack";
|
||||
import dayjs from "dayjs";
|
||||
import { type ClassName, useClassName } from "hooks/useClassName";
|
||||
import { CloudDownloadIcon } from "lucide-react";
|
||||
import { CloudUploadIcon } from "lucide-react";
|
||||
import { GitCompareArrowsIcon } from "lucide-react";
|
||||
import { GaugeIcon } from "lucide-react";
|
||||
import { AppWindowIcon } from "lucide-react";
|
||||
import { RotateCwIcon, WrenchIcon } from "lucide-react";
|
||||
import { CircleAlertIcon } from "lucide-react";
|
||||
import {
|
||||
AppWindowIcon,
|
||||
CircleAlertIcon,
|
||||
CloudDownloadIcon,
|
||||
CloudUploadIcon,
|
||||
GaugeIcon,
|
||||
GitCompareArrowsIcon,
|
||||
RotateCwIcon,
|
||||
WrenchIcon,
|
||||
} from "lucide-react";
|
||||
import prettyBytes from "pretty-bytes";
|
||||
import {
|
||||
type FC,
|
||||
@@ -139,7 +142,7 @@ export const DeploymentBannerView: FC<DeploymentBannerViewProps> = ({
|
||||
</Stack>
|
||||
</>
|
||||
) : (
|
||||
<>Status of your Coder deployment. Only visible for admins!</>
|
||||
"Status of your Coder deployment. Only visible for admins!"
|
||||
)
|
||||
}
|
||||
open={process.env.STORYBOOK === "true" ? true : undefined}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { LicenseBannerView } from "./LicenseBannerView";
|
||||
|
||||
const meta: Meta<typeof LicenseBannerView> = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
type CSSObject,
|
||||
css,
|
||||
type Interpolation,
|
||||
type Theme,
|
||||
css,
|
||||
useTheme,
|
||||
} from "@emotion/react";
|
||||
import Link from "@mui/material/Link";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type Interpolation, type Theme, css, useTheme } from "@emotion/react";
|
||||
import { css, type Interpolation, type Theme, useTheme } from "@emotion/react";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import { Button } from "components/Button/Button";
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { PointerEventsCheckLevel } from "@testing-library/user-event";
|
||||
import type { FC } from "react";
|
||||
import { fn, userEvent, within } from "storybook/test";
|
||||
import {
|
||||
MockPrimaryWorkspaceProxy,
|
||||
MockProxyLatencies,
|
||||
@@ -10,6 +6,10 @@ import {
|
||||
MockUserOwner,
|
||||
MockWorkspaceProxies,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { PointerEventsCheckLevel } from "@testing-library/user-event";
|
||||
import type { FC } from "react";
|
||||
import { fn, userEvent, within } from "storybook/test";
|
||||
import { MobileMenu } from "./MobileMenu";
|
||||
|
||||
const meta: Meta<typeof MobileMenu> = {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { render, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { App } from "App";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import {
|
||||
MockEntitlementsWithAuditLog,
|
||||
MockMemberPermissions,
|
||||
} from "testHelpers/entities";
|
||||
import { server } from "testHelpers/server";
|
||||
import { render, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { HttpResponse, http } from "msw";
|
||||
|
||||
/**
|
||||
* The LicenseBanner, mounted above the AppRouter, fetches entitlements. Thus, to test their
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import { chromaticWithTablet } from "testHelpers/chromatic";
|
||||
import { MockUserMember, MockUserOwner } from "testHelpers/entities";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import { NavbarView } from "./NavbarView";
|
||||
|
||||
const meta: Meta<typeof NavbarView> = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MockPrimaryWorkspaceProxy, MockUserOwner } from "testHelpers/entities";
|
||||
import { renderWithAuth } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import type { ProxyContextValue } from "contexts/ProxyContext";
|
||||
import { MockPrimaryWorkspaceProxy, MockUserOwner } from "testHelpers/entities";
|
||||
import { renderWithAuth } from "testHelpers/renderHelpers";
|
||||
import { NavbarView } from "./NavbarView";
|
||||
|
||||
const proxyContextValue: ProxyContextValue = {
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { getAuthorizationKey } from "api/queries/authCheck";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { AuthProvider } from "contexts/auth/AuthProvider";
|
||||
import { permissionChecks } from "modules/permissions";
|
||||
import { fn, userEvent, within } from "storybook/test";
|
||||
import {
|
||||
MockAuthMethodsAll,
|
||||
MockPermissions,
|
||||
@@ -12,6 +6,12 @@ import {
|
||||
MockWorkspaceProxies,
|
||||
} from "testHelpers/entities";
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { getAuthorizationKey } from "api/queries/authCheck";
|
||||
import { AuthProvider } from "contexts/auth/AuthProvider";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { permissionChecks } from "modules/permissions";
|
||||
import { fn, userEvent, within } from "storybook/test";
|
||||
import { ProxyMenu } from "./ProxyMenu";
|
||||
|
||||
const defaultProxyContextValue = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
||||
import { MockBuildInfo, MockUserOwner } from "testHelpers/entities";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
||||
import { UserDropdown } from "./UserDropdown";
|
||||
|
||||
const meta: Meta<typeof UserDropdown> = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { screen } from "@testing-library/react";
|
||||
import { Popover } from "components/deprecated/Popover/Popover";
|
||||
import { MockUserOwner } from "testHelpers/entities";
|
||||
import { render, waitForLoaderToBeRemoved } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { Popover } from "components/deprecated/Popover/Popover";
|
||||
import { Language, UserDropdownContent } from "./UserDropdownContent";
|
||||
|
||||
describe("UserDropdownContent", () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
type CSSObject,
|
||||
css,
|
||||
type Interpolation,
|
||||
type Theme,
|
||||
css,
|
||||
} from "@emotion/react";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
@@ -10,15 +10,18 @@ import type { SvgIconProps } from "@mui/material/SvgIcon";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import type * as TypesGen from "api/typesGenerated";
|
||||
import { CopyButton } from "components/CopyButton/CopyButton";
|
||||
import { usePopover } from "components/deprecated/Popover/Popover";
|
||||
import { ExternalImage } from "components/ExternalImage/ExternalImage";
|
||||
import { Stack } from "components/Stack/Stack";
|
||||
import { usePopover } from "components/deprecated/Popover/Popover";
|
||||
import { BookOpenTextIcon } from "lucide-react";
|
||||
import { BugIcon } from "lucide-react";
|
||||
import { CircleUserIcon } from "lucide-react";
|
||||
import { LogOutIcon } from "lucide-react";
|
||||
import { MessageSquareIcon } from "lucide-react";
|
||||
import { MonitorDownIcon, SquareArrowOutUpRightIcon } from "lucide-react";
|
||||
import {
|
||||
BookOpenTextIcon,
|
||||
BugIcon,
|
||||
CircleUserIcon,
|
||||
LogOutIcon,
|
||||
MessageSquareIcon,
|
||||
MonitorDownIcon,
|
||||
SquareArrowOutUpRightIcon,
|
||||
} from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { Link } from "react-router";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { act, renderHook, waitFor } from "@testing-library/react";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "react-query";
|
||||
import { MockUpdateCheck } from "testHelpers/entities";
|
||||
import { server } from "testHelpers/server";
|
||||
import { act, renderHook, waitFor } from "@testing-library/react";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "react-query";
|
||||
import { useUpdateCheck } from "./useUpdateCheck";
|
||||
|
||||
const createWrapper = (): FC<PropsWithChildren> => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type * as TypesGen from "api/typesGenerated";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
import type { PreviewParameter } from "api/typesGenerated";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
type UseSyncFormParametersProps = {
|
||||
parameters: readonly PreviewParameter[];
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { DeploymentConfig } from "api/api";
|
||||
import { deploymentConfig } from "api/queries/deployment";
|
||||
import { ErrorAlert } from "components/Alert/ErrorAlert";
|
||||
import { Loader } from "components/Loader/Loader";
|
||||
import { type FC, createContext, useContext } from "react";
|
||||
import { createContext, type FC, useContext } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { Outlet } from "react-router";
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import {
|
||||
MockBuildInfo,
|
||||
MockNoPermissions,
|
||||
MockPermissions,
|
||||
} from "testHelpers/entities";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { DeploymentSidebarView } from "./DeploymentSidebarView";
|
||||
|
||||
const meta: Meta<typeof DeploymentSidebarView> = {
|
||||
|
||||
@@ -12,11 +12,11 @@ import {
|
||||
import { Loader } from "components/Loader/Loader";
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import {
|
||||
type OrganizationPermissions,
|
||||
canViewOrganization,
|
||||
type OrganizationPermissions,
|
||||
} from "modules/permissions/organizations";
|
||||
import NotFoundPage from "pages/404Page/404Page";
|
||||
import { type FC, Suspense, createContext, useContext } from "react";
|
||||
import { createContext, type FC, Suspense, useContext } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { Outlet, useParams } from "react-router";
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import type { Organization } from "api/typesGenerated";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import {
|
||||
MockNoOrganizationPermissions,
|
||||
MockNoPermissions,
|
||||
@@ -10,6 +7,9 @@ import {
|
||||
MockPermissions,
|
||||
} from "testHelpers/entities";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import type { Organization } from "api/typesGenerated";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import { OrganizationSidebarView } from "./OrganizationSidebarView";
|
||||
|
||||
const meta: Meta<typeof OrganizationSidebarView> = {
|
||||
|
||||
@@ -163,60 +163,58 @@ const OrganizationSettingsNavigation: FC<
|
||||
OrganizationSettingsNavigationProps
|
||||
> = ({ organization, orgPermissions }) => {
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col gap-1 my-2">
|
||||
<SettingsSidebarNavItem end href={urlForSubpage(organization.name)}>
|
||||
Members
|
||||
<div className="flex flex-col gap-1 my-2">
|
||||
<SettingsSidebarNavItem end href={urlForSubpage(organization.name)}>
|
||||
Members
|
||||
</SettingsSidebarNavItem>
|
||||
{orgPermissions.viewGroups && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "groups")}
|
||||
>
|
||||
Groups
|
||||
</SettingsSidebarNavItem>
|
||||
{orgPermissions.viewGroups && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "groups")}
|
||||
>
|
||||
Groups
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
{orgPermissions.viewOrgRoles && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "roles")}
|
||||
>
|
||||
Roles
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
{orgPermissions.viewProvisioners &&
|
||||
orgPermissions.viewProvisionerJobs && (
|
||||
<>
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "provisioners")}
|
||||
>
|
||||
Provisioners
|
||||
</SettingsSidebarNavItem>
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "provisioner-keys")}
|
||||
>
|
||||
Provisioner Keys
|
||||
</SettingsSidebarNavItem>
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "provisioner-jobs")}
|
||||
>
|
||||
Provisioner Jobs
|
||||
</SettingsSidebarNavItem>
|
||||
</>
|
||||
)}
|
||||
{orgPermissions.viewOrgRoles && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "roles")}
|
||||
>
|
||||
Roles
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
{orgPermissions.viewProvisioners &&
|
||||
orgPermissions.viewProvisionerJobs && (
|
||||
<>
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "provisioners")}
|
||||
>
|
||||
Provisioners
|
||||
</SettingsSidebarNavItem>
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "provisioner-keys")}
|
||||
>
|
||||
Provisioner Keys
|
||||
</SettingsSidebarNavItem>
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "provisioner-jobs")}
|
||||
>
|
||||
Provisioner Jobs
|
||||
</SettingsSidebarNavItem>
|
||||
</>
|
||||
)}
|
||||
{orgPermissions.viewIdpSyncSettings && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "idp-sync")}
|
||||
>
|
||||
IdP Sync
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
{orgPermissions.editSettings && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "settings")}
|
||||
>
|
||||
Settings
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
{orgPermissions.viewIdpSyncSettings && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "idp-sync")}
|
||||
>
|
||||
IdP Sync
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
{orgPermissions.editSettings && (
|
||||
<SettingsSidebarNavItem
|
||||
href={urlForSubpage(organization.name, "settings")}
|
||||
>
|
||||
Settings
|
||||
</SettingsSidebarNavItem>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ function withFilter(path: string, filter: string) {
|
||||
|
||||
export const linkToAuditing = "/audit";
|
||||
|
||||
const linkToUsers = withFilter("/deployment/users", "status:active");
|
||||
const _linkToUsers = withFilter("/deployment/users", "status:active");
|
||||
|
||||
export const linkToTemplate =
|
||||
(organizationName: string, templateName: string): LinkThunk =>
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
LayoutTemplateIcon,
|
||||
UserIcon,
|
||||
} from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import type React from "react";
|
||||
import type { FC } from "react";
|
||||
|
||||
const InboxNotificationFallbackIcons = [
|
||||
InboxNotificationFallbackIconAccount,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockNotification } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, userEvent, within } from "storybook/test";
|
||||
import { MockNotification } from "testHelpers/entities";
|
||||
import { daysAgo } from "utils/time";
|
||||
import { InboxItem } from "./InboxItem";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockNotifications } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, userEvent, within } from "storybook/test";
|
||||
import { MockNotifications } from "testHelpers/entities";
|
||||
import { InboxPopover } from "./InboxPopover";
|
||||
|
||||
const meta: Meta<typeof InboxPopover> = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
||||
import { MockNotifications, mockApiError } from "testHelpers/entities";
|
||||
import { withGlobalSnackbar } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
||||
import { NotificationsInbox } from "./NotificationsInbox";
|
||||
|
||||
const meta: Meta<typeof NotificationsInbox> = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { MailIcon } from "lucide-react";
|
||||
import { WebhookIcon } from "lucide-react";
|
||||
import { MailIcon, WebhookIcon } from "lucide-react";
|
||||
|
||||
// TODO: This should be provided by the auto generated types from codersdk
|
||||
const notificationMethods = ["smtp", "webhook"] as const;
|
||||
|
||||
@@ -2,8 +2,7 @@ import { useTheme } from "@emotion/react";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import type { HealthMessage, ProvisionerDaemon } from "api/typesGenerated";
|
||||
import { Pill } from "components/Pill/Pill";
|
||||
import { Building2Icon } from "lucide-react";
|
||||
import { UserIcon } from "lucide-react";
|
||||
import { Building2Icon, UserIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { createDayString } from "utils/createDayString";
|
||||
import { ProvisionerTag } from "./ProvisionerTag";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AlertVariant, ProvisionerAlert } from "./ProvisionerAlert";
|
||||
|
||||
const meta: Meta<typeof ProvisionerAlert> = {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Theme } from "@emotion/react";
|
||||
import AlertTitle from "@mui/material/AlertTitle";
|
||||
import { Alert, type AlertColor } from "components/Alert/Alert";
|
||||
import { AlertDetail } from "components/Alert/Alert";
|
||||
import { Alert, type AlertColor, AlertDetail } from "components/Alert/Alert";
|
||||
import { ProvisionerTag } from "modules/provisioners/ProvisionerTag";
|
||||
import type { FC } from "react";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { MockTemplateVersion } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AlertVariant } from "./ProvisionerAlert";
|
||||
import { ProvisionerStatusAlert } from "./ProvisionerStatusAlert";
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { WorkspaceApp } from "api/typesGenerated";
|
||||
import type { Workspace, WorkspaceAgent } from "api/typesGenerated";
|
||||
import type {
|
||||
Workspace,
|
||||
WorkspaceAgent,
|
||||
WorkspaceApp,
|
||||
} from "api/typesGenerated";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
@@ -39,11 +42,9 @@ export const AgentApps: FC<AgentAppsProps> = ({
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : (
|
||||
<>
|
||||
{section.apps.map((app) => (
|
||||
<AppLink key={app.slug} app={app} agent={agent} workspace={workspace} />
|
||||
))}
|
||||
</>
|
||||
section.apps.map((app) => (
|
||||
<AppLink key={app.slug} app={app} agent={agent} workspace={workspace} />
|
||||
))
|
||||
);
|
||||
};
|
||||
|
||||
@@ -68,7 +69,7 @@ type AgentAppSection = {
|
||||
export function organizeAgentApps(
|
||||
apps: readonly WorkspaceApp[],
|
||||
): AgentAppSection[] {
|
||||
let currentSection: AgentAppSection | undefined = undefined;
|
||||
let currentSection: AgentAppSection | undefined;
|
||||
const appGroups: AgentAppSection[] = [];
|
||||
const groupsByName = new Map<string, AgentAppSection>();
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import {
|
||||
MockListeningPortsResponse,
|
||||
@@ -18,6 +16,8 @@ import {
|
||||
withDashboardProvider,
|
||||
withProxyProvider,
|
||||
} from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { AgentDevcontainerCard } from "./AgentDevcontainerCard";
|
||||
|
||||
const meta: Meta<typeof AgentDevcontainerCard> = {
|
||||
|
||||
@@ -296,28 +296,26 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
|
||||
|
||||
{showSubAgentApps && (
|
||||
<section className={appsClasses}>
|
||||
<>
|
||||
{showVSCode && (
|
||||
<VSCodeDevContainerButton
|
||||
userName={workspace.owner_name}
|
||||
workspaceName={workspace.name}
|
||||
devContainerName={devcontainer.container.name}
|
||||
devContainerFolder={subAgent?.directory ?? ""}
|
||||
localWorkspaceFolder={devcontainer.workspace_folder}
|
||||
localConfigFile={devcontainer.config_path || ""}
|
||||
displayApps={displayApps} // TODO(mafredri): We could use subAgent display apps here but we currently set none.
|
||||
agentName={parentAgent.name}
|
||||
/>
|
||||
)}
|
||||
{appSections.map((section, i) => (
|
||||
<AgentApps
|
||||
key={section.group ?? i}
|
||||
section={section}
|
||||
agent={subAgent}
|
||||
workspace={workspace}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
{showVSCode && (
|
||||
<VSCodeDevContainerButton
|
||||
userName={workspace.owner_name}
|
||||
workspaceName={workspace.name}
|
||||
devContainerName={devcontainer.container.name}
|
||||
devContainerFolder={subAgent?.directory ?? ""}
|
||||
localWorkspaceFolder={devcontainer.workspace_folder}
|
||||
localConfigFile={devcontainer.config_path || ""}
|
||||
displayApps={displayApps} // TODO(mafredri): We could use subAgent display apps here but we currently set none.
|
||||
agentName={parentAgent.name}
|
||||
/>
|
||||
)}
|
||||
{appSections.map((section, i) => (
|
||||
<AgentApps
|
||||
key={section.group ?? i}
|
||||
section={section}
|
||||
agent={subAgent}
|
||||
workspace={workspace}
|
||||
/>
|
||||
))}
|
||||
|
||||
{displayApps.includes("web_terminal") && (
|
||||
<TerminalLink
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { type Theme, useTheme } from "@emotion/react";
|
||||
import type { DERPRegion, WorkspaceAgent } from "api/typesGenerated";
|
||||
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
|
||||
import {
|
||||
HelpTooltip,
|
||||
HelpTooltipContent,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
HelpTooltipTitle,
|
||||
} from "components/HelpTooltip/HelpTooltip";
|
||||
import { Stack } from "components/Stack/Stack";
|
||||
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
|
||||
import type { FC } from "react";
|
||||
import { getLatencyColor } from "utils/latency";
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ export const AgentMetadata: FC<AgentMetadataProps> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
let timeoutId: number | undefined = undefined;
|
||||
let timeoutId: number | undefined;
|
||||
let activeSocket: OneWayWebSocket<ServerSentEvent> | null = null;
|
||||
let retries = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import type { WorkspaceAgent } from "api/typesGenerated";
|
||||
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
|
||||
import {
|
||||
HelpTooltip,
|
||||
HelpTooltipAction,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
HelpTooltipTitle,
|
||||
} from "components/HelpTooltip/HelpTooltip";
|
||||
import { Stack } from "components/Stack/Stack";
|
||||
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
|
||||
import { RotateCcwIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { agentVersionStatus } from "../../utils/workspace";
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { API } from "api/api";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { spyOn, userEvent, within } from "storybook/test";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import * as M from "testHelpers/entities";
|
||||
import {
|
||||
@@ -9,6 +5,10 @@ import {
|
||||
withProxyProvider,
|
||||
withWebSocket,
|
||||
} from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { API } from "api/api";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { spyOn, userEvent, within } from "storybook/test";
|
||||
import { AgentRow } from "./AgentRow";
|
||||
|
||||
const defaultAgentMetadata = [
|
||||
|
||||
@@ -37,9 +37,9 @@ import { DownloadAgentLogsButton } from "./DownloadAgentLogsButton";
|
||||
import { PortForwardButton } from "./PortForwardButton";
|
||||
import { AgentSSHButton } from "./SSHButton/SSHButton";
|
||||
import { TerminalLink } from "./TerminalLink/TerminalLink";
|
||||
import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton";
|
||||
import { useAgentContainers } from "./useAgentContainers";
|
||||
import { useAgentLogs } from "./useAgentLogs";
|
||||
import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton";
|
||||
|
||||
interface AgentRowProps {
|
||||
agent: WorkspaceAgent;
|
||||
@@ -335,7 +335,7 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
Logs
|
||||
</Button>
|
||||
<Divider orientation="vertical" variant="middle" flexItem />
|
||||
<DownloadAgentLogsButton workspaceId={workspace.id} agent={agent} />
|
||||
<DownloadAgentLogsButton agent={agent} />
|
||||
</Stack>
|
||||
</section>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceAgent, MockWorkspaceApp } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AgentRowPreview } from "./AgentRowPreview";
|
||||
|
||||
const meta: Meta<typeof AgentRowPreview> = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import {
|
||||
type DisplayApp,
|
||||
DisplayApps,
|
||||
type WorkspaceAgent,
|
||||
} from "api/typesGenerated";
|
||||
import { MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import { AgentRowPreview } from "./AgentRowPreview";
|
||||
import { DisplayAppNameMap } from "./AppLink/AppLink";
|
||||
|
||||
|
||||
@@ -93,10 +93,8 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
|
||||
{/* We display all modules returned in agent.apps */}
|
||||
{agent.apps.map((app) => (
|
||||
<AppPreview key={app.slug}>
|
||||
<>
|
||||
<BaseIcon app={app} />
|
||||
{app.display_name}
|
||||
</>
|
||||
<BaseIcon app={app} />
|
||||
{app.display_name}
|
||||
</AppPreview>
|
||||
))}
|
||||
{/* Additionally, we display any apps that are visible, e.g.
|
||||
|
||||
@@ -6,13 +6,13 @@ import type {
|
||||
WorkspaceAgentDevcontainer,
|
||||
} from "api/typesGenerated";
|
||||
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
|
||||
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
|
||||
import {
|
||||
HelpTooltip,
|
||||
HelpTooltipContent,
|
||||
HelpTooltipText,
|
||||
HelpTooltipTitle,
|
||||
} from "components/HelpTooltip/HelpTooltip";
|
||||
import { PopoverTrigger } from "components/deprecated/Popover/Popover";
|
||||
import { TriangleAlertIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import {
|
||||
MockPrimaryWorkspaceProxy,
|
||||
MockWorkspace,
|
||||
@@ -8,6 +6,8 @@ import {
|
||||
MockWorkspaceProxies,
|
||||
} from "testHelpers/entities";
|
||||
import { withGlobalSnackbar, withProxyProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { AppLink } from "./AppLink";
|
||||
|
||||
const meta: Meta<typeof AppLink> = {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { agentLogsKey } from "api/queries/workspaces";
|
||||
import type { WorkspaceAgentLog } from "api/typesGenerated";
|
||||
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
||||
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { DownloadAgentLogsButton } from "./DownloadAgentLogsButton";
|
||||
|
||||
const meta: Meta<typeof DownloadAgentLogsButton> = {
|
||||
title: "modules/resources/DownloadAgentLogsButton",
|
||||
component: DownloadAgentLogsButton,
|
||||
args: {
|
||||
workspaceId: MockWorkspace.id,
|
||||
agent: MockWorkspaceAgent,
|
||||
},
|
||||
parameters: {
|
||||
|
||||
@@ -8,13 +8,11 @@ import { type FC, useState } from "react";
|
||||
import { useQueryClient } from "react-query";
|
||||
|
||||
type DownloadAgentLogsButtonProps = {
|
||||
workspaceId: string;
|
||||
agent: Pick<WorkspaceAgent, "id" | "name" | "status" | "lifecycle_state">;
|
||||
download?: (file: Blob, filename: string) => void;
|
||||
};
|
||||
|
||||
export const DownloadAgentLogsButton: FC<DownloadAgentLogsButtonProps> = ({
|
||||
workspaceId,
|
||||
agent,
|
||||
download = saveAs,
|
||||
}) => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import {
|
||||
MockListeningPortsResponse,
|
||||
MockSharedPortsResponse,
|
||||
@@ -8,6 +6,8 @@ import {
|
||||
MockWorkspaceAgent,
|
||||
} from "testHelpers/entities";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import { PortForwardButton } from "./PortForwardButton";
|
||||
|
||||
const meta: Meta<typeof PortForwardButton> = {
|
||||
|
||||
@@ -26,6 +26,11 @@ import {
|
||||
WorkspaceAppSharingLevels,
|
||||
} from "api/typesGenerated";
|
||||
import { Button } from "components/Button/Button";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "components/deprecated/Popover/Popover";
|
||||
import {
|
||||
HelpTooltipLink,
|
||||
HelpTooltipText,
|
||||
@@ -38,11 +43,6 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "components/Tooltip/Tooltip";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "components/deprecated/Popover/Popover";
|
||||
import { useFormik } from "formik";
|
||||
import { type ClassName, useClassName } from "hooks/useClassName";
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import {
|
||||
MockListeningPortsResponse,
|
||||
MockSharedPortsResponse,
|
||||
@@ -7,6 +5,8 @@ import {
|
||||
MockWorkspace,
|
||||
MockWorkspaceAgent,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import { PortForwardPopoverView } from "./PortForwardButton";
|
||||
|
||||
const meta: Meta<typeof PortForwardPopoverView> = {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { screen } from "@testing-library/react";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import {
|
||||
MockListeningPortsResponse,
|
||||
MockTemplate,
|
||||
@@ -10,6 +8,8 @@ import {
|
||||
createTestQueryClient,
|
||||
renderComponent,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import { PortForwardPopoverView } from "./PortForwardButton";
|
||||
|
||||
describe("Port Forward Popover View", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceResource } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { ResourceAvatar } from "./ResourceAvatar";
|
||||
|
||||
const meta: Meta<typeof ResourceAvatar> = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceResource } from "testHelpers/entities";
|
||||
import { withProxyProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AgentRowPreview } from "./AgentRowPreview";
|
||||
import { ResourceCard } from "./ResourceCard";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { screen } from "@testing-library/react";
|
||||
import type { WorkspaceResourceMetadata } from "api/typesGenerated";
|
||||
import { MockWorkspaceResource } from "testHelpers/entities";
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import type { WorkspaceResourceMetadata } from "api/typesGenerated";
|
||||
import { ResourceCard } from "./ResourceCard";
|
||||
|
||||
describe("Resource Card", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import {
|
||||
MockWorkspaceResource,
|
||||
MockWorkspaceResourceMultipleAgents,
|
||||
} from "testHelpers/entities";
|
||||
import { withProxyProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AgentRowPreview } from "./AgentRowPreview";
|
||||
import { Resources } from "./Resources";
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { API } from "api/api";
|
||||
import { spyOn, userEvent, within } from "storybook/test";
|
||||
import {
|
||||
MockDeploymentSSH,
|
||||
MockWorkspace,
|
||||
MockWorkspaceAgent,
|
||||
} from "testHelpers/entities";
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { API } from "api/api";
|
||||
import { spyOn, userEvent, within } from "storybook/test";
|
||||
import { AgentSSHButton } from "./SSHButton";
|
||||
|
||||
const meta: Meta<typeof AgentSSHButton> = {
|
||||
|
||||
@@ -2,17 +2,17 @@ import type { Interpolation, Theme } from "@emotion/react";
|
||||
import { deploymentSSHConfig } from "api/queries/deployment";
|
||||
import { Button } from "components/Button/Button";
|
||||
import { CodeExample } from "components/CodeExample/CodeExample";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "components/deprecated/Popover/Popover";
|
||||
import {
|
||||
HelpTooltipLink,
|
||||
HelpTooltipLinksGroup,
|
||||
HelpTooltipText,
|
||||
} from "components/HelpTooltip/HelpTooltip";
|
||||
import { Stack } from "components/Stack/Stack";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "components/deprecated/Popover/Popover";
|
||||
import { type ClassName, useClassName } from "hooks/useClassName";
|
||||
import { ChevronDownIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type Interpolation, type Theme, css } from "@emotion/react";
|
||||
import { css, type Interpolation, type Theme } from "@emotion/react";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { CopyableValue } from "components/CopyableValue/CopyableValue";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspace } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { TerminalLink } from "./TerminalLink";
|
||||
|
||||
const meta: Meta<typeof TerminalLink> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { VSCodeDesktopButton } from "./VSCodeDesktopButton";
|
||||
|
||||
const meta: Meta<typeof VSCodeDesktopButton> = {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { VSCodeDevContainerButton } from "./VSCodeDevContainerButton";
|
||||
|
||||
const meta: Meta<typeof VSCodeDevContainerButton> = {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { renderHook, waitFor } from "@testing-library/react";
|
||||
import * as API from "api/api";
|
||||
import type { WorkspaceAgentListContainersResponse } from "api/typesGenerated";
|
||||
import * as GlobalSnackbar from "components/GlobalSnackbar/utils";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { act } from "react";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import {
|
||||
MockWorkspaceAgent,
|
||||
MockWorkspaceAgentDevcontainer,
|
||||
} from "testHelpers/entities";
|
||||
import { createTestQueryClient } from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { renderHook, waitFor } from "@testing-library/react";
|
||||
import * as API from "api/api";
|
||||
import type { WorkspaceAgentListContainersResponse } from "api/typesGenerated";
|
||||
import * as GlobalSnackbar from "components/GlobalSnackbar/utils";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { act } from "react";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import type { OneWayWebSocket } from "utils/OneWayWebSocket";
|
||||
import { useAgentContainers } from "./useAgentContainers";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { renderHook, waitFor } from "@testing-library/react";
|
||||
import type { WorkspaceAgentLog } from "api/typesGenerated";
|
||||
import WS from "jest-websocket-mock";
|
||||
import { MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { useAgentLogs } from "./useAgentLogs";
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
*/
|
||||
import { API } from "api/api";
|
||||
import { Avatar } from "components/Avatar/Avatar";
|
||||
import {
|
||||
type UseFilterMenuOptions,
|
||||
useFilterMenu,
|
||||
} from "components/Filter/menu";
|
||||
import {
|
||||
SelectFilter,
|
||||
type SelectFilterOption,
|
||||
SelectFilterSearch,
|
||||
} from "components/Filter/SelectFilter";
|
||||
import {
|
||||
type UseFilterMenuOptions,
|
||||
useFilterMenu,
|
||||
} from "components/Filter/menu";
|
||||
import type { FC } from "react";
|
||||
|
||||
// Organization helpers ////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import {
|
||||
MockTemplateExample,
|
||||
MockTemplateExample2,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { TemplateExampleCard } from "./TemplateExampleCard";
|
||||
|
||||
const meta: Meta<typeof TemplateExampleCard> = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { FileTree } from "utils/filetree";
|
||||
import { TemplateFileTree } from "./TemplateFileTree";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { TemplateFiles } from "./TemplateFiles";
|
||||
|
||||
const exampleFiles = {
|
||||
|
||||
+1
-1
@@ -1,4 +1,3 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import {
|
||||
MockWorkspaceAgent,
|
||||
MockWorkspaceAgentConnecting,
|
||||
@@ -6,6 +5,7 @@ import {
|
||||
MockWorkspaceResource,
|
||||
MockWorkspaceVolumeResource,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { TemplateResourcesTable } from "./TemplateResourcesTable";
|
||||
|
||||
const meta: Meta<typeof TemplateResourcesTable> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockPreviewParameter } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { DynamicParameter } from "./DynamicParameter";
|
||||
|
||||
const meta: Meta<typeof DynamicParameter> = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { render } from "testHelpers/renderHelpers";
|
||||
import { act, fireEvent, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import type { PreviewParameter } from "api/typesGenerated";
|
||||
import { render } from "testHelpers/renderHelpers";
|
||||
import { DynamicParameter } from "./DynamicParameter";
|
||||
|
||||
const createMockParameter = (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceAppStatus } from "testHelpers/entities";
|
||||
import { withProxyProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { WorkspaceAppStatus } from "./WorkspaceAppStatus";
|
||||
|
||||
const meta: Meta<typeof WorkspaceAppStatus> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceBuild } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { WorkspaceBuildData } from "./WorkspaceBuildData";
|
||||
|
||||
const meta: Meta<typeof WorkspaceBuildData> = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { MockWorkspaceBuildLogs } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { WorkspaceBuildLogs } from "./WorkspaceBuildLogs";
|
||||
|
||||
const meta: Meta<typeof WorkspaceBuildLogs> = {
|
||||
|
||||
@@ -54,7 +54,7 @@ export const WorkspaceBuildLogs: FC<WorkspaceBuildLogsProps> = ({
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
|
||||
const processedLogs = useMemo(() => {
|
||||
const _processedLogs = useMemo(() => {
|
||||
const allLogs = logs || [];
|
||||
|
||||
// Add synthetic overflow message if needed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockDormantWorkspace } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import { MockDormantWorkspace } from "testHelpers/entities";
|
||||
import { WorkspaceDormantBadge } from "./WorkspaceDormantBadge";
|
||||
|
||||
const meta: Meta<typeof WorkspaceDormantBadge> = {
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { templateVersionsQueryKey } from "api/queries/templates";
|
||||
import {
|
||||
MockTemplateVersion,
|
||||
MockTemplateVersionWithMarkdownMessage,
|
||||
MockWorkspace,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { templateVersionsQueryKey } from "api/queries/templates";
|
||||
import { ChangeWorkspaceVersionDialog } from "./ChangeWorkspaceVersionDialog";
|
||||
|
||||
const noMessage = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { agentLogsKey, buildLogsKey } from "api/queries/workspaces";
|
||||
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
||||
import { MockWorkspace, MockWorkspaceAgent } from "testHelpers/entities";
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import { DownloadLogsDialog } from "./DownloadLogsDialog";
|
||||
|
||||
const meta: Meta<typeof DownloadLogsDialog> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockFailedWorkspace, MockWorkspace } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { daysAgo } from "utils/time";
|
||||
import { WorkspaceDeleteDialog } from "./WorkspaceDeleteDialog";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { MissingBuildParameters, ParameterValidationError } from "api/api";
|
||||
import { isApiError } from "api/errors";
|
||||
import { type ApiError, getErrorMessage } from "api/errors";
|
||||
import { type ApiError, getErrorMessage, isApiError } from "api/errors";
|
||||
import {
|
||||
changeVersion,
|
||||
deleteWorkspace,
|
||||
@@ -32,8 +31,8 @@ import { ChangeWorkspaceVersionDialog } from "./ChangeWorkspaceVersionDialog";
|
||||
import { DownloadLogsDialog } from "./DownloadLogsDialog";
|
||||
import { UpdateBuildParametersDialog } from "./UpdateBuildParametersDialog";
|
||||
import { UpdateBuildParametersDialogExperimental } from "./UpdateBuildParametersDialogExperimental";
|
||||
import { WorkspaceDeleteDialog } from "./WorkspaceDeleteDialog";
|
||||
import { useWorkspaceDuplication } from "./useWorkspaceDuplication";
|
||||
import { WorkspaceDeleteDialog } from "./WorkspaceDeleteDialog";
|
||||
|
||||
type WorkspaceMoreActionsProps = {
|
||||
workspace: Workspace;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { act, waitFor } from "@testing-library/react";
|
||||
import type { Workspace } from "api/typesGenerated";
|
||||
import * as M from "testHelpers/entities";
|
||||
import {
|
||||
type GetLocationSnapshot,
|
||||
renderHookWithAuth,
|
||||
} from "testHelpers/hooks";
|
||||
import { act, waitFor } from "@testing-library/react";
|
||||
import type { Workspace } from "api/typesGenerated";
|
||||
import CreateWorkspacePage from "../../../pages/CreateWorkspacePage/CreateWorkspacePage";
|
||||
import { useWorkspaceDuplication } from "./useWorkspaceDuplication";
|
||||
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import {
|
||||
MockTemplate,
|
||||
MockTemplateVersion,
|
||||
MockWorkspace,
|
||||
} from "testHelpers/entities";
|
||||
import { withDashboardProvider } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import { WorkspaceOutdatedTooltip } from "./WorkspaceOutdatedTooltip";
|
||||
|
||||
const meta: Meta<typeof WorkspaceOutdatedTooltip> = {
|
||||
|
||||
@@ -4,6 +4,7 @@ import Skeleton from "@mui/material/Skeleton";
|
||||
import { getErrorDetail, getErrorMessage } from "api/errors";
|
||||
import { templateVersion } from "api/queries/templates";
|
||||
import type { Workspace } from "api/typesGenerated";
|
||||
import { usePopover } from "components/deprecated/Popover/Popover";
|
||||
import { displayError } from "components/GlobalSnackbar/utils";
|
||||
import {
|
||||
HelpTooltip,
|
||||
@@ -14,15 +15,13 @@ import {
|
||||
HelpTooltipTitle,
|
||||
HelpTooltipTrigger,
|
||||
} from "components/HelpTooltip/HelpTooltip";
|
||||
import { usePopover } from "components/deprecated/Popover/Popover";
|
||||
import { InfoIcon } from "lucide-react";
|
||||
import { RotateCcwIcon } from "lucide-react";
|
||||
import { InfoIcon, RotateCcwIcon } from "lucide-react";
|
||||
import { linkToTemplate, useLinks } from "modules/navigation";
|
||||
import type { FC } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import {
|
||||
WorkspaceUpdateDialogs,
|
||||
useWorkspaceUpdate,
|
||||
WorkspaceUpdateDialogs,
|
||||
} from "../WorkspaceUpdateDialogs";
|
||||
|
||||
interface TooltipProps {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { MockWorkspace } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import type { Workspace, WorkspaceStatus } from "api/typesGenerated";
|
||||
import { MockWorkspace } from "testHelpers/entities";
|
||||
import { WorkspaceStatusIndicator } from "./WorkspaceStatusIndicator";
|
||||
|
||||
const meta: Meta<typeof WorkspaceStatusIndicator> = {
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "components/Tooltip/Tooltip";
|
||||
import type { FC } from "react";
|
||||
import type React from "react";
|
||||
import type { FC } from "react";
|
||||
import {
|
||||
type DisplayWorkspaceStatusType,
|
||||
getDisplayWorkspaceStatus,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Interpolation, Theme } from "@emotion/react";
|
||||
import { type ButtonHTMLAttributes, type HTMLProps, forwardRef } from "react";
|
||||
import { type ButtonHTMLAttributes, forwardRef, type HTMLProps } from "react";
|
||||
|
||||
export type BarColors = {
|
||||
stroke: string;
|
||||
|
||||
@@ -93,7 +93,7 @@ export const XAxisRow: FC<XAxisRowProps> = ({ yAxisLabelId, ...htmlProps }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
<section
|
||||
css={styles.row}
|
||||
{...htmlProps}
|
||||
aria-labelledby={yAxisLabelId}
|
||||
|
||||
@@ -65,7 +65,7 @@ const scales = [
|
||||
100,
|
||||
];
|
||||
|
||||
const zeroTime: Date = dayjs("0001-01-01T00:00:00Z").toDate();
|
||||
const _zeroTime: Date = dayjs("0001-01-01T00:00:00Z").toDate();
|
||||
|
||||
const pickScale = (totalTime: number): number => {
|
||||
for (const s of scales) {
|
||||
|
||||
@@ -11,6 +11,14 @@ import {
|
||||
ChartToolbar,
|
||||
} from "./Chart/Chart";
|
||||
import { Tooltip, TooltipLink, TooltipTitle } from "./Chart/Tooltip";
|
||||
import {
|
||||
calcDuration,
|
||||
calcOffset,
|
||||
formatTime,
|
||||
makeTicks,
|
||||
mergeTimeRanges,
|
||||
type TimeRange,
|
||||
} from "./Chart/utils";
|
||||
import { XAxis, XAxisRow, XAxisSection } from "./Chart/XAxis";
|
||||
import {
|
||||
YAxis,
|
||||
@@ -19,14 +27,6 @@ import {
|
||||
YAxisLabels,
|
||||
YAxisSection,
|
||||
} from "./Chart/YAxis";
|
||||
import {
|
||||
type TimeRange,
|
||||
calcDuration,
|
||||
calcOffset,
|
||||
formatTime,
|
||||
makeTicks,
|
||||
mergeTimeRanges,
|
||||
} from "./Chart/utils";
|
||||
import type { Stage } from "./StagesChart";
|
||||
|
||||
type ResourceTiming = {
|
||||
|
||||
@@ -11,6 +11,14 @@ import {
|
||||
ChartToolbar,
|
||||
} from "./Chart/Chart";
|
||||
import { Tooltip, TooltipTitle } from "./Chart/Tooltip";
|
||||
import {
|
||||
calcDuration,
|
||||
calcOffset,
|
||||
formatTime,
|
||||
makeTicks,
|
||||
mergeTimeRanges,
|
||||
type TimeRange,
|
||||
} from "./Chart/utils";
|
||||
import { XAxis, XAxisRow, XAxisSection } from "./Chart/XAxis";
|
||||
import {
|
||||
YAxis,
|
||||
@@ -19,14 +27,6 @@ import {
|
||||
YAxisLabels,
|
||||
YAxisSection,
|
||||
} from "./Chart/YAxis";
|
||||
import {
|
||||
type TimeRange,
|
||||
calcDuration,
|
||||
calcOffset,
|
||||
formatTime,
|
||||
makeTicks,
|
||||
mergeTimeRanges,
|
||||
} from "./Chart/utils";
|
||||
import type { Stage } from "./StagesChart";
|
||||
|
||||
type ScriptTiming = {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Interpolation, Theme } from "@emotion/react";
|
||||
import type { TimingStage } from "api/typesGenerated";
|
||||
import { CircleAlertIcon } from "lucide-react";
|
||||
import { InfoIcon } from "lucide-react";
|
||||
import { CircleAlertIcon, InfoIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { Bar, ClickableBar } from "./Chart/Bar";
|
||||
import { Blocks } from "./Chart/Blocks";
|
||||
@@ -12,6 +11,14 @@ import {
|
||||
TooltipShortDescription,
|
||||
TooltipTitle,
|
||||
} from "./Chart/Tooltip";
|
||||
import {
|
||||
calcDuration,
|
||||
calcOffset,
|
||||
formatTime,
|
||||
makeTicks,
|
||||
mergeTimeRanges,
|
||||
type TimeRange,
|
||||
} from "./Chart/utils";
|
||||
import { XAxis, XAxisRow, XAxisSection } from "./Chart/XAxis";
|
||||
import {
|
||||
YAxis,
|
||||
@@ -20,14 +27,6 @@ import {
|
||||
YAxisLabels,
|
||||
YAxisSection,
|
||||
} from "./Chart/YAxis";
|
||||
import {
|
||||
type TimeRange,
|
||||
calcDuration,
|
||||
calcOffset,
|
||||
formatTime,
|
||||
makeTicks,
|
||||
mergeTimeRanges,
|
||||
} from "./Chart/utils";
|
||||
|
||||
export type Stage = {
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { WorkspaceTimings } from "./WorkspaceTimings";
|
||||
import { WorkspaceTimingsResponse } from "./storybookData";
|
||||
import { WorkspaceTimings } from "./WorkspaceTimings";
|
||||
|
||||
const meta: Meta<typeof WorkspaceTimings> = {
|
||||
title: "modules/workspaces/WorkspaceTimings",
|
||||
|
||||
@@ -12,18 +12,18 @@ import uniqBy from "lodash/uniqBy";
|
||||
import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
||||
import { type FC, useState } from "react";
|
||||
import {
|
||||
type TimeRange,
|
||||
calcDuration,
|
||||
formatTime,
|
||||
mergeTimeRanges,
|
||||
type TimeRange,
|
||||
} from "./Chart/utils";
|
||||
import { ResourcesChart, isCoderResource } from "./ResourcesChart";
|
||||
import { isCoderResource, ResourcesChart } from "./ResourcesChart";
|
||||
import { ScriptsChart } from "./ScriptsChart";
|
||||
import {
|
||||
type Stage,
|
||||
StagesChart,
|
||||
agentStages,
|
||||
provisioningStages,
|
||||
type Stage,
|
||||
StagesChart,
|
||||
} from "./StagesChart";
|
||||
|
||||
type TimingView =
|
||||
@@ -218,7 +218,7 @@ const toTimeRange = (timing: {
|
||||
};
|
||||
};
|
||||
|
||||
const humanizeDuration = (durationMs: number): string => {
|
||||
const _humanizeDuration = (durationMs: number): string => {
|
||||
const seconds = Math.floor(durationMs / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
NumberDictionary,
|
||||
animals,
|
||||
colors,
|
||||
NumberDictionary,
|
||||
uniqueNamesGenerator,
|
||||
} from "unique-names-generator";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user