feat: tarjeta portal lleva al tablero IT (boardHref shell)

This commit is contained in:
Nurfog committed 2026-09-09 10:02:12 -03:00
1 parent 23df440b79
commit 39cb4ec89a
3 files changed
+42 -8

No files matched your search

+18 -6
View File
@@ -3,6 +3,7 @@
import Link from "next/link";
import { useModules, refreshModules } from "@/lib/store";
import {
boardHref,
displayName,
envOf,
getModuleMeta,
@@ -33,6 +34,22 @@ export default function Home() {
const env = envOf(m.branch);
const url = moduleUrl(m);
const name = displayName(m.name);
const board = boardHref(m);
const boardLink = board.external ? (
<a
href={board.href}
className="text-decoration-none text-dark d-block py-2 stretched-link"
>
{name}
</a>
) : (
<Link
href={board.href}
className="text-decoration-none text-dark d-block py-2 stretched-link"
>
{name}
</Link>
);
return (
<div className="col-md-6" key={m.name}>
<div className="app-card p-2">
@@ -45,12 +62,7 @@ export default function Home() {
/>
</td>
<td>
<Link
href={`/m/${m.name}`}
className="text-decoration-none text-dark d-block py-2 stretched-link"
>
{name}
</Link>
{boardLink}
<div className="d-flex align-items-center gap-2">
<span className={`status-dot ${status.cls}`} />
<small className="text-muted" style={{ fontSize: "0.75rem" }}>
+9 -1
View File
@@ -5,6 +5,7 @@ import SamShell from "@/components/SamShell";
import { useModules, useStats } from "@/lib/store";
import {
displayName,
boardHref,
envOf,
getModuleMeta,
moduleUrl,
@@ -103,6 +104,7 @@ function AppCard({ m, stat }: { m: ModuleState; stat?: ContainerStat }) {
const env = envOf(m.branch);
const cpu = pct(stat?.cpu);
const mem = pct(stat?.memPerc);
const board = boardHref(m);
return (
<div className="col-md-6 col-xl-4">
<div className="app-card p-3 h-100">
@@ -133,9 +135,15 @@ function AppCard({ m, stat }: { m: ModuleState; stat?: ContainerStat }) {
<Bar value={mem} color="#6f42c1" />
</div>
<div className="d-flex gap-2 mt-2">
<Link href={`/m/${m.name}`} className="btn btn-sm btn-outline-primary flex-fill">
{board.external ? (
<a href={board.href} className="btn btn-sm btn-outline-primary flex-fill">
<i className="bx bx-grid-alt me-1" /> Tablero
</a>
) : (
<Link href={board.href} className="btn btn-sm btn-outline-primary flex-fill">
<i className="bx bx-grid-alt me-1" /> Tablero
</Link>
)}
<a
href={moduleUrl(m)}
target="_blank"
+15 -1
View File
@@ -221,6 +221,20 @@ export function moduleUrl(m: ModuleState) {
return `https://${m.subdomain}.devops.norteamericano.cl`;
}
// Tablero IT: es el tablero del propio shell (módulo portal).
export const IT_BOARD_URL = "https://it.sam.devops.norteamericano.cl";
// El módulo que sirve sam.devops es el shell: su tablero es el IT.
export function isShellModule(m: ModuleState): boolean {
return m.subdomain === "sam" || m.name.toLowerCase() === "portal";
}
// Destino del botón/tarjeta "Tablero" del módulo.
export function boardHref(m: ModuleState): { href: string; external: boolean } {
if (isShellModule(m)) return { href: IT_BOARD_URL, external: true };
return { href: `/m/${m.name}`, external: false };
}
// ============================================================
// Secciones del índice: dónde aparece cada módulo.
// - Todo módulo nuevo cae en "apps" (Aplicaciones) automáticamente.
@@ -270,7 +284,7 @@ export function itMenu(modules: ModuleState[]): MenuItem[] {
...modules.map((m) => ({
label: displayName(m.name),
icon: getModuleMeta(m.name).icon,
href: `/m/${m.name}`,
href: boardHref(m).href,
})),
{ label: "Agregar", icon: "bx-plus", href: "/upload" },
{ label: "Actualizar", icon: "bx-refresh", href: "/actualizar" },