mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-14 18:56:52 +00:00
Beta cycle bundle over 1.2.4.1
- **VM/LXC modal** — PVE tags (dots on list cards, editable pills in modal with click-to-edit) using NVIDIA-style hash colour and SAPC contrast; Status tab redesign (single card, always-visible subsections, Edit button, autostart toggle, blue subsection icons); Backups and Firewall tabs now fill the full modal height with sticky headers/notes; stopped VMs no longer shift the metrics grid; mount-point card brightness unified across breakpoints. - **Disks modal** — Overview / SMART / History / Schedule tabs adopt the VM/LXC modal size and the mobile icon-only tab pattern; SMART attributes table drops the 15-row cap and gains a sticky "View full SMART report" footer; Print/Save-as-PDF collapses to two icons in the report; loose i18n and layout follow-ups. - **NVIDIA driver installer (#298)** — version picker cross-checks kernel + NVIDIA's Production/New Feature/Legacy branch classification (scraped from `nvidia.com/en-us/drivers/unix/`) + the PCI Device IDs of every host GPU, with a release-count heuristic to keep superseded production branches selectable while dropping Vulkan-beta ones; Recommended follows same-branch head when a driver is installed, Production Branch head on a fresh install; Hardware card now shows installed alongside available driver version. - **Custom notifications (#297)** — `event_type: "custom"` accepts `title`/`message` at the root or nested under `data`; defensive strip of stray `[TITLE]`/`[BODY]` markers echoed by the AI enhancer. - **App tab** — new "Exclude from the LXC updates counter" toggle; the CT's aggregate updates badge now sums OS packages plus registered apps (respecting the flag); Docs page updated; App suggestion no longer treats bare OS helper slugs (alpine/ubuntu/debian…) as installable apps. - **i18n and copy** — Monitor UI available in EN / ES / DE / FR / IT / PT / SV / SK (thanks @vaso73) surfaced as the first entry in the What's New modal with a link to the contributor's profile; ES cleanup pass (`Historial`, `Velocidad de rotación`, `Consumo actual`, `Ejecutar`, `Eliminar`, `Activar`, `Ver contenido`, `Repuesto disp.`, `Registrar`, `Ocultar`, `Descartar`); redundant "Tip: search any Linux/Proxmox command" line removed from the terminal command search across all locales.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
// Proxmox VE tag color scheme — 1:1 port of the algorithm in
|
||||
// proxmoxlib.js (`Proxmox.Utils.stringToRGB` +
|
||||
// `Proxmox.Utils.getTextContrastClass`). Same input → same color
|
||||
// as the PVE web UI, so tags render identically in both places.
|
||||
|
||||
export type TagColor = {
|
||||
bg: string // css `background-color`
|
||||
fg: string // css `color` — auto-picked for contrast (SAPC)
|
||||
border: string // css `border-color`
|
||||
}
|
||||
|
||||
// Verbatim port of stringToRGB from proxmoxlib.js. The `+ 'prox'`
|
||||
// suffix, the `<< 5` hash, and the `alpha=0.7 / bg=255` blend
|
||||
// keep the output in the [76.5, 255] range per channel — that's
|
||||
// why every PVE tag is a "washed" bright color instead of a raw
|
||||
// hash-hue.
|
||||
function stringToRGB(input: string): [number, number, number] {
|
||||
let hash = 0
|
||||
if (!input) return [255, 255, 255]
|
||||
const source = input + "prox"
|
||||
for (let i = 0; i < source.length; i++) {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
hash = source.charCodeAt(i) + ((hash << 5) - hash)
|
||||
// eslint-disable-next-line no-bitwise
|
||||
hash = hash & hash
|
||||
}
|
||||
const alpha = 0.7
|
||||
const bg = 255
|
||||
return [
|
||||
// eslint-disable-next-line no-bitwise
|
||||
(hash & 255) * alpha + bg * (1 - alpha),
|
||||
// eslint-disable-next-line no-bitwise
|
||||
((hash >> 8) & 255) * alpha + bg * (1 - alpha),
|
||||
// eslint-disable-next-line no-bitwise
|
||||
((hash >> 16) & 255) * alpha + bg * (1 - alpha),
|
||||
]
|
||||
}
|
||||
|
||||
// SAPC-based light/dark text picker — verbatim port of
|
||||
// getTextContrastClass. Same tag → same text color as PVE.
|
||||
function getTextContrastClass(rgb: [number, number, number]): "light" | "dark" {
|
||||
const blkThrs = 0.022
|
||||
const blkClmp = 1.414
|
||||
const r = (rgb[0] / 255) ** 2.4
|
||||
const g = (rgb[1] / 255) ** 2.4
|
||||
const b = (rgb[2] / 255) ** 2.4
|
||||
let bg = r * 0.2126729 + g * 0.7151522 + b * 0.072175
|
||||
bg = bg > blkThrs ? bg : bg + (blkThrs - bg) ** blkClmp
|
||||
const contrastLight = bg ** 0.65 - 1
|
||||
const contrastDark = bg ** 0.56 - 0.046134502
|
||||
return Math.abs(contrastLight) >= Math.abs(contrastDark) ? "light" : "dark"
|
||||
}
|
||||
|
||||
function rgbToCss(rgb: [number, number, number]): string {
|
||||
return `rgb(${Math.round(rgb[0])}, ${Math.round(rgb[1])}, ${Math.round(rgb[2])})`
|
||||
}
|
||||
|
||||
export function tagToColor(tag: string): TagColor {
|
||||
const rgb = stringToRGB(tag)
|
||||
const bg = rgbToCss(rgb)
|
||||
const fg = getTextContrastClass(rgb) === "light" ? "#ffffff" : "#000000"
|
||||
return { bg, fg, border: bg }
|
||||
}
|
||||
|
||||
// Split a PVE tags string into an array. PVE separators are ';' and
|
||||
// ',' (both accepted); whitespace around tokens is stripped and
|
||||
// empty tokens dropped.
|
||||
export function parseTags(raw: string | null | undefined): string[] {
|
||||
if (!raw) return []
|
||||
return raw
|
||||
.split(/[;,]/)
|
||||
.map((t) => t.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
// Join back into the canonical PVE format (';' separator).
|
||||
export function stringifyTags(tags: string[]): string {
|
||||
return tags.map((t) => t.trim()).filter(Boolean).join(";")
|
||||
}
|
||||
Reference in New Issue
Block a user