fix: indentation in frontend handlers and restore dhcp auto-sync toast
This commit is contained in:
@@ -209,7 +209,12 @@ export default definePage({
|
|||||||
'on:click': async () => {
|
'on:click': async () => {
|
||||||
const res = await apiFetch('/api/dhcp/apply', { method: 'POST' });
|
const res = await apiFetch('/api/dhcp/apply', { method: 'POST' });
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
toast('dnsmasq applied', 'success');
|
const synced = res.data?.synced;
|
||||||
|
let msg = 'dnsmasq applied';
|
||||||
|
if (synced && synced.length) {
|
||||||
|
msg += ' (auto-synced: ' + synced.join(', ') + ')';
|
||||||
|
}
|
||||||
|
toast(msg, 'success');
|
||||||
modelFetch('dnsmasq');
|
modelFetch('dnsmasq');
|
||||||
} else {
|
} else {
|
||||||
toast(res.error || 'Apply failed', 'error');
|
toast(res.error || 'Apply failed', 'error');
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ function addCredentialModal() {
|
|||||||
closeModal();
|
closeModal();
|
||||||
loadCredentials();
|
loadCredentials();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = typeof e === 'string' ? e : (e.message || 'Registration failed');
|
const msg = typeof e === 'string' ? e : (e.message || 'Registration failed');
|
||||||
if (!msg.toLowerCase().includes('cancelled')) {
|
if (!msg.toLowerCase().includes('cancelled')) {
|
||||||
toast(msg, 'error');
|
toast(msg, 'error');
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -188,8 +188,8 @@ function confirmRemove(credentialId, credentialName) {
|
|||||||
closeModal();
|
closeModal();
|
||||||
loadCredentials();
|
loadCredentials();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = typeof e === 'string' ? e : (e.message || 'Removal failed');
|
const msg = typeof e === 'string' ? e : (e.message || 'Removal failed');
|
||||||
toast(msg, 'error');
|
toast(msg, 'error');
|
||||||
} finally {
|
} finally {
|
||||||
setModalProcessing(false);
|
setModalProcessing(false);
|
||||||
refreshModals();
|
refreshModals();
|
||||||
|
|||||||
@@ -159,16 +159,16 @@ function openEditPermissionsModal(user) {
|
|||||||
for (const sub of SUBSYSTEMS) {
|
for (const sub of SUBSYSTEMS) {
|
||||||
const level = document.getElementById('edit-perm-' + sub.key).value;
|
const level = document.getElementById('edit-perm-' + sub.key).value;
|
||||||
if (level && level !== '—') {
|
if (level && level !== '—') {
|
||||||
perms[sub.key] = level;
|
perms[sub.key] = level;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (user.username === BUILTIN_ADMIN) {
|
if (user.username === BUILTIN_ADMIN) {
|
||||||
toast('Cannot modify permissions for builtin admin', 'error');
|
toast('Cannot modify permissions for builtin admin', 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await apiFetch('/api/auth/users/' + encodeURIComponent(user.username), {
|
const res = await apiFetch('/api/auth/users/' + encodeURIComponent(user.username), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { permissions: perms },
|
body: { permissions: perms },
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user