mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-01-01 17:20:14 -06:00
small bugfixes
This commit is contained in:
@@ -29,7 +29,6 @@ export default function DialogEditDialog({ children, domain, appId }: { children
|
||||
|
||||
const [isOpen, setIsOpen] = useState<boolean>(false);
|
||||
|
||||
|
||||
const form = useForm<AppDomainEditModel>({
|
||||
resolver: zodResolver(appDomainEditZodModel),
|
||||
defaultValues: {
|
||||
@@ -48,7 +47,9 @@ export default function DialogEditDialog({ children, domain, appId }: { children
|
||||
useEffect(() => {
|
||||
if (state.status === 'success') {
|
||||
form.reset();
|
||||
toast.success('Domain saved successfully');
|
||||
toast.success('Domain saved successfully. ', {
|
||||
description: "Klick \"deploy\" to apply the changes to your app.",
|
||||
});
|
||||
setIsOpen(false);
|
||||
}
|
||||
FormUtils.mapValidationErrorsToForm<typeof appDomainEditZodModel>(state, form);
|
||||
@@ -56,6 +57,12 @@ export default function DialogEditDialog({ children, domain, appId }: { children
|
||||
|
||||
const values = form.watch();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) {
|
||||
form.reset();
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div onClick={() => setIsOpen(true)}>
|
||||
|
||||
@@ -19,7 +19,6 @@ import { OpenInNewWindowIcon, QuestionMarkCircledIcon } from "@radix-ui/react-ic
|
||||
export default function DomainsList({ app }: {
|
||||
app: AppExtendedModel
|
||||
}) {
|
||||
|
||||
return <>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
|
||||
@@ -67,12 +67,19 @@ export default function DialogEditDialog({ children, volume, appId }: { children
|
||||
useEffect(() => {
|
||||
if (state.status === 'success') {
|
||||
form.reset();
|
||||
toast.success('Volume saved successfully');
|
||||
toast.success('Volume saved successfully', {
|
||||
description: "Klick \"deploy\" to apply the changes to your app.",
|
||||
});
|
||||
setIsOpen(false);
|
||||
}
|
||||
FormUtils.mapValidationErrorsToForm<typeof appVolumeEditZodModel>(state, form);
|
||||
}, [state]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) {
|
||||
form.reset();
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,32 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { FormUtils } from "@/lib/form.utilts";
|
||||
import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/model/app-source-info.model";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useFormState } from "react-dom";
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { AppRateLimitsModel, appRateLimitsZodModel } from "@/model/app-rate-limits.model";
|
||||
import { App } from "@prisma/client";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/model/env-edit.model";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CheckIcon, CrossIcon, DeleteIcon, EditIcon, TrashIcon, XIcon } from "lucide-react";
|
||||
import { EditIcon, TrashIcon } from "lucide-react";
|
||||
import DialogEditDialog from "./storage-edit-overlay";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { deleteVolume } from "./actions";
|
||||
import { getPvcUsage } from "./actions";
|
||||
import pvcStatusService from "@/server/services/pvc.status.service";
|
||||
|
||||
|
||||
export default function StorageList({ app }: {
|
||||
@@ -74,6 +55,5 @@ export default function StorageList({ app }: {
|
||||
</DialogEditDialog>
|
||||
</CardFooter>
|
||||
</Card >
|
||||
|
||||
</>;
|
||||
}
|
||||
@@ -120,11 +120,13 @@ class AppService {
|
||||
hostname: domainToBeSaved.hostname as string,
|
||||
}
|
||||
});
|
||||
if (domainToBeSaved.id && domainToBeSaved.id !== existingDomainWithSameHostname?.id) {
|
||||
throw new ServiceException("Hostname is already in use by this or another app.");
|
||||
}
|
||||
try {
|
||||
if (domainToBeSaved.id) {
|
||||
if (domainToBeSaved.hostname === existingDomainWithSameHostname?.hostname &&
|
||||
domainToBeSaved.id &&
|
||||
domainToBeSaved.id !== existingDomainWithSameHostname?.id) {
|
||||
throw new ServiceException("Hostname is already in use by this or another app.");
|
||||
}
|
||||
savedItem = await dataAccess.client.appDomain.update({
|
||||
where: {
|
||||
id: domainToBeSaved.id as string
|
||||
@@ -132,6 +134,9 @@ class AppService {
|
||||
data: domainToBeSaved
|
||||
});
|
||||
} else {
|
||||
if (existingDomainWithSameHostname) {
|
||||
throw new ServiceException("Hostname is already in use by this or another app.");
|
||||
}
|
||||
savedItem = await dataAccess.client.appDomain.create({
|
||||
data: domainToBeSaved as Prisma.AppDomainUncheckedCreateInput
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ class DeploymentService {
|
||||
}
|
||||
|
||||
async validateDeployment(app: AppExtendedModel) {
|
||||
if (app.replicas > 1 && app.appVolumes.every(vol => vol.accessMode === 'ReadWriteOnce')) {
|
||||
if (app.replicas > 1 && app.appVolumes.length > 0 && app.appVolumes.every(vol => vol.accessMode === 'ReadWriteOnce')) {
|
||||
throw new ServiceException("Deployment with more than one replica is not possible if access mode of one volume is ReadWriteOnce.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user