{{ truncation_message }}
+diff --git a/assets/less/cds-rdm/administration/harvester-reports.less b/assets/less/cds-rdm/administration/harvester-reports.less index 12a16ecb..b6d3ee1f 100644 --- a/assets/less/cds-rdm/administration/harvester-reports.less +++ b/assets/less/cds-rdm/administration/harvester-reports.less @@ -53,4 +53,58 @@ color: #999; margin-top: 0.2em; } -} \ No newline at end of file +} + +.harvester-report-actions { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-items: center; + justify-content: flex-end; + gap: 0.5em; + width: 100%; + box-sizing: border-box; + padding-right: 0.25rem; + + > .ui.button { + flex: 0 0 auto; + margin: 0 !important; + } +} + +.ui.grid .column.harvester-report-actions-col { + padding-right: 1.25rem; +} + +.harvester-run-report-meta { + margin-top: 0.15rem !important; +} + +.harvester-run-log-grid { + margin-top: 1rem; +} + +.harvester-run-success-message { + white-space: normal; + text-align: left; +} + +// Job run report: wrap long lines; scroll region height (matches admin log-table intent) +.harvester-run-log-report { + width: 100%; + + .harvester-run-log-table.log-table { + max-height: calc(100vh - 11rem); + overflow-x: hidden; + } + + .harvester-run-log-segment { + overflow-x: hidden; + } + + .log-line .log-message { + white-space: pre-wrap; + overflow-wrap: anywhere; + word-break: break-word; + } +} diff --git a/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js b/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js index 8ca4c67a..0b981fbd 100644 --- a/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js +++ b/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/DownloadButton.js @@ -5,39 +5,39 @@ // under the terms of the GPL-2.0 License; see LICENSE file for more details. import React from "react"; -import { withState } from "react-searchkit"; import { Button, Icon } from "semantic-ui-react"; import { i18next } from "@translations/invenio_administration/i18next"; -import { extractRunIdFromQuery } from "./utils"; -const DownloadButtonComponent = ({ currentQueryState }) => { - const domContainer = document.getElementById("invenio-search-config"); - const runs = JSON.parse(domContainer?.dataset.harvesterRuns || "[]"); - - const runId = extractRunIdFromQuery( - currentQueryState.queryString || "", - runs - ); - - const handleDownload = () => { - if (!runId) return; - const params = new URLSearchParams({ run_id: runId }); - window.location.href = `/harvester-reports/download?${params.toString()}`; - }; - - return ( +export const DownloadButton = ({ runId }) => ( +
{{ started_at }}
+ {% if run.started_at and run.finished_at %} ++ {{ ((run.finished_at - run.started_at).total_seconds() // 60) | int }} {{ _("mins") }} +
+ {% endif %} + {% else %} +{{ _("Not yet started") }}
+ {% endif %} + {% if run.message and status not in ("FAILED", "PARTIAL_SUCCESS") %} + + {% endif %} +{{ _("No log lines in this view.") }}
+ {% endif %} +Download all record.publish audit logs from this harvest run @@ -57,7 +57,7 @@
View detailed audit reports for all harvester runs
diff --git a/site/cds_rdm/templates/semantic-ui/invenio_jobs/emails/run_notification.txt b/site/cds_rdm/templates/semantic-ui/invenio_jobs/emails/run_notification.txt
index 07f278f8..fbabaaba 100644
--- a/site/cds_rdm/templates/semantic-ui/invenio_jobs/emails/run_notification.txt
+++ b/site/cds_rdm/templates/semantic-ui/invenio_jobs/emails/run_notification.txt
@@ -25,10 +25,10 @@ Harvester Actions:
{% set end_time = (run.finished_at | string | replace(' ', 'T')) if run.finished_at else '*' %}
{% set timestamp_range = "@timestamp:[" ~ start_time ~ " TO " ~ end_time ~ "]" %}
-Download Harvester Logs:
+Download error log:
{{ config.SITE_UI_URL }}/harvester-reports/download?q={{ timestamp_range | urlencode }}&action=record.publish
-View Harvester Reports:
+View list of changes:
{{ config.SITE_UI_URL }}/administration/harvester-reports?q={{ timestamp_range | urlencode }}&l=list&p=1&s=20&sort=newest
{% endif %}
diff --git a/site/cds_rdm/views.py b/site/cds_rdm/views.py
index fb931943..a2172a71 100644
--- a/site/cds_rdm/views.py
+++ b/site/cds_rdm/views.py
@@ -8,7 +8,7 @@
"""CDS views."""
-from flask import Blueprint, current_app, render_template, url_for
+from flask import Blueprint, current_app, jsonify, render_template, url_for
from flask_principal import AnonymousIdentity
from invenio_access.permissions import any_user
from invenio_app_rdm.records_ui.utils import dump_external_resource
@@ -45,9 +45,28 @@ def create_cds_clc_sync_bp(app):
def create_harvester_download_bp(app):
- """Create harvester download blueprint."""
+ """Harvester log download blueprint and colored HTML report page."""
+ from cds_rdm.administration.permissions import curators_permission
+
ext = app.extensions["cds-rdm"]
- return ext.harvester_download_resource.as_blueprint()
+ bp = ext.harvester_download_resource.as_blueprint()
+
+ report_bp = Blueprint("cds_rdm_harvester_report_page", __name__)
+
+ @report_bp.route("/administration/harvester-reports/