mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
chore: enable consistent-type-definitions oxlint rule (#29566)
This commit is contained in:
@@ -124,6 +124,7 @@
|
||||
"prefer-literal-enum-member": "error",
|
||||
"prefer-node-protocol": "error",
|
||||
"prefer-const": ["error", { "destructuring": "all" }],
|
||||
"consistent-type-definitions": ["error", "type"],
|
||||
|
||||
// --- style (coder-enabled as error) ---
|
||||
"prefer-as-const": "error",
|
||||
@@ -276,6 +277,12 @@
|
||||
],
|
||||
"rules": { "no-restricted-imports": "off" }
|
||||
},
|
||||
{
|
||||
// Ambient declarations (global and module augmentation) must stay
|
||||
// interfaces; type aliases cannot merge with the upstream declaration.
|
||||
"files": ["src/@types/*.d.ts"],
|
||||
"rules": { "consistent-type-definitions": "off" }
|
||||
},
|
||||
{
|
||||
"files": ["src/components/**/*.ts", "src/components/**/*.tsx"],
|
||||
"rules": {
|
||||
|
||||
+2
-2
@@ -614,7 +614,7 @@ type RecursivePartial<T> = {
|
||||
: T[P];
|
||||
};
|
||||
|
||||
interface EchoProvisionerResponses {
|
||||
type EchoProvisionerResponses = {
|
||||
init?: RecursivePartial<Response>[];
|
||||
// parse is for observing any Terraform variables
|
||||
parse?: RecursivePartial<Response>[];
|
||||
@@ -626,7 +626,7 @@ interface EchoProvisionerResponses {
|
||||
// extraFiles allows the bundling of terraform files in echo provisioner tars
|
||||
// in order to support dynamic parameters
|
||||
extraFiles?: Map<string, string>;
|
||||
}
|
||||
};
|
||||
|
||||
const emptyPlan = new TextEncoder().encode("{}");
|
||||
|
||||
|
||||
+2
-2
@@ -28,10 +28,10 @@ const defaultQueryClient = new QueryClient({
|
||||
},
|
||||
});
|
||||
|
||||
interface AppProvidersProps {
|
||||
type AppProvidersProps = {
|
||||
children: ReactNode;
|
||||
queryClient?: QueryClient;
|
||||
}
|
||||
};
|
||||
|
||||
export const AppProviders: FC<AppProvidersProps> = ({
|
||||
children,
|
||||
|
||||
+2
-2
@@ -4041,13 +4041,13 @@ function createWebSocket(
|
||||
}
|
||||
|
||||
// Other non-API methods defined here to make it a little easier to find them.
|
||||
interface ClientApi extends ApiMethods {
|
||||
type ClientApi = ApiMethods & {
|
||||
getCsrfToken: () => string;
|
||||
setSessionToken: (token: string) => void;
|
||||
getSessionToken: () => string | undefined;
|
||||
setHost: (host: string | undefined) => void;
|
||||
getAxiosInstance: () => AxiosInstance;
|
||||
}
|
||||
};
|
||||
|
||||
/** @public Exported for use by external consumers (e.g., VS Code extension). */
|
||||
export class Api extends ApiMethods implements ClientApi {
|
||||
|
||||
@@ -4,7 +4,7 @@ import schema from "./chatModelOptionsGenerated.json";
|
||||
* Describes a single configurable field for a chat model provider.
|
||||
* Generated from Go struct tags via `scripts/modeloptionsgen`.
|
||||
*/
|
||||
export interface FieldSchema {
|
||||
export type FieldSchema = {
|
||||
/** The JSON key used in API payloads (may use dot-notation for nested fields). */
|
||||
json_name: string;
|
||||
/** The corresponding Go struct field name. */
|
||||
@@ -27,14 +27,14 @@ export interface FieldSchema {
|
||||
conflicts_with?: string[];
|
||||
/** Raw provider types the field applies to; absent means every provider. */
|
||||
visible_for_providers?: string[];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A group of fields belonging to a single provider or the general section.
|
||||
*/
|
||||
interface ProviderSchema {
|
||||
type ProviderSchema = {
|
||||
fields: FieldSchema[];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Top-level schema describing all configurable chat model options.
|
||||
@@ -44,11 +44,11 @@ interface ProviderSchema {
|
||||
* - `provider_aliases` maps alternate names to canonical provider names
|
||||
* (e.g. "azure" → "openai").
|
||||
*/
|
||||
interface ModelOptionsSchema {
|
||||
type ModelOptionsSchema = {
|
||||
general: ProviderSchema;
|
||||
providers: Record<string, ProviderSchema>;
|
||||
provider_aliases: Record<string, string>;
|
||||
}
|
||||
};
|
||||
|
||||
/** The imported schema, typed as {@link ModelOptionsSchema}. */
|
||||
const modelOptionsSchema: ModelOptionsSchema = schema as ModelOptionsSchema;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { type AxiosError, type AxiosResponse, isAxiosError } from "axios";
|
||||
|
||||
export interface FieldError {
|
||||
export type FieldError = {
|
||||
field: string;
|
||||
detail: string;
|
||||
}
|
||||
};
|
||||
|
||||
type FieldErrors = Record<FieldError["field"], FieldError["detail"]>;
|
||||
|
||||
export interface ApiErrorResponse {
|
||||
export type ApiErrorResponse = {
|
||||
message: string;
|
||||
detail?: string;
|
||||
validations?: FieldError[];
|
||||
}
|
||||
};
|
||||
|
||||
export type ApiError = AxiosError<ApiErrorResponse> & {
|
||||
response: AxiosResponse<ApiErrorResponse>;
|
||||
|
||||
@@ -43,10 +43,10 @@ export const createOrganization = (queryClient: QueryClient) => {
|
||||
};
|
||||
};
|
||||
|
||||
interface UpdateOrganizationVariables {
|
||||
type UpdateOrganizationVariables = {
|
||||
organizationId: string;
|
||||
req: UpdateOrganizationRequest;
|
||||
}
|
||||
};
|
||||
|
||||
export const updateOrganization = (queryClient: QueryClient) => {
|
||||
return {
|
||||
|
||||
@@ -294,10 +294,10 @@ export const setOptimisticWorkspaceListBuildStatus = (
|
||||
};
|
||||
};
|
||||
|
||||
interface WorkspaceMutationInvalidationOptions {
|
||||
type WorkspaceMutationInvalidationOptions = {
|
||||
organizationName: string;
|
||||
username: string;
|
||||
}
|
||||
};
|
||||
|
||||
export async function invalidateWorkspaceMutationQueries(
|
||||
queryClient: QueryClient,
|
||||
@@ -536,12 +536,12 @@ export const agentListeningPorts = (agentId: string) => {
|
||||
};
|
||||
|
||||
// workspace usage options
|
||||
interface WorkspaceUsageOptions {
|
||||
type WorkspaceUsageOptions = {
|
||||
usageApp: UsageAppName;
|
||||
connectionStatus: ConnectionStatus;
|
||||
workspaceId: string | undefined;
|
||||
agentId: string | undefined;
|
||||
}
|
||||
};
|
||||
|
||||
export const workspaceUsage = (options: WorkspaceUsageOptions) => {
|
||||
return {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { cn } from "cn";
|
||||
import { ChevronDownIcon as LucideChevronDown } from "lucide-react";
|
||||
|
||||
interface ChevronDownIconProps
|
||||
extends React.ComponentProps<typeof LucideChevronDown> {
|
||||
type ChevronDownIconProps = React.ComponentProps<typeof LucideChevronDown> & {
|
||||
/**
|
||||
* Explicitly control rotation state. When omitted, rotation is
|
||||
* driven by Radix's data-state attribute on a parent element
|
||||
* with className="group".
|
||||
*/
|
||||
open?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const ChevronDownIcon: React.FC<ChevronDownIconProps> = ({
|
||||
open,
|
||||
|
||||
@@ -18,10 +18,10 @@ export default meta;
|
||||
|
||||
type Story = StoryObj<typeof Autocomplete>;
|
||||
|
||||
interface SimpleOption {
|
||||
type SimpleOption = {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
};
|
||||
|
||||
const simpleOptions: SimpleOption[] = [
|
||||
{ id: "1", name: "Mango" },
|
||||
@@ -372,12 +372,12 @@ export const ClearSelection: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
interface User {
|
||||
type User = {
|
||||
id: string;
|
||||
username: string;
|
||||
email: string;
|
||||
avatar_url?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const users: User[] = [
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from "#/components/Popover/Popover";
|
||||
import { Spinner } from "#/components/Spinner/Spinner";
|
||||
|
||||
interface AutocompleteProps<TOption> {
|
||||
type AutocompleteProps<TOption> = {
|
||||
value: TOption | null;
|
||||
onChange: (value: TOption | null) => void;
|
||||
options: readonly TOption[];
|
||||
@@ -52,7 +52,7 @@ interface AutocompleteProps<TOption> {
|
||||
triggerAriaDescribedBy?: string;
|
||||
id?: string;
|
||||
"data-testid"?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export function Autocomplete<TOption>({
|
||||
value,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
|
||||
interface AvatarDataProps {
|
||||
type AvatarDataProps = {
|
||||
title: ReactNode;
|
||||
subtitle?: ReactNode;
|
||||
src?: string;
|
||||
@@ -25,7 +25,7 @@ interface AvatarDataProps {
|
||||
* nodes (icons, badges) as `title` would otherwise clip silently.
|
||||
*/
|
||||
truncate?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const AvatarData: FC<AvatarDataProps> = ({
|
||||
title,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { CopyButton } from "../CopyButton/CopyButton";
|
||||
|
||||
interface CodeExampleProps {
|
||||
type CodeExampleProps = {
|
||||
code: string;
|
||||
/** Defaulting to true to be on the safe side; you should have to opt out of the secure option, not remember to opt in */
|
||||
secret?: boolean;
|
||||
@@ -20,7 +20,7 @@ interface CodeExampleProps {
|
||||
/** Show a button to reveal the redacted parts of the code */
|
||||
showRevealButton?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Component to show single-line code examples, with a copy button
|
||||
|
||||
@@ -20,8 +20,9 @@ const collapsibleSummaryVariants = cva(
|
||||
},
|
||||
);
|
||||
|
||||
interface CollapsibleSummaryProps
|
||||
extends VariantProps<typeof collapsibleSummaryVariants> {
|
||||
type CollapsibleSummaryProps = VariantProps<
|
||||
typeof collapsibleSummaryVariants
|
||||
> & {
|
||||
/**
|
||||
* The label to display for the collapsible section
|
||||
*/
|
||||
@@ -46,7 +47,7 @@ interface CollapsibleSummaryProps
|
||||
* Will scroll the children into view whenever the component is opened
|
||||
*/
|
||||
scrollIntoViewOnOpen?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const CollapsibleSummary: FC<CollapsibleSummaryProps> = ({
|
||||
label,
|
||||
|
||||
@@ -35,10 +35,10 @@ function useCombobox() {
|
||||
return context;
|
||||
}
|
||||
|
||||
interface ComboboxProps extends React.ComponentProps<typeof Popover> {
|
||||
type ComboboxProps = {
|
||||
value?: string;
|
||||
onValueChange?: (value: string | undefined) => void;
|
||||
}
|
||||
} & React.ComponentProps<typeof Popover>;
|
||||
|
||||
export const Combobox = ({
|
||||
children,
|
||||
@@ -65,11 +65,11 @@ export const Combobox = ({
|
||||
|
||||
export const ComboboxTrigger = PopoverTrigger;
|
||||
|
||||
interface ComboboxButtonProps extends React.ComponentProps<"button"> {
|
||||
type ComboboxButtonProps = React.ComponentProps<"button"> & {
|
||||
width?: number;
|
||||
selectedOption?: SelectFilterOption;
|
||||
placeholder?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const ComboboxButton = ({
|
||||
children,
|
||||
|
||||
@@ -10,10 +10,10 @@ import { useClipboard } from "#/hooks/useClipboard";
|
||||
|
||||
type TooltipSide = "top" | "right" | "bottom" | "left";
|
||||
|
||||
interface CopyableValueProps extends ComponentProps<"span"> {
|
||||
type CopyableValueProps = ComponentProps<"span"> & {
|
||||
value: string;
|
||||
side?: TooltipSide;
|
||||
}
|
||||
};
|
||||
|
||||
export const CopyableValue: FC<CopyableValueProps> = ({
|
||||
value,
|
||||
|
||||
@@ -22,10 +22,10 @@ export type DateRangeValue = {
|
||||
endDate: Date;
|
||||
};
|
||||
|
||||
interface DateRangePreset {
|
||||
type DateRangePreset = {
|
||||
label: string;
|
||||
range: () => { from: Date; to: Date };
|
||||
}
|
||||
};
|
||||
|
||||
const buildDefaultPresets = (now?: Date): DateRangePreset[] => {
|
||||
const getCurrentTime = () => dayjs(now ?? new Date());
|
||||
@@ -77,13 +77,13 @@ const buildDefaultPresets = (now?: Date): DateRangePreset[] => {
|
||||
];
|
||||
};
|
||||
|
||||
interface DateRangePickerProps {
|
||||
type DateRangePickerProps = {
|
||||
value: DateRangeValue;
|
||||
onChange: (value: DateRangeValue) => void;
|
||||
now?: Date;
|
||||
presets?: DateRangePreset[];
|
||||
size?: ButtonProps["size"];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalise a calendar selection into the API-friendly boundary format
|
||||
|
||||
@@ -35,13 +35,13 @@ import {
|
||||
toClockFields,
|
||||
} from "./dateTimeRange";
|
||||
|
||||
interface DateTimeRangePickerProps {
|
||||
type DateTimeRangePickerProps = {
|
||||
value: DateTimeRangeValue;
|
||||
onChange: (value: DateTimeRangeValue) => void;
|
||||
now?: Date;
|
||||
presets?: QuickPreset[];
|
||||
size?: ButtonProps["size"];
|
||||
}
|
||||
};
|
||||
|
||||
const INVALID_TIME_MESSAGE = "Enter a valid time, e.g. 09:30:00";
|
||||
const RANGE_ORDER_MESSAGE = "End must be after start";
|
||||
@@ -50,14 +50,14 @@ const RANGE_ORDER_MESSAGE = "End must be after start";
|
||||
// until the input is corrected.
|
||||
const ERROR_DISMISS_TIMEOUT_MS = 5_000;
|
||||
|
||||
interface TimeFieldsState {
|
||||
type TimeFieldsState = {
|
||||
from: string;
|
||||
fromMeridiem: Meridiem;
|
||||
fromTouched: boolean;
|
||||
to: string;
|
||||
toMeridiem: Meridiem;
|
||||
toTouched: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
// From defaults to the start of the day and To to the end, so any
|
||||
// day-only selection spans the full final day.
|
||||
@@ -354,12 +354,12 @@ export const DateTimeRangePicker: FC<DateTimeRangePickerProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface QuickPickButtonProps {
|
||||
type QuickPickButtonProps = {
|
||||
label: string;
|
||||
selected: boolean;
|
||||
tabIndex: number;
|
||||
onClick: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
const QuickPickButton: FC<QuickPickButtonProps> = ({
|
||||
label,
|
||||
@@ -386,7 +386,7 @@ const QuickPickButton: FC<QuickPickButtonProps> = ({
|
||||
</button>
|
||||
);
|
||||
|
||||
interface TimeRowProps {
|
||||
type TimeRowProps = {
|
||||
id: string;
|
||||
label: string;
|
||||
time: string;
|
||||
@@ -396,7 +396,7 @@ interface TimeRowProps {
|
||||
onTimeChange: (time: string) => void;
|
||||
onBlur: () => void;
|
||||
onMeridiemChange: (meridiem: Meridiem) => void;
|
||||
}
|
||||
};
|
||||
|
||||
const TimeRow: FC<TimeRowProps> = ({
|
||||
id,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export interface QuickPreset {
|
||||
export type QuickPreset = {
|
||||
id: string;
|
||||
label: string;
|
||||
range: (now: Date) => { start: Date; end: Date };
|
||||
}
|
||||
};
|
||||
|
||||
export interface DateTimeRangeValue {
|
||||
export type DateTimeRangeValue = {
|
||||
start: Date;
|
||||
end: Date;
|
||||
/** Display metadata only; never sent to the API. */
|
||||
preset?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const DEFAULT_QUICK_PRESETS: QuickPreset[] = [
|
||||
{
|
||||
@@ -52,12 +52,12 @@ export const DEFAULT_QUICK_PRESETS: QuickPreset[] = [
|
||||
|
||||
export type Meridiem = "AM" | "PM";
|
||||
|
||||
interface ClockTime {
|
||||
type ClockTime = {
|
||||
/** 12-hour clock hours, 1-12. */
|
||||
hours: number;
|
||||
minutes: number;
|
||||
seconds: number;
|
||||
}
|
||||
};
|
||||
|
||||
const TIME_PATTERN = /^(\d{1,2}):([0-5]\d)(?::([0-5]\d))?$/;
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ import {
|
||||
|
||||
type ConfirmDialogType = "delete" | "info" | "success";
|
||||
|
||||
interface ConfirmDialogTypeConfig {
|
||||
type ConfirmDialogTypeConfig = {
|
||||
confirmText: ReactNode;
|
||||
hideCancel: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
const CONFIRM_DIALOG_DEFAULTS: Record<
|
||||
ConfirmDialogType,
|
||||
@@ -34,7 +34,7 @@ const CONFIRM_DIALOG_DEFAULTS: Record<
|
||||
},
|
||||
};
|
||||
|
||||
export interface ConfirmDialogProps {
|
||||
export type ConfirmDialogProps = {
|
||||
readonly title: string;
|
||||
readonly open: boolean;
|
||||
readonly onClose: () => void;
|
||||
@@ -60,7 +60,7 @@ export interface ConfirmDialogProps {
|
||||
* and focus that control instead.
|
||||
*/
|
||||
readonly onCloseAutoFocus?: (event: Event) => void;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Quick-use dialog for yes/no style confirmations without custom layout.
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Input } from "#/components/Input/Input";
|
||||
import { Label } from "#/components/Label/Label";
|
||||
import { Spinner } from "#/components/Spinner/Spinner";
|
||||
|
||||
interface DeleteDialogProps {
|
||||
type DeleteDialogProps = {
|
||||
isOpen: boolean;
|
||||
onConfirm: () => void;
|
||||
onCancel: () => void;
|
||||
@@ -25,7 +25,7 @@ interface DeleteDialogProps {
|
||||
title?: string;
|
||||
label?: string;
|
||||
confirmText?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const DeleteDialog: FC<DeleteDialogProps> = ({
|
||||
isOpen,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC, ReactNode } from "react";
|
||||
|
||||
export interface EmptyStateProps extends ComponentProps<"div"> {
|
||||
export type EmptyStateProps = ComponentProps<"div"> & {
|
||||
/** Text Message to display, placed inside Typography component */
|
||||
message: string;
|
||||
/** Longer optional description to display below the message */
|
||||
@@ -9,7 +9,7 @@ export interface EmptyStateProps extends ComponentProps<"div"> {
|
||||
cta?: ReactNode;
|
||||
image?: ReactNode;
|
||||
isCompact?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Component to place on screens or in lists that have no content. Optionally
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { type FC, useMemo } from "react";
|
||||
import setiIconTheme from "./seti-icon-theme.json";
|
||||
|
||||
interface SetiIconDefinition {
|
||||
type SetiIconDefinition = {
|
||||
fontCharacter?: string;
|
||||
fontColor?: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface FileIconGlyph {
|
||||
type FileIconGlyph = {
|
||||
character: string;
|
||||
color?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const setiIconDefinitions: Record<string, SetiIconDefinition> =
|
||||
setiIconTheme.iconDefinitions;
|
||||
@@ -249,12 +249,12 @@ const BASE_ICON_STYLE: React.CSSProperties = {
|
||||
letterSpacing: "normal",
|
||||
};
|
||||
|
||||
interface FileIconProps {
|
||||
type FileIconProps = {
|
||||
fileName?: string | null;
|
||||
filePath?: string | null;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
};
|
||||
|
||||
export const FileIcon: FC<FileIconProps> = ({
|
||||
fileName,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Button } from "#/components/Button/Button";
|
||||
import { useClickable } from "#/hooks/useClickable";
|
||||
import { Spinner } from "../Spinner/Spinner";
|
||||
|
||||
interface FileUploadProps {
|
||||
type FileUploadProps = {
|
||||
isUploading: boolean;
|
||||
onUpload: (file: File) => void;
|
||||
onUnsupportedFile?: (file: File) => void;
|
||||
@@ -15,7 +15,7 @@ interface FileUploadProps {
|
||||
title: string;
|
||||
description?: ReactNode;
|
||||
extensions?: string[];
|
||||
}
|
||||
};
|
||||
|
||||
export const FileUpload: FC<FileUploadProps> = ({
|
||||
isUploading,
|
||||
|
||||
@@ -225,14 +225,14 @@ export const Filter: FC<FilterProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface PresetMenuProps {
|
||||
type PresetMenuProps = {
|
||||
value: string;
|
||||
presets: PresetFilter[];
|
||||
learnMoreLink?: string;
|
||||
learnMoreLabel2?: string;
|
||||
learnMoreLink2?: string;
|
||||
onSelect: (query: string) => void;
|
||||
}
|
||||
};
|
||||
|
||||
const PresetMenu: FC<PresetMenuProps> = ({
|
||||
value,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { FC } from "react";
|
||||
import { Filter, type useFilter } from "#/components/Filter/Filter";
|
||||
|
||||
interface GroupsFilterProps {
|
||||
type GroupsFilterProps = {
|
||||
filter: ReturnType<typeof useFilter>;
|
||||
}
|
||||
};
|
||||
|
||||
// GroupsFilter renders a search-only filter. Groups support free-text search
|
||||
// against name and display name, so there are no presets or option menus.
|
||||
|
||||
@@ -82,11 +82,11 @@ export const useUserFilterMenu = ({
|
||||
|
||||
export type UserFilterMenu = ReturnType<typeof useUserFilterMenu>;
|
||||
|
||||
interface UserMenuProps {
|
||||
type UserMenuProps = {
|
||||
menu: UserFilterMenu;
|
||||
placeholder?: string;
|
||||
width?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export const UserMenu: FC<UserMenuProps> = ({ menu, width, placeholder }) => {
|
||||
return (
|
||||
|
||||
@@ -60,13 +60,13 @@ const PRESET_FILTERS = [
|
||||
{ query: userFilterQuery.all, name: "All users" },
|
||||
];
|
||||
|
||||
interface UsersFilterProps {
|
||||
type UsersFilterProps = {
|
||||
filter: ReturnType<typeof useFilter>;
|
||||
error?: unknown;
|
||||
menus?: {
|
||||
status?: StatusFilterMenu;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const UsersFilter: FC<UsersFilterProps> = ({ filter, error, menus }) => {
|
||||
return (
|
||||
|
||||
@@ -56,7 +56,7 @@ export const VerticalForm: FC<HTMLProps<HTMLFormElement>> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface FormSectionProps {
|
||||
type FormSectionProps = {
|
||||
children?: ReactNode;
|
||||
title: ReactNode;
|
||||
description: ReactNode;
|
||||
@@ -68,7 +68,7 @@ interface FormSectionProps {
|
||||
alpha?: boolean;
|
||||
deprecated?: boolean;
|
||||
ref?: React.Ref<HTMLElement>;
|
||||
}
|
||||
};
|
||||
|
||||
export const FormSection: FC<FormSectionProps> = ({
|
||||
children,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { FC } from "react";
|
||||
import { expect, within } from "storybook/test";
|
||||
import { FormField } from "./FormField";
|
||||
|
||||
interface ExampleFormFieldProps {
|
||||
type ExampleFormFieldProps = {
|
||||
id?: string;
|
||||
label: string;
|
||||
description?: string;
|
||||
@@ -12,7 +12,7 @@ interface ExampleFormFieldProps {
|
||||
required?: boolean;
|
||||
error?: string;
|
||||
value?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const ExampleFormField: FC<ExampleFormFieldProps> = ({
|
||||
id,
|
||||
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
PageHeaderSubtitle,
|
||||
PageHeaderTitle,
|
||||
} from "#/components/PageHeader/PageHeader";
|
||||
export interface FullPageFormProps {
|
||||
export type FullPageFormProps = {
|
||||
title: string;
|
||||
detail?: ReactNode;
|
||||
children?: ReactNode;
|
||||
size?: Size;
|
||||
}
|
||||
};
|
||||
|
||||
export const FullPageForm: FC<FullPageFormProps> = ({
|
||||
title,
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
PageHeaderTitle,
|
||||
} from "#/components/PageHeader/PageHeader";
|
||||
|
||||
interface FullPageHorizontalFormProps {
|
||||
type FullPageHorizontalFormProps = {
|
||||
title: string;
|
||||
detail?: ReactNode;
|
||||
onCancel?: () => void;
|
||||
children?: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const FullPageHorizontalForm: FC<FullPageHorizontalFormProps> = ({
|
||||
title,
|
||||
|
||||
@@ -25,9 +25,9 @@ export const SidebarLink: FC<LinkProps> = ({ className, ...props }) => {
|
||||
);
|
||||
};
|
||||
|
||||
interface SidebarItemProps extends ComponentProps<"button"> {
|
||||
type SidebarItemProps = ComponentProps<"button"> & {
|
||||
isActive?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const SidebarItem: FC<SidebarItemProps> = ({
|
||||
isActive,
|
||||
@@ -55,10 +55,9 @@ export const SidebarCaption: FC<ComponentProps<"span">> = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
interface SidebarIconButtonProps
|
||||
extends ComponentProps<typeof TopbarIconButton> {
|
||||
type SidebarIconButtonProps = {
|
||||
isActive: boolean;
|
||||
}
|
||||
} & ComponentProps<typeof TopbarIconButton>;
|
||||
|
||||
export const SidebarIconButton: FC<SidebarIconButtonProps> = ({
|
||||
isActive,
|
||||
|
||||
@@ -9,10 +9,10 @@ import { Link } from "#/components/Link/Link";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
import { Spinner } from "../Spinner/Spinner";
|
||||
|
||||
interface GitDeviceAuthProps {
|
||||
type GitDeviceAuthProps = {
|
||||
externalAuthDevice?: ExternalAuthDevice;
|
||||
deviceExchangeError?: ApiErrorResponse;
|
||||
}
|
||||
};
|
||||
|
||||
const DeviceExchangeError = {
|
||||
AuthorizationPending: "authorization_pending",
|
||||
|
||||
@@ -104,10 +104,10 @@ export const HelpPopoverText: FC<ComponentProps<"p">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface HelpPopoverLinkProps {
|
||||
type HelpPopoverLinkProps = {
|
||||
children?: ReactNode;
|
||||
href: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const HelpPopoverLink: FC<HelpPopoverLinkProps> = ({
|
||||
children,
|
||||
@@ -126,12 +126,12 @@ export const HelpPopoverLink: FC<HelpPopoverLinkProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface HelpPopoverActionProps {
|
||||
type HelpPopoverActionProps = {
|
||||
children?: ReactNode;
|
||||
icon: Icon;
|
||||
onClick: () => void;
|
||||
ariaLabel?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const HelpPopoverAction: FC<HelpPopoverActionProps> = ({
|
||||
children,
|
||||
|
||||
@@ -13,11 +13,11 @@ export type InfoTooltipType = "info" | "warning";
|
||||
|
||||
type InfoTooltipSize = "small" | "medium";
|
||||
|
||||
interface InfoTooltipProps {
|
||||
type InfoTooltipProps = {
|
||||
type?: InfoTooltipType;
|
||||
size?: InfoTooltipSize;
|
||||
children: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
const typeIcon: Record<InfoTooltipType, typeof InfoIcon> = {
|
||||
info: InfoIcon,
|
||||
|
||||
@@ -3,12 +3,12 @@ import type dayjs from "dayjs";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { isAfter, subtractTime, timeFrom } from "#/utils/time";
|
||||
|
||||
interface LastSeenProps extends Omit<ComponentProps<"span">, "children"> {
|
||||
type LastSeenProps = Omit<ComponentProps<"span">, "children"> & {
|
||||
at: dayjs.ConfigType;
|
||||
// Injectable reference time so the component is deterministic in tests.
|
||||
now?: dayjs.ConfigType;
|
||||
"data-pixel"?: string; // prevents a type error in the stories
|
||||
}
|
||||
};
|
||||
|
||||
const displayFor = (
|
||||
at: dayjs.ConfigType,
|
||||
|
||||
@@ -10,11 +10,11 @@ import {
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { getLatencyColor } from "#/utils/latency";
|
||||
|
||||
interface LatencyProps {
|
||||
type LatencyProps = {
|
||||
latency?: number;
|
||||
isLoading?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const Latency: FC<LatencyProps> = ({
|
||||
latency,
|
||||
|
||||
@@ -2,14 +2,14 @@ import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { Spinner } from "#/components/Spinner/Spinner";
|
||||
|
||||
interface LoaderProps extends ComponentProps<"div"> {
|
||||
type LoaderProps = ComponentProps<"div"> & {
|
||||
fullscreen?: boolean;
|
||||
size?: "sm" | "lg";
|
||||
/**
|
||||
* A label for the loader. This is used for accessibility purposes.
|
||||
*/
|
||||
label?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const Loader: FC<LoaderProps> = ({
|
||||
fullscreen,
|
||||
|
||||
@@ -4,13 +4,13 @@ import type { LogLevel } from "#/api/typesGenerated";
|
||||
|
||||
const DEFAULT_LOG_LINE_SIDE_PADDING = 24;
|
||||
|
||||
export interface Line {
|
||||
export type Line = {
|
||||
id: number;
|
||||
time: string;
|
||||
output: string;
|
||||
level: LogLevel;
|
||||
sourceId: string;
|
||||
}
|
||||
};
|
||||
|
||||
type LogLineProps = {
|
||||
level: LogLevel;
|
||||
|
||||
@@ -5,11 +5,11 @@ import { type Line, LogLine, LogLinePrefix } from "./LogLine";
|
||||
|
||||
export const DEFAULT_LOG_LINE_SIDE_PADDING = 24;
|
||||
|
||||
interface LogsProps {
|
||||
type LogsProps = {
|
||||
lines: Line[];
|
||||
hideTimestamps?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const Logs: FC<LogsProps> = ({
|
||||
hideTimestamps,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { type FC, memo } from "react";
|
||||
import ReactMarkdown, { type Options } from "react-markdown";
|
||||
import { Link } from "#/components/Link/Link";
|
||||
|
||||
interface InlineMarkdownProps {
|
||||
type InlineMarkdownProps = {
|
||||
/**
|
||||
* The Markdown text to parse and render
|
||||
*/
|
||||
@@ -22,7 +22,7 @@ interface InlineMarkdownProps {
|
||||
* Can override the behavior of the generated elements
|
||||
*/
|
||||
components?: Options["components"];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Supports a strict subset of Markdown that behaves well as inline/confined
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
TableRow,
|
||||
} from "#/components/Table/Table";
|
||||
|
||||
interface MarkdownProps {
|
||||
type MarkdownProps = {
|
||||
/**
|
||||
* The Markdown text to parse and render
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ interface MarkdownProps {
|
||||
* Can override the behavior of the generated elements
|
||||
*/
|
||||
components?: Options["components"];
|
||||
}
|
||||
};
|
||||
|
||||
export const Markdown: FC<MarkdownProps> = (props) => {
|
||||
const { children, className, components = {} } = props;
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { useDebouncedValue } from "#/hooks/debounce";
|
||||
|
||||
export interface Option {
|
||||
export type Option = {
|
||||
value: string;
|
||||
label: string;
|
||||
icon?: string;
|
||||
@@ -43,12 +43,12 @@ export interface Option {
|
||||
fixed?: boolean;
|
||||
/** Group the options by providing key. */
|
||||
[key: string]: string | boolean | undefined;
|
||||
}
|
||||
interface GroupOption {
|
||||
};
|
||||
type GroupOption = {
|
||||
[key: string]: Option[];
|
||||
}
|
||||
};
|
||||
|
||||
interface MultiSelectComboboxProps {
|
||||
type MultiSelectComboboxProps = {
|
||||
value?: Option[];
|
||||
defaultOptions?: Option[];
|
||||
/** manually controlled options */
|
||||
@@ -106,14 +106,14 @@ interface MultiSelectComboboxProps {
|
||||
/** Test ID for testing purposes */
|
||||
"data-testid"?: string;
|
||||
ref?: Ref<MultiSelectComboboxRef>;
|
||||
}
|
||||
};
|
||||
|
||||
interface MultiSelectComboboxRef {
|
||||
type MultiSelectComboboxRef = {
|
||||
selectedValue: Option[];
|
||||
input: HTMLInputElement;
|
||||
focus: () => void;
|
||||
reset: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
function transitionToGroupOption(options: Option[], groupBy?: string) {
|
||||
if (options.length === 0) {
|
||||
|
||||
@@ -234,14 +234,14 @@ const TableLoader: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
interface UserRowProps<T extends SelectedUser> {
|
||||
type UserRowProps<T extends SelectedUser> = {
|
||||
checked: boolean;
|
||||
children?: ReactNode;
|
||||
isFirst: boolean;
|
||||
isLast: boolean;
|
||||
onChange: (user: T, checked: boolean) => void;
|
||||
user: T;
|
||||
}
|
||||
};
|
||||
|
||||
const UserRow = <T extends SelectedUser>({
|
||||
checked,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, PropsWithChildren, ReactNode } from "react";
|
||||
|
||||
interface FullWidthPageHeaderProps {
|
||||
type FullWidthPageHeaderProps = {
|
||||
children?: ReactNode;
|
||||
sticky?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const FullWidthPageHeader: FC<FullWidthPageHeaderProps> = ({
|
||||
children,
|
||||
|
||||
@@ -2,11 +2,11 @@ import { cn } from "cn";
|
||||
import type React from "react";
|
||||
import type { FC, ReactNode } from "react";
|
||||
|
||||
interface PageHeaderProps {
|
||||
type PageHeaderProps = {
|
||||
actions?: ReactNode;
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const PageHeader: FC<PageHeaderProps> = ({
|
||||
children,
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
import { cn } from "cn";
|
||||
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
|
||||
|
||||
interface ScrollAreaProps
|
||||
extends React.ComponentProps<typeof ScrollAreaPrimitive.Root> {
|
||||
type ScrollAreaProps = React.ComponentProps<typeof ScrollAreaPrimitive.Root> & {
|
||||
scrollBarClassName?: string;
|
||||
horizontalScrollBarClassName?: string;
|
||||
/** Extra thumb classes; also reaches the thumb's `::before` hit-target. */
|
||||
@@ -17,7 +16,7 @@ interface ScrollAreaProps
|
||||
viewportAriaLabel?: string;
|
||||
/** Which scrollbar(s) to show. Defaults to "vertical". */
|
||||
orientation?: "vertical" | "horizontal" | "both";
|
||||
}
|
||||
};
|
||||
|
||||
export const ScrollArea: React.FC<ScrollAreaProps> = ({
|
||||
className,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SelectField } from "./SelectField";
|
||||
|
||||
const regions = ["us-east-1", "us-west-2", "eu-central-1"];
|
||||
|
||||
interface ExampleSelectFieldProps {
|
||||
type ExampleSelectFieldProps = {
|
||||
id?: string;
|
||||
label: string;
|
||||
description?: string;
|
||||
@@ -16,7 +16,7 @@ interface ExampleSelectFieldProps {
|
||||
error?: string;
|
||||
value?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
const ExampleSelectField: FC<ExampleSelectFieldProps> = ({
|
||||
id,
|
||||
|
||||
@@ -2,10 +2,10 @@ import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { NavLink, type To } from "react-router";
|
||||
|
||||
interface SidebarProps {
|
||||
type SidebarProps = {
|
||||
children?: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const Sidebar: FC<SidebarProps> = ({ className, children }) => {
|
||||
return (
|
||||
@@ -13,11 +13,11 @@ export const Sidebar: FC<SidebarProps> = ({ className, children }) => {
|
||||
);
|
||||
};
|
||||
|
||||
interface SettingsSidebarNavItemProps {
|
||||
type SettingsSidebarNavItemProps = {
|
||||
children?: ReactNode;
|
||||
href: To;
|
||||
end?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const SettingsSidebarNavItem: FC<SettingsSidebarNavItemProps> = ({
|
||||
children,
|
||||
|
||||
@@ -19,10 +19,10 @@ export const Stats: FC<ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface StatsItemProps extends ComponentProps<"div"> {
|
||||
type StatsItemProps = ComponentProps<"div"> & {
|
||||
label: string;
|
||||
value: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const StatsItem: FC<StatsItemProps> = ({
|
||||
label,
|
||||
|
||||
@@ -29,11 +29,11 @@ function themeRoleToBadgeVariant(
|
||||
}
|
||||
}
|
||||
|
||||
interface StatusBadgeProps {
|
||||
type StatusBadgeProps = {
|
||||
code: number;
|
||||
isHttpCode: boolean;
|
||||
label?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const StatusBadge: FC<StatusBadgeProps> = ({
|
||||
code,
|
||||
|
||||
@@ -73,9 +73,8 @@ const dotVariants = cva("rounded-full inline-block border-4 border-solid", {
|
||||
},
|
||||
});
|
||||
|
||||
interface StatusIndicatorDotProps
|
||||
extends React.ComponentProps<"div">,
|
||||
VariantProps<typeof dotVariants> {}
|
||||
type StatusIndicatorDotProps = React.ComponentProps<"div"> &
|
||||
VariantProps<typeof dotVariants>;
|
||||
|
||||
export const StatusIndicatorDot: FC<StatusIndicatorDotProps> = ({
|
||||
className,
|
||||
@@ -100,9 +99,9 @@ export const StatusIndicatorDot: FC<StatusIndicatorDotProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface StatusHealthyIndicatorProps {
|
||||
type StatusHealthyIndicatorProps = {
|
||||
derpOnly?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const StatusHealthyIndicator: FC<StatusHealthyIndicatorProps> = ({
|
||||
derpOnly,
|
||||
|
||||
@@ -27,12 +27,12 @@ type CommonEditorProps = Omit<
|
||||
) => void;
|
||||
};
|
||||
|
||||
interface SyntaxHighlighterProps {
|
||||
type SyntaxHighlighterProps = {
|
||||
value: string;
|
||||
language?: string;
|
||||
editorProps?: CommonEditorProps;
|
||||
compareWith?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const SyntaxHighlighter: FC<SyntaxHighlighterProps> = ({
|
||||
value,
|
||||
|
||||
@@ -16,10 +16,10 @@ export const TableLoader: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
interface TableLoaderSkeletonProps {
|
||||
type TableLoaderSkeletonProps = {
|
||||
rows?: number;
|
||||
children?: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const TableLoaderSkeleton: FC<TableLoaderSkeletonProps> = ({
|
||||
rows = 4,
|
||||
|
||||
@@ -22,11 +22,11 @@ const groupByDate = <TData,>(
|
||||
return itemsByDate;
|
||||
};
|
||||
|
||||
interface TimelineProps<TData> {
|
||||
type TimelineProps<TData> = {
|
||||
items: readonly TData[];
|
||||
getDate: GetDateFn<TData>;
|
||||
row: (item: TData) => JSX.Element;
|
||||
}
|
||||
};
|
||||
|
||||
export const Timeline = <TData,>({
|
||||
items,
|
||||
|
||||
@@ -3,9 +3,9 @@ import { TableCell, TableRow } from "#/components/Table/Table";
|
||||
import { formatDate } from "#/utils/time";
|
||||
import { createDisplayDate } from "./utils";
|
||||
|
||||
interface TimelineDateRowProps {
|
||||
type TimelineDateRowProps = {
|
||||
date: Date;
|
||||
}
|
||||
};
|
||||
|
||||
export const TimelineDateRow: FC<TimelineDateRowProps> = ({ date }) => {
|
||||
return (
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { cn } from "cn";
|
||||
import { TableRow, type TableRowProps } from "#/components/Table/Table";
|
||||
|
||||
interface TimelineEntryProps extends TableRowProps {
|
||||
type TimelineEntryProps = TableRowProps & {
|
||||
ref?: React.Ref<HTMLTableRowElement>;
|
||||
clickable?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const TimelineEntry: React.FC<TimelineEntryProps> = ({
|
||||
children,
|
||||
|
||||
@@ -8,14 +8,14 @@ const severityProgressClasses = {
|
||||
exceeded: "bg-content-destructive",
|
||||
} as const satisfies Record<UsageSeverity, string>;
|
||||
|
||||
interface UsageBarProps {
|
||||
type UsageBarProps = {
|
||||
/** Fraction used, 0-100. Clamped for safety. */
|
||||
percent: number;
|
||||
severity?: UsageSeverity;
|
||||
ariaLabel: string;
|
||||
/** Track overrides, e.g. height. */
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const UsageBar: FC<UsageBarProps> = ({
|
||||
percent,
|
||||
|
||||
@@ -5,9 +5,9 @@ import {
|
||||
} from "@pierre/diffs/react";
|
||||
import type { FC, ReactNode } from "react";
|
||||
|
||||
interface DiffsWorkerPoolProviderProps {
|
||||
type DiffsWorkerPoolProviderProps = {
|
||||
children: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
const highlighterOptions: WorkerInitializationRenderOptions = {
|
||||
theme: {
|
||||
|
||||
@@ -169,7 +169,7 @@ const TestingScreen = () => {
|
||||
);
|
||||
};
|
||||
|
||||
interface ProxyContextSelectionTest {
|
||||
type ProxyContextSelectionTest = {
|
||||
// Regions is the list of regions to return via the "api" response.
|
||||
regions: Region[];
|
||||
// storageProxy should be the proxy stored in local storage before the
|
||||
@@ -188,7 +188,7 @@ interface ProxyContextSelectionTest {
|
||||
expProxyID: string;
|
||||
// expUserProxyID is the user's stored selection.
|
||||
expUserProxyID?: string;
|
||||
}
|
||||
};
|
||||
|
||||
describe("ProxyContextSelection", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { type ProxyLatencyReport, useProxyLatency } from "./useProxyLatency";
|
||||
|
||||
export type Proxies = readonly Region[] | readonly WorkspaceProxy[];
|
||||
export type ProxyLatencies = Record<string, ProxyLatencyReport>;
|
||||
export interface ProxyContextValue {
|
||||
export type ProxyContextValue = {
|
||||
// proxy is **always** the workspace proxy that should be used.
|
||||
// The 'proxy.selectedProxy' field is the proxy being used and comes from either:
|
||||
// 1. The user manually selected this proxy. (saved to local storage)
|
||||
@@ -68,9 +68,9 @@ export interface ProxyContextValue {
|
||||
// clearProxy is a function that clears the user's selected proxy.
|
||||
// If no proxy is selected, then the default proxy will be used.
|
||||
clearProxy: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
interface PreferredProxy {
|
||||
type PreferredProxy = {
|
||||
// proxy is the proxy being used. It is provided for
|
||||
// getting the fields such as "display_name" and "id"
|
||||
// Do not use the fields 'path_app_url' or 'wildcard_hostname' from this
|
||||
@@ -82,7 +82,7 @@ interface PreferredProxy {
|
||||
preferredPathAppURL: string;
|
||||
// PreferredWildcardHostname is a hostname that includes a wildcard.
|
||||
preferredWildcardHostname: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const ProxyContext = createContext<ProxyContextValue | undefined>(
|
||||
undefined,
|
||||
|
||||
@@ -49,10 +49,10 @@ export const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {
|
||||
return <ThemeOverride theme={theme}>{children}</ThemeOverride>;
|
||||
};
|
||||
|
||||
interface ThemeOverrideProps {
|
||||
type ThemeOverrideProps = {
|
||||
theme: Theme;
|
||||
children?: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const ThemeOverride: FC<ThemeOverrideProps> = ({ theme, children }) => {
|
||||
return (
|
||||
|
||||
@@ -5,7 +5,7 @@ import { generateRandomBase64String } from "#/utils/random";
|
||||
|
||||
const proxyIntervalSeconds = 30; // seconds
|
||||
|
||||
export interface ProxyLatencyReport {
|
||||
export type ProxyLatencyReport = {
|
||||
// accurate identifies if the latency was calculated using the
|
||||
// PerformanceResourceTiming API. If this is false, then the
|
||||
// latency is calculated using the total duration of the request
|
||||
@@ -19,14 +19,14 @@ export interface ProxyLatencyReport {
|
||||
* https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/nextHopProtocol
|
||||
*/
|
||||
nextHopProtocol?: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface ProxyLatencyAction {
|
||||
type ProxyLatencyAction = {
|
||||
proxyID: string;
|
||||
// cached indicates if the latency was loaded from a cache (local storage)
|
||||
cached: boolean;
|
||||
report: ProxyLatencyReport;
|
||||
}
|
||||
};
|
||||
|
||||
const proxyLatenciesReducer = (
|
||||
state: Record<string, ProxyLatencyReport>,
|
||||
|
||||
@@ -4,14 +4,14 @@ import { API } from "#/api/api";
|
||||
import { buildInfo } from "#/api/queries/buildInfo";
|
||||
import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
|
||||
interface WebpushNotifications {
|
||||
type WebpushNotifications = {
|
||||
readonly enabled: boolean;
|
||||
readonly subscribed: boolean;
|
||||
readonly loading: boolean;
|
||||
|
||||
subscribe(): Promise<void>;
|
||||
unsubscribe(): Promise<void>;
|
||||
}
|
||||
};
|
||||
|
||||
export const useWebpushNotifications = (): WebpushNotifications => {
|
||||
const { metadata } = useEmbeddedMetadata();
|
||||
|
||||
@@ -69,11 +69,11 @@ type ParseJsonResult<T = unknown> = Readonly<
|
||||
}
|
||||
>;
|
||||
|
||||
interface MetadataManagerApi {
|
||||
type MetadataManagerApi = {
|
||||
subscribe: (callback: SubscriptionCallback) => () => void;
|
||||
getMetadata: () => RuntimeHtmlMetadata;
|
||||
clearMetadataByKey: (key: MetadataKey) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export class MetadataManager implements MetadataManagerApi {
|
||||
private readonly metadataKey: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useEffectEvent, useState } from "react";
|
||||
|
||||
interface UseTimeOptions {
|
||||
type UseTimeOptions = {
|
||||
/**
|
||||
* Can be set to `true` to disable checking for updates in circumstances where it is known
|
||||
* that there is no work to do.
|
||||
@@ -11,7 +11,7 @@ interface UseTimeOptions {
|
||||
* The amount of time in milliseconds that should pass between checking for updates.
|
||||
*/
|
||||
interval?: number;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* useTime allows a component to rerender over time without a corresponding state change.
|
||||
|
||||
@@ -413,11 +413,11 @@ const JSONField: FC<
|
||||
|
||||
// ── Schema-driven field renderer ───────────────────────────────
|
||||
|
||||
interface SchemaFieldProps extends FieldRenderContext {
|
||||
type SchemaFieldProps = FieldRenderContext & {
|
||||
field: FieldSchema;
|
||||
fieldKey: string;
|
||||
errorKey: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Render a single field from the schema using the appropriate
|
||||
@@ -511,13 +511,13 @@ const colSpanClass: Record<1 | 3, string | undefined> = {
|
||||
3: "sm:col-span-full",
|
||||
};
|
||||
|
||||
interface ModelConfigFieldsProps {
|
||||
type ModelConfigFieldsProps = {
|
||||
provider: string;
|
||||
form: FormikContextType<ModelFormValues>;
|
||||
fieldErrors: ModelConfigFormBuildResult["fieldErrors"];
|
||||
disabled: boolean;
|
||||
children?: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Provider-specific fields (reasoning, tool calls, etc.) that
|
||||
|
||||
@@ -26,7 +26,7 @@ import { formatReasoningEffort } from "#/modules/aiModels/helpers";
|
||||
import { ProviderIcon } from "#/modules/aiModels/ProviderIcon";
|
||||
import { formatProviderLabel as defaultFormatProviderLabel } from "#/utils/aiProviders";
|
||||
|
||||
export interface ModelSelectorOption {
|
||||
export type ModelSelectorOption = {
|
||||
id: string;
|
||||
provider: string;
|
||||
providerId?: string;
|
||||
@@ -37,9 +37,9 @@ export interface ModelSelectorOption {
|
||||
contextLimit?: number;
|
||||
reasoningEffortDefault?: string;
|
||||
reasoningEfforts?: readonly string[];
|
||||
}
|
||||
};
|
||||
|
||||
interface ModelSelectorProps {
|
||||
type ModelSelectorProps = {
|
||||
options: readonly ModelSelectorOption[];
|
||||
value: string;
|
||||
onValueChange: (value: string) => void;
|
||||
@@ -66,7 +66,7 @@ interface ModelSelectorProps {
|
||||
enableMobileFullWidthDropdown?: boolean;
|
||||
reasoningEffort?: string;
|
||||
onReasoningEffortChange?: (value: string) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const formatContextLimit = (tokens: number): string => {
|
||||
if (tokens >= 1_000_000) {
|
||||
@@ -318,11 +318,11 @@ export const ModelSelector: FC<ModelSelectorProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface ReasoningEffortRowProps {
|
||||
type ReasoningEffortRowProps = {
|
||||
option: ModelSelectorOption;
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
}
|
||||
};
|
||||
|
||||
// Effort row pinned below the model list. Lives outside the Command
|
||||
// so it stays visible while the list scrolls and cmdk's arrow-key
|
||||
@@ -381,11 +381,11 @@ const ReasoningEffortRow: FC<ReasoningEffortRowProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface ModelOptionItemProps {
|
||||
type ModelOptionItemProps = {
|
||||
option: ModelSelectorOption;
|
||||
isSelected: boolean;
|
||||
onSelect: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
const ModelOptionItem: FC<ModelOptionItemProps> = ({
|
||||
option,
|
||||
|
||||
@@ -2,10 +2,10 @@ import type { FC } from "react";
|
||||
import { InlineMarkdown } from "#/components/Markdown/InlineMarkdown";
|
||||
import { readableForegroundColor } from "#/utils/colors";
|
||||
|
||||
interface AnnouncementBannerViewProps {
|
||||
type AnnouncementBannerViewProps = {
|
||||
message: string;
|
||||
backgroundColor: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const AnnouncementBannerView: FC<AnnouncementBannerViewProps> = ({
|
||||
message,
|
||||
|
||||
@@ -19,7 +19,7 @@ import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { canViewAnyOrganization } from "#/modules/permissions";
|
||||
import { selectFeatureVisibility } from "./entitlements";
|
||||
|
||||
export interface DashboardValue {
|
||||
export type DashboardValue = {
|
||||
entitlements: Entitlements;
|
||||
experiments: Experiment[];
|
||||
appearance: AppearanceConfig;
|
||||
@@ -27,7 +27,7 @@ export interface DashboardValue {
|
||||
organizations: readonly Organization[];
|
||||
showOrganizations: boolean;
|
||||
canViewOrganizationSettings: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const DashboardContext = createContext<DashboardValue | undefined>(
|
||||
undefined,
|
||||
|
||||
@@ -37,11 +37,11 @@ import {
|
||||
} from "#/components/Tooltip/Tooltip";
|
||||
import { getDisplayWorkspaceStatus } from "#/utils/workspace";
|
||||
|
||||
interface DeploymentBannerViewProps {
|
||||
type DeploymentBannerViewProps = {
|
||||
health?: HealthcheckReport;
|
||||
stats?: DeploymentStats;
|
||||
fetchStats?: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const DeploymentBannerView: FC<DeploymentBannerViewProps> = ({
|
||||
health,
|
||||
@@ -358,10 +358,10 @@ export const DeploymentBannerView: FC<DeploymentBannerViewProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface WorkspaceBuildValueProps {
|
||||
type WorkspaceBuildValueProps = {
|
||||
status: WorkspaceStatus;
|
||||
count?: number;
|
||||
}
|
||||
};
|
||||
|
||||
const WorkspaceBuildValue: FC<WorkspaceBuildValueProps> = ({
|
||||
status,
|
||||
|
||||
@@ -20,14 +20,14 @@ const formatMessage = (message: string) => {
|
||||
|
||||
type LicenseBannerVariant = "warning" | "warningProminent" | "error";
|
||||
|
||||
export interface LicenseBannerLink {
|
||||
export type LicenseBannerLink = {
|
||||
href: string;
|
||||
label: string;
|
||||
showExternalIcon?: boolean;
|
||||
target?: React.ComponentProps<typeof Link>["target"];
|
||||
}
|
||||
};
|
||||
|
||||
export interface LicenseBannerMessage {
|
||||
export type LicenseBannerMessage = {
|
||||
message: string;
|
||||
variant: LicenseBannerVariant;
|
||||
// Diagnostics about the license or the usage measurement rather than
|
||||
@@ -35,7 +35,7 @@ export interface LicenseBannerMessage {
|
||||
// they are the only message, since the muted text needs that context.
|
||||
kind?: "diagnostic";
|
||||
link?: LicenseBannerLink;
|
||||
}
|
||||
};
|
||||
|
||||
const bannerVariants = cva("flex items-center p-3", {
|
||||
variants: {
|
||||
@@ -57,9 +57,9 @@ const iconVariants = cva("size-4", {
|
||||
},
|
||||
});
|
||||
|
||||
interface LicenseBannerViewProps {
|
||||
type LicenseBannerViewProps = {
|
||||
messages: readonly LicenseBannerMessage[];
|
||||
}
|
||||
};
|
||||
|
||||
const messageLinkClass = "text-xs font-medium text-content-link!";
|
||||
const listClass =
|
||||
|
||||
@@ -19,7 +19,7 @@ import { ProxyMenu } from "./ProxyMenu";
|
||||
import { SupportIcon } from "./SupportIcon";
|
||||
import { UserDropdown } from "./UserDropdown/UserDropdown";
|
||||
|
||||
interface NavbarViewProps {
|
||||
type NavbarViewProps = {
|
||||
user: TypesGen.User;
|
||||
buildInfo?: TypesGen.BuildInfoResponse;
|
||||
supportLinks: readonly TypesGen.LinkConfig[];
|
||||
@@ -29,7 +29,7 @@ interface NavbarViewProps {
|
||||
canCreateChat: boolean;
|
||||
canViewLicenses: boolean;
|
||||
proxyContextValue?: ProxyContextValue;
|
||||
}
|
||||
};
|
||||
|
||||
const linkStyles = {
|
||||
default:
|
||||
@@ -151,10 +151,10 @@ export const NavbarView: FC<NavbarViewProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface NavItemsProps {
|
||||
type NavItemsProps = {
|
||||
className?: string;
|
||||
canCreateChat: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
const NavItems: FC<NavItemsProps> = ({ className, canCreateChat }) => {
|
||||
const location = useLocation();
|
||||
@@ -198,12 +198,12 @@ function isNavbarLink(link: TypesGen.LinkConfig): boolean {
|
||||
return link.location === "navbar";
|
||||
}
|
||||
|
||||
interface SupportButtonProps {
|
||||
type SupportButtonProps = {
|
||||
name: string;
|
||||
target: string;
|
||||
icon: string;
|
||||
location?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const SupportButton: FC<SupportButtonProps> = ({ name, target, icon }) => {
|
||||
return (
|
||||
|
||||
@@ -23,9 +23,9 @@ import { useAuthenticated } from "#/hooks/useAuthenticated";
|
||||
import { getLatencyColor } from "#/utils/latency";
|
||||
import { sortProxiesByLatency } from "./proxyUtils";
|
||||
|
||||
interface ProxyMenuProps {
|
||||
type ProxyMenuProps = {
|
||||
proxyContextValue: ProxyContextValue;
|
||||
}
|
||||
};
|
||||
|
||||
export const ProxyMenu: FC<ProxyMenuProps> = ({ proxyContextValue }) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
@@ -2,10 +2,10 @@ import { BookOpenTextIcon, BugIcon, MessageSquareIcon } from "lucide-react";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { ExternalImage } from "#/components/ExternalImage/ExternalImage";
|
||||
|
||||
interface SupportIconProps {
|
||||
type SupportIconProps = {
|
||||
icon: string;
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const SupportIcon: FC<SupportIconProps> = ({ icon, className }) => {
|
||||
switch (icon) {
|
||||
|
||||
@@ -33,14 +33,14 @@ const severityIndicators: Partial<
|
||||
},
|
||||
};
|
||||
|
||||
interface UserDropdownProps {
|
||||
type UserDropdownProps = {
|
||||
user: TypesGen.User;
|
||||
buildInfo?: TypesGen.BuildInfoResponse;
|
||||
supportLinks: readonly TypesGen.LinkConfig[];
|
||||
codernautsEnabled?: boolean;
|
||||
onSignOut: () => void;
|
||||
canViewLicenses: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const UserDropdown: FC<UserDropdownProps> = ({
|
||||
buildInfo,
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
} from "#/utils/budget";
|
||||
import { formatBudgetUSD } from "#/utils/currency";
|
||||
|
||||
interface UserDropdownAISpendProps {
|
||||
type UserDropdownAISpendProps = {
|
||||
currentSpend: number;
|
||||
/** A null limit means unlimited. */
|
||||
spendLimit: number | null;
|
||||
periodStart: string;
|
||||
periodEnd: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const UserDropdownAISpend: FC<UserDropdownAISpendProps> = ({
|
||||
currentSpend,
|
||||
|
||||
@@ -45,7 +45,7 @@ const CodernautsSVG = () => (
|
||||
</svg>
|
||||
);
|
||||
|
||||
interface UserDropdownContentProps {
|
||||
type UserDropdownContentProps = {
|
||||
user: TypesGen.User;
|
||||
buildInfo?: TypesGen.BuildInfoResponse;
|
||||
/** Extra content for the profile area, rendered below the profile link
|
||||
@@ -56,7 +56,7 @@ interface UserDropdownContentProps {
|
||||
onSignOut: () => void;
|
||||
/** Premium trial entry, rendered above the build info. */
|
||||
trialCta?: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const UserDropdownContent: FC<UserDropdownContentProps> = ({
|
||||
user,
|
||||
|
||||
@@ -70,9 +70,9 @@ const trialCtaLabel = (cta: TrialCta): string => {
|
||||
}
|
||||
};
|
||||
|
||||
interface UserDropdownPremiumTrialCTAProps {
|
||||
type UserDropdownPremiumTrialCTAProps = {
|
||||
canViewLicenses: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Offers a premium trial, or counts down an active one. Renders under
|
||||
|
||||
@@ -15,12 +15,12 @@ type ExportableSyncSettings =
|
||||
| RoleSyncSettings
|
||||
| OrganizationSyncSettings;
|
||||
|
||||
interface ExportPolicyButtonProps {
|
||||
type ExportPolicyButtonProps = {
|
||||
syncSettings: ExportableSyncSettings | undefined;
|
||||
filename: string;
|
||||
size?: ButtonProps["size"];
|
||||
download?: (file: Blob, filename: string) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const ExportPolicyButton: FC<ExportPolicyButtonProps> = ({
|
||||
syncSettings,
|
||||
|
||||
@@ -17,12 +17,12 @@ import {
|
||||
} from "#/modules/permissions";
|
||||
import { modelOrganizationSearchParam } from "#/pages/AISettingsPage/ModelsPage/organizationModels";
|
||||
|
||||
interface AISettingsSidebarViewProps {
|
||||
type AISettingsSidebarViewProps = {
|
||||
/** Site-wide permissions. */
|
||||
permissions: Permissions;
|
||||
canAccessOrganizationModels?: boolean;
|
||||
canShareOrganizationMCPServers?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
const SubNavItem: FC<{ href: To; children?: ReactNode }> = ({
|
||||
href,
|
||||
|
||||
@@ -8,13 +8,13 @@ import {
|
||||
} from "#/components/Sidebar/Sidebar";
|
||||
import type { Permissions } from "#/modules/permissions";
|
||||
|
||||
interface DeploymentSidebarViewProps {
|
||||
type DeploymentSidebarViewProps = {
|
||||
/** Site-wide permissions. */
|
||||
permissions: Permissions;
|
||||
showOrganizations: boolean;
|
||||
hidePremiumTab: boolean;
|
||||
buildInfo: BuildInfoResponse;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays navigation for deployment settings. If active, highlight the main
|
||||
|
||||
@@ -23,7 +23,7 @@ import { SettingsSidebarNavItem } from "#/components/Sidebar/Sidebar";
|
||||
import type { Permissions } from "#/modules/permissions";
|
||||
import type { OrganizationPermissions } from "#/modules/permissions/organizations";
|
||||
|
||||
interface OrganizationsSettingsNavigationProps {
|
||||
type OrganizationsSettingsNavigationProps = {
|
||||
/** The organization selected from the dropdown */
|
||||
activeOrganization: Organization | undefined;
|
||||
/** Permissions for the active organization */
|
||||
@@ -32,7 +32,7 @@ interface OrganizationsSettingsNavigationProps {
|
||||
organizations: readonly Organization[];
|
||||
/** Site-wide permissions. */
|
||||
permissions: Permissions;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays navigation items for the active organization and a combobox to
|
||||
@@ -155,10 +155,10 @@ function urlForSubpage(organizationName: string, subpage = ""): string {
|
||||
.join("/");
|
||||
}
|
||||
|
||||
interface OrganizationSettingsNavigationProps {
|
||||
type OrganizationSettingsNavigationProps = {
|
||||
organization: Organization;
|
||||
orgPermissions: OrganizationPermissions;
|
||||
}
|
||||
};
|
||||
|
||||
const OrganizationSettingsNavigation: FC<
|
||||
OrganizationSettingsNavigationProps
|
||||
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
} from "#/components/Dialog/Dialog";
|
||||
import { Link } from "#/components/Link/Link";
|
||||
|
||||
interface RequirePermissionProps {
|
||||
type RequirePermissionProps = {
|
||||
children?: ReactNode;
|
||||
isFeatureVisible: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Wraps routes that are available based on RBAC or licensing.
|
||||
|
||||
@@ -11,10 +11,10 @@ import {
|
||||
import { createDayString } from "#/utils/createDayString";
|
||||
import { ProvisionerTag } from "./ProvisionerTag";
|
||||
|
||||
interface ProvisionerProps {
|
||||
type ProvisionerProps = {
|
||||
readonly provisioner: ProvisionerDaemon;
|
||||
readonly warnings?: readonly HealthMessage[];
|
||||
}
|
||||
};
|
||||
|
||||
export const Provisioner: FC<ProvisionerProps> = ({
|
||||
provisioner,
|
||||
|
||||
@@ -18,13 +18,13 @@ export enum AlertVariant {
|
||||
Inline = "Inline",
|
||||
}
|
||||
|
||||
interface ProvisionerAlertProps {
|
||||
type ProvisionerAlertProps = {
|
||||
title: string;
|
||||
detail: string;
|
||||
severity: AlertColor;
|
||||
tags: Record<string, string>;
|
||||
variant?: AlertVariant;
|
||||
}
|
||||
};
|
||||
|
||||
const severityBorderColors: Record<AlertColor, string> = {
|
||||
info: "border-l-highlight-sky",
|
||||
|
||||
@@ -2,12 +2,12 @@ import type { FC } from "react";
|
||||
import type { AlertColor } from "#/components/Alert/Alert";
|
||||
import { AlertVariant, ProvisionerAlert } from "./ProvisionerAlert";
|
||||
|
||||
interface ProvisionerStatusAlertProps {
|
||||
type ProvisionerStatusAlertProps = {
|
||||
matchingProvisioners: number | undefined;
|
||||
availableProvisioners: number | undefined;
|
||||
tags: Record<string, string>;
|
||||
variant?: AlertVariant;
|
||||
}
|
||||
};
|
||||
|
||||
export const ProvisionerStatusAlert: FC<ProvisionerStatusAlertProps> = ({
|
||||
matchingProvisioners,
|
||||
|
||||
@@ -19,12 +19,12 @@ const parseBool = (s: string): { valid: boolean; value: boolean } => {
|
||||
}
|
||||
};
|
||||
|
||||
interface ProvisionerTagProps {
|
||||
type ProvisionerTagProps = {
|
||||
tagName: string;
|
||||
tagValue: string;
|
||||
/** Only used in the TemplateVersionEditor */
|
||||
onDelete?: (tagName: string) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const ProvisionerTag: FC<ProvisionerTagProps> = ({
|
||||
tagName,
|
||||
|
||||
@@ -6,10 +6,10 @@ import { ErrorAlert } from "#/components/Alert/ErrorAlert";
|
||||
import { CodeExample } from "#/components/CodeExample/CodeExample";
|
||||
import { Loader } from "#/components/Loader/Loader";
|
||||
|
||||
interface AgentExternalProps {
|
||||
type AgentExternalProps = {
|
||||
agent: WorkspaceAgent;
|
||||
workspace: Workspace;
|
||||
}
|
||||
};
|
||||
|
||||
export const AgentExternal: FC<AgentExternalProps> = ({ agent, workspace }) => {
|
||||
const {
|
||||
|
||||
@@ -29,9 +29,9 @@ const getDisplayLatency = (agent: WorkspaceAgent) => {
|
||||
};
|
||||
};
|
||||
|
||||
interface AgentLatencyProps {
|
||||
type AgentLatencyProps = {
|
||||
agent: WorkspaceAgent;
|
||||
}
|
||||
};
|
||||
|
||||
export const AgentLatency: FC<AgentLatencyProps> = ({ agent }) => {
|
||||
const latency = getDisplayLatency(agent);
|
||||
|
||||
@@ -5,11 +5,11 @@ import { type Line, LogLine, LogLinePrefix } from "#/components/Logs/LogLine";
|
||||
// Approximate height of a log line. Used to control virtualized list height.
|
||||
export const AGENT_LOG_LINE_HEIGHT = 20;
|
||||
|
||||
interface AgentLogLineProps {
|
||||
type AgentLogLineProps = {
|
||||
line: Line;
|
||||
style?: React.CSSProperties;
|
||||
sourceIcon: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
export const AgentLogLine: FC<AgentLogLineProps> = ({
|
||||
line,
|
||||
|
||||
@@ -257,13 +257,13 @@ export const AgentLogs: FC<AgentLogsProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
interface MeasuredLogRowProps {
|
||||
type MeasuredLogRowProps = {
|
||||
index: number;
|
||||
// react-window's positioning style for the row (absolute top/left/width).
|
||||
style: CSSProperties;
|
||||
onMeasure: (index: number, height: number) => void;
|
||||
children: ReactNode;
|
||||
}
|
||||
};
|
||||
|
||||
// Wraps a log line and reports its rendered height back to the virtualized
|
||||
// list. The height is left to the content (`height: auto`) so wrapped or
|
||||
|
||||
@@ -25,9 +25,9 @@ import type { OneWayWebSocket } from "#/utils/OneWayWebSocket";
|
||||
|
||||
type ItemStatus = "stale" | "valid" | "loading";
|
||||
|
||||
interface AgentMetadataViewProps {
|
||||
type AgentMetadataViewProps = {
|
||||
metadata: WorkspaceAgentMetadata[];
|
||||
}
|
||||
};
|
||||
|
||||
export const AgentMetadataView: FC<AgentMetadataViewProps> = ({ metadata }) => {
|
||||
if (metadata.length === 0) {
|
||||
@@ -42,10 +42,10 @@ export const AgentMetadataView: FC<AgentMetadataViewProps> = ({ metadata }) => {
|
||||
);
|
||||
};
|
||||
|
||||
interface AgentMetadataProps {
|
||||
type AgentMetadataProps = {
|
||||
agent: WorkspaceAgent;
|
||||
initialMetadata?: WorkspaceAgentMetadata[];
|
||||
}
|
||||
};
|
||||
|
||||
const maxSocketErrorRetryCount = 3;
|
||||
|
||||
@@ -157,9 +157,9 @@ const AgentMetadataSkeleton: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
interface MetadataItemProps {
|
||||
type MetadataItemProps = {
|
||||
item: WorkspaceAgentMetadata;
|
||||
}
|
||||
};
|
||||
|
||||
const MetadataItem: FC<MetadataItemProps> = ({ item }) => {
|
||||
const staleThreshold = Math.max(
|
||||
|
||||
@@ -86,7 +86,7 @@ import { canShowPortForwarding } from "./usePortsData";
|
||||
import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton";
|
||||
import { WildcardHostnameWarning } from "./WildcardHostnameWarning";
|
||||
|
||||
interface AgentRowProps {
|
||||
type AgentRowProps = {
|
||||
agent: WorkspaceAgent;
|
||||
subAgents?: WorkspaceAgent[];
|
||||
workspace: Workspace;
|
||||
@@ -94,7 +94,7 @@ interface AgentRowProps {
|
||||
initialMetadata?: WorkspaceAgentMetadata[];
|
||||
agentScriptTimings?: readonly AgentScriptTiming[];
|
||||
onUpdateAgent: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
const statusBorderClassByStatus: Partial<
|
||||
Record<WorkspaceAgent["status"], string>
|
||||
|
||||
@@ -7,14 +7,14 @@ import { DisplayAppNameMap } from "./AppLink/AppLink";
|
||||
import { AppPreview } from "./AppLink/AppPreview";
|
||||
import { BaseIcon } from "./AppLink/BaseIcon";
|
||||
|
||||
interface AgentRowPreviewStyles {
|
||||
type AgentRowPreviewStyles = {
|
||||
// Helpful when there are more than one row so the values are aligned
|
||||
// When it is only one row, it is better to have than "flex" and not hard aligned
|
||||
alignValues?: boolean;
|
||||
}
|
||||
interface AgentRowPreviewProps extends AgentRowPreviewStyles {
|
||||
};
|
||||
type AgentRowPreviewProps = AgentRowPreviewStyles & {
|
||||
agent: WorkspaceAgent;
|
||||
}
|
||||
};
|
||||
|
||||
export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
|
||||
agent,
|
||||
|
||||
@@ -31,13 +31,13 @@ const statusDotConnectingClassName =
|
||||
// connected:ready, connected:shutting_down, connected:shutdown_timeout,
|
||||
// connected:shutdown_error, connected:off.
|
||||
|
||||
interface AgentWarningTooltipProps {
|
||||
type AgentWarningTooltipProps = {
|
||||
ariaLabel: string;
|
||||
title: string;
|
||||
detail: string;
|
||||
troubleshootingURL?: string;
|
||||
variant?: "warning" | "error";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Shared tooltip for agent warning/error states. Renders an alert
|
||||
@@ -116,19 +116,19 @@ const StartingLifecycle: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
interface AgentStatusProps {
|
||||
type AgentStatusProps = {
|
||||
agent: WorkspaceAgent;
|
||||
}
|
||||
};
|
||||
|
||||
interface SubAgentStatusProps {
|
||||
type SubAgentStatusProps = {
|
||||
agent?: WorkspaceAgent;
|
||||
}
|
||||
};
|
||||
|
||||
interface DevcontainerStatusProps {
|
||||
type DevcontainerStatusProps = {
|
||||
devcontainer: WorkspaceAgentDevcontainer;
|
||||
parentAgent: WorkspaceAgent;
|
||||
agent?: WorkspaceAgent;
|
||||
}
|
||||
};
|
||||
|
||||
const ShuttingDownLifecycle: FC = () => {
|
||||
return (
|
||||
|
||||
@@ -6,10 +6,10 @@ import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata";
|
||||
import { agentVersionStatus, getDisplayVersionStatus } from "#/utils/workspace";
|
||||
import { AgentOutdatedTooltip } from "./AgentOutdatedTooltip";
|
||||
|
||||
interface AgentVersionProps {
|
||||
type AgentVersionProps = {
|
||||
agent: WorkspaceAgent;
|
||||
onUpdate: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const AgentVersion: FC<AgentVersionProps> = ({ agent, onUpdate }) => {
|
||||
const { metadata } = useEmbeddedMetadata();
|
||||
|
||||
@@ -35,12 +35,12 @@ export const DisplayAppNameMap: Record<TypesGen.DisplayApp, string> = {
|
||||
web_terminal: "Terminal",
|
||||
};
|
||||
|
||||
interface AppLinkProps {
|
||||
type AppLinkProps = {
|
||||
workspace: TypesGen.Workspace;
|
||||
app: TypesGen.WorkspaceApp;
|
||||
agent: TypesGen.WorkspaceAgent;
|
||||
grouped?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const AppLink: FC<AppLinkProps> = ({
|
||||
app,
|
||||
|
||||
@@ -3,10 +3,10 @@ import type { FC } from "react";
|
||||
import type { WorkspaceApp } from "#/api/typesGenerated";
|
||||
import { ExternalImage } from "#/components/ExternalImage/ExternalImage";
|
||||
|
||||
interface BaseIconProps {
|
||||
type BaseIconProps = {
|
||||
app: WorkspaceApp;
|
||||
onIconPathError?: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const BaseIcon: FC<BaseIconProps> = ({ app, onIconPathError }) => {
|
||||
return app.icon ? (
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user