feat: colores de modulo en tablero IT y sidebar minimo en tablero de modulo

This commit is contained in:
Nurfog committed 2026-09-16 17:11:29 -03:00
1 parent 9ee35fd713
commit 9710d995b8
3 files changed
+58 -16

No files matched your search

+18
View File
@@ -531,6 +531,24 @@ body {
box-shadow: 0 0.6rem 1.4rem rgba(22, 36, 61, 0.1); box-shadow: 0 0.6rem 1.4rem rgba(22, 36, 61, 0.1);
} }
/* Tarjeta de módulo en el tablero IT: conserva franja + sombra
izquierda con el color de la app sobre el tema inventario. */
.sam-shell .app-card.module-card {
border: 1px solid rgba(22, 36, 61, 0.09);
border-left: 4px solid var(--module-color, transparent);
box-shadow:
-6px 2px 14px rgba(var(--module-rgb, 0, 40, 93), 0.22),
0 0.35rem 1rem rgba(22, 36, 61, 0.055);
}
.sam-shell .app-card.module-card:hover {
transform: translateY(-2px);
background-color: #fff;
box-shadow:
-8px 4px 22px rgba(var(--module-rgb, 0, 40, 93), 0.38),
0 0.6rem 1.4rem rgba(22, 36, 61, 0.1);
}
.sam-shell .section-header { .sam-shell .section-header {
display: flex; display: flex;
align-items: center; align-items: center;
+2 -10
View File
@@ -57,22 +57,14 @@ export default function ModuleBoard() {
const mem = pct(stat?.memPerc); const mem = pct(stat?.memPerc);
const title = mod ? displayName(mod.name) : displayName(name || "Módulo"); const title = mod ? displayName(mod.name) : displayName(name || "Módulo");
const menu = [ const menu = [{ label: "Aplicaciones", icon: "bx-layer", href: "/" }];
{ label: "Estado", icon: "bx-grid-alt", href: "#estado" },
...functions.map((f) => ({
label: f.label,
icon: f.icon,
href: `/m/${name}#${f.path}`,
})),
{ label: "Aplicaciones", icon: "bx-layer", href: "/" },
];
return ( return (
<SamShell <SamShell
brand={title} brand={title}
subtitle="Tablero del módulo" subtitle="Tablero del módulo"
menu={menu} menu={menu}
activeHref="#estado" activeHref="/"
topUser={me?.email || "SAM"} topUser={me?.email || "SAM"}
allowLogout allowLogout
topSede={mod ? `${mod.subdomain}.devops.norteamericano.cl` : undefined} topSede={mod ? `${mod.subdomain}.devops.norteamericano.cl` : undefined}
+38 -6
View File
@@ -1,8 +1,10 @@
"use client"; "use client";
import Link from "next/link"; import Link from "next/link";
import { useMemo, type CSSProperties } from "react";
import { useModules, useStats } from "@/lib/store"; import { useModules, useStats } from "@/lib/store";
import { import {
assignColorsForModules,
displayName, displayName,
boardHref, boardHref,
envOf, envOf,
@@ -100,17 +102,36 @@ function Bar({ value, color }: { value: number; color: string }) {
); );
} }
function AppCard({ m, stat }: { m: ModuleState; stat?: ContainerStat }) { function AppCard({
const meta = getModuleMeta(m.name); m,
stat,
color,
}: {
m: ModuleState;
stat?: ContainerStat;
color?: string | null;
}) {
const meta = getModuleMeta(m.name, color ?? m.color);
const env = envOf(m.branch); const env = envOf(m.branch);
const cpu = pct(stat?.cpu); const cpu = pct(stat?.cpu);
const mem = pct(stat?.memPerc); const mem = pct(stat?.memPerc);
const board = boardHref(m); const board = boardHref(m);
return ( return (
<div className="col-md-6 col-xl-4"> <div className="col-md-6 col-xl-4">
<div className="app-card p-3 h-100"> <div
className="app-card module-card p-3 h-100"
style={
{
"--module-color": meta.color,
"--module-rgb": meta.rgb,
} as CSSProperties
}
>
<div className="d-flex align-items-center gap-2 mb-2"> <div className="d-flex align-items-center gap-2 mb-2">
<i className={`bx ${meta.icon} bx-border text-light ${meta.bg}`} /> <i
className={`bx ${meta.icon} bx-border module-icon`}
style={{ backgroundColor: meta.color, color: meta.onColor }}
/>
<div> <div>
<strong>{displayName(m.name)}</strong> <strong>{displayName(m.name)}</strong>
<div> <div>
@@ -167,7 +188,13 @@ export default function TableroView() {
const stats = useStats(); const stats = useStats();
const loading = data === null; const loading = data === null;
const modules = visibleModules(data?.modules ?? []); const modules = useMemo(
() => visibleModules(data?.modules ?? []),
[data]
);
// Mismo color que en el índice: guardado manda, al resto se le genera
// uno sin repetir para lo ya importado.
const colorMap = useMemo(() => assignColorsForModules(modules), [modules]);
const ok = modules.filter((m) => healthOf(m) === "ok").length; const ok = modules.filter((m) => healthOf(m) === "ok").length;
const starting = modules.filter((m) => healthOf(m) === "starting").length; const starting = modules.filter((m) => healthOf(m) === "starting").length;
const down = modules.length - ok - starting; const down = modules.length - ok - starting;
@@ -225,7 +252,12 @@ export default function TableroView() {
</div> </div>
<div className="row row-cards"> <div className="row row-cards">
{list.map((m) => ( {list.map((m) => (
<AppCard key={m.name} m={m} stat={statForModule(stats, m.name)} /> <AppCard
key={m.name}
m={m}
stat={statForModule(stats, m.name)}
color={colorMap[m.name] ?? m.color}
/>
))} ))}
</div> </div>
</div> </div>