mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-05-14 22:08:55 -05:00
reorganized files
This commit is contained in:
@@ -42,5 +42,4 @@ kube-config.config_clusteradmin
|
||||
kube-config.config_old
|
||||
kube-config.config_restricted
|
||||
internal
|
||||
shared
|
||||
dist
|
||||
@@ -10,7 +10,7 @@ generator client {
|
||||
|
||||
generator zod {
|
||||
provider = "zod-prisma"
|
||||
output = "../src/model/generated-zod" // (default) the directory where generated zod schemas will be saved
|
||||
output = "../src/shared/model/generated-zod" // (default) the directory where generated zod schemas will be saved
|
||||
|
||||
relationModel = true // (default) Create and export both plain and related models.
|
||||
// relationModel = "default" // Do not export model without relations.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import NextAuth, { } from "next-auth"
|
||||
import { authOptions } from "@/lib/auth-options";
|
||||
import { authOptions } from "@/server/utils/auth-options";
|
||||
|
||||
|
||||
const handler = NextAuth(authOptions)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use server'
|
||||
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/model/auth-form";
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/shared/model/auth-form";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import paramService, { ParamService } from "@/server/services/param.service";
|
||||
import quickStackService from "@/server/services/qs.service";
|
||||
import userService from "@/server/services/user.service";
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useState } from "react";
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod } from "@/model/auth-form"
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod } from "@/shared/model/auth-form"
|
||||
import { authUser } from "./actions"
|
||||
import { signIn } from "next-auth/react";
|
||||
import LoadingSpinner from "@/components/ui/loading-spinner"
|
||||
|
||||
@@ -14,9 +14,9 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useFormState } from 'react-dom'
|
||||
import { useEffect } from "react";
|
||||
import { FormUtils } from "@/lib/form.utilts";
|
||||
import { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/model/auth-form"
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/shared/model/auth-form"
|
||||
import { registerUser } from "./actions"
|
||||
import { signIn } from "next-auth/react";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useState } from "react";
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod, TwoFaInputSchema, twoFaInputSchemaZod } from "@/model/auth-form"
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod, TwoFaInputSchema, twoFaInputSchemaZod } from "@/shared/model/auth-form"
|
||||
import { signIn } from "next-auth/react";
|
||||
import LoadingSpinner from "@/components/ui/loading-spinner"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { Toaster } from "@/components/ui/sonner"
|
||||
import "./globals.css";
|
||||
import { NavBar } from "./nav-bar";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use server'
|
||||
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use server'
|
||||
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import deploymentService from "@/server/services/deployment.service";
|
||||
import { getAuthUserSession, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { deploy, startApp, stopApp } from "./action";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import AppStatus from "./app-status";
|
||||
import { Hammer, Pause, Play, Rocket } from "lucide-react";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import React from "react";
|
||||
import { DeplyomentStatus } from "@/model/deployment-info.model";
|
||||
import { DeplyomentStatus } from "@/shared/model/deployment-info.model";
|
||||
import { set } from "date-fns";
|
||||
|
||||
export default function AppStatus({
|
||||
|
||||
@@ -9,8 +9,8 @@ import { App } from "@prisma/client";
|
||||
import DomainsList from "./domains/domains";
|
||||
import StorageList from "./storage/storages";
|
||||
import MonitoringList from "./monitoring/monitoring";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { BuildJobModel } from "@/model/build-job";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { BuildJobModel } from "@/shared/model/build-job";
|
||||
import BuildsTab from "./overview/deployments";
|
||||
import Logs from "./overview/logs";
|
||||
import InternalHostnames from "./domains/internal-hostnames";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use server'
|
||||
|
||||
import { AppRateLimitsModel } from "@/model/app-rate-limits.model";
|
||||
import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/model/default-port.model";
|
||||
import { appDomainEditZodModel } from "@/model/domain-edit.model";
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { AppRateLimitsModel } from "@/shared/model/app-rate-limits.model";
|
||||
import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/shared/model/default-port.model";
|
||||
import { appDomainEditZodModel } from "@/shared/model/domain-edit.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -14,11 +14,11 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useFormState } from 'react-dom'
|
||||
import { useEffect, useState } from "react";
|
||||
import { FormUtils } from "@/lib/form.utilts";
|
||||
import { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { AppDomain } from "@prisma/client"
|
||||
import { AppDomainEditModel, appDomainEditZodModel } from "@/model/domain-edit.model"
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model"
|
||||
import { AppDomainEditModel, appDomainEditZodModel } from "@/shared/model/domain-edit.model"
|
||||
import { ServerActionResult } from "@/shared/model/server-action-error-return.model"
|
||||
import { saveDomain } from "./actions"
|
||||
import { toast } from "sonner"
|
||||
import CheckboxFormField from "@/components/custom/checkbox-form-field"
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/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 DialogEditDialog from "./domain-edit-overlay";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { deleteDomain } from "./actions";
|
||||
import { ListUtils } from "@/server/utils/list.utils";
|
||||
import { StringUtils } from "@/server/utils/string.utils";
|
||||
import { ListUtils } from "@/shared/utils/list.utils";
|
||||
import { KubeObjectNameUtils } from "@/server/utils/kube-object-name.utils";
|
||||
import { Code } from "@/components/custom/code";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { OpenInNewWindowIcon, QuestionMarkCircledIcon } from "@radix-ui/react-icons";
|
||||
|
||||
@@ -3,29 +3,29 @@
|
||||
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 { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { saveDefaultPortConfiguration } from "./actions";
|
||||
import { useFormState } from "react-dom";
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/model/default-port.model";
|
||||
import { StringUtils } from "@/server/utils/string.utils";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/shared/model/default-port.model";
|
||||
import { KubeObjectNameUtils } from "@/server/utils/kube-object-name.utils";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { QuestionMarkCircledIcon } from "@radix-ui/react-icons";
|
||||
import { Code } from "@/components/custom/code";
|
||||
import { ListUtils } from "@/server/utils/list.utils";
|
||||
import { ListUtils } from "@/shared/utils/list.utils";
|
||||
|
||||
|
||||
export default function InternalHostnames({ app }: {
|
||||
app: AppExtendedModel
|
||||
}) {
|
||||
|
||||
const internalUrl = StringUtils.toServiceName(app.id);
|
||||
const internalUrl = KubeObjectNameUtils.toServiceName(app.id);
|
||||
|
||||
const form = useForm<AppDefaultPortsModel>({
|
||||
resolver: zodResolver(appdefaultPortZodModel),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use server'
|
||||
|
||||
import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/model/env-edit.model";
|
||||
import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/shared/model/env-edit.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import { getAuthUserSession, saveFormAction } from "@/server/utils/action-wrapper.utils";
|
||||
|
||||
|
||||
@@ -3,23 +3,23 @@
|
||||
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 { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { saveEnvVariables } from "./actions";
|
||||
import { useFormState } from "react-dom";
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult } from "@/shared/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 { AppRateLimitsModel, appRateLimitsZodModel } from "@/shared/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 { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/shared/model/env-edit.model";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
|
||||
|
||||
export default function EnvEdit({ app }: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
'use server'
|
||||
|
||||
import { AppRateLimitsModel, appRateLimitsZodModel } from "@/model/app-rate-limits.model";
|
||||
import { appSourceInfoContainerZodModel, appSourceInfoGitZodModel, AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/model/app-source-info.model";
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod } from "@/model/auth-form";
|
||||
import { ErrorActionResult, ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { AppRateLimitsModel, appRateLimitsZodModel } from "@/shared/model/app-rate-limits.model";
|
||||
import { appSourceInfoContainerZodModel, appSourceInfoGitZodModel, AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model";
|
||||
import { AuthFormInputSchema, authFormInputSchemaZod } from "@/shared/model/auth-form";
|
||||
import { ErrorActionResult, ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import userService from "@/server/services/user.service";
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
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 { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { saveGeneralAppRateLimits, saveGeneralAppSourceInfo } from "./actions";
|
||||
import { useFormState } from "react-dom";
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult } from "@/shared/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 { AppRateLimitsModel, appRateLimitsZodModel } from "@/shared/model/app-rate-limits.model";
|
||||
import { App } from "@prisma/client";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
|
||||
|
||||
export default function GeneralAppRateLimits({ app }: {
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
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 { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { saveGeneralAppSourceInfo } from "./actions";
|
||||
import { useFormState } from "react-dom";
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult } from "@/shared/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 { useEffect } from "react";
|
||||
import { App } from "@prisma/client";
|
||||
import { toast } from "sonner";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
|
||||
export default function GeneralAppSource({ app }: {
|
||||
app: AppExtendedModel
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use server'
|
||||
|
||||
import { BuildJobModel } from "@/model/build-job";
|
||||
import { DeploymentInfoModel } from "@/model/deployment-info.model";
|
||||
import { PodsInfoModel } from "@/model/pods-info.model";
|
||||
import { ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { BuildJobModel } from "@/shared/model/build-job";
|
||||
import { DeploymentInfoModel } from "@/shared/model/deployment-info.model";
|
||||
import { PodsInfoModel } from "@/shared/model/pods-info.model";
|
||||
import { ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import buildService from "@/server/services/build.service";
|
||||
import deploymentService from "@/server/services/deployment.service";
|
||||
|
||||
@@ -12,10 +12,10 @@ import { Input } from "@/components/ui/input"
|
||||
import { Label } from "@/components/ui/label"
|
||||
import React, { useEffect } from "react";
|
||||
import { set } from "date-fns";
|
||||
import { DeploymentInfoModel } from "@/model/deployment-info.model";
|
||||
import { DeploymentInfoModel } from "@/shared/model/deployment-info.model";
|
||||
import LogsStreamed from "./logs-streamed";
|
||||
import { formatDate, formatDateTime } from "@/lib/format.utils";
|
||||
import { podLogsSocket } from "@/lib/sockets";
|
||||
import { formatDate, formatDateTime } from "@/frontend/utils/format.utils";
|
||||
import { podLogsSocket } from "@/frontend/sockets/sockets";
|
||||
|
||||
export function BuildLogsDialog({
|
||||
deploymentInfo,
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "@/components/ui/form"
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { isDate } from "date-fns";
|
||||
import { BuildJobStatus } from "@/model/build-job";
|
||||
import { BuildJobStatus } from "@/shared/model/build-job";
|
||||
|
||||
|
||||
export default function BuildStatusBadge(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { DeplyomentStatus } from "@/model/deployment-info.model";
|
||||
import { DeplyomentStatus } from "@/shared/model/deployment-info.model";
|
||||
|
||||
|
||||
export default function DeploymentStatusBadge(
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { SimpleDataTable } from "@/components/custom/simple-data-table";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { formatDateTime } from "@/lib/format.utils";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { formatDateTime } from "@/frontend/utils/format.utils";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { useEffect, useState } from "react";
|
||||
import { deleteBuild, getDeploymentsAndBuildsForApp } from "./actions";
|
||||
import FullLoadingSpinner from "@/components/ui/full-loading-spinnter";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useConfirmDialog } from "@/lib/zustand.states";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { DeploymentInfoModel } from "@/model/deployment-info.model";
|
||||
import { useConfirmDialog } from "@/frontend/states/zustand.states";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { DeploymentInfoModel } from "@/shared/model/deployment-info.model";
|
||||
import DeploymentStatusBadge from "./deployment-status-badge";
|
||||
import { BuildLogsDialog } from "./build-logs-overlay";
|
||||
import ShortCommitHash from "@/components/custom/short-commit-hash";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { useEffect, useState } from "react";
|
||||
import { podLogsSocket } from "@/lib/sockets";
|
||||
import { podLogsSocket } from "@/frontend/sockets/sockets";
|
||||
import LogsStreamed from "./logs-streamed";
|
||||
import { getPodsForApp } from "./actions";
|
||||
import { PodsInfoModel } from "@/model/pods-info.model";
|
||||
import { PodsInfoModel } from "@/shared/model/pods-info.model";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import FullLoadingSpinner from "@/components/ui/full-loading-spinnter";
|
||||
import { toast } from "sonner";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
'use server'
|
||||
|
||||
import { appVolumeEditZodModel } from "@/model/volume-edit.model";
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { appVolumeEditZodModel } from "@/shared/model/volume-edit.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import appService from "@/server/services/app.service";
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import { z } from "zod";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import pvcStatusService from "@/server/services/pvc.status.service";
|
||||
|
||||
const actionAppVolumeEditZodModel = appVolumeEditZodModel.merge(z.object({
|
||||
|
||||
@@ -22,18 +22,18 @@ import {
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Check, ChevronsUpDown } from "lucide-react"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useFormState } from 'react-dom'
|
||||
import { useEffect, useState } from "react";
|
||||
import { FormUtils } from "@/lib/form.utilts";
|
||||
import { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { AppVolume } from "@prisma/client"
|
||||
import { AppVolumeEditModel, appVolumeEditZodModel } from "@/model/volume-edit.model"
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model"
|
||||
import { AppVolumeEditModel, appVolumeEditZodModel } from "@/shared/model/volume-edit.model"
|
||||
import { ServerActionResult } from "@/shared/model/server-action-error-return.model"
|
||||
import { saveVolume } from "./actions"
|
||||
import { toast } from "sonner"
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { EditIcon, TrashIcon } from "lucide-react";
|
||||
import DialogEditDialog from "./storage-edit-overlay";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { deleteVolume } from "./actions";
|
||||
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import { Button } from "@/components/ui/button";
|
||||
|
||||
import Link from "next/link";
|
||||
import { SimpleDataTable } from "@/components/custom/simple-data-table";
|
||||
import { formatDateTime } from "@/lib/format.utils";
|
||||
import { formatDateTime } from "@/frontend/utils/format.utils";
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||
import { MoreHorizontal } from "lucide-react";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { App } from "@prisma/client";
|
||||
import { deleteApp } from "./actions";
|
||||
import { useConfirmDialog } from "@/lib/zustand.states";
|
||||
import { useConfirmDialog } from "@/frontend/states/zustand.states";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { InputDialog } from "@/components/custom/input-dialog"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { createApp } from "./actions";
|
||||
import { redirect } from "next/navigation";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use server'
|
||||
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import projectService from "@/server/services/project.service";
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { InputDialog } from "@/components/custom/input-dialog"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { createProject } from "./actions";
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import { Button } from "@/components/ui/button";
|
||||
|
||||
import Link from "next/link";
|
||||
import { SimpleDataTable } from "@/components/custom/simple-data-table";
|
||||
import { formatDateTime } from "@/lib/format.utils";
|
||||
import { formatDateTime } from "@/frontend/utils/format.utils";
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||
import { MoreHorizontal } from "lucide-react";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { Project } from "@prisma/client";
|
||||
import { deleteProject } from "./actions";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use server'
|
||||
|
||||
import { getAuthUserSession, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import clusterService from "@/server/services/node.service";
|
||||
|
||||
export const setNodeStatus = async (nodeName: string, schedulable: boolean) =>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import { NodeInfoModel } from "@/model/node-info.model";
|
||||
import { NodeInfoModel } from "@/shared/model/node-info.model";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Code } from "@/components/custom/code";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { setNodeStatus } from "./actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useConfirmDialog } from "@/lib/zustand.states";
|
||||
import { useConfirmDialog } from "@/frontend/states/zustand.states";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
|
||||
export default async function NodeInfo({ nodeInfos }: { nodeInfos: NodeInfoModel[] }) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
'use server'
|
||||
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/model/update-password.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/shared/model/update-password.model";
|
||||
import userService from "@/server/services/user.service";
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import { TotpModel, totpZodModel } from "@/model/totp.model";
|
||||
import { SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { TotpModel, totpZodModel } from "@/shared/model/totp.model";
|
||||
import { SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
|
||||
export const changePassword = async (prevState: any, inputData: ProfilePasswordChangeModel) =>
|
||||
saveFormAction(inputData, profilePasswordChangeZodModel, async (validatedData) => {
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
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 { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
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 { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/model/update-password.model";
|
||||
import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/shared/model/update-password.model";
|
||||
import { changePassword } from "./actions";
|
||||
|
||||
export default function ProfilePasswordChange() {
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { FormUtils } from "@/lib/form.utilts";
|
||||
import { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
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 { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { createNewTotpToken, verifyTotpToken } from "./actions";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import React from "react";
|
||||
import { TotpModel, totpZodModel } from "@/model/totp.model";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { TotpModel, totpZodModel } from "@/shared/model/totp.model";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import FullLoadingSpinner from "@/components/ui/full-loading-spinnter";
|
||||
|
||||
export default function TotpCreateDialog({
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { deactivate2fa } from "./actions";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import TotpCreateDialog from "./totp-create-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils";
|
||||
import paramService, { ParamService } from "@/server/services/param.service";
|
||||
import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/model/qs-settings.model";
|
||||
import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/model/qs-letsencrypt-settings.model";
|
||||
import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/shared/model/qs-settings.model";
|
||||
import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/shared/model/qs-letsencrypt-settings.model";
|
||||
import quickStackService from "@/server/services/qs.service";
|
||||
import { ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
|
||||
export const updateIngressSettings = async (prevState: any, inputData: QsIngressSettingsModel) =>
|
||||
saveFormAction(inputData, qsIngressSettingsZodModel, async (validatedData) => {
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
import { SubmitButton } from "@/components/custom/submit-button";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { FormUtils } from "@/lib/form.utilts";
|
||||
import { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
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 { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/model/qs-settings.model";
|
||||
import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/shared/model/qs-settings.model";
|
||||
import { updateIngressSettings } from "./actions";
|
||||
import CheckboxFormField from "@/components/custom/checkbox-form-field";
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
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 { FormUtils } from "@/frontend/utils/form.utilts";
|
||||
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 { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { useEffect } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { updateLetsEncryptSettings } from "./actions";
|
||||
import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/model/qs-letsencrypt-settings.model";
|
||||
import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/shared/model/qs-letsencrypt-settings.model";
|
||||
|
||||
export default function QuickStackLetsEncryptSettings({
|
||||
letsEncryptMail,
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { updateQuickstack } from "./actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Toast } from "@/lib/toast.utils";
|
||||
import { useConfirmDialog } from "@/lib/zustand.states";
|
||||
import { Toast } from "@/frontend/utils/toast.utils";
|
||||
import { useConfirmDialog } from "@/frontend/states/zustand.states";
|
||||
|
||||
export default function QuickStackMaintenanceSettings() {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog"
|
||||
import React from "react";
|
||||
import { useConfirmDialog } from "@/lib/zustand.states";
|
||||
import { useConfirmDialog } from "@/frontend/states/zustand.states";
|
||||
|
||||
export function ConfirmDialog() {
|
||||
const { isDialogOpen, data, closeDialog } = useConfirmDialog();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CaretSortIcon, CheckIcon, Cross2Icon } from '@radix-ui/react-icons'
|
||||
import * as React from 'react'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { cn } from '@/frontend/utils/utils'
|
||||
|
||||
import {
|
||||
Command,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
|
||||
const AlertDialog = AlertDialogPrimitive.Root
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react"
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { ChevronRight, MoreHorizontal } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Breadcrumb = React.forwardRef<
|
||||
HTMLElement,
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react"
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react"
|
||||
import { DayPicker } from "react-day-picker"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
|
||||
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Card = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
||||
import { Check } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Checkbox = React.forwardRef<
|
||||
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { Button } from "./button"
|
||||
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from "./dropdown-menu"
|
||||
import {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { type DialogProps } from "@radix-ui/react-dialog"
|
||||
import { Command as CommandPrimitive } from "cmdk"
|
||||
import { Search } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { Dialog, DialogContent } from "@/components/ui/dialog"
|
||||
|
||||
const Command = React.forwardRef<
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
||||
import { X } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Dialog = DialogPrimitive.Root
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import { Drawer as DrawerPrimitive } from "vaul"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Drawer = ({
|
||||
shouldScaleBackground = true,
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
||||
import { Check, ChevronRight, Circle } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const DropdownMenu = DropdownMenuPrimitive.Root
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
useFormContext,
|
||||
} from "react-hook-form"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import { Label } from "@/components/ui/label"
|
||||
|
||||
const Form = FormProvider
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
import LoadingSpinner from "./loading-spinner";
|
||||
|
||||
export default function FullLoadingSpinner() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const HoverCard = HoverCardPrimitive.Root
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
export interface InputProps
|
||||
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as LabelPrimitive from "@radix-ui/react-label"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const labelVariants = cva(
|
||||
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
export default function LoadingSpinner() {
|
||||
return <svg
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Popover = PopoverPrimitive.Root
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const ScrollArea = React.forwardRef<
|
||||
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from "react"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Select = SelectPrimitive.Root
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
function Skeleton({
|
||||
className,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Table = React.forwardRef<
|
||||
HTMLTableElement,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const Tabs = TabsPrimitive.Root
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
export interface TextareaProps
|
||||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/frontend/utils/utils"
|
||||
|
||||
const TooltipProvider = TooltipPrimitive.Provider
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { UseFormReturn } from "react-hook-form";
|
||||
import { z, ZodType } from "zod";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export class Toast {
|
||||
+2
-2
@@ -5,8 +5,8 @@ import socketIoServer from './socket-io.server'
|
||||
import quickStackService from './server/services/qs.service'
|
||||
import { CommandExecutorUtils } from './server/utils/command-executor.utils'
|
||||
import dataAccess from './server/adapter/db.client'
|
||||
import { FancyConsoleUtils } from './server/utils/fancy-console.utils'
|
||||
import { Constants } from './server/utils/constants'
|
||||
import { FancyConsoleUtils } from './shared/utils/fancy-console.utils'
|
||||
import { Constants } from './shared/utils/constants'
|
||||
|
||||
// Source: https://nextjs.org/docs/app/building-your-application/configuring/custom-server
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Prisma, PrismaClient } from "@prisma/client";
|
||||
import { DefaultArgs } from "@prisma/client/runtime/library";
|
||||
import { ListUtils } from "../utils/list.utils";
|
||||
import { ListUtils } from "../../shared/utils/list.utils";
|
||||
|
||||
type clientType = keyof PrismaClient<Prisma.PrismaClientOptions, never | undefined>;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import dataAccess from "../adapter/db.client";
|
||||
import { Tags } from "../utils/cache-tag-generator.utils";
|
||||
import { App, AppDomain, AppVolume, Prisma } from "@prisma/client";
|
||||
import { DefaultArgs } from "@prisma/client/runtime/library";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import deploymentService from "./deployment.service";
|
||||
import buildService, { BUILD_NAMESPACE } from "./build.service";
|
||||
import namespaceService from "./namespace.service";
|
||||
@@ -100,7 +100,7 @@ class AppService {
|
||||
data: item
|
||||
});
|
||||
} else {
|
||||
item.id = StringUtils.toAppId(item.name as string);
|
||||
item.id = KubeObjectNameUtils.toAppId(item.name as string);
|
||||
savedItem = dataAccess.client.app.create({
|
||||
data: item as Prisma.AppUncheckedCreateInput
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1Job, V1JobStatus } from "@kubernetes/client-node";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { BuildJobModel } from "@/model/build-job";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { PodsInfoModel } from "@/model/pods-info.model";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import { BuildJobModel } from "@/shared/model/build-job";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { PodsInfoModel } from "@/shared/model/pods-info.model";
|
||||
import namespaceService from "./namespace.service";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
import gitService from "./git.service";
|
||||
import deploymentService from "./deployment.service";
|
||||
import deploymentLogService from "./deployment-logs.service";
|
||||
@@ -46,7 +46,7 @@ class BuildService {
|
||||
|
||||
private async createAndStartBuildJob(app: AppExtendedModel, latestRemoteGitHash: string): Promise<[string, string, Promise<void>]> {
|
||||
|
||||
const buildName = StringUtils.addRandomSuffix(StringUtils.toJobName(app.id));
|
||||
const buildName = KubeObjectNameUtils.addRandomSuffix(KubeObjectNameUtils.toJobName(app.id));
|
||||
const jobDefinition: V1Job = {
|
||||
apiVersion: "batch/v1",
|
||||
kind: "Job",
|
||||
@@ -118,7 +118,7 @@ class BuildService {
|
||||
|
||||
|
||||
async deleteAllBuildsOfApp(appId: string) {
|
||||
const jobNamePrefix = StringUtils.toJobName(appId);
|
||||
const jobNamePrefix = KubeObjectNameUtils.toJobName(appId);
|
||||
const jobs = await k3s.batch.listNamespacedJob(BUILD_NAMESPACE);
|
||||
const jobsOfBuild = jobs.body.items.filter((job) => job.metadata?.name?.startsWith(jobNamePrefix));
|
||||
for (const job of jobsOfBuild) {
|
||||
@@ -140,7 +140,7 @@ class BuildService {
|
||||
}
|
||||
|
||||
async getBuildsForApp(appId: string) {
|
||||
const jobNamePrefix = StringUtils.toJobName(appId);
|
||||
const jobNamePrefix = KubeObjectNameUtils.toJobName(appId);
|
||||
const jobs = await k3s.batch.listNamespacedJob(BUILD_NAMESPACE);
|
||||
const jobsOfBuild = jobs.body.items.filter((job) => job.metadata?.name?.startsWith(jobNamePrefix));
|
||||
const builds = jobsOfBuild.map((job) => {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1Deployment, V1ReplicaSet } from "@kubernetes/client-node";
|
||||
import buildService from "./build.service";
|
||||
import { ListUtils } from "../utils/list.utils";
|
||||
import { DeploymentInfoModel, DeplyomentStatus } from "@/model/deployment-info.model";
|
||||
import { BuildJobStatus } from "@/model/build-job";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { PodsInfoModel } from "@/model/pods-info.model";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { ListUtils } from "../../shared/utils/list.utils";
|
||||
import { DeploymentInfoModel, DeplyomentStatus } from "@/shared/model/deployment-info.model";
|
||||
import { BuildJobStatus } from "@/shared/model/build-job";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { PodsInfoModel } from "@/shared/model/pods-info.model";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import pvcService from "./pvc.service";
|
||||
import ingressService from "./ingress.service";
|
||||
import namespaceService from "./namespace.service";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
import svcService from "./svc.service";
|
||||
|
||||
class DeploymentService {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import simpleGit from "simple-git";
|
||||
import { PathUtils } from "../utils/path.utils";
|
||||
import { FsUtils } from "../utils/fs.utils";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1Ingress } from "@kubernetes/client-node";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import { App, AppDomain } from "@prisma/client";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
|
||||
|
||||
const traefikNamespace = 'kube-system';
|
||||
@@ -17,7 +17,7 @@ class IngressService {
|
||||
|
||||
async getIngress(projectId: string, domainId: string) {
|
||||
const res = await k3s.network.listNamespacedIngress(projectId);
|
||||
return res.body.items.find((item) => item.metadata?.name === StringUtils.getIngressName(domainId));
|
||||
return res.body.items.find((item) => item.metadata?.name === KubeObjectNameUtils.getIngressName(domainId));
|
||||
}
|
||||
|
||||
async deleteUnusedIngressesOfApp(app: AppExtendedModel) {
|
||||
@@ -63,7 +63,7 @@ class IngressService {
|
||||
|
||||
async createIngress(app: AppExtendedModel, domain: AppDomain) {
|
||||
const hostname = domain.hostname;
|
||||
const ingressName = StringUtils.getIngressName(domain.id);
|
||||
const ingressName = KubeObjectNameUtils.getIngressName(domain.id);
|
||||
const existingIngress = await this.getIngress(app.projectId, domain.id);
|
||||
|
||||
const ingressDefinition: V1Ingress = {
|
||||
@@ -92,7 +92,7 @@ class IngressService {
|
||||
pathType: 'Prefix',
|
||||
backend: {
|
||||
service: {
|
||||
name: StringUtils.toServiceName(app.id),
|
||||
name: KubeObjectNameUtils.toServiceName(app.id),
|
||||
port: {
|
||||
number: domain.port,
|
||||
},
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1Deployment, V1Ingress, V1PersistentVolumeClaim } from "@kubernetes/client-node";
|
||||
import buildService from "./build.service";
|
||||
import { ListUtils } from "../utils/list.utils";
|
||||
import { DeploymentInfoModel, DeplyomentStatus } from "@/model/deployment-info.model";
|
||||
import { BuildJobStatus } from "@/model/build-job";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { PodsInfoModel } from "@/model/pods-info.model";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { ListUtils } from "../../shared/utils/list.utils";
|
||||
import { DeploymentInfoModel, DeplyomentStatus } from "@/shared/model/deployment-info.model";
|
||||
import { BuildJobStatus } from "@/shared/model/build-job";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { PodsInfoModel } from "@/shared/model/pods-info.model";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import pvcService from "./pvc.service";
|
||||
import ingressService from "./ingress.service";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
|
||||
class NamespaceService {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { spec } from "node:test/reporters";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { NodeInfoModel } from "@/model/node-info.model";
|
||||
import { NodeInfoModel } from "@/shared/model/node-info.model";
|
||||
import { Tags } from "../utils/cache-tag-generator.utils";
|
||||
import { revalidateTag, unstable_cache } from "next/cache";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { revalidateTag, unstable_cache } from "next/cache";
|
||||
import dataAccess from "../adapter/db.client";
|
||||
import { Tags } from "../utils/cache-tag-generator.utils";
|
||||
import { Parameter, Prisma } from "@prisma/client";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
|
||||
export class ParamService {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PodsInfoModel } from "@/model/pods-info.model";
|
||||
import { PodsInfoModel } from "@/shared/model/pods-info.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import setupPodService from "./setup-services/setup-pod.service";
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { revalidateTag, unstable_cache } from "next/cache";
|
||||
import dataAccess from "../adapter/db.client";
|
||||
import { Tags } from "../utils/cache-tag-generator.utils";
|
||||
import { Prisma, Project } from "@prisma/client";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import deploymentService from "./deployment.service";
|
||||
import namespaceService from "./namespace.service";
|
||||
import buildService from "./build.service";
|
||||
@@ -53,7 +53,7 @@ class ProjectService {
|
||||
data: item
|
||||
});
|
||||
} else {
|
||||
item.id = StringUtils.toProjectId(item.name as string);
|
||||
item.id = KubeObjectNameUtils.toProjectId(item.name as string);
|
||||
savedItem = await dataAccess.client.project.create({
|
||||
data: item as Prisma.ProjectUncheckedCreateInput
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1PersistentVolumeClaim } from "@kubernetes/client-node";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { AppVolume } from "@prisma/client";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
import { MemoryCalcUtils } from "../utils/memory-caluclation.utils";
|
||||
|
||||
class PvcService {
|
||||
@@ -15,7 +15,7 @@ class PvcService {
|
||||
const existingPvcs = await this.getAllPvcForApp(app.projectId, app.id);
|
||||
|
||||
for (const appVolume of app.appVolumes) {
|
||||
const pvcName = StringUtils.toPvcName(appVolume.id);
|
||||
const pvcName = KubeObjectNameUtils.toPvcName(appVolume.id);
|
||||
const existingPvc = existingPvcs.find(pvc => pvc.metadata?.name === pvcName);
|
||||
if (existingPvc && existingPvc.spec!.resources!.requests!.storage !== MemoryCalcUtils.formatSize(appVolume.size)) {
|
||||
return true;
|
||||
@@ -56,7 +56,7 @@ class PvcService {
|
||||
const existingPvcs = await this.getAllPvcForApp(app.projectId, app.id);
|
||||
|
||||
for (const appVolume of app.appVolumes) {
|
||||
const pvcName = StringUtils.toPvcName(appVolume.id);
|
||||
const pvcName = KubeObjectNameUtils.toPvcName(appVolume.id);
|
||||
|
||||
const pvcDefinition: V1PersistentVolumeClaim = {
|
||||
apiVersion: 'v1',
|
||||
@@ -107,16 +107,16 @@ class PvcService {
|
||||
const volumes = app.appVolumes
|
||||
.filter(pvcObj => pvcObj.appId === app.id)
|
||||
.map(pvcObj => ({
|
||||
name: StringUtils.toPvcName(pvcObj.id),
|
||||
name: KubeObjectNameUtils.toPvcName(pvcObj.id),
|
||||
persistentVolumeClaim: {
|
||||
claimName: StringUtils.toPvcName(pvcObj.id)
|
||||
claimName: KubeObjectNameUtils.toPvcName(pvcObj.id)
|
||||
},
|
||||
}));
|
||||
|
||||
const volumeMounts = app.appVolumes
|
||||
.filter(pvcObj => pvcObj.appId === app.id)
|
||||
.map(pvcObj => ({
|
||||
name: StringUtils.toPvcName(pvcObj.id),
|
||||
name: KubeObjectNameUtils.toPvcName(pvcObj.id),
|
||||
mountPath: pvcObj.containerMountPath,
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1Deployment, V1Ingress, V1Service } from "@kubernetes/client-node";
|
||||
import namespaceService from "./namespace.service";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import crypto from "crypto";
|
||||
import { FancyConsoleUtils } from "../utils/fancy-console.utils";
|
||||
import { FancyConsoleUtils } from "../../shared/utils/fancy-console.utils";
|
||||
import setupPodService from "./setup-services/setup-pod.service";
|
||||
|
||||
class QuickStackService {
|
||||
@@ -57,7 +57,7 @@ class QuickStackService {
|
||||
}
|
||||
|
||||
async createOrUpdateIngress(hostname: string) {
|
||||
const ingressName = StringUtils.getIngressName(this.QUICKSTACK_NAMESPACE);
|
||||
const ingressName = KubeObjectNameUtils.getIngressName(this.QUICKSTACK_NAMESPACE);
|
||||
const existingIngresses = await k3s.network.listNamespacedIngress(this.QUICKSTACK_NAMESPACE);
|
||||
const existingIngress = existingIngresses.body.items.find((item) => item.metadata?.name === ingressName);
|
||||
|
||||
@@ -84,7 +84,7 @@ class QuickStackService {
|
||||
pathType: 'Prefix',
|
||||
backend: {
|
||||
service: {
|
||||
name: StringUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME),
|
||||
name: KubeObjectNameUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME),
|
||||
port: {
|
||||
number: this.QUICKSTACK_PORT_NUMBER,
|
||||
},
|
||||
@@ -185,7 +185,7 @@ class QuickStackService {
|
||||
}
|
||||
|
||||
async createOrUpdateService(openNodePort = false) {
|
||||
const serviceName = StringUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME);
|
||||
const serviceName = KubeObjectNameUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME);
|
||||
const body: V1Service = {
|
||||
apiVersion: 'v1',
|
||||
kind: 'Service',
|
||||
@@ -223,7 +223,7 @@ class QuickStackService {
|
||||
}
|
||||
|
||||
private async createOrUpdatePvc() {
|
||||
const pvcName = StringUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME);
|
||||
const pvcName = KubeObjectNameUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME);
|
||||
const pvc = {
|
||||
apiVersion: 'v1',
|
||||
kind: 'PersistentVolumeClaim',
|
||||
@@ -318,7 +318,7 @@ class QuickStackService {
|
||||
volumes: [{
|
||||
name: 'quickstack-volume',
|
||||
persistentVolumeClaim: {
|
||||
claimName: StringUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME)
|
||||
claimName: KubeObjectNameUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME)
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { AppExtendedModel } from "@/model/app-extended.model";
|
||||
import { AppExtendedModel } from "@/shared/model/app-extended.model";
|
||||
import k3s from "../adapter/kubernetes-api.adapter";
|
||||
import { V1PersistentVolumeClaim } from "@kubernetes/client-node";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { AppVolume } from "@prisma/client";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import { Constants } from "../utils/constants";
|
||||
import { KubeObjectNameUtils } from "../utils/kube-object-name.utils";
|
||||
import { Constants } from "../../shared/utils/constants";
|
||||
|
||||
class SvcService {
|
||||
|
||||
@@ -13,16 +13,16 @@ class SvcService {
|
||||
if (!existingService) {
|
||||
return;
|
||||
}
|
||||
const returnVal = await k3s.core.deleteNamespacedService(StringUtils.toServiceName(appId), projectId);
|
||||
console.log(`Deleted Service ${StringUtils.toServiceName(appId)} in namespace ${projectId}`);
|
||||
const returnVal = await k3s.core.deleteNamespacedService(KubeObjectNameUtils.toServiceName(appId), projectId);
|
||||
console.log(`Deleted Service ${KubeObjectNameUtils.toServiceName(appId)} in namespace ${projectId}`);
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
|
||||
async getService(projectId: string, appId: string) {
|
||||
const allServices = await k3s.core.listNamespacedService(projectId);
|
||||
if (allServices.body.items.some((item) => item.metadata?.name === StringUtils.toServiceName(appId))) {
|
||||
const res = await k3s.core.readNamespacedService(StringUtils.toServiceName(appId), projectId);
|
||||
if (allServices.body.items.some((item) => item.metadata?.name === KubeObjectNameUtils.toServiceName(appId))) {
|
||||
const res = await k3s.core.readNamespacedService(KubeObjectNameUtils.toServiceName(appId), projectId);
|
||||
return res.body;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class SvcService {
|
||||
|
||||
const body = {
|
||||
metadata: {
|
||||
name: StringUtils.toServiceName(app.id)
|
||||
name: KubeObjectNameUtils.toServiceName(app.id)
|
||||
},
|
||||
spec: {
|
||||
selector: {
|
||||
@@ -60,7 +60,7 @@ class SvcService {
|
||||
}
|
||||
};
|
||||
if (existingService) {
|
||||
await k3s.core.replaceNamespacedService(StringUtils.toServiceName(app.id), app.projectId, body);
|
||||
await k3s.core.replaceNamespacedService(KubeObjectNameUtils.toServiceName(app.id), app.projectId, body);
|
||||
} else {
|
||||
await k3s.core.createNamespacedService(app.projectId, body);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import dataAccess from "../adapter/db.client";
|
||||
import { revalidateTag, unstable_cache } from "next/cache";
|
||||
import { Tags } from "../utils/cache-tag-generator.utils";
|
||||
import bcrypt from "bcrypt";
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import QRCode from "qrcode";
|
||||
import * as OTPAuth from "otpauth";
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ServiceException } from "@/model/service.exception.model";
|
||||
import { UserSession } from "@/model/sim-session.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
import { UserSession } from "@/shared/model/sim-session.model";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { ZodRawShape, ZodObject, objectUtil, baseObjectOutputType, z, ZodType } from "zod";
|
||||
import { redirect } from "next/navigation";
|
||||
import { ServerActionResult } from "@/model/server-action-error-return.model";
|
||||
import { FormValidationException } from "@/model/form-validation-exception.model";
|
||||
import { authOptions } from "@/lib/auth-options";
|
||||
import { ServerActionResult } from "@/shared/model/server-action-error-return.model";
|
||||
import { FormValidationException } from "@/shared/model/form-validation-exception.model";
|
||||
import { authOptions } from "@/server/utils/auth-options";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import NextAuth, { NextAuthOptions, Session } from "next-auth"
|
||||
import EmailProvider from "next-auth/providers/email";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter"
|
||||
import { JWT } from "next-auth/jwt";
|
||||
import { UserSession } from "@/model/sim-session.model";
|
||||
import { UserSession } from "@/shared/model/sim-session.model";
|
||||
import dataAccess from "@/server/adapter/db.client";
|
||||
import CredentialsProvider from "next-auth/providers/credentials";
|
||||
import bcrypt from "bcrypt";
|
||||
@@ -54,25 +54,6 @@ export const authOptions: NextAuthOptions = {
|
||||
}
|
||||
})
|
||||
],
|
||||
callbacks: {
|
||||
/* async jwt({ token, user }) {
|
||||
// Initial sign in
|
||||
if (user) {
|
||||
token.id = user.id;
|
||||
token.role = 'tenant'; //user.role;
|
||||
}
|
||||
return token;
|
||||
},*/
|
||||
/*async session({ session, token, user }) {
|
||||
// Add the user's role to the session
|
||||
const dbUser = user as User;
|
||||
const simSession = session as SimSession;
|
||||
simSession.userId = dbUser.id;
|
||||
|
||||
|
||||
return simSession;
|
||||
},*/
|
||||
},
|
||||
adapter: PrismaAdapter(dataAccess.client),
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
export class StringUtils {
|
||||
export class KubeObjectNameUtils {
|
||||
|
||||
private static readonly MAX_OBJECT_NAME_LENGTH = 30; // in Kubernetes, the maximum length of an object name is 63 characters
|
||||
|
||||
@@ -16,7 +16,7 @@ export class StringUtils {
|
||||
}
|
||||
|
||||
static toObjectId(str: string): string {
|
||||
let snakeCase = StringUtils.toSnakeCase(str);
|
||||
let snakeCase = KubeObjectNameUtils.toSnakeCase(str);
|
||||
const randomString = crypto.randomBytes(4).toString('hex');
|
||||
snakeCase = `${snakeCase}-${randomString}`;
|
||||
return snakeCase
|
||||
@@ -26,13 +26,13 @@ export class StringUtils {
|
||||
}
|
||||
|
||||
static toProjectId(str: string): `proj-${string}` {
|
||||
str = str.substring(0, StringUtils.MAX_OBJECT_NAME_LENGTH).trim();
|
||||
return `proj-${StringUtils.toObjectId(str)}`;
|
||||
str = str.substring(0, KubeObjectNameUtils.MAX_OBJECT_NAME_LENGTH).trim();
|
||||
return `proj-${KubeObjectNameUtils.toObjectId(str)}`;
|
||||
}
|
||||
|
||||
static toAppId(str: string): `app-${string}` {
|
||||
str = str.substring(0, StringUtils.MAX_OBJECT_NAME_LENGTH).trim();
|
||||
return `app-${StringUtils.toObjectId(str)}`;
|
||||
str = str.substring(0, KubeObjectNameUtils.MAX_OBJECT_NAME_LENGTH).trim();
|
||||
return `app-${KubeObjectNameUtils.toObjectId(str)}`;
|
||||
}
|
||||
|
||||
static toJobName(appId: string): `build-${string}` {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user