feat: add support for viewing docker logs in swarm mode

This commit is contained in:
faytranevozter
2024-12-18 16:40:33 +07:00
parent 852895c382
commit 6211a19805
10 changed files with 280 additions and 12 deletions
@@ -12,6 +12,7 @@ import { type LogLine, getLogType, parseLogs } from "./utils";
interface Props {
containerId: string;
serverId?: string | null;
runType: "swarm" | "native";
}
export const priorities = [
@@ -37,7 +38,11 @@ export const priorities = [
},
];
export const DockerLogsId: React.FC<Props> = ({ containerId, serverId }) => {
export const DockerLogsId: React.FC<Props> = ({
containerId,
serverId,
runType,
}) => {
const { data } = api.docker.getConfig.useQuery(
{
containerId,
@@ -104,6 +109,7 @@ export const DockerLogsId: React.FC<Props> = ({ containerId, serverId }) => {
tail: lines.toString(),
since,
search,
runType,
});
if (serverId) {
@@ -46,7 +46,11 @@ export const ShowDockerModalLogs = ({
<DialogDescription>View the logs for {containerId}</DialogDescription>
</DialogHeader>
<div className="flex flex-col gap-4 pt-2.5">
<DockerLogsId containerId={containerId || ""} serverId={serverId} />
<DockerLogsId
containerId={containerId || ""}
serverId={serverId}
runType="native"
/>
</div>
</DialogContent>
</Dialog>