feat: add deployments dashboard with tables for deployments and queue

Introduced a new deployments page that includes a table for viewing all application and compose deployments, as well as a queue table for monitoring deployment jobs. Updated the sidebar to include a link to the new deployments section. Enhanced the API to support centralized deployment queries and job queue retrieval, improving overall deployment management and visibility.
This commit is contained in:
Mauricio Siu
2026-03-02 00:06:27 -06:00
parent 39b40c58bb
commit 1014d4674c
7 changed files with 1017 additions and 1 deletions

View File

@@ -4,9 +4,11 @@ import {
findAllDeploymentsByApplicationId,
findAllDeploymentsByComposeId,
findAllDeploymentsByServerId,
findAllDeploymentsCentralized,
findApplicationById,
findComposeById,
findDeploymentById,
findMemberById,
findServerById,
removeDeployment,
updateDeploymentStatus,
@@ -22,6 +24,7 @@ import {
apiFindAllByType,
deployments,
} from "@/server/db/schema";
import { myQueue } from "@/server/queues/queueSetup";
import { createTRPCRouter, protectedProcedure } from "../trpc";
export const deploymentRouter = createTRPCRouter({
@@ -68,6 +71,39 @@ export const deploymentRouter = createTRPCRouter({
}
return await findAllDeploymentsByServerId(input.serverId);
}),
allCentralized: protectedProcedure.query(async ({ ctx }) => {
const orgId = ctx.session.activeOrganizationId;
const accessedServices =
ctx.user.role === "member"
? (await findMemberById(ctx.user.id, orgId)).accessedServices
: null;
if (accessedServices !== null && accessedServices.length === 0) {
return [];
}
return findAllDeploymentsCentralized(orgId, accessedServices);
}),
queueList: protectedProcedure.query(async () => {
const jobs = await myQueue.getJobs();
const rows = await Promise.all(
jobs.map(async (job) => {
const state = await job.getState();
console.log(job.data);
return {
id: job.id,
name: job.name ?? undefined,
data: job.data as Record<string, unknown>,
timestamp: job.timestamp,
processedOn: job.processedOn,
finishedOn: job.finishedOn,
failedReason: job.failedReason ?? undefined,
state,
};
}),
);
rows.sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
return rows;
}),
allByType: protectedProcedure
.input(apiFindAllByType)