Add manual Cove import trigger (Run import now button)
- New route POST /settings/cove/run-now calls run_cove_import() directly and shows result as flash message - Settings > Integrations > Cove: "Run import now" button visible when partner_id is known (connection confirmed) - Status bar shows partner ID, last import timestamp or "No import yet" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3bd8178464
commit
c045240001
@ -1325,6 +1325,45 @@ def settings_cove_test_connection():
|
||||
return jsonify({"ok": False, "message": f"Unexpected error: {exc}"})
|
||||
|
||||
|
||||
@main_bp.route("/settings/cove/run-now", methods=["POST"])
|
||||
@login_required
|
||||
@roles_required("admin")
|
||||
def settings_cove_run_now():
|
||||
"""Manually trigger a Cove import and show the result as a flash message."""
|
||||
from ..cove_importer import CoveImportError, run_cove_import
|
||||
|
||||
settings = _get_or_create_settings()
|
||||
|
||||
if not getattr(settings, "cove_enabled", False):
|
||||
flash("Cove integration is not enabled.", "warning")
|
||||
return redirect(url_for("main.settings", section="integrations"))
|
||||
|
||||
username = (getattr(settings, "cove_api_username", None) or "").strip()
|
||||
password = (getattr(settings, "cove_api_password", None) or "").strip()
|
||||
if not username or not password:
|
||||
flash("Cove API credentials not configured.", "warning")
|
||||
return redirect(url_for("main.settings", section="integrations"))
|
||||
|
||||
try:
|
||||
total, created, skipped, errors = run_cove_import(settings)
|
||||
_log_admin_event(
|
||||
"cove_import_manual",
|
||||
f"Manual Cove import finished. accounts={total}, created={created}, skipped={skipped}, errors={errors}",
|
||||
)
|
||||
flash(
|
||||
f"Cove import finished. Accounts: {total}, new runs: {created}, skipped: {skipped}, errors: {errors}.",
|
||||
"success" if errors == 0 else "warning",
|
||||
)
|
||||
except CoveImportError as exc:
|
||||
_log_admin_event("cove_import_manual_error", f"Manual Cove import failed: {exc}")
|
||||
flash(f"Cove import failed: {exc}", "danger")
|
||||
except Exception as exc:
|
||||
_log_admin_event("cove_import_manual_error", f"Unexpected error during manual Cove import: {exc}")
|
||||
flash(f"Unexpected error: {exc}", "danger")
|
||||
|
||||
return redirect(url_for("main.settings", section="integrations"))
|
||||
|
||||
|
||||
@main_bp.route("/settings/news/create", methods=["POST"])
|
||||
@login_required
|
||||
@roles_required("admin")
|
||||
|
||||
@ -560,12 +560,19 @@
|
||||
</div>
|
||||
|
||||
{% if settings.cove_partner_id %}
|
||||
<div class="mt-2 text-muted small">
|
||||
<div class="mt-2 d-flex justify-content-between align-items-center flex-wrap gap-2">
|
||||
<div class="text-muted small">
|
||||
Connected – Partner ID: <strong>{{ settings.cove_partner_id }}</strong>
|
||||
{% if settings.cove_last_import_at %}
|
||||
· Last import: {{ settings.cove_last_import_at|local_datetime }}
|
||||
{% else %}
|
||||
· No import yet
|
||||
{% endif %}
|
||||
</div>
|
||||
<form method="post" action="{{ url_for('main.settings_cove_run_now') }}" class="mb-0">
|
||||
<button type="submit" class="btn btn-sm btn-outline-primary">Run import now</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -15,6 +15,7 @@ This file documents all changes made to this project via Claude Code.
|
||||
- Settings > Integrations tab: new Cove section with enable toggle, API URL/username/password, import interval, and Test Connection button (AJAX → JSON response with partner ID)
|
||||
- Job Detail page: Cove Integration card showing Account ID input (only when `cove_enabled`)
|
||||
- Route `POST /settings/cove/test-connection` – verifies Cove credentials and stores partner ID
|
||||
- Route `POST /settings/cove/run-now` – manually trigger a Cove import from the Settings page
|
||||
- Route `POST /jobs/<id>/set-cove-account` – saves or clears Cove Account ID on a job
|
||||
- `cove_api_test.py` – standalone Python test script to verify Cove Data Protection API column codes
|
||||
- Tests D9Fxx (Total), D10Fxx (VssMsSql), D11Fxx (VssSharePoint), and D1Fxx (Files&Folders)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user