diff --git a/app/templates/replicas.html b/app/templates/replicas.html index da1b325..70bc9da 100644 --- a/app/templates/replicas.html +++ b/app/templates/replicas.html @@ -2,7 +2,12 @@ {% block title %}Replicas — pngx-controller{% endblock %} {% block content %} -

Replicas

+
+
+

Replicas

+ Paperless-ngx instances that receive documents from the master. +
+
{% if replicas %}
@@ -11,7 +16,7 @@ Name URL - Enabled + Status Interval Last Sync Actions @@ -21,16 +26,22 @@ {% for r in replicas %} {{ r.name }} - {{ r.url }} - {% if r.enabled %}✅{% else %}⛔{% endif %} + {{ r.url }} + + {% if r.suspended_at %} + suspended +
{{ r.consecutive_failures }} failures + {% elif not r.enabled %} + disabled + {% else %} + enabled + {% endif %} + {% if r.sync_interval_seconds %}{{ r.sync_interval_seconds }}s{% else %}global{% endif %} - {% if r.last_sync_ts %}{{ r.last_sync_ts.strftime('%Y-%m-%d %H:%M') }}{% else %}never{% endif %} - {% if r.suspended_at %} -
suspended · {{ r.consecutive_failures }} failures - {% endif %} + {% if r.last_sync_ts %}{{ r.last_sync_ts.strftime('%Y-%m-%d %H:%M') }} UTC{% else %}never{% endif %} Detail @@ -65,61 +76,137 @@
{% else %} -

No replicas yet.

+

No replicas configured yet.

{% endif %} -
+
-

Add Replica

+

Add Replica

+

The controller will test the connection before saving.

{% if env_replicas %} -
- From pngx.env — {{ env_replicas|length }} not yet added +
+ Detected in pngx.env — not yet added
{% for er in env_replicas %} {% set er_name = er.safe | lower | replace('_', '-') %} - {% endfor %}
-
+ {% endif %} -
-
-
- - - - - -
-
- -
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+ + + +
-

Edit Replica

+
+

Edit Replica

+
- - - - - -
-
- - + + + + + +
+
+ +
@@ -144,14 +231,18 @@ async function submitAddReplica(e) { sync_interval_seconds: data.sync_interval_seconds ? parseInt(data.sync_interval_seconds) : null }; const resultEl = document.getElementById('add-test-result'); - resultEl.textContent = 'Saving…'; + const btn = form.querySelector('button[type=submit]'); + btn.setAttribute('aria-busy', 'true'); + btn.textContent = 'Testing connection…'; const r = await fetch('/api/replicas', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify(body)}); const json = await r.json(); + btn.removeAttribute('aria-busy'); + btn.textContent = 'Add Replica'; if (r.ok) { - resultEl.innerHTML = '✓ Saved — doc count: ' + (json.doc_count || 0) + ''; - setTimeout(() => window.location.reload(), 800); + resultEl.innerHTML = '✓ Connected — ' + (json.doc_count || 0) + ' documents found. Saving…'; + setTimeout(() => window.location.reload(), 900); } else { - resultEl.innerHTML = '✗ ' + (json.detail || 'Error') + ''; + resultEl.innerHTML = '✗ ' + (json.detail || 'Connection failed') + ''; } } @@ -178,14 +269,18 @@ async function submitEditReplica(e) { }; if (data.api_token) body.api_token = data.api_token; const resultEl = document.getElementById('edit-test-result'); - resultEl.textContent = 'Saving…'; + const btn = form.querySelector('button[type=submit]'); + btn.setAttribute('aria-busy', 'true'); + btn.textContent = 'Saving…'; const r = await fetch('/api/replicas/' + id, {method:'PUT', headers:{'Content-Type':'application/json'}, body:JSON.stringify(body)}); const json = await r.json(); + btn.removeAttribute('aria-busy'); + btn.textContent = 'Save Changes'; if (r.ok) { - resultEl.innerHTML = '✓ Saved'; - setTimeout(() => window.location.reload(), 600); + resultEl.innerHTML = '✓ Saved'; + setTimeout(() => window.location.reload(), 700); } else { - resultEl.innerHTML = '✗ ' + (json.detail || 'Error') + ''; + resultEl.innerHTML = '✗ ' + (json.detail || 'Error') + ''; } }