Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions site/cds_rdm/administration/harvester_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,22 @@
from invenio_search_ui.searchconfig import search_app_config

from cds_rdm.administration.permissions import curators_permission
from cds_rdm.generators import _harvester_user_id
from cds_rdm.inspire_harvester.reports.runs.logs import (
HarvesterRunError,
report_context,
)


def harvester_report_hidden_params():
"""Hidden search params for harvester reports (action + harvester user)."""
params = [["action", "record.publish"]]
harvester_user_id = _harvester_user_id()
if harvester_user_id is not None:
params.append(["user_id", harvester_user_id])
return params


def create_harvester_report_blueprint(app):
"""Create the harvester run report UI blueprint."""
blueprint = Blueprint("cds_rdm_harvester_report_page", __name__)
Expand Down Expand Up @@ -156,7 +166,5 @@ def init_search_config(self, **kwargs):
headers=self.get_search_request_headers(**kwargs),
pagination_options=(20, 50),
default_size=20,
hidden_params=[
["action", "record.publish"],
],
hidden_params=harvester_report_hidden_params(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
import { DownloadButton } from "./DownloadButton";
import PropTypes from "prop-types";

const hiddenParams = [["action", "record.publish"]];

/**
* Custom SearchBar component with run selector
*/
Expand Down Expand Up @@ -52,10 +50,10 @@ const SearchBarComponent = ({ updateQueryState, currentQueryState }) => {
}

setInputValue(queryString);
// Do not override hiddenParams — server sets action + harvester user_id.
updateQueryState({
...currentQueryState,
queryString,
hiddenParams,
});
},
[currentQueryState, updateQueryState]
Expand Down Expand Up @@ -85,7 +83,6 @@ const SearchBarComponent = ({ updateQueryState, currentQueryState }) => {
updateQueryState({
...currentQueryState,
queryString: inputValue,
hiddenParams,
});
const id = extractRunIdFromQuery(inputValue, runs);
if (id) {
Expand Down
Loading