the path gets the row, the actions get their own
Root location is two states now. reading, it is a path and one Edit. editing, it is a field and the things you can do to it. the actions moved to the block's BOTTOM row, off the value's line. an absolute path is long, and it was being truncated to make room for buttons that are not needed most of the time — the thing somebody opened this to read was the thing squeezed. shown, it wraps with `break-all` rather than truncating, because a path is read from both ends: the machine at the front, the folder at the back, and hiding either is worse than two lines. Edit is a mode and not an always-live field. this is looked at far more often than it is changed, and a live input invites a stray keystroke into a path everything else will depend on. Cancel restores what is stored, so leaving the mode cannot leave half a path on screen looking like the setting. "back to the default" is gone, as asked — and `clearRootPath` and its DELETE route with it, since that button was the only caller. an unreferenced endpoint is the same rot as an unreferenced component, and this one was a second, quieter Save that wrote a value nobody chose. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+1
-6
@@ -2,7 +2,7 @@ import type { Context } from 'hono';
|
||||
import { createRouter, type HonoVariables } from '@@/create-router';
|
||||
import { registerProxiedPrefix } from '@@/sidecar/proxied-prefixes';
|
||||
import { deleteConnection, readConnection, readCredentials, recordProbe, saveConnection } from './connection';
|
||||
import { readSettings, saveRootPath, clearRootPath } from './settings';
|
||||
import { readSettings, saveRootPath } from './settings';
|
||||
import { fofosRequest, FofosError, probe, type FofosResponse } from './fofos-client';
|
||||
|
||||
/**
|
||||
@@ -180,11 +180,6 @@ router.put('/_config/root', async (ctx) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.delete('/_config/root', async (ctx) => {
|
||||
const user = ctx.get('user');
|
||||
return ctx.json(await clearRootPath(user.email));
|
||||
});
|
||||
|
||||
/**
|
||||
* Is this plugin usable? Asked once by the detail panel rather than by all nine sections.
|
||||
*
|
||||
|
||||
+3
-13
@@ -14,7 +14,9 @@ import { fofosAdminSettings } from '../db/schema';
|
||||
* restore onto a machine with a different owner then points at a directory that does not exist while
|
||||
* looking deliberately chosen. Computed, it follows the machine; written, it follows the install.
|
||||
*
|
||||
* A saved path is a DECISION and is stored exactly as given. Only the absence of one is derived.
|
||||
* A saved path is a DECISION and is stored exactly as given. Only the absence of one is derived — and
|
||||
* once saved it stays saved: there is no route back to the default, because "reset this to something
|
||||
* you never chose" is not a thing anybody asked for and it read as a second, quieter Save.
|
||||
*
|
||||
* ── Absolute, always ──
|
||||
*
|
||||
@@ -81,15 +83,3 @@ export async function saveRootPath(input: string, email: string): Promise<Settin
|
||||
|
||||
return readSettings(email);
|
||||
}
|
||||
|
||||
/** Back to the computed default. The row stays, so this is a reset rather than a delete. */
|
||||
export async function clearRootPath(email: string): Promise<SettingsView> {
|
||||
const existing = await row();
|
||||
if (existing) {
|
||||
await db
|
||||
.update(fofosAdminSettings)
|
||||
.set({ rootPath: null, updatedAt: new Date() })
|
||||
.where(eq(fofosAdminSettings.id, existing.id));
|
||||
}
|
||||
return readSettings(email);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user