Wire the Servers overview's Proxmox badge to the integration color setting
The new integration badge-color setting only reached the Integrations page's Manage table — the Servers & Tasks overview card grid had its own hardcoded bg-purple-lt badge for Proxmox-linked servers that never picked it up. Reuses the same typeBadgeStyle pattern already used there and in the DNS module. Note: until a Proxmox color is set in Settings -> Badges, this badge now renders with Tabler's default neutral badge style rather than purple, matching how every other badge customized this way already behaves before a color is chosen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useState, type CSSProperties } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import {
|
||||
api,
|
||||
@@ -22,6 +22,12 @@ const SCHEDULE_TYPE_OPTIONS: { value: ScheduleType; label: string }[] = [
|
||||
{ value: "manual", label: "Other / manual" },
|
||||
];
|
||||
|
||||
function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties {
|
||||
const color = colors[type];
|
||||
if (!color) return {};
|
||||
return { backgroundColor: `${color}22`, color, border: `1px solid ${color}55` };
|
||||
}
|
||||
|
||||
function installCommand(token: string, insecure: boolean): string {
|
||||
const curlFlags = insecure ? "-fsSL -k" : "-fsSL";
|
||||
const envVars = insecure
|
||||
@@ -51,6 +57,11 @@ export default function ServersTasks({ user }: { user: CurrentUser }) {
|
||||
const [tasks, setTasks] = useState<TaskRecord[] | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [managingServers, setManagingServers] = useState(false);
|
||||
const [integrationColors, setIntegrationColors] = useState<Record<string, string>>({});
|
||||
|
||||
useEffect(() => {
|
||||
api.settings.integrationColors().then((res) => setIntegrationColors(res.integrationColors)).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const [filters, setFilters] = useState({
|
||||
serverId: undefined as number | undefined,
|
||||
@@ -381,7 +392,9 @@ export default function ServersTasks({ user }: { user: CurrentUser }) {
|
||||
<div className="text-secondary small">{s.hostname ?? "no hostname reported"}</div>
|
||||
</div>
|
||||
{s.proxmoxIntegrationId ? (
|
||||
<span className="badge bg-purple-lt text-purple">Proxmox</span>
|
||||
<span className="badge" style={typeBadgeStyle(integrationColors, "proxmox")}>
|
||||
Proxmox
|
||||
</span>
|
||||
) : s.lastSeenAt ? (
|
||||
<span className="badge bg-green-lt text-green">Agent</span>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user