diff --git a/apps/webapp/app/components/metrics/BigNumber.tsx b/apps/webapp/app/components/metrics/BigNumber.tsx index 2097ba928b..7c4441be34 100644 --- a/apps/webapp/app/components/metrics/BigNumber.tsx +++ b/apps/webapp/app/components/metrics/BigNumber.tsx @@ -1,7 +1,10 @@ import { type ReactNode } from "react"; -import { AnimatedNumber } from "../primitives/AnimatedNumber"; -import { Spinner } from "../primitives/Spinner"; import { cn } from "~/utils/cn"; +import { formatNumber, formatNumberCompact } from "~/utils/numberFormatter"; +import { Header3 } from "../primitives/Headers"; +import { Spinner } from "../primitives/Spinner"; +import { SimpleTooltip } from "../primitives/Tooltip"; +import { AnimatedNumber } from "../primitives/AnimatedNumber"; interface BigNumberProps { title: ReactNode; @@ -13,6 +16,7 @@ interface BigNumberProps { accessory?: ReactNode; suffix?: string; suffixClassName?: string; + compactThreshold?: number; } export function BigNumber({ @@ -25,25 +29,39 @@ export function BigNumber({ accessory, animate = false, loading = false, + compactThreshold, }: BigNumberProps) { const v = value ?? defaultValue; + + const shouldCompact = + typeof compactThreshold === "number" && v !== undefined && v >= compactThreshold; + return ( -
-
-
{title}
+
+
+ {title} {accessory &&
{accessory}
}
{loading ? ( ) : v !== undefined ? ( -
- {animate ? : v} +
+ {shouldCompact ? ( + : formatNumberCompact(v)} + content={formatNumber(v)} + /> + ) : animate ? ( + + ) : ( + formatNumber(v) + )} {suffix &&
{suffix}
}
) : ( diff --git a/apps/webapp/app/components/primitives/AnimatedNumber.tsx b/apps/webapp/app/components/primitives/AnimatedNumber.tsx index a585670502..f2f309a526 100644 --- a/apps/webapp/app/components/primitives/AnimatedNumber.tsx +++ b/apps/webapp/app/components/primitives/AnimatedNumber.tsx @@ -1,4 +1,4 @@ -import { motion, useSpring, useTransform, useMotionValue, animate } from "framer-motion"; +import { animate, motion, useMotionValue, useTransform } from "framer-motion"; import { useEffect } from "react"; export function AnimatedNumber({ value }: { value: number }) { diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx index 00ec1336ab..c9820c726a 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx @@ -69,6 +69,7 @@ import { docsPath, EnvironmentParamSchema, v3BillingPath } from "~/utils/pathBui import { PauseEnvironmentService } from "~/v3/services/pauseEnvironment.server"; import { PauseQueueService } from "~/v3/services/pauseQueue.server"; import { useCurrentPlan } from "../_app.orgs.$organizationSlug/route"; +import { Header3 } from "~/components/primitives/Headers"; import { Input } from "~/components/primitives/Input"; import { useThrottle } from "~/hooks/useThrottle"; @@ -257,13 +258,30 @@ export default function Page() { suffix={env.paused && environment.queued > 0 ? "paused" : undefined} animate accessory={} - valueClassName={env.paused ? "text-amber-500" : undefined} + valueClassName={env.paused ? "text-warning" : undefined} + compactThreshold={1000000} + /> + - Name Queued - Running + Running/limit + +
+ Environment + + This queue is limited by your environment's concurrency limit of{" "} + {environment.concurrencyLimit}. + +
+
+ User + + This queue is limited by a concurrency limit set in your code. + +
+
+ } + > + Limited by + Release on waitpoint - Concurrency limit Pause/resume @@ -342,80 +389,103 @@ export default function Page() { {queues.length > 0 ? ( - queues.map((queue) => ( - - - - {queue.type === "task" ? ( - - } - content={`This queue was automatically created from your "${queue.name}" task`} - /> - ) : ( - - } - content={`This is a custom queue you added in your code.`} - /> - )} - - {queue.name} + queues.map((queue) => { + const limit = queue.concurrencyLimit ?? environment.concurrencyLimit; + const isAtLimit = queue.running === limit; + return ( + + + + {queue.type === "task" ? ( + + } + content={`This queue was automatically created from your "${queue.name}" task`} + /> + ) : ( + + } + content={`This is a custom queue you added in your code.`} + /> + )} + + {queue.name} + + {queue.paused ? ( + + Paused + + ) : null} + {isAtLimit ? ( + + At concurrency limit + + ) : null} - {queue.paused ? ( - - Paused - - ) : null} - - - - {queue.queued} - - - {queue.running} - - - {queue.releaseConcurrencyOnWaitpoint ? "Yes" : "No"} - - - {queue.concurrencyLimit ?? ( - - Max ({environment.concurrencyLimit}) + + + {queue.queued} + + + {queue.running}/ + + {limit} - )} - - } - hiddenButtons={!queue.paused && } - /> - - )) + + + {queue.concurrencyLimit ? "User" : "Environment"} + + + {queue.releaseConcurrencyOnWaitpoint ? "Yes" : "No"} + + + } + hiddenButtons={ + !queue.paused && + } + /> + + ); + }) ) : ( @@ -503,7 +573,7 @@ function EnvironmentPauseResumeButton({ type="button" variant="secondary/small" LeadingIcon={env.paused ? PlayIcon : PauseIcon} - leadingIconClassName={env.paused ? "text-success" : "text-amber-500"} + leadingIconClassName={env.paused ? "text-success" : "text-warning"} > {env.paused ? "Resume..." : "Pause environment..."} @@ -512,8 +582,8 @@ function EnvironmentPauseResumeButton({ {env.paused - ? `Resume processing runs in ${environmentFullTitle(env)}.` - : `Pause processing runs in ${environmentFullTitle(env)}.`} + ? `Resume processing runs in ${environmentFullTitle(env)}` + : `Pause processing runs in ${environmentFullTitle(env)}`} @@ -582,7 +652,7 @@ function QueuePauseResumeButton({ type="button" variant="tertiary/small" LeadingIcon={queue.paused ? PlayIcon : PauseIcon} - leadingIconClassName={queue.paused ? "text-success" : "text-amber-500"} + leadingIconClassName={queue.paused ? "text-success" : "text-warning"} > {queue.paused ? "Resume..." : "Pause..."} @@ -703,7 +773,7 @@ export function QueueFilters() { const search = searchParams.get("query") ?? ""; return ( -
+