Add ShowDeploymentsModal component and refactor ShowDeployments for enhanced deployment handling

- Introduced `ShowDeploymentsModal` component to manage deployment logs and details in a modal interface.
- Updated `ShowDeployments` to accept `serverId` and `refreshToken` props, allowing for more flexible deployment data handling.
- Refactored API queries in `ShowDeployments` to utilize a unified query for fetching deployments by type, improving code efficiency.
- Replaced instances of `ShowSchedulesLogs` with `ShowDeploymentsModal` in relevant components to streamline deployment log access.
This commit is contained in:
Mauricio Siu
2025-05-04 12:58:46 -06:00
parent 2fa0c7dfd2
commit e09447d4b4
8 changed files with 155 additions and 58 deletions

View File

@@ -35,7 +35,7 @@ import {
PostgresqlIcon,
} from "@/components/icons/data-tools-icons";
import { AlertBlock } from "@/components/shared/alert-block";
import { ShowSchedulesLogs } from "../../application/schedules/show-schedules-logs";
import { ShowDeploymentsModal } from "../../application/deployments/show-deployments-modal";
interface Props {
id: string;
@@ -179,12 +179,6 @@ export const ShowBackups = ({
)}
<div className="flex flex-col gap-6">
{postgres?.backups.map((backup) => {
const orderedDeployments = backup.deployments.sort(
(a, b) =>
new Date(b.createdAt).getTime() -
new Date(a.createdAt).getTime(),
);
const serverId =
"serverId" in postgres ? postgres.serverId : undefined;
@@ -285,8 +279,9 @@ export const ShowBackups = ({
</div>
<div className="flex flex-row md:flex-col gap-1.5">
<ShowSchedulesLogs
deployments={orderedDeployments}
<ShowDeploymentsModal
id={backup.backupId}
type="backup"
serverId={serverId || undefined}
>
<Button
@@ -296,7 +291,7 @@ export const ShowBackups = ({
>
<ClipboardList className="size-4 transition-colors " />
</Button>
</ShowSchedulesLogs>
</ShowDeploymentsModal>
<TooltipProvider delayDuration={0}>
<Tooltip>
<TooltipTrigger asChild>