Racks, notes and to-do, OS support, suggested dependencies, Nginx Proxy Manager and Home Assistant
- Racks page and a network diagram (UniFi tree with servers, printable) - Notes on servers and devices; To do list shown in Coming up and My work - Agents report the operating system (Linux 7, Windows 6); end-of-life badge and alert - Suggested dependencies from where a service is reached - Nginx Proxy Manager integration: proxy hosts page, certificate and host alerts, suggested checks - Home Assistant integration: watch chosen entities, history chart, limit and unavailable alerts - TimeChart gets a "value" scale that fits negatives; docs updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68b41b5586
commit
18ceed62e8
77 files changed
+20432
-35
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, type CurrentUser, type DependenciesResponse, type DependencyNode } from "../api/client";
|
||||
import { api, type CurrentUser, type DependenciesResponse, type DependencyNode, type DependencySuggestions } from "../api/client";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { BlockSkeleton } from "../components/Skeleton";
|
||||
import { removeWithUndo } from "../utils/undoable";
|
||||
@@ -49,12 +49,48 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
|
||||
const [from, setFrom] = useState("");
|
||||
const [to, setTo] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [offered, setOffered] = useState<DependencySuggestions | null>(null);
|
||||
const [showHidden, setShowHidden] = useState(false);
|
||||
|
||||
function load() {
|
||||
api.dependencies
|
||||
.list()
|
||||
.then(setData)
|
||||
.catch((err) => setError(readableError(err)));
|
||||
api.dependencies
|
||||
.suggestions()
|
||||
.then(setOffered)
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
async function addOffered(keys: string[]) {
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await api.dependencies.addSuggestions(keys);
|
||||
toast.success(res.added.length === 1 ? `${res.added[0].from} now needs ${res.added[0].to}.` : `Added ${res.added.length} dependencies.`);
|
||||
load();
|
||||
} catch (err) {
|
||||
setError(readableError(err));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function hideOffered(keys: string[]) {
|
||||
try {
|
||||
setOffered(await api.dependencies.dismissSuggestions(keys));
|
||||
} catch (err) {
|
||||
setError(readableError(err));
|
||||
}
|
||||
}
|
||||
|
||||
async function restoreOffered() {
|
||||
try {
|
||||
setOffered(await api.dependencies.restoreSuggestions());
|
||||
setShowHidden(false);
|
||||
} catch (err) {
|
||||
setError(readableError(err));
|
||||
}
|
||||
}
|
||||
useEffect(load, []);
|
||||
|
||||
@@ -101,6 +137,69 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
|
||||
</p>
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{offered && (offered.suggestions.length > 0 || offered.dismissed.length > 0) && (
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Suggested</h3>
|
||||
{canEdit && offered.suggestions.length > 1 && (
|
||||
<div className="card-actions">
|
||||
<button type="button" className="btn btn-sm btn-primary" disabled={busy} onClick={() => void addOffered(offered.suggestions.map((s) => s.key))}>
|
||||
Add all {offered.suggestions.length}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="card-body text-secondary small pb-0">Worked out from where each service is reached: when that is a server’s own address, the service most likely runs there. Nothing is written until you add it.</div>
|
||||
{offered.suggestions.length > 0 ? (
|
||||
<ul className="list-group list-group-flush">
|
||||
{offered.suggestions.map((s) => (
|
||||
<li key={s.key} className="list-group-item d-flex flex-wrap align-items-center gap-2">
|
||||
<div className="me-auto">
|
||||
<strong>{s.from.name}</strong> <span className="text-secondary">needs</span> <strong>{s.to.name}</strong>
|
||||
<div className="text-secondary small">{s.reason}</div>
|
||||
</div>
|
||||
{canEdit && (
|
||||
<>
|
||||
<button type="button" className="btn btn-sm btn-primary" disabled={busy} onClick={() => void addOffered([s.key])}>
|
||||
Add
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => void hideOffered([s.key])}>
|
||||
Not that
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<div className="card-body text-secondary">Nothing more to suggest.</div>
|
||||
)}
|
||||
{offered.dismissed.length > 0 && (
|
||||
<div className="card-footer small">
|
||||
<button type="button" className="btn btn-link btn-sm p-0" onClick={() => setShowHidden((v) => !v)}>
|
||||
{showHidden ? "Hide" : "Show"} the {offered.dismissed.length} you said no to
|
||||
</button>
|
||||
{showHidden && (
|
||||
<>
|
||||
<ul className="mb-2 mt-2">
|
||||
{offered.dismissed.map((s) => (
|
||||
<li key={s.key}>
|
||||
{s.from.name} needs {s.to.name}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{canEdit && (
|
||||
<button type="button" className="btn btn-sm" onClick={() => void restoreOffered()}>
|
||||
Offer them again
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{canEdit && (
|
||||
<form className="card mb-3" onSubmit={add}>
|
||||
<div className="card-header">
|
||||
|
||||
Reference in new issue
Block a user