mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: modernize all typescript imports (#23511)
This commit is contained in:
+1
-1
@@ -1,11 +1,11 @@
|
||||
import "@testing-library/jest-dom";
|
||||
import "jest-location-mock";
|
||||
import { server } from "testHelpers/server";
|
||||
import crypto from "node:crypto";
|
||||
import { cleanup } from "@testing-library/react";
|
||||
import type { ProxyLatencyReport } from "contexts/useProxyLatency";
|
||||
import { useMemo } from "react";
|
||||
import type { Region } from "#/api/typesGenerated";
|
||||
import { server } from "#/testHelpers/server";
|
||||
|
||||
// useProxyLatency does some http requests to determine latency.
|
||||
// This would fail unit testing, or at least make it very slow with
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { Theme as CoderTheme } from "theme";
|
||||
import type { Theme as CoderTheme } from "#/theme";
|
||||
|
||||
declare module "@emotion/react" {
|
||||
interface Theme extends CoderTheme {}
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ import type {
|
||||
SerpentOption,
|
||||
User,
|
||||
} from "#/api/typesGenerated";
|
||||
import type { Permissions } from "modules/permissions";
|
||||
import type { Permissions } from "#/modules/permissions";
|
||||
import type { QueryKey } from "react-query";
|
||||
import type { ReactRouterAddonStoryParameters } from "storybook-addon-remix-react-router";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
MockWorkspace,
|
||||
MockWorkspaceBuild,
|
||||
MockWorkspaceBuildParameter1,
|
||||
} from "testHelpers/entities";
|
||||
} from "#/testHelpers/entities";
|
||||
import { API, getURLWithSearchParams, MissingBuildParameters } from "./api";
|
||||
import type * as TypesGen from "./typesGenerated";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mockApiError } from "testHelpers/entities";
|
||||
import { mockApiError } from "#/testHelpers/entities";
|
||||
import {
|
||||
getErrorMessage,
|
||||
getValidationErrorMessage,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { MetadataState } from "hooks/useEmbeddedMetadata";
|
||||
import type { QueryClient } from "react-query";
|
||||
import { API } from "#/api/api";
|
||||
import type { AppearanceConfig } from "#/api/typesGenerated";
|
||||
import type { MetadataState } from "#/hooks/useEmbeddedMetadata";
|
||||
import { cachedQuery } from "./util";
|
||||
|
||||
export const appearanceConfigKey = ["appearance"] as const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { UsePaginatedQueryOptions } from "hooks/usePaginatedQuery";
|
||||
import { API } from "#/api/api";
|
||||
import type { AuditLogResponse } from "#/api/typesGenerated";
|
||||
import { useFilterParamsKey } from "#/components/Filter/Filter";
|
||||
import type { UsePaginatedQueryOptions } from "#/hooks/usePaginatedQuery";
|
||||
|
||||
export function paginatedAudits(
|
||||
searchParams: URLSearchParams,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { MetadataState, MetadataValue } from "hooks/useEmbeddedMetadata";
|
||||
import { API } from "#/api/api";
|
||||
import type {
|
||||
AuthorizationRequest,
|
||||
AuthorizationResponse,
|
||||
} from "#/api/typesGenerated";
|
||||
import type { MetadataState, MetadataValue } from "#/hooks/useEmbeddedMetadata";
|
||||
import { disabledRefetchOptions } from "./util";
|
||||
|
||||
const AUTHORIZATION_KEY = "authorization";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MetadataState } from "hooks/useEmbeddedMetadata";
|
||||
import { API } from "#/api/api";
|
||||
import type { BuildInfoResponse } from "#/api/typesGenerated";
|
||||
import type { MetadataState } from "#/hooks/useEmbeddedMetadata";
|
||||
import { cachedQuery } from "./util";
|
||||
|
||||
const buildInfoKey = ["buildInfo"] as const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { UsePaginatedQueryOptions } from "hooks/usePaginatedQuery";
|
||||
import { API } from "#/api/api";
|
||||
import type { ConnectionLogResponse } from "#/api/typesGenerated";
|
||||
import { useFilterParamsKey } from "#/components/Filter/Filter";
|
||||
import type { UsePaginatedQueryOptions } from "#/hooks/usePaginatedQuery";
|
||||
|
||||
export function paginatedConnectionLogs(
|
||||
searchParams: URLSearchParams,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { MetadataState } from "hooks/useEmbeddedMetadata";
|
||||
import type { QueryClient } from "react-query";
|
||||
import { API } from "#/api/api";
|
||||
import type { Entitlements } from "#/api/typesGenerated";
|
||||
import type { MetadataState } from "#/hooks/useEmbeddedMetadata";
|
||||
import { cachedQuery } from "./util";
|
||||
|
||||
const entitlementsQueryKey = ["entitlements"] as const;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MetadataState } from "hooks/useEmbeddedMetadata";
|
||||
import { API } from "#/api/api";
|
||||
import { type Experiment, Experiments } from "#/api/typesGenerated";
|
||||
import type { MetadataState } from "#/hooks/useEmbeddedMetadata";
|
||||
import { cachedQuery } from "./util";
|
||||
|
||||
const experimentsKey = ["experiments"] as const;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { UsePaginatedQueryOptions } from "hooks/usePaginatedQuery";
|
||||
import type { QueryClient, UseQueryOptions } from "react-query";
|
||||
import { prepareQuery } from "utils/filters";
|
||||
import { API } from "#/api/api";
|
||||
@@ -10,6 +9,7 @@ import type {
|
||||
PatchGroupRequest,
|
||||
UsersRequest,
|
||||
} from "#/api/typesGenerated";
|
||||
import type { UsePaginatedQueryOptions } from "#/hooks/usePaginatedQuery";
|
||||
|
||||
type GroupSortOrder = "asc" | "desc";
|
||||
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
import type { MetadataState } from "hooks/useEmbeddedMetadata";
|
||||
import type { UsePaginatedQueryOptions } from "hooks/usePaginatedQuery";
|
||||
import {
|
||||
type OrganizationPermissionName,
|
||||
type OrganizationPermissions,
|
||||
organizationPermissionChecks,
|
||||
} from "modules/permissions/organizations";
|
||||
import {
|
||||
type WorkspacePermissionName,
|
||||
type WorkspacePermissions,
|
||||
workspacePermissionChecks,
|
||||
} from "modules/permissions/workspaces";
|
||||
import type { QueryClient, UseQueryOptions } from "react-query";
|
||||
import {
|
||||
API,
|
||||
@@ -27,6 +15,18 @@ import type {
|
||||
UpdateWorkspaceSharingSettingsRequest,
|
||||
UsersRequest,
|
||||
} from "#/api/typesGenerated";
|
||||
import type { MetadataState } from "#/hooks/useEmbeddedMetadata";
|
||||
import type { UsePaginatedQueryOptions } from "#/hooks/usePaginatedQuery";
|
||||
import {
|
||||
type OrganizationPermissionName,
|
||||
type OrganizationPermissions,
|
||||
organizationPermissionChecks,
|
||||
} from "#/modules/permissions/organizations";
|
||||
import {
|
||||
type WorkspacePermissionName,
|
||||
type WorkspacePermissions,
|
||||
workspacePermissionChecks,
|
||||
} from "#/modules/permissions/workspaces";
|
||||
import { meKey } from "./users";
|
||||
import { cachedQuery } from "./util";
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import {
|
||||
defaultMetadataManager,
|
||||
type MetadataState,
|
||||
} from "hooks/useEmbeddedMetadata";
|
||||
import type { UsePaginatedQueryOptions } from "hooks/usePaginatedQuery";
|
||||
import type {
|
||||
MutationOptions,
|
||||
QueryClient,
|
||||
@@ -26,6 +21,11 @@ import type {
|
||||
UserPreferenceSettings,
|
||||
UsersRequest,
|
||||
} from "#/api/typesGenerated";
|
||||
import {
|
||||
defaultMetadataManager,
|
||||
type MetadataState,
|
||||
} from "#/hooks/useEmbeddedMetadata";
|
||||
import type { UsePaginatedQueryOptions } from "#/hooks/usePaginatedQuery";
|
||||
import { getAuthorizationKey } from "./authCheck";
|
||||
import { cachedQuery } from "./util";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MetadataState, MetadataValue } from "hooks/useEmbeddedMetadata";
|
||||
import type { QueryKey, UseQueryOptions } from "react-query";
|
||||
import type { MetadataState, MetadataValue } from "#/hooks/useEmbeddedMetadata";
|
||||
|
||||
export const disabledRefetchOptions = {
|
||||
gcTime: Number.POSITIVE_INFINITY,
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import type { Dayjs } from "dayjs";
|
||||
import {
|
||||
type WorkspacePermissions,
|
||||
workspaceChecks,
|
||||
} from "modules/workspaces/permissions";
|
||||
import type { ConnectionStatus } from "pages/TerminalPage/types";
|
||||
import type {
|
||||
MutationOptions,
|
||||
@@ -29,6 +25,10 @@ import type {
|
||||
WorkspacesRequest,
|
||||
WorkspacesResponse,
|
||||
} from "#/api/typesGenerated";
|
||||
import {
|
||||
type WorkspacePermissions,
|
||||
workspaceChecks,
|
||||
} from "#/modules/workspaces/permissions";
|
||||
import { checkAuthorization } from "./authCheck";
|
||||
import { disabledRefetchOptions } from "./util";
|
||||
import { workspaceBuildsKey } from "./workspaceBuilds";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { mockApiError } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { mockApiError } from "#/testHelpers/entities";
|
||||
import { ErrorAlert } from "./ErrorAlert";
|
||||
|
||||
const mockError = mockApiError({
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { getExternalImageStylesFromUrl } from "theme/externalImages";
|
||||
import { cn } from "utils/cn";
|
||||
import { getExternalImageStylesFromUrl } from "#/theme/externalImages";
|
||||
|
||||
const avatarVariants = cva(
|
||||
"relative flex shrink-0 overflow-hidden rounded border border-solid bg-surface-secondary text-content-secondary",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { MockOrganization } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import {
|
||||
Breadcrumb,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "#/components/Breadcrumb/Breadcrumb";
|
||||
import { MockOrganization } from "#/testHelpers/entities";
|
||||
|
||||
const meta: Meta<typeof Breadcrumb> = {
|
||||
title: "components/Breadcrumb",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { Interpolation, Theme } from "@emotion/react";
|
||||
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
||||
import { type FC, useState } from "react";
|
||||
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { MONOSPACE_FONT_FAMILY } from "#/theme/constants";
|
||||
import { CopyButton } from "../CopyButton/CopyButton";
|
||||
|
||||
interface CodeExampleProps {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useClipboard } from "hooks/useClipboard";
|
||||
import { CopyIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { CheckIcon } from "#/components/AnimatedIcons/Check";
|
||||
@@ -8,6 +7,7 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useClipboard } from "#/hooks/useClipboard";
|
||||
|
||||
type CopyButtonProps = ButtonProps & {
|
||||
text: string;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useClickable } from "hooks/useClickable";
|
||||
import { useClipboard } from "hooks/useClipboard";
|
||||
import { type FC, type HTMLAttributes, useState } from "react";
|
||||
import { cn } from "utils/cn";
|
||||
import {
|
||||
@@ -7,6 +5,8 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useClickable } from "#/hooks/useClickable";
|
||||
import { useClipboard } from "#/hooks/useClipboard";
|
||||
|
||||
type TooltipSide = "top" | "right" | "bottom" | "left";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import { fireEvent, screen } from "@testing-library/react";
|
||||
import { renderComponent } from "#/testHelpers/renderHelpers";
|
||||
import { ConfirmDialog } from "./ConfirmDialog";
|
||||
|
||||
describe("ConfirmDialog", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { act } from "react";
|
||||
import { renderComponent } from "#/testHelpers/renderHelpers";
|
||||
import { DeleteDialog } from "./DeleteDialog";
|
||||
|
||||
const inputTestId = "delete-dialog-name-confirmation";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { type FC, useState } from "react";
|
||||
import {
|
||||
type ErrorResponse,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { CoderIcon } from "#/components/Icons/CoderIcon";
|
||||
import { Link } from "#/components/Link/Link";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
|
||||
const errorPageTitle = "Something went wrong";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { getExternalImageStylesFromUrl } from "theme/externalImages";
|
||||
import { getExternalImageStylesFromUrl } from "#/theme/externalImages";
|
||||
|
||||
export const ExternalImage: React.FC<React.ComponentPropsWithRef<"img">> = ({
|
||||
...props
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import { fireEvent, screen } from "@testing-library/react";
|
||||
import { renderComponent } from "#/testHelpers/renderHelpers";
|
||||
import { FileUpload } from "./FileUpload";
|
||||
|
||||
test("accepts files with the correct extension", async () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { css, type Interpolation, type Theme } from "@emotion/react";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import { useClickable } from "hooks/useClickable";
|
||||
import { CloudUploadIcon, FolderIcon, TrashIcon } from "lucide-react";
|
||||
import { type DragEvent, type FC, type ReactNode, useRef } from "react";
|
||||
import { Stack } from "#/components/Stack/Stack";
|
||||
import { useClickable } from "#/hooks/useClickable";
|
||||
|
||||
interface FileUploadProps {
|
||||
isUploading: boolean;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import Skeleton, { type SkeletonProps } from "@mui/material/Skeleton";
|
||||
import type { Breakpoint } from "@mui/system/createTheme";
|
||||
import { useDebouncedFunction } from "hooks/debounce";
|
||||
import { ExternalLinkIcon, SlidersHorizontal } from "lucide-react";
|
||||
import { type FC, type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
@@ -20,6 +19,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from "#/components/DropdownMenu/DropdownMenu";
|
||||
import { SearchField } from "#/components/SearchField/SearchField";
|
||||
import { useDebouncedFunction } from "#/hooks/debounce";
|
||||
|
||||
type PresetFilter = {
|
||||
name: string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { useState } from "react";
|
||||
import { expect, screen, userEvent, within } from "storybook/test";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
import { ComboboxInput } from "#/components/Combobox/Combobox";
|
||||
import { withDesktopViewport } from "#/testHelpers/storybook";
|
||||
import { SelectFilter, type SelectFilterOption } from "./SelectFilter";
|
||||
|
||||
const options: SelectFilterOption[] = Array.from({ length: 50 }, (_, i) => ({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import data from "@emoji-mart/data/sets/15/apple.json";
|
||||
import EmojiMart from "@emoji-mart/react";
|
||||
import { type ComponentProps, type FC, useEffect } from "react";
|
||||
import { DEPRECATED_ICONS } from "theme/deprecatedIcons";
|
||||
import icons from "theme/icons.json";
|
||||
import { DEPRECATED_ICONS } from "#/theme/deprecatedIcons";
|
||||
import icons from "#/theme/icons.json";
|
||||
|
||||
const custom = [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { FC, ReactNode } from "react";
|
||||
import type { ThemeRole } from "theme/roles";
|
||||
import { cn } from "utils/cn";
|
||||
import {
|
||||
HelpTooltip,
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
HelpTooltipText,
|
||||
HelpTooltipTitle,
|
||||
} from "#/components/HelpTooltip/HelpTooltip";
|
||||
import type { ThemeRole } from "#/theme/roles";
|
||||
|
||||
interface InfoTooltipProps {
|
||||
type?: ThemeRole;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "#/testHelpers/chromatic";
|
||||
import { LogLine, LogLinePrefix } from "./LogLine";
|
||||
|
||||
const meta: Meta<typeof LogLine> = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Interpolation, Theme } from "@emotion/react";
|
||||
import type { FC, HTMLAttributes } from "react";
|
||||
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
|
||||
import type { LogLevel } from "#/api/typesGenerated";
|
||||
import { MONOSPACE_FONT_FAMILY } from "#/theme/constants";
|
||||
|
||||
const DEFAULT_LOG_LINE_SIDE_PADDING = 24;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { MockWorkspaceBuildLogs } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "#/testHelpers/chromatic";
|
||||
import { MockWorkspaceBuildLogs } from "#/testHelpers/entities";
|
||||
import type { Line } from "./LogLine";
|
||||
import { Logs } from "./Logs";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
containerWidth,
|
||||
containerWidthMedium,
|
||||
sidePadding,
|
||||
} from "theme/constants";
|
||||
} from "#/theme/constants";
|
||||
|
||||
type Size = "regular" | "medium" | "small";
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import ReactMarkdown, { type Options } from "react-markdown";
|
||||
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
||||
import { dracula } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
||||
import gfm from "remark-gfm";
|
||||
import colors from "theme/tailwindColors";
|
||||
import { cn } from "utils/cn";
|
||||
import {
|
||||
Table,
|
||||
@@ -22,6 +21,7 @@ import {
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "#/components/Table/Table";
|
||||
import colors from "#/theme/tailwindColors";
|
||||
|
||||
interface MarkdownProps {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockOrganization, MockOrganization2 } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import { MockOrganization, MockOrganization2 } from "#/testHelpers/entities";
|
||||
import { MultiSelectCombobox } from "./MultiSelectCombobox";
|
||||
|
||||
const organizations = [MockOrganization, MockOrganization2];
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* @see {@link https://shadcnui-expansions.typeart.cc/docs/multiple-selector}
|
||||
*/
|
||||
import { Command as CommandPrimitive, useCommandState } from "cmdk";
|
||||
import { useDebouncedValue } from "hooks/debounce";
|
||||
import { Info, X } from "lucide-react";
|
||||
import {
|
||||
type ComponentPropsWithoutRef,
|
||||
@@ -32,6 +31,7 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useDebouncedValue } from "#/hooks/debounce";
|
||||
|
||||
export interface Option {
|
||||
value: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockOrganizationMember } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { organizationMembersKey } from "api/queries/organizations";
|
||||
import { MockOrganizationMember } from "#/testHelpers/entities";
|
||||
import { MultiMemberSelect } from "./MultiUserSelect";
|
||||
|
||||
const meta: Meta<typeof MultiMemberSelect> = {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { mockApiError } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { API } from "api/api";
|
||||
import { usersKey } from "api/queries/users";
|
||||
import { MockUsers } from "pages/UsersPage/storybookData/users";
|
||||
import { spyOn } from "storybook/test";
|
||||
import { mockApiError } from "#/testHelpers/entities";
|
||||
import { MultiUserSelect } from "./MultiUserSelect";
|
||||
|
||||
const meta: Meta<typeof MultiUserSelect> = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { action } from "storybook/actions";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import {
|
||||
MockOrganization,
|
||||
MockOrganization2,
|
||||
MockUserOwner,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { action } from "storybook/actions";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
} from "#/testHelpers/entities";
|
||||
import { OrganizationAutocomplete } from "./OrganizationAutocomplete";
|
||||
|
||||
const meta: Meta<typeof OrganizationAutocomplete> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { PaginationResultInfo } from "hooks/usePaginatedQuery";
|
||||
import type { FC, HTMLAttributes } from "react";
|
||||
import type { PaginationResultInfo } from "#/hooks/usePaginatedQuery";
|
||||
import { PaginationAmount } from "./PaginationAmount";
|
||||
import { PaginationWidgetBase } from "./PaginationWidgetBase";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { renderWithAuth } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { renderWithAuth } from "#/testHelpers/renderHelpers";
|
||||
import {
|
||||
PaginationWidgetBase,
|
||||
type PaginationWidgetBaseProps,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import TextField, { type TextFieldProps } from "@mui/material/TextField";
|
||||
import { useDebouncedValue } from "hooks/debounce";
|
||||
import type { FC } from "react";
|
||||
import { keepPreviousData, useQuery } from "react-query";
|
||||
import { API } from "#/api/api";
|
||||
import { useDebouncedValue } from "#/hooks/debounce";
|
||||
|
||||
// TODO: @BrunoQuaresma: Unable to integrate Yup + Formik for validation. The
|
||||
// validation was triggering on the onChange event, but the form.errors were not
|
||||
|
||||
@@ -3,7 +3,7 @@ import CircularProgress, {
|
||||
type CircularProgressProps,
|
||||
} from "@mui/material/CircularProgress";
|
||||
import { type FC, type ReactNode, useMemo } from "react";
|
||||
import type { ThemeRole } from "theme/roles";
|
||||
import type { ThemeRole } from "#/theme/roles";
|
||||
|
||||
type PillProps = React.ComponentPropsWithRef<"div"> & {
|
||||
icon?: ReactNode;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import type { TemplateVersionParameter } from "#/api/typesGenerated";
|
||||
import { chromatic } from "#/testHelpers/chromatic";
|
||||
import { RichParameterInput } from "./RichParameterInput";
|
||||
|
||||
const meta: Meta<typeof RichParameterInput> = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useEffectEvent } from "hooks/hookPolyfills";
|
||||
import { SearchIcon, XIcon } from "lucide-react";
|
||||
import { type Ref, useLayoutEffect, useRef } from "react";
|
||||
import {
|
||||
@@ -12,6 +11,7 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useEffectEvent } from "#/hooks/hookPolyfills";
|
||||
|
||||
export type SearchFieldProps = {
|
||||
value: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { action } from "storybook/actions";
|
||||
import { userEvent, within } from "storybook/test";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
import { withDesktopViewport } from "#/testHelpers/storybook";
|
||||
import {
|
||||
SelectMenu,
|
||||
SelectMenuButton,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MockOrganizationMember } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockOrganizationMember } from "#/testHelpers/entities";
|
||||
import { MemberAutocomplete } from "./UserAutocomplete";
|
||||
|
||||
const meta: Meta<typeof MemberAutocomplete> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MockUserOwner } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockUserOwner } from "#/testHelpers/entities";
|
||||
import { UserAutocomplete } from "./UserAutocomplete";
|
||||
|
||||
const meta: Meta<typeof UserAutocomplete> = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useDebouncedFunction, useDebouncedValue } from "hooks/debounce";
|
||||
import { type FC, useId, useState } from "react";
|
||||
import { keepPreviousData, useQuery } from "react-query";
|
||||
import { cn } from "utils/cn";
|
||||
@@ -26,6 +25,7 @@ import {
|
||||
} from "#/components/Combobox/Combobox";
|
||||
import { Label } from "#/components/Label/Label";
|
||||
import { Spinner } from "#/components/Spinner/Spinner";
|
||||
import { useDebouncedFunction, useDebouncedValue } from "#/hooks/debounce";
|
||||
|
||||
// The common properties between users and org members that we need.
|
||||
type SelectedUser = {
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import "testHelpers/localStorage";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { Region } from "#/api/typesGenerated";
|
||||
import {
|
||||
MockHealthyWildWorkspaceProxy,
|
||||
MockPrimaryWorkspaceProxy,
|
||||
MockUnhealthyWildWorkspaceProxy,
|
||||
MockWorkspaceProxies,
|
||||
} from "testHelpers/entities";
|
||||
} from "#/testHelpers/entities";
|
||||
import {
|
||||
renderWithAuth,
|
||||
waitForLoaderToBeRemoved,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { Region } from "#/api/typesGenerated";
|
||||
} from "#/testHelpers/renderHelpers";
|
||||
import { server } from "#/testHelpers/server";
|
||||
import {
|
||||
getPreferredProxy,
|
||||
ProxyProvider,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import {
|
||||
createContext,
|
||||
type FC,
|
||||
@@ -13,6 +12,7 @@ import { useQuery } from "react-query";
|
||||
import { API } from "#/api/api";
|
||||
import { cachedQuery } from "#/api/queries/util";
|
||||
import type { Region, WorkspaceProxy } from "#/api/typesGenerated";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { type ProxyLatencyReport, useProxyLatency } from "./useProxyLatency";
|
||||
|
||||
export type Proxies = readonly Region[] | readonly WorkspaceProxy[];
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
ThemeProvider as MuiThemeProvider,
|
||||
StyledEngineProvider,
|
||||
} from "@mui/material/styles";
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import {
|
||||
type FC,
|
||||
type PropsWithChildren,
|
||||
@@ -21,8 +20,9 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import themes, { DEFAULT_THEME, type Theme } from "theme";
|
||||
import { appearanceSettings } from "#/api/queries/users";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import themes, { DEFAULT_THEME, type Theme } from "#/theme";
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { type Permissions, permissionChecks } from "modules/permissions";
|
||||
import {
|
||||
createContext,
|
||||
type FC,
|
||||
@@ -19,6 +17,8 @@ import {
|
||||
updateProfile as updateProfileOptions,
|
||||
} from "#/api/queries/users";
|
||||
import type { UpdateUserProfileRequest, User } from "#/api/typesGenerated";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { type Permissions, permissionChecks } from "#/modules/permissions";
|
||||
|
||||
export type AuthContextValue = {
|
||||
isLoading: boolean;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { MockPermissions, MockUserOwner } from "testHelpers/entities";
|
||||
import {
|
||||
createTestQueryClient,
|
||||
renderWithAuth,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { renderHook, screen } from "@testing-library/react";
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import { MockPermissions, MockUserOwner } from "#/testHelpers/entities";
|
||||
import {
|
||||
createTestQueryClient,
|
||||
renderWithAuth,
|
||||
} from "#/testHelpers/renderHelpers";
|
||||
import { server } from "#/testHelpers/server";
|
||||
import { AuthContext, type AuthContextValue } from "./AuthProvider";
|
||||
|
||||
describe("RequireAuth", () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ProxyProvider as ProductionProxyProvider } from "contexts/ProxyContext";
|
||||
import { DashboardProvider as ProductionDashboardProvider } from "modules/dashboard/DashboardProvider";
|
||||
import { type FC, useEffect } from "react";
|
||||
import { Navigate, Outlet, useLocation } from "react-router";
|
||||
import { embedRedirect } from "utils/redirect";
|
||||
import { API } from "#/api/api";
|
||||
import { isApiError } from "#/api/errors";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
import { DashboardProvider as ProductionDashboardProvider } from "#/modules/dashboard/DashboardProvider";
|
||||
import { useAuthContext } from "./AuthProvider";
|
||||
|
||||
type RequireAuthProps = Readonly<{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { API } from "#/api/api";
|
||||
import { buildInfo } from "#/api/queries/buildInfo";
|
||||
import { experiments } from "#/api/queries/experiments";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
|
||||
interface WebpushNotifications {
|
||||
readonly enabled: boolean;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { act, renderHook } from "@testing-library/react";
|
||||
import type { Region, User } from "#/api/typesGenerated";
|
||||
import {
|
||||
MockAgentsTabVisible,
|
||||
MockAppearanceConfig,
|
||||
@@ -9,9 +11,7 @@ import {
|
||||
MockTasksTabVisible,
|
||||
MockUserAppearanceSettings,
|
||||
MockUserOwner,
|
||||
} from "testHelpers/entities";
|
||||
import { act, renderHook } from "@testing-library/react";
|
||||
import type { Region, User } from "#/api/typesGenerated";
|
||||
} from "#/testHelpers/entities";
|
||||
import {
|
||||
DEFAULT_METADATA_KEY,
|
||||
type MetadataKey,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { Permissions } from "modules/permissions";
|
||||
import { useMemo, useSyncExternalStore } from "react";
|
||||
import type {
|
||||
AppearanceConfig,
|
||||
@@ -10,6 +9,7 @@ import type {
|
||||
User,
|
||||
UserAppearanceSettings,
|
||||
} from "#/api/typesGenerated";
|
||||
import type { Permissions } from "#/modules/permissions";
|
||||
export const DEFAULT_METADATA_KEY = "property";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { renderHookWithAuth } from "testHelpers/hooks";
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHookWithAuth } from "#/testHelpers/hooks";
|
||||
import {
|
||||
type PaginatedData,
|
||||
type UsePaginatedQueryOptions,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { renderHookWithAuth } from "testHelpers/hooks";
|
||||
import { act, waitFor } from "@testing-library/react";
|
||||
import { renderHookWithAuth } from "#/testHelpers/hooks";
|
||||
import { useSearchParamsKey } from "./useSearchParamsKey";
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
MockWorkspace,
|
||||
MockWorkspaceAgent,
|
||||
MockWorkspaceApp,
|
||||
} from "testHelpers/entities";
|
||||
} from "#/testHelpers/entities";
|
||||
import { getAppHref, getVSCodeHref, SESSION_TOKEN_PLACEHOLDER } from "./apps";
|
||||
|
||||
describe("getVSCodeHref", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MockWorkspaceBuild } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { MockWorkspaceBuild } from "#/testHelpers/entities";
|
||||
import { BuildAvatar } from "./BuildAvatar";
|
||||
|
||||
const meta: Meta<typeof BuildAvatar> = {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useClassName } from "hooks/useClassName";
|
||||
import type { FC } from "react";
|
||||
import { getDisplayWorkspaceBuildStatus } from "utils/workspace";
|
||||
import type { WorkspaceBuild } from "#/api/typesGenerated";
|
||||
import { Avatar, type AvatarProps } from "#/components/Avatar/Avatar";
|
||||
import { BuildIcon } from "#/components/BuildIcon/BuildIcon";
|
||||
import { useClassName } from "#/hooks/useClassName";
|
||||
|
||||
interface BuildAvatarProps {
|
||||
build: WorkspaceBuild;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import type { FC } from "react";
|
||||
import type { BannerConfig } from "#/api/typesGenerated";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import { AnnouncementBannerView } from "./AnnouncementBannerView";
|
||||
|
||||
export const AnnouncementBanners: FC = () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
renderWithAuth,
|
||||
waitForLoaderToBeRemoved,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import {
|
||||
renderWithAuth,
|
||||
waitForLoaderToBeRemoved,
|
||||
} from "#/testHelpers/renderHelpers";
|
||||
import { server } from "#/testHelpers/server";
|
||||
import { DashboardLayout } from "./DashboardLayout";
|
||||
|
||||
test("Show the new Coder version notification", async () => {
|
||||
|
||||
@@ -2,14 +2,14 @@ import Link from "@mui/material/Link";
|
||||
import Snackbar from "@mui/material/Snackbar";
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { InfoIcon } from "lucide-react";
|
||||
import { AnnouncementBanners } from "modules/dashboard/AnnouncementBanners/AnnouncementBanners";
|
||||
import { LicenseBanner } from "modules/dashboard/LicenseBanner/LicenseBanner";
|
||||
import { type FC, type HTMLAttributes, Suspense } from "react";
|
||||
import { Outlet } from "react-router";
|
||||
import { cn } from "utils/cn";
|
||||
import { docs } from "utils/docs";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
import { AnnouncementBanners } from "#/modules/dashboard/AnnouncementBanners/AnnouncementBanners";
|
||||
import { LicenseBanner } from "#/modules/dashboard/LicenseBanner/LicenseBanner";
|
||||
import { DeploymentBanner } from "./DeploymentBanner/DeploymentBanner";
|
||||
import { Navbar } from "./Navbar/Navbar";
|
||||
import { useUpdateCheck } from "./useUpdateCheck";
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { canViewAnyOrganization } from "modules/permissions";
|
||||
import { createContext, type FC, type PropsWithChildren } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { appearance } from "#/api/queries/appearance";
|
||||
@@ -17,6 +15,8 @@ import type {
|
||||
} from "#/api/typesGenerated";
|
||||
import { ErrorAlert } from "#/components/Alert/ErrorAlert";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { canViewAnyOrganization } from "#/modules/permissions";
|
||||
import { selectFeatureVisibility } from "./entitlements";
|
||||
|
||||
export interface DashboardValue {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
||||
import {
|
||||
DeploymentHealthUnhealthy,
|
||||
MockDeploymentStats,
|
||||
} from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
|
||||
} from "#/testHelpers/entities";
|
||||
import { DeploymentBannerView } from "./DeploymentBannerView";
|
||||
|
||||
const meta: Meta<typeof DeploymentBannerView> = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import type { FC } from "react";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import { LicenseBannerView } from "./LicenseBannerView";
|
||||
|
||||
export const LicenseBanner: FC = () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { LicenseManagedAgentLimitExceededWarningText } from "#/api/typesGenerated";
|
||||
import { chromatic } from "#/testHelpers/chromatic";
|
||||
import { LicenseBannerView } from "./LicenseBannerView";
|
||||
|
||||
const meta: Meta<typeof LicenseBannerView> = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { linkToAuditing } from "modules/navigation";
|
||||
import type { FC } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { ChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown";
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "#/components/DropdownMenu/DropdownMenu";
|
||||
import { linkToAuditing } from "#/modules/navigation";
|
||||
|
||||
interface DeploymentDropdownProps {
|
||||
canViewDeployment: boolean;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
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,
|
||||
@@ -5,11 +9,7 @@ import {
|
||||
MockUserMember,
|
||||
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";
|
||||
} from "#/testHelpers/entities";
|
||||
import { MobileMenu } from "./MobileMenu";
|
||||
|
||||
const meta: Meta<typeof MobileMenu> = {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useProxy } from "contexts/ProxyContext";
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import { canViewDeploymentSettings } from "modules/permissions";
|
||||
import type { FC } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { buildInfo } from "#/api/queries/buildInfo";
|
||||
import type { LinkConfig } from "#/api/typesGenerated";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import { canViewDeploymentSettings } from "#/modules/permissions";
|
||||
import { useFeatureVisibility } from "../useFeatureVisibility";
|
||||
import { NavbarView } from "./NavbarView";
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { chromaticWithTablet } from "testHelpers/chromatic";
|
||||
import { MockTasks, 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 type { TasksFilter } from "#/api/typesGenerated";
|
||||
import { chromaticWithTablet } from "#/testHelpers/chromatic";
|
||||
import {
|
||||
MockTasks,
|
||||
MockUserMember,
|
||||
MockUserOwner,
|
||||
} from "#/testHelpers/entities";
|
||||
import { withDashboardProvider } from "#/testHelpers/storybook";
|
||||
import { NavbarView } from "./NavbarView";
|
||||
|
||||
const tasksFilter: TasksFilter = {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import type { ProxyContextValue } from "contexts/ProxyContext";
|
||||
import { useEmbeddedMetadata } from "hooks/useEmbeddedMetadata";
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import { NotificationsInbox } from "modules/notifications/NotificationsInbox/NotificationsInbox";
|
||||
import type { FC } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
import { NavLink, useLocation } from "react-router";
|
||||
@@ -18,6 +15,9 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import { NotificationsInbox } from "#/modules/notifications/NotificationsInbox/NotificationsInbox";
|
||||
import { DeploymentDropdown } from "./DeploymentDropdown";
|
||||
import { MobileMenu } from "./MobileMenu";
|
||||
import { ProxyMenu } from "./ProxyMenu";
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AuthProvider } from "contexts/auth/AuthProvider";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { fn, userEvent, within } from "storybook/test";
|
||||
import { getAuthorizationKey } from "#/api/queries/authCheck";
|
||||
import { permissionChecks } from "#/modules/permissions";
|
||||
import {
|
||||
MockAuthMethodsAll,
|
||||
MockPermissions,
|
||||
MockProxyLatencies,
|
||||
MockUserOwner,
|
||||
MockWorkspaceProxies,
|
||||
} from "testHelpers/entities";
|
||||
import { withDesktopViewport } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { AuthProvider } from "contexts/auth/AuthProvider";
|
||||
import { getPreferredProxy } from "contexts/ProxyContext";
|
||||
import { permissionChecks } from "modules/permissions";
|
||||
import { fn, userEvent, within } from "storybook/test";
|
||||
import { getAuthorizationKey } from "#/api/queries/authCheck";
|
||||
} from "#/testHelpers/entities";
|
||||
import { withDesktopViewport } from "#/testHelpers/storybook";
|
||||
import { ProxyMenu } from "./ProxyMenu";
|
||||
|
||||
const defaultProxyContextValue = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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 { MockBuildInfo, MockUserOwner } from "#/testHelpers/entities";
|
||||
import { withDashboardProvider } from "#/testHelpers/storybook";
|
||||
import { UserDropdown } from "./UserDropdown";
|
||||
|
||||
const meta: Meta<typeof UserDropdown> = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { MockUserOwner } from "testHelpers/entities";
|
||||
import { render, waitForLoaderToBeRemoved } from "testHelpers/renderHelpers";
|
||||
import { screen } from "@testing-library/react";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuTrigger,
|
||||
} from "#/components/DropdownMenu/DropdownMenu";
|
||||
import { MockUserOwner } from "#/testHelpers/entities";
|
||||
import { render, waitForLoaderToBeRemoved } from "#/testHelpers/renderHelpers";
|
||||
import { Language, UserDropdownContent } from "./UserDropdownContent";
|
||||
|
||||
const renderUserDropdownContent = (props: { onSignOut: () => void }) => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useClipboard } from "hooks/useClipboard";
|
||||
import {
|
||||
CircleUserIcon,
|
||||
CopyIcon,
|
||||
@@ -19,6 +18,7 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useClipboard } from "#/hooks/useClipboard";
|
||||
import { SupportIcon } from "../SupportIcon";
|
||||
|
||||
export const Language = {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
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 { MockUpdateCheck } from "#/testHelpers/entities";
|
||||
import { server } from "#/testHelpers/server";
|
||||
import { useUpdateCheck } from "./useUpdateCheck";
|
||||
|
||||
const createWrapper = (): FC<PropsWithChildren> => {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { canViewDeploymentSettings } from "modules/permissions";
|
||||
import { RequirePermission } from "modules/permissions/RequirePermission";
|
||||
import { type FC, Suspense } from "react";
|
||||
import { Navigate, Outlet, useLocation } from "react-router";
|
||||
import {
|
||||
@@ -11,6 +9,8 @@ import {
|
||||
BreadcrumbSeparator,
|
||||
} from "#/components/Breadcrumb/Breadcrumb";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
import { canViewDeploymentSettings } from "#/modules/permissions";
|
||||
import { RequirePermission } from "#/modules/permissions/RequirePermission";
|
||||
import { DeploymentSidebar } from "./DeploymentSidebar";
|
||||
|
||||
const DeploymentSettingsLayout: FC = () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import type { FC } from "react";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import { DeploymentSidebarView } from "./DeploymentSidebarView";
|
||||
|
||||
/**
|
||||
|
||||
@@ -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";
|
||||
} from "#/testHelpers/entities";
|
||||
import { withDashboardProvider } from "#/testHelpers/storybook";
|
||||
import { DeploymentSidebarView } from "./DeploymentSidebarView";
|
||||
|
||||
const meta: Meta<typeof DeploymentSidebarView> = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ArrowUpRight } from "lucide-react";
|
||||
import type { Permissions } from "modules/permissions";
|
||||
import type { FC } from "react";
|
||||
import { isDevBuild } from "utils/buildInfo";
|
||||
import type { BuildInfoResponse, Experiment } from "#/api/typesGenerated";
|
||||
@@ -8,6 +7,7 @@ import {
|
||||
SettingsSidebarNavItem as SidebarNavItem,
|
||||
} from "#/components/Sidebar/Sidebar";
|
||||
import { Stack } from "#/components/Stack/Stack";
|
||||
import type { Permissions } from "#/modules/permissions";
|
||||
|
||||
interface DeploymentSidebarViewProps {
|
||||
/** Site-wide permissions. */
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
import { useDashboard } from "modules/dashboard/useDashboard";
|
||||
import {
|
||||
canViewOrganization,
|
||||
type OrganizationPermissions,
|
||||
} from "modules/permissions/organizations";
|
||||
import NotFoundPage from "pages/404Page/404Page";
|
||||
import { createContext, type FC, Suspense, useContext } from "react";
|
||||
import { useQuery } from "react-query";
|
||||
@@ -19,6 +14,11 @@ import {
|
||||
BreadcrumbSeparator,
|
||||
} from "#/components/Breadcrumb/Breadcrumb";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import {
|
||||
canViewOrganization,
|
||||
type OrganizationPermissions,
|
||||
} from "#/modules/permissions/organizations";
|
||||
|
||||
export const OrganizationSettingsContext = createContext<
|
||||
OrganizationSettingsValue | undefined
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useAuthenticated } from "hooks";
|
||||
import { useOrganizationSettings } from "modules/management/OrganizationSettingsLayout";
|
||||
import type { FC } from "react";
|
||||
import { Sidebar as BaseSidebar } from "#/components/Sidebar/Sidebar";
|
||||
import { useOrganizationSettings } from "#/modules/management/OrganizationSettingsLayout";
|
||||
import { OrganizationSidebarView } from "./OrganizationSidebarView";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import type { Organization } from "#/api/typesGenerated";
|
||||
import {
|
||||
MockNoOrganizationPermissions,
|
||||
MockNoPermissions,
|
||||
@@ -5,11 +8,8 @@ import {
|
||||
MockOrganization2,
|
||||
MockOrganizationPermissions,
|
||||
MockPermissions,
|
||||
} 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 type { Organization } from "#/api/typesGenerated";
|
||||
} from "#/testHelpers/entities";
|
||||
import { withDashboardProvider } from "#/testHelpers/storybook";
|
||||
import { OrganizationSidebarView } from "./OrganizationSidebarView";
|
||||
|
||||
const meta: Meta<typeof OrganizationSidebarView> = {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Check, Plus } from "lucide-react";
|
||||
import type { Permissions } from "modules/permissions";
|
||||
import type { OrganizationPermissions } from "modules/permissions/organizations";
|
||||
import { type FC, useState } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import type { Organization } from "#/api/typesGenerated";
|
||||
@@ -22,6 +20,8 @@ import {
|
||||
PopoverTrigger,
|
||||
} from "#/components/Popover/Popover";
|
||||
import { SettingsSidebarNavItem } from "#/components/Sidebar/Sidebar";
|
||||
import type { Permissions } from "#/modules/permissions";
|
||||
import type { OrganizationPermissions } from "#/modules/permissions/organizations";
|
||||
|
||||
interface OrganizationsSettingsNavigationProps {
|
||||
/** The organization selected from the dropdown */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @fileoverview TODO: centralize navigation code here! URL constants, URL formatting, all of it
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from "hooks/hookPolyfills";
|
||||
import { useEffectEvent } from "#/hooks/hookPolyfills";
|
||||
import type { DashboardValue } from "./dashboard/DashboardProvider";
|
||||
import { useDashboard } from "./dashboard/useDashboard";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MockNotification } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, userEvent, within } from "storybook/test";
|
||||
import { daysAgo } from "utils/time";
|
||||
import { MockNotification } from "#/testHelpers/entities";
|
||||
import { InboxItem } from "./InboxItem";
|
||||
|
||||
const meta: Meta<typeof 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 { MockNotifications, mockApiError } from "testHelpers/entities";
|
||||
import { withToaster } from "testHelpers/storybook";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
||||
import { MockNotifications, mockApiError } from "#/testHelpers/entities";
|
||||
import { withToaster } from "#/testHelpers/storybook";
|
||||
import { NotificationsInbox } from "./NotificationsInbox";
|
||||
|
||||
const meta: Meta<typeof NotificationsInbox> = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useEffectEvent } from "hooks/hookPolyfills";
|
||||
import { type FC, useEffect } from "react";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { toast } from "sonner";
|
||||
@@ -8,6 +7,7 @@ import type {
|
||||
ListInboxNotificationsResponse,
|
||||
UpdateInboxNotificationReadStatusResponse,
|
||||
} from "#/api/typesGenerated";
|
||||
import { useEffectEvent } from "#/hooks/hookPolyfills";
|
||||
import { InboxPopover } from "./InboxPopover";
|
||||
|
||||
const NOTIFICATIONS_QUERY_KEY = ["notifications"];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "#/testHelpers/chromatic";
|
||||
import { AlertVariant, ProvisionerAlert } from "./ProvisionerAlert";
|
||||
|
||||
const meta: Meta<typeof ProvisionerAlert> = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { ProvisionerTag } from "modules/provisioners/ProvisionerTag";
|
||||
import type { FC } from "react";
|
||||
import { cn } from "utils/cn";
|
||||
import {
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
AlertDescription,
|
||||
AlertTitle,
|
||||
} from "#/components/Alert/Alert";
|
||||
import { ProvisionerTag } from "#/modules/provisioners/ProvisionerTag";
|
||||
|
||||
export enum AlertVariant {
|
||||
// Alerts are usually styled with a full rounded border and meant to use as a visually distinct element of the page.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import { MockTemplateVersion } from "testHelpers/entities";
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { chromatic } from "#/testHelpers/chromatic";
|
||||
import { MockTemplateVersion } from "#/testHelpers/entities";
|
||||
import { AlertVariant } from "./ProvisionerAlert";
|
||||
import { ProvisionerStatusAlert } from "./ProvisionerStatusAlert";
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user