Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unused parse crashing swarm page #1001

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions apps/dokploy/components/dashboard/swarm/monitoring-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Loader2,
Server,
} from "lucide-react";
import { NodeCard } from "./details/details-card";
import { NodeCard, type SwarmList as Node } from "./details/details-card";

interface Props {
serverId?: string;
Expand Down Expand Up @@ -52,16 +52,16 @@ export default function SwarmMonitorCard({ serverId }: Props) {

const totalNodes = nodes.length;
const activeNodesCount = nodes.filter(
(node) => node.Status === "Ready",
(node: Node) => node.Status === "Ready",
).length;
const managerNodesCount = nodes.filter(
(node) =>
(node: Node) =>
node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable",
).length;

const activeNodes = nodes.filter((node) => node.Status === "Ready");
const activeNodes = nodes.filter((node: Node) => node.Status === "Ready");
const managerNodes = nodes.filter(
(node) =>
(node: Node) =>
node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable",
);

Expand Down Expand Up @@ -120,7 +120,7 @@ export default function SwarmMonitorCard({ serverId }: Props) {
</TooltipTrigger>
<TooltipContent>
<div className="max-h-48 overflow-y-auto">
{activeNodes.map((node) => (
{activeNodes.map((node: Node) => (
<div key={node.ID} className="flex items-center gap-2">
{getStatusIcon(node.Status)}
{node.Hostname}
Expand All @@ -145,7 +145,7 @@ export default function SwarmMonitorCard({ serverId }: Props) {
</TooltipTrigger>
<TooltipContent>
<div className="max-h-48 overflow-y-auto">
{managerNodes.map((node) => (
{managerNodes.map((node: Node) => (
<div key={node.ID} className="flex items-center gap-2">
{getStatusIcon(node.Status)}
{node.Hostname}
Expand All @@ -160,7 +160,7 @@ export default function SwarmMonitorCard({ serverId }: Props) {
<div className="border-t pt-4 mt-4">
<h4 className="text-sm font-semibold mb-2">Node Status:</h4>
<ul className="space-y-2">
{nodes.map((node) => (
{nodes.map((node: Node) => (
<li
key={node.ID}
className="flex justify-between items-center text-sm"
Expand All @@ -179,7 +179,7 @@ export default function SwarmMonitorCard({ serverId }: Props) {
</CardContent>
</Card>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{nodes.map((node) => (
{nodes.map((node: Node) => (
<NodeCard key={node.ID} node={node} serverId={serverId} />
))}
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/services/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ export const getSwarmNodes = async (serverId?: string) => {

const nodes = JSON.parse(stdout);

const nodesArray = stdout
const nodesArray = nodes
.trim()
.split("\n")
.map((line) => JSON.parse(line));
.map((line: string) => JSON.parse(line));
return nodesArray;
} catch (error) {}
};
Expand Down
Loading