diff --git a/oarepo_requests/resolvers/ui.py b/oarepo_requests/resolvers/ui.py index e3c8547..d994e96 100644 --- a/oarepo_requests/resolvers/ui.py +++ b/oarepo_requests/resolvers/ui.py @@ -12,6 +12,7 @@ import abc import contextlib import copy +import json from typing import TYPE_CHECKING, Any, TypedDict, cast, override from flask import request @@ -62,7 +63,18 @@ def resolve(identity: Identity, reference: dict[str, str]) -> UIResolvedReferenc return cache[(reference_type, reference_value)] entity_resolvers = current_oarepo_requests.entity_reference_ui_resolvers - if reference_type in entity_resolvers: + + if reference_type == 'multiple': + # TODO(mirekys): add test coverage + resolved = [] + reference_values_list = list(json.loads(reference_value)) + + for reference_values_item in reference_values_list: + for key, value in reference_values_item.items(): + resolved.append(entity_resolvers[key].resolve_one( + identity, value + )) + elif reference_type in entity_resolvers: resolved = entity_resolvers[reference_type].resolve_one( identity, reference_value ) diff --git a/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx b/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx index d075ac2..41865c7 100644 --- a/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx +++ b/oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/common/components/SideRequestInfo.jsx @@ -3,6 +3,7 @@ import { i18next } from "@translations/oarepo_requests_ui/i18next"; import { Icon, List } from "semantic-ui-react"; import _has from "lodash/has"; import _truncate from "lodash/truncate"; +import _isArray from "lodash/isArray"; import { getRequestStatusIcon } from "@js/oarepo_requests_common"; import PropTypes from "prop-types"; @@ -31,15 +32,16 @@ export const SideRequestInfo = ({ request }) => { )} - {request?.receiver && ( + {(request?.receiver && + !_isArray(request.receiver)) ? ( {i18next.t("Receiver")} - {_has(request, "links.receiver.self_html") ? ( + {_has(request, "links.receiver_html") ? ( @@ -50,8 +52,32 @@ export const SideRequestInfo = ({ request }) => { )} + ) : (_isArray(request.receiver)) && ( + + {i18next.t("Receiver")} + + + {request.receiver.map((receiverItem, index) => ( + + {receiverItem.links.self_html ? ( + + {receiverItem.label} + + ) : ( + receiverItem.label + )} + { request.receiver.length - 1 !== index && ', ' } + + + ))} + - )} + ) + } {i18next.t("Status")} diff --git a/setup.cfg b/setup.cfg index f4ea7bc..df16c9b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-requests -version = 2.3.13 +version = 2.3.14 description = authors = Ronald Krist readme = README.md