mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: extract badgeStateColor function for reuse across log components
This commit is contained in:
@@ -31,7 +31,7 @@ export const DockerLogs = dynamic(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const badgeStateColor = (state: string) => {
|
export const badgeStateColor = (state: string) => {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case "running":
|
case "running":
|
||||||
return "green";
|
return "green";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { badgeStateColor } from "@/components/dashboard/application/logs/show";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
@@ -36,20 +37,7 @@ interface Props {
|
|||||||
serverId?: string;
|
serverId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const badgeStateColor = (state: string) => {
|
badgeStateColor;
|
||||||
switch (state) {
|
|
||||||
case "running":
|
|
||||||
return "green";
|
|
||||||
case "exited":
|
|
||||||
case "shutdown":
|
|
||||||
return "red";
|
|
||||||
case "accepted":
|
|
||||||
case "created":
|
|
||||||
return "blue";
|
|
||||||
default:
|
|
||||||
return "default";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ShowDockerLogsStack = ({ appName, serverId }: Props) => {
|
export const ShowDockerLogsStack = ({ appName, serverId }: Props) => {
|
||||||
const [option, setOption] = useState<"swarm" | "native">("native");
|
const [option, setOption] = useState<"swarm" | "native">("native");
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { badgeStateColor } from "@/components/dashboard/application/logs/show";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
@@ -36,21 +37,6 @@ interface Props {
|
|||||||
appType: "stack" | "docker-compose";
|
appType: "stack" | "docker-compose";
|
||||||
}
|
}
|
||||||
|
|
||||||
const badgeStateColor = (state: string) => {
|
|
||||||
switch (state) {
|
|
||||||
case "running":
|
|
||||||
return "green";
|
|
||||||
case "exited":
|
|
||||||
case "shutdown":
|
|
||||||
return "red";
|
|
||||||
case "accepted":
|
|
||||||
case "created":
|
|
||||||
return "blue";
|
|
||||||
default:
|
|
||||||
return "default";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ShowDockerLogsCompose = ({
|
export const ShowDockerLogsCompose = ({
|
||||||
appName,
|
appName,
|
||||||
appType,
|
appType,
|
||||||
|
|||||||
Reference in New Issue
Block a user