refacto(#118): remove last toaster on start deployments

This commit is contained in:
Mauricio Siu
2024-06-06 00:11:46 -06:00
parent 0c197c095b
commit 7fb34ade00
7 changed files with 29 additions and 56 deletions

View File

@@ -11,6 +11,7 @@ import {
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { api } from "@/utils/api"; import { api } from "@/utils/api";
import { useEffect, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
interface Props { interface Props {
@@ -51,18 +52,14 @@ export const DeployApplication = ({ applicationId }: Props) => {
applicationId, applicationId,
}) })
.then(async () => { .then(async () => {
toast.success("Application Deploying...."); toast.success("Deploying Application....");
await refetch(); await refetch();
await deploy({ await deploy({
applicationId, applicationId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Application");
toast.success("Application Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Application");
});
await refetch(); await refetch();
}) })

View File

@@ -49,18 +49,14 @@ export const DeployCompose = ({ composeId }: Props) => {
composeStatus: "running", composeStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Compose Deploying...."); toast.success("Deploying Compose....");
await refetch(); await refetch();
await deploy({ await deploy({
composeId, composeId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Compose");
toast.success("Compose Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Compose");
});
await refetch(); await refetch();
}) })

View File

@@ -50,17 +50,13 @@ export const DeployMariadb = ({ mariadbId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mariadbId, mariadbId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployMongo = ({ mongoId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mongoId, mongoId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployMysql = ({ mysqlId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mysqlId, mysqlId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployPostgres = ({ postgresId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
postgresId, postgresId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {

View File

@@ -50,17 +50,13 @@ export const DeployRedis = ({ redisId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database...");
await refetch(); await refetch();
await deploy({ await deploy({
redisId, redisId,
}) }).catch(() => {
.then(() => { toast.error("Error to deploy Database");
toast.success("Database Deployed Succesfully"); });
})
.catch(() => {
toast.error("Error to deploy Database");
});
await refetch(); await refetch();
}) })
.catch((e) => { .catch((e) => {