fix: CSS reset, settings API, modules champs, proxmox token
- CSS: ajout reset (box-sizing, margin, font-family, body background)
- Settings: save par PUT /api/settings/{key} (pas bulk), un appel par clé
- Settings: proxmox_token champ unique (format user@realm!id=secret)
- Modules: is_enabled/is_core (champs backend réels, pas enabled/core)
- Proxmox: supprime bouton reboot (route inexistante)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
65c8bf332f
commit
a4b5b06f04
5 changed files with 58 additions and 30 deletions
|
|
@ -544,10 +544,9 @@ document.addEventListener('alpine:init', () => {
|
|||
default_lang: 'fr',
|
||||
ssh_host: '',
|
||||
ssh_username: '',
|
||||
ssh_password: '',
|
||||
ssh_password: '', // chiffré, laisser vide = pas de changement
|
||||
proxmox_url: '',
|
||||
proxmox_token_id: '',
|
||||
proxmox_token_secret: '',
|
||||
proxmox_token: '', // chiffré, format: user@realm!tokenid=secret
|
||||
},
|
||||
|
||||
async init() {
|
||||
|
|
@ -572,13 +571,20 @@ document.addEventListener('alpine:init', () => {
|
|||
this.saved = false
|
||||
this.error = ''
|
||||
try {
|
||||
const res = await apiFetch('/api/settings', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(this.settings),
|
||||
})
|
||||
if (!res.ok) {
|
||||
const d = await res.json().catch(() => ({}))
|
||||
throw new Error(d.error || 'Erreur sauvegarde')
|
||||
// Backend: PUT /api/settings/{key} avec { value: "..." } — un appel par clé
|
||||
const keys = Object.keys(this.settings)
|
||||
for (const key of keys) {
|
||||
const val = this.settings[key]
|
||||
// Ignorer les champs vides pour les secrets (ne pas écraser l'existant)
|
||||
if (val === '' && (key === 'ssh_password' || key === 'proxmox_token')) continue
|
||||
const res = await apiFetch(`/api/settings/${key}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ value: val }),
|
||||
})
|
||||
if (!res.ok) {
|
||||
const d = await res.json().catch(() => ({}))
|
||||
throw new Error(d.error || `Erreur sauvegarde de ${key}`)
|
||||
}
|
||||
}
|
||||
this.saved = true
|
||||
setTimeout(() => { this.saved = false }, 3000)
|
||||
|
|
@ -617,10 +623,11 @@ document.addEventListener('alpine:init', () => {
|
|||
async toggle(mod) {
|
||||
this.toggling[mod.id] = true
|
||||
try {
|
||||
const action = mod.enabled ? 'disable' : 'enable'
|
||||
// Backend: is_enabled (pas enabled)
|
||||
const action = mod.is_enabled ? 'disable' : 'enable'
|
||||
const res = await apiFetch(`/api/modules/${mod.id}/${action}`, { method: 'POST' })
|
||||
if (res.ok) {
|
||||
mod.enabled = !mod.enabled
|
||||
mod.is_enabled = !mod.is_enabled
|
||||
}
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue