feat(widgets): implémentation Phase 4 — widgets Glance complets
- widget-network-scan : liste équipements avec état (online/offline), hostname, IP, vendor, badges services, tri online en premier - widget-agent-metrics : barres CPU/RAM/disque/température par agent, code couleur ok (vert) / warn (orange) / crit (rouge) - sentinelmesh.css : styles custom (points statut, badges, barres de progression animées) compatibles thèmes Glance - glance-page-example.yaml : page Infrastructure prête à l'emploi - Backend widgets enrichi : mac, ports, offline count, net_rx/tx_bps - ROADMAP Phase 4 marquée complète Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# Widget SentinelMesh — Découverte réseau
|
||||
# À copier dans votre glance.yml
|
||||
#
|
||||
# Prérequis :
|
||||
# - Backend SentinelMesh démarré (port 8080)
|
||||
# - agent-scan-network en cours d'exécution
|
||||
# - Fichier CSS custom copié dans votre répertoire assets Glance
|
||||
# et référencé dans glance.yml : custom-css-file: /assets/sentinelmesh.css
|
||||
|
||||
- type: custom-api
|
||||
title: Réseau local
|
||||
cache: 30s
|
||||
url: http://sentinelmesh:8080/api/v1/widgets/network
|
||||
template: |
|
||||
{{- $online := .JSON.Int "online" -}}
|
||||
{{- $offline := .JSON.Int "offline" -}}
|
||||
{{- $total := .JSON.Int "total" -}}
|
||||
|
||||
<div class="sm-net-header flex justify-between margin-bottom-10">
|
||||
<span class="size-h5 color-paragraph">
|
||||
{{ $online }} en ligne
|
||||
{{ if gt $offline 0 }} · <span class="color-negative">{{ $offline }} hors ligne</span>{{ end }}
|
||||
· {{ $total }} total
|
||||
</span>
|
||||
{{ if .JSON.Exists "last_scan_at" }}
|
||||
<span class="size-h6 color-paragraph"
|
||||
{{ .JSON.String "last_scan_at" | parseTime "rfc3339" | toRelativeTime }}></span>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<ul class="list list-gap-10 collapsible-container" data-collapse-after="8">
|
||||
{{ range .JSON.Array "devices" }}
|
||||
{{- $state := .String "state" -}}
|
||||
{{- $host := .String "hostname" -}}
|
||||
{{- $ip := .String "ip" -}}
|
||||
{{- $vendor := .String "vendor" -}}
|
||||
<li class="sm-device flex gap-10 items-center">
|
||||
|
||||
<div class="sm-state-dot {{ if eq $state "online" }}sm-dot-online{{ else }}sm-dot-offline{{ end }}"></div>
|
||||
|
||||
<div class="grow min-width-0">
|
||||
<div class="flex justify-between">
|
||||
<span class="size-h4 color-highlight text-truncate">
|
||||
{{- if ne $host "" }}{{ $host }}{{ else }}{{ $ip }}{{ end -}}
|
||||
</span>
|
||||
<span class="size-h6 color-paragraph shrink-0 margin-left-10">{{ $ip }}</span>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-5 flex-wrap margin-top-3">
|
||||
{{ if ne $vendor "" }}
|
||||
<span class="sm-badge sm-badge-vendor size-h6">{{ $vendor }}</span>
|
||||
{{ end }}
|
||||
{{ range .Array "services" }}
|
||||
<span class="sm-badge size-h6">{{ .String "" }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
Reference in New Issue
Block a user