Compare commits
No commits in common. "686b2f62f3c633b5ded67e4e197af4bdb467643b" and "9980e034498a8e95a2d058d75c58d1c708c6b5ad" have entirely different histories.
686b2f62f3
...
9980e03449
5 changed files with 18 additions and 58 deletions
38
web/build.sh
38
web/build.sh
|
|
@ -242,35 +242,29 @@ for spec in "${REMOTE_PAGES[@]}"; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$CHECK_ONLY" == false ]]; then
|
if [[ "$CHECK_ONLY" == false ]]; then
|
||||||
# Build navigation.json from menu: section.
|
# Apply menu order if defined — reorder PAGE_ENTRIES and filter nav visibility
|
||||||
# Convert full manifest to JSON once (single yq call) then jq handles all logic.
|
mapfile -t MENU_ORDER < <(yq '(.menu // [])[]' "$MANIFEST")
|
||||||
# Menu items: string → page lookup, object → pass-through (separator/section).
|
|
||||||
manifest_json=$(yq -o json '.' "$MANIFEST")
|
|
||||||
menu_json=$(echo "$manifest_json" | jq -c '.menu // []')
|
|
||||||
menu_len=$(echo "$menu_json" | jq 'length')
|
|
||||||
|
|
||||||
if [[ "$menu_len" -gt 0 ]]; then
|
if [[ ${#MENU_ORDER[@]} -gt 0 ]]; then
|
||||||
NAV_ENTRIES=$(jq -n \
|
ORDERED="[]"
|
||||||
--argjson menu "$menu_json" \
|
for route in "${MENU_ORDER[@]}"; do
|
||||||
--argjson pages "$PAGE_ENTRIES" \
|
[[ -z "$route" ]] && continue
|
||||||
'[ $menu[] |
|
entry="$(echo "$PAGE_ENTRIES" | jq --arg r "$route" '.[] | select(.route == $r)')"
|
||||||
if type == "string"
|
[[ -z "$entry" ]] && warn "menu: route '${route}' not found in pages, skipping"
|
||||||
then (. as $r | $pages[] | select(.route == $r) |
|
[[ -n "$entry" ]] && ORDERED="$(echo "$ORDERED" | jq --argjson e "$entry" '. + [$e]')"
|
||||||
{ label, href: ("#/" + .route), icon })
|
done
|
||||||
else .
|
NAV_ENTRIES="$ORDERED"
|
||||||
end
|
|
||||||
]')
|
|
||||||
else
|
else
|
||||||
# No menu defined — use all pages in discovery order
|
NAV_ENTRIES="$PAGE_ENTRIES"
|
||||||
NAV_ENTRIES=$(echo "$PAGE_ENTRIES" | \
|
|
||||||
jq '[.[] | { label, href: ("#/" + .route), icon }]')
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pages.json — full list (all pages, original discovery order)
|
# pages.json — full list (all pages, original discovery order)
|
||||||
echo "$PAGE_ENTRIES" | jq '.' > "${WEB_DIR}/pages.json"
|
echo "$PAGE_ENTRIES" | jq '.' > "${WEB_DIR}/pages.json"
|
||||||
|
|
||||||
# navigation.json — write NAV_ENTRIES as-is (already correctly shaped)
|
# navigation.json — ordered + filtered by menu:
|
||||||
echo "$NAV_ENTRIES" | jq '.' > "${WEB_DIR}/navigation.json"
|
echo "$NAV_ENTRIES" | \
|
||||||
|
jq '[.[] | {label: .label, href: ("#/" + .route), icon: .icon}]' \
|
||||||
|
> "${WEB_DIR}/navigation.json"
|
||||||
|
|
||||||
log "wrote pages.json ($(echo "$PAGE_ENTRIES" | jq 'length') pages) + navigation.json ($(echo "$NAV_ENTRIES" | jq 'length') in menu)"
|
log "wrote pages.json ($(echo "$PAGE_ENTRIES" | jq 'length') pages) + navigation.json ($(echo "$NAV_ENTRIES" | jq 'length') in menu)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,7 @@ remote_pages: []
|
||||||
# A page not listed here is accessible via /#/route but hidden from the nav.
|
# A page not listed here is accessible via /#/route but hidden from the nav.
|
||||||
menu:
|
menu:
|
||||||
- dashboard
|
- dashboard
|
||||||
- type: section
|
|
||||||
label: Réseau
|
|
||||||
- vpcs
|
- vpcs
|
||||||
- subnets
|
- subnets
|
||||||
- type: separator
|
|
||||||
- vms
|
- vms
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,13 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 5px 12px;
|
padding: 11px 12px;
|
||||||
margin: 2px;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #a6adc8;
|
color: #a6adc8;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||||
min-height: 25px;
|
min-height: 44px;
|
||||||
transition: background 0.1s, color 0.1s;
|
transition: background 0.1s, color 0.1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,18 +38,3 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.item:hover .icon { color: #cdd6f4; }
|
.item:hover .icon { color: #cdd6f4; }
|
||||||
|
|
||||||
.section-header {
|
|
||||||
font-size: 10px;
|
|
||||||
font-weight: 700;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.1em;
|
|
||||||
color: #45475a;
|
|
||||||
padding: 14px 12px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.separator {
|
|
||||||
height: 1px;
|
|
||||||
background: #313244;
|
|
||||||
margin: 6px 4px;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,6 @@ class SideNav extends HTMLElement {
|
||||||
const current = this.#currentHref()
|
const current = this.#currentHref()
|
||||||
|
|
||||||
const links = this.#items.map(item => {
|
const links = this.#items.map(item => {
|
||||||
if (item.type === 'separator') {
|
|
||||||
return `<div class="separator"></div>`
|
|
||||||
}
|
|
||||||
if (item.type === 'section') {
|
|
||||||
return `<div class="section-header">${item.label ?? ''}</div>`
|
|
||||||
}
|
|
||||||
// Skip malformed entries (missing href or label)
|
|
||||||
if (!item.href || !item.label) return ''
|
|
||||||
const active = item.href === current
|
const active = item.href === current
|
||||||
return `<a href="${item.href}" class="item ${active ? 'active' : ''}">
|
return `<a href="${item.href}" class="item ${active ? 'active' : ''}">
|
||||||
<span class="icon">${resolveIcon(item.icon)}</span>
|
<span class="icon">${resolveIcon(item.icon)}</span>
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@
|
||||||
"href": "#/dashboard",
|
"href": "#/dashboard",
|
||||||
"icon": "dashboard"
|
"icon": "dashboard"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"label": "Réseau"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "VPCs",
|
"label": "VPCs",
|
||||||
"href": "#/vpcs",
|
"href": "#/vpcs",
|
||||||
|
|
@ -18,9 +14,6 @@
|
||||||
"href": "#/subnets",
|
"href": "#/subnets",
|
||||||
"icon": "subnet"
|
"icon": "subnet"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "VMs",
|
"label": "VMs",
|
||||||
"href": "#/vms",
|
"href": "#/vms",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue