Skip to content

Commit 4e3ef9f

Browse files
committed
Blank state if you have no queues
1 parent 16ff502 commit 4e3ef9f

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

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/presenters/v3/QueueListPresenter.server.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@ export class QueueListPresenter extends BasePresenter {
2222
page: number;
2323
perPage?: number;
2424
}) {
25+
// Get total count for pagination
26+
const totalQueues = await this._replica.taskQueue.count({
27+
where: {
28+
runtimeEnvironmentId: environment.id,
29+
},
30+
});
31+
2532
//check the engine is the correct version
2633
const engineVersion = await determineEngineVersion({ environment });
2734

2835
if (engineVersion === "V1") {
2936
return {
3037
success: false as const,
3138
code: "engine-version",
39+
totalQueues,
3240
};
3341
}
3442

35-
// Get total count for pagination
36-
const totalQueues = await this._replica.taskQueue.count({
37-
where: {
38-
runtimeEnvironmentId: environment.id,
39-
},
40-
});
41-
4243
return {
4344
success: true as const,
4445
queues: await this.getQueuesWithPagination(environment, page),
@@ -47,6 +48,7 @@ export class QueueListPresenter extends BasePresenter {
4748
totalPages: Math.ceil(totalQueues / this.perPage),
4849
count: totalQueues,
4950
},
51+
totalQueues,
5052
};
5153
}
5254

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { docsPath, EnvironmentParamSchema, v3BillingPath } from "~/utils/pathBui
6060
import { PauseEnvironmentService } from "~/v3/services/pauseEnvironment.server";
6161
import { PauseQueueService } from "~/v3/services/pauseQueue.server";
6262
import { useCurrentPlan } from "../_app.orgs.$organizationSlug/route";
63+
import { QueuesHasNoTasks } from "~/components/BlankStatePanels";
6364

6465
const SearchParamsSchema = z.object({
6566
page: z.coerce.number().min(1).default(1),
@@ -197,7 +198,8 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
197198
};
198199

199200
export default function Page() {
200-
const { environment, queues, success, pagination, code } = useTypedLoaderData<typeof loader>();
201+
const { environment, queues, success, pagination, code, totalQueues } =
202+
useTypedLoaderData<typeof loader>();
201203

202204
const organization = useOrganization();
203205
const project = useProject();
@@ -406,7 +408,13 @@ export default function Page() {
406408
) : (
407409
<div className="grid place-items-center py-6 text-text-dimmed">
408410
{code === "engine-version" ? (
409-
<EngineVersionUpgradeCallout />
411+
totalQueues === 0 ? (
412+
<div className="pt-12">
413+
<QueuesHasNoTasks />
414+
</div>
415+
) : (
416+
<EngineVersionUpgradeCallout />
417+
)
410418
) : (
411419
<Callout variant="error">Something went wrong</Callout>
412420
)}

0 commit comments

Comments
 (0)