Toasts, logo icons, shared table toolbar with search, and a density toggle
Feedback: toasts confirm common actions, and a page's error or success message that appears out of view is also shown as a toast. Icons: the tab, app and home-screen icons are the house from the logo; a dev instance gets a coloured dot on its tab icon. Tables: Secrets, Admin Links, IP Addresses and Alerts share one toolbar (search, filters, row count, actions, Export CSV); twelve more tables get a multi-word search box; long tables keep their column headings in view on wide screens. Density: Compact / Normal / Roomy in the user menu, remembered per browser. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d56ad18b7
commit
617dc1ea2f
56 files changed
+757
-158
No files matched your search
@@ -12,6 +12,10 @@ import { TagBadges } from "../components/ServerTags";
|
||||
import { AGENT_RUN_HINT, agentOsOf, installCommand, uninstallCommand, type AgentOs } from "../utils/agentCommands";
|
||||
import { tagBadge, useTagColors } from "../utils/tags";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties {
|
||||
const color = colors[type];
|
||||
@@ -66,6 +70,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
osType: serverOs,
|
||||
});
|
||||
setNewToken(result);
|
||||
toast.success(`Added ${serverName}. Its install command is shown below.`);
|
||||
setServerName("");
|
||||
setServerHostname("");
|
||||
setServerDescription("");
|
||||
@@ -89,13 +94,15 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
if (!(await confirmDialog({ title: "Remove server", message: "Remove this server and all its tracked tasks?", confirmLabel: "Remove", danger: true }))) return;
|
||||
try {
|
||||
await api.servers.remove(id);
|
||||
toast.success("Server removed.");
|
||||
await loadServers();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted: sortedServers, sortKey, sortDir, requestSort } = useSortable(servers);
|
||||
const tableSearch = useTableSearch(servers);
|
||||
const { sorted: sortedServers, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems: serverPageItems, page: serverPage, setPage: setServerPage, pageCount: serverPageCount, totalCount: serverTotalCount } =
|
||||
usePagination(sortedServers);
|
||||
|
||||
@@ -136,7 +143,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{managingServers ? (
|
||||
<>
|
||||
@@ -257,8 +264,9 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header justify-content-end">
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={exportCsv} disabled={servers.length === 0}>
|
||||
<div className="card-header">
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} />
|
||||
<button className="btn btn-outline-secondary btn-sm ms-auto" onClick={exportCsv} disabled={servers.length === 0}>
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user