Skip to content

Commit 71c7b53

Browse files
authored
Merge pull request #1805 from triggerdotdev/queues-page
Queues page and pausing the environment/queues
2 parents 4b6f51a + 4e3ef9f commit 71c7b53

File tree

56 files changed

+2201
-434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2201
-434
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ apps/**/public/build
5858
.yarn
5959
*.tsbuildinfo
6060
/packages/cli-v3/src/package.json
61+
.husky
62+
/packages/react-hooks/src/package.json

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"search.exclude": {
66
"**/node_modules/**": true,
77
"packages/cli-v3/e2e": true
8-
}
8+
},
9+
"vitest.disableWorkspaceWarning": true
910
}
Loading

apps/webapp/app/components/BlankStatePanels.tsx

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ClockIcon,
77
PlusIcon,
88
RectangleGroupIcon,
9+
RectangleStackIcon,
910
ServerStackIcon,
1011
Squares2X2Icon,
1112
} from "@heroicons/react/20/solid";
@@ -368,35 +369,28 @@ export function AlertsNoneDeployed() {
368369
);
369370
}
370371

371-
function AlertsNoneProd() {
372+
export function QueuesHasNoTasks() {
373+
const organization = useOrganization();
374+
const project = useProject();
375+
const environment = useEnvironment();
376+
372377
return (
373-
<div className="space-y-8">
374-
<InfoPanel
375-
icon={BellAlertIcon}
376-
iconClassName="text-red-500"
377-
title="Adding alerts"
378-
panelClassName="max-w-full"
378+
<InfoPanel
379+
title="You have no queues"
380+
icon={RectangleStackIcon}
381+
iconClassName="text-purple-500"
382+
panelClassName="max-w-full"
383+
>
384+
<Paragraph spacing variant="small">
385+
This means you haven't got any tasks yet in this environment.
386+
</Paragraph>
387+
<LinkButton
388+
to={v3EnvironmentPath(organization, project, environment)}
389+
variant="tertiary/medium"
379390
>
380-
<Paragraph spacing variant="small">
381-
You can get alerted when deployed runs fail.
382-
</Paragraph>
383-
<Paragraph spacing variant="small">
384-
We don't support alerts in the Development environment. Switch to a deployed environment
385-
to setup alerts.
386-
</Paragraph>
387-
<div className="flex gap-3">
388-
<LinkButton
389-
to={docsPath("troubleshooting-alerts")}
390-
variant="docs/medium"
391-
LeadingIcon={BookOpenIcon}
392-
className="inline-flex"
393-
>
394-
How to setup alerts
395-
</LinkButton>
396-
</div>
397-
</InfoPanel>
398-
<SwitcherPanel />
399-
</div>
391+
Add tasks
392+
</LinkButton>
393+
</InfoPanel>
400394
);
401395
}
402396

apps/webapp/app/components/SetupCommands.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { createContext, useContext, useState } from "react";
22
import { useAppOrigin } from "~/hooks/useAppOrigin";
33
import { useProject } from "~/hooks/useProject";
4-
import { InlineCode } from "./code/InlineCode";
54
import {
65
ClientTabs,
76
ClientTabsContent,
87
ClientTabsList,
98
ClientTabsTrigger,
109
} from "./primitives/ClientTabs";
1110
import { ClipboardField } from "./primitives/ClipboardField";
12-
import { Paragraph } from "./primitives/Paragraph";
1311
import { Header3 } from "./primitives/Headers";
1412

1513
type PackageManagerContextType = {

apps/webapp/app/components/admin/debugTooltip.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TooltipProvider,
77
TooltipTrigger,
88
} from "~/components/primitives/Tooltip";
9+
import { useOptionalEnvironment } from "~/hooks/useEnvironment";
910
import { useIsImpersonating, useOptionalOrganization } from "~/hooks/useOrganizations";
1011
import { useOptionalProject } from "~/hooks/useProject";
1112
import { useHasAdminAccess, useUser } from "~/hooks/useUser";
@@ -35,6 +36,7 @@ export function AdminDebugTooltip({ children }: { children?: React.ReactNode })
3536
function Content({ children }: { children: React.ReactNode }) {
3637
const organization = useOptionalOrganization();
3738
const project = useOptionalProject();
39+
const environment = useOptionalEnvironment();
3840
const user = useUser();
3941

4042
return (
@@ -62,6 +64,22 @@ function Content({ children }: { children: React.ReactNode }) {
6264
</Property.Item>
6365
</>
6466
)}
67+
{environment && (
68+
<>
69+
<Property.Item>
70+
<Property.Label>Environment ID</Property.Label>
71+
<Property.Value>{environment.id}</Property.Value>
72+
</Property.Item>
73+
<Property.Item>
74+
<Property.Label>Environment type</Property.Label>
75+
<Property.Value>{environment.type}</Property.Value>
76+
</Property.Item>
77+
<Property.Item>
78+
<Property.Label>Environment paused</Property.Label>
79+
<Property.Value>{environment.paused ? "Yes" : "No"}</Property.Value>
80+
</Property.Item>
81+
</>
82+
)}
6583
</Property.Table>
6684
<div className="pt-2">{children}</div>
6785
</div>

apps/webapp/app/components/layout/AppLayout.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { useOptionalOrganization } from "~/hooks/useOrganizations";
21
import { cn } from "~/utils/cn";
3-
import { useShowUpgradePrompt } from "../billing/UpgradePrompt";
42

53
/** This container is used to surround the entire app, it correctly places the nav bar */
64
export function AppContainer({ children }: { children: React.ReactNode }) {
@@ -13,19 +11,7 @@ export function MainBody({ children }: { children: React.ReactNode }) {
1311

1412
/** This container should be placed around the content on a page */
1513
export function PageContainer({ children }: { children: React.ReactNode }) {
16-
const organization = useOptionalOrganization();
17-
const showUpgradePrompt = useShowUpgradePrompt(organization);
18-
19-
return (
20-
<div
21-
className={cn(
22-
"grid overflow-hidden",
23-
showUpgradePrompt.shouldShow ? "grid-rows-[5rem_1fr]" : "grid-rows-[2.5rem_1fr]"
24-
)}
25-
>
26-
{children}
27-
</div>
28-
);
14+
return <div className="grid grid-rows-[auto_1fr] overflow-hidden">{children}</div>;
2915
}
3016

3117
export function PageBody({
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { type ReactNode } from "react";
2+
import { AnimatedNumber } from "../primitives/AnimatedNumber";
3+
import { Spinner } from "../primitives/Spinner";
4+
import { cn } from "~/utils/cn";
5+
6+
interface BigNumberProps {
7+
title: ReactNode;
8+
animate?: boolean;
9+
loading?: boolean;
10+
value?: number;
11+
valueClassName?: string;
12+
defaultValue?: number;
13+
accessory?: ReactNode;
14+
suffix?: string;
15+
suffixClassName?: string;
16+
}
17+
18+
export function BigNumber({
19+
title,
20+
value,
21+
defaultValue,
22+
valueClassName,
23+
suffix,
24+
suffixClassName,
25+
accessory,
26+
animate = false,
27+
loading = false,
28+
}: BigNumberProps) {
29+
const v = value ?? defaultValue;
30+
return (
31+
<div className="grid grid-rows-[1.5rem_auto] gap-4 rounded-sm border border-grid-dimmed bg-background-bright p-4">
32+
<div className="flex items-center justify-between">
33+
<div className="text-2sm text-text-dimmed">{title}</div>
34+
{accessory && <div className="flex-shrink-0">{accessory}</div>}
35+
</div>
36+
<div
37+
className={cn(
38+
"h-[3.75rem] text-[3.75rem] font-normal tabular-nums leading-none text-text-bright",
39+
valueClassName
40+
)}
41+
>
42+
{loading ? (
43+
<Spinner className="size-6" />
44+
) : v !== undefined ? (
45+
<div className="flex items-baseline gap-1">
46+
{animate ? <AnimatedNumber value={v} /> : v}
47+
{suffix && <div className={cn("text-xs", suffixClassName)}>{suffix}</div>}
48+
</div>
49+
) : (
50+
"–"
51+
)}
52+
</div>
53+
</div>
54+
);
55+
}

apps/webapp/app/components/navigation/AccountSideMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ export function AccountSideMenu({ user }: { user: User }) {
2222
to={rootPath()}
2323
fullWidth
2424
textAlignLeft
25-
className="text-text-bright"
2625
>
27-
Back to app
26+
<span className="text-text-bright">Back to app</span>
2827
</LinkButton>
2928
</div>
3029
<div className="mb-6 flex grow flex-col gap-1 overflow-y-auto px-1 pt-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { ExclamationCircleIcon } from "@heroicons/react/20/solid";
2+
import { useLocation } from "@remix-run/react";
3+
import { AnimatePresence, motion } from "framer-motion";
4+
import { useOptionalEnvironment } from "~/hooks/useEnvironment";
5+
import { useOptionalOrganization } from "~/hooks/useOrganizations";
6+
import { useOptionalProject } from "~/hooks/useProject";
7+
import { v3QueuesPath } from "~/utils/pathBuilder";
8+
import { environmentFullTitle } from "../environments/EnvironmentLabel";
9+
import { LinkButton } from "../primitives/Buttons";
10+
import { Icon } from "../primitives/Icon";
11+
import { Paragraph } from "../primitives/Paragraph";
12+
13+
export function EnvironmentPausedBanner() {
14+
const organization = useOptionalOrganization();
15+
const project = useOptionalProject();
16+
const environment = useOptionalEnvironment();
17+
const location = useLocation();
18+
19+
const hideButton = location.pathname.endsWith("/queues");
20+
21+
return (
22+
<AnimatePresence initial={false}>
23+
{organization && project && environment && environment.paused ? (
24+
<motion.div
25+
className="flex h-10 items-center justify-between overflow-hidden border-y border-amber-400/20 bg-warning/20 py-0 pl-3 pr-2"
26+
initial={{ opacity: 0, height: 0 }}
27+
animate={{ opacity: 1, height: "2.5rem" }}
28+
exit={{ opacity: 0, height: 0 }}
29+
>
30+
<div className="flex items-center gap-2">
31+
<Icon icon={ExclamationCircleIcon} className="h-5 w-5 text-amber-400" />
32+
<Paragraph variant="small" className="text-amber-200">
33+
{environmentFullTitle(environment)} environment paused. No new runs will be dequeued
34+
and executed.
35+
</Paragraph>
36+
</div>
37+
{hideButton ? null : (
38+
<div>
39+
<LinkButton
40+
variant="tertiary/small"
41+
to={v3QueuesPath(organization, project, environment)}
42+
>
43+
Manage
44+
</LinkButton>
45+
</div>
46+
)}
47+
</motion.div>
48+
) : null}
49+
</AnimatePresence>
50+
);
51+
}
52+
53+
export function useShowEnvironmentPausedBanner() {
54+
const environment = useOptionalEnvironment();
55+
const shouldShow = environment?.paused ?? false;
56+
return { shouldShow };
57+
}

apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ import { HelpAndFeedback } from "./HelpAndFeedbackPopover";
2020
import { SideMenuHeader } from "./SideMenuHeader";
2121
import { SideMenuItem } from "./SideMenuItem";
2222
import { useCurrentPlan } from "~/routes/_app.orgs.$organizationSlug/route";
23+
import { Paragraph } from "../primitives/Paragraph";
2324

2425
export function OrganizationSettingsSideMenu({
2526
organization,
27+
version,
2628
}: {
2729
organization: MatchedOrganization;
30+
version: string;
2831
}) {
2932
const { isManagedCloud } = useFeatures();
3033
const currentPlan = useCurrentPlan();
@@ -42,48 +45,55 @@ export function OrganizationSettingsSideMenu({
4245
to={rootPath()}
4346
fullWidth
4447
textAlignLeft
45-
className="text-text-bright"
4648
>
47-
Back to app
49+
<span className="text-text-bright">Back to app</span>
4850
</LinkButton>
4951
</div>
50-
<div className="mb-6 flex grow flex-col gap-1 overflow-y-auto px-1 pt-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
51-
<SideMenuHeader title="Organization" />
52-
<SideMenuItem
53-
name="Usage"
54-
icon={ChartBarIcon}
55-
activeIconColor="text-indigo-500"
56-
to={v3UsagePath(organization)}
57-
data-action="usage"
58-
/>
59-
{isManagedCloud && (
52+
<div className="mb-6 flex grow flex-col gap-4 overflow-y-auto px-1 pt-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
53+
<div className="flex flex-col gap-1">
54+
<SideMenuHeader title="Organization" />
6055
<SideMenuItem
61-
name="Billing"
62-
icon={CreditCardIcon}
63-
activeIconColor="text-emerald-500"
64-
to={v3BillingPath(organization)}
65-
data-action="billing"
66-
badge={
67-
currentPlan?.v3Subscription?.isPaying
68-
? currentPlan?.v3Subscription?.plan?.title
69-
: undefined
70-
}
56+
name="Usage"
57+
icon={ChartBarIcon}
58+
activeIconColor="text-indigo-500"
59+
to={v3UsagePath(organization)}
60+
data-action="usage"
7161
/>
72-
)}
73-
<SideMenuItem
74-
name="Team"
75-
icon={UserGroupIcon}
76-
activeIconColor="text-amber-500"
77-
to={organizationTeamPath(organization)}
78-
data-action="team"
79-
/>
80-
<SideMenuItem
81-
name="Settings"
82-
icon={Cog8ToothIcon}
83-
activeIconColor="text-blue-500"
84-
to={organizationSettingsPath(organization)}
85-
data-action="settings"
86-
/>
62+
{isManagedCloud && (
63+
<SideMenuItem
64+
name="Billing"
65+
icon={CreditCardIcon}
66+
activeIconColor="text-emerald-500"
67+
to={v3BillingPath(organization)}
68+
data-action="billing"
69+
badge={
70+
currentPlan?.v3Subscription?.isPaying
71+
? currentPlan?.v3Subscription?.plan?.title
72+
: undefined
73+
}
74+
/>
75+
)}
76+
<SideMenuItem
77+
name="Team"
78+
icon={UserGroupIcon}
79+
activeIconColor="text-amber-500"
80+
to={organizationTeamPath(organization)}
81+
data-action="team"
82+
/>
83+
<SideMenuItem
84+
name="Settings"
85+
icon={Cog8ToothIcon}
86+
activeIconColor="text-blue-500"
87+
to={organizationSettingsPath(organization)}
88+
data-action="settings"
89+
/>
90+
</div>
91+
<div className="flex flex-col gap-1">
92+
<SideMenuHeader title="App version" />
93+
<Paragraph variant="extra-small" className="px-2 text-text-dimmed">
94+
v{version}
95+
</Paragraph>
96+
</div>
8797
</div>
8898
<div className="flex flex-col gap-1 border-t border-grid-bright p-1">
8999
<HelpAndFeedback />

0 commit comments

Comments
 (0)