mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix(ui): showing manual backup indicator only against the current backup
This commit is contained in:
parent
1d2da0ac35
commit
401f8d9be4
@ -20,12 +20,14 @@ import { toast } from "sonner";
|
|||||||
import type { ServiceType } from "../../application/advanced/show-resources";
|
import type { ServiceType } from "../../application/advanced/show-resources";
|
||||||
import { AddBackup } from "./add-backup";
|
import { AddBackup } from "./add-backup";
|
||||||
import { UpdateBackup } from "./update-backup";
|
import { UpdateBackup } from "./update-backup";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: string;
|
id: string;
|
||||||
type: Exclude<ServiceType, "application" | "redis">;
|
type: Exclude<ServiceType, "application" | "redis">;
|
||||||
}
|
}
|
||||||
export const ShowBackups = ({ id, type }: Props) => {
|
export const ShowBackups = ({ id, type }: Props) => {
|
||||||
|
const [activeManualBackup, setActiveManualBackup] = useState<string | undefined>();
|
||||||
const queryMap = {
|
const queryMap = {
|
||||||
postgres: () =>
|
postgres: () =>
|
||||||
api.postgres.one.useQuery({ postgresId: id }, { enabled: !!id }),
|
api.postgres.one.useQuery({ postgresId: id }, { enabled: !!id }),
|
||||||
@ -151,8 +153,9 @@ export const ShowBackups = ({ id, type }: Props) => {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
isLoading={isManualBackup}
|
isLoading={isManualBackup && activeManualBackup === backup.backupId}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
setActiveManualBackup(backup.backupId);
|
||||||
await manualBackup({
|
await manualBackup({
|
||||||
backupId: backup.backupId as string,
|
backupId: backup.backupId as string,
|
||||||
})
|
})
|
||||||
@ -166,6 +169,7 @@ export const ShowBackups = ({ id, type }: Props) => {
|
|||||||
"Error creating the manual backup",
|
"Error creating the manual backup",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
setActiveManualBackup(undefined);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Play className="size-5 text-muted-foreground" />
|
<Play className="size-5 text-muted-foreground" />
|
||||||
|
Loading…
Reference in New Issue
Block a user