Make the Uptime Kuma maintenance import say what it found
The import route returned its errors as {error} while the page reads
{message}, so a wrong API key or an unreachable Uptime Kuma showed as raw
JSON. Every failure now carries a readable message. An empty result now
says how many monitors were read and that only maintenance active right
now can be imported, and a disabled integration is explained instead of
leaving a greyed-out button. Adds route tests against a stand-in Uptime Kuma.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3daec601fd
commit
5e416b0273
4 files changed
+134
-7
No files matched your search
@@ -256,7 +256,13 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
{kumaResult && (
|
||||
<div className="card-body pt-0">
|
||||
{kumaResult.monitorsInMaintenance === 0 ? (
|
||||
<div className="text-secondary">Nothing is currently in maintenance in Uptime Kuma.</div>
|
||||
<div className="alert alert-info mb-0">
|
||||
{kumaResult.monitorsChecked === 0
|
||||
? "Uptime Kuma answered, but reported no monitors at all."
|
||||
: `Read ${kumaResult.monitorsChecked} monitor${kumaResult.monitorsChecked === 1 ? "" : "s"} from Uptime Kuma; none is in maintenance right now.`}{" "}
|
||||
Only a maintenance window that is active at this moment can be imported — one scheduled for later
|
||||
shows up here once it starts.
|
||||
</div>
|
||||
) : (
|
||||
<div className="alert alert-success mb-0">
|
||||
{kumaResult.imported.length > 0 ? (
|
||||
@@ -282,10 +288,13 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="card-footer">
|
||||
<div className="card-footer d-flex align-items-center gap-3">
|
||||
<button type="submit" className="btn btn-primary" disabled={kumaBusy || kumaIntegrationId === ""}>
|
||||
{kumaBusy ? "Importing…" : "Import"}
|
||||
</button>
|
||||
{kumaIntegrationId === "" && (
|
||||
<span className="text-secondary">Every Uptime Kuma integration is disabled — enable one under Integrations.</span>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user