Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: fix some ui bugs for access request #342

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
LabelTypeCommunityInclusion,
LabelTypeCommunityInvitation,
LabelTypeCommunitySubmission,
LabelTypeGuestAccess,
LabelTypeUserAccess,
} from "@js/invenio_requests/contrib";
import {
RequestAcceptButton,
Expand All @@ -24,6 +26,8 @@ export const defaultContribComponents = {
[`RequestTypeLabel.layout.community-submission`]: LabelTypeCommunitySubmission,
[`RequestTypeLabel.layout.community-inclusion`]: LabelTypeCommunityInclusion,
[`RequestTypeLabel.layout.community-invitation`]: LabelTypeCommunityInvitation,
[`RequestTypeLabel.layout.guest-access-request`]: LabelTypeGuestAccess,
[`RequestTypeLabel.layout.user-access-request`]: LabelTypeUserAccess,
[`RequestStatusLabel.layout.submitted`]: LabelStatusSubmit,
[`RequestStatusLabel.layout.deleted`]: LabelStatusDelete,
[`RequestStatusLabel.layout.accepted`]: LabelStatusAccept,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ export const LabelTypeCommunityInvitation = (props) => (
{i18next.t("Member invitation")}
</Label>
);

export const LabelTypeGuestAccess = (props) => (
<Label horizontal className="primary" size="small">
{i18next.t("Guest access")}
</Label>
);

export const LabelTypeUserAccess = (props) => (
<Label horizontal className="primary" size="small">
{i18next.t("User access")}
</Label>
);
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import {
LabelTypeCommunityInclusion,
LabelTypeCommunityInvitation,
LabelTypeCommunitySubmission,
LabelTypeGuestAccess,
LabelTypeUserAccess,
} from "./contrib";

const requestDetailsDiv = document.getElementById("request-detail");
Expand All @@ -61,6 +63,8 @@ const overriddenComponents = {
"RequestTypeLabel.layout.community-submission": LabelTypeCommunitySubmission,
"RequestTypeLabel.layout.community-inclusion": LabelTypeCommunityInclusion,
"RequestTypeLabel.layout.community-invitation": LabelTypeCommunityInvitation,
"RequestTypeLabel.layout.guest-access-request": LabelTypeGuestAccess,
"RequestTypeLabel.layout.user-access-request": LabelTypeUserAccess,
"RequestActionModalTrigger.accept": RequestAcceptModalTrigger,
"RequestActionModalTrigger.decline": RequestDeclineModalTrigger,
"RequestActionModalTrigger.cancel": RequestCancelModalTrigger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const ComputerTabletRequestItem = ({
let creatorName = "";
const isCreatorUser = "user" in result.created_by;
const isCreatorCommunity = "community" in result.created_by;
const isCreatorGuest = "email" in result.created_by;
if (isCreatorUser) {
creatorName =
result.expanded?.created_by.profile?.full_name ||
Expand All @@ -33,6 +34,8 @@ export const ComputerTabletRequestItem = ({
} else if (isCreatorCommunity) {
creatorName =
result.expanded?.created_by.metadata?.title || result.created_by.community;
} else if (isCreatorGuest) {
creatorName = result.created_by.email;
}

const getUserIcon = (receiver) => {
Expand Down
2 changes: 2 additions & 0 deletions invenio_requests/services/requests/facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"community-submission": _("Draft review"),
"community-inclusion": _("Community inclusion"),
"community-invitation": _("Member invitation"),
"guest-access-request": _("Guest access"),
"user-access-request": _("User access"),
},
)

Expand Down
Loading