PublicDashboards: Add recipient uid to recipient list (#64076)

uid added for recipients
This commit is contained in:
juanicabanas
2023-03-02 19:15:56 -03:00
committed by GitHub
parent 976db3f53f
commit 528dc28657
3 changed files with 12 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ import {
} from 'app/features/dashboard/api/publicDashboardApi';
import { useSelector } from 'app/types';
import { PublicDashboardShareType, validEmailRegex } from '../SharePublicDashboardUtils';
import { PublicDashboard, PublicDashboardShareType, validEmailRegex } from '../SharePublicDashboardUtils';
interface EmailSharingConfigurationForm {
shareType: PublicDashboardShareType;
@@ -41,23 +41,23 @@ const EmailList = ({
dashboardUid,
publicDashboardUid,
}: {
recipients: string[];
recipients: PublicDashboard['recipients'];
dashboardUid: string;
publicDashboardUid: string;
}) => {
const styles = useStyles2(getStyles);
const [deleteEmail, { isLoading: isDeleteLoading }] = useDeleteEmailSharingMutation();
const onDeleteEmail = (email: string) => {
deleteEmail({ recipient: email, dashboardUid: dashboardUid, uid: publicDashboardUid });
const onDeleteEmail = (recipientUid: string) => {
deleteEmail({ recipientUid, dashboardUid: dashboardUid, uid: publicDashboardUid });
};
return (
<table className={styles.table} data-testid={selectors.EmailSharingList}>
<tbody>
{recipients.map((recipient) => (
<tr key={recipient}>
<td>{recipient}</td>
{recipients!.map((recipient) => (
<tr key={recipient.uid}>
<td>{recipient.recipient}</td>
<td>
<ButtonGroup className={styles.tableButtonsContainer}>
<Button
@@ -68,7 +68,7 @@ const EmailList = ({
title="Revoke"
size="sm"
disabled={isDeleteLoading}
onClick={() => onDeleteEmail(recipient)}
onClick={() => onDeleteEmail(recipient.uid)}
>
Revoke
</Button>

View File

@@ -22,7 +22,7 @@ export interface PublicDashboard extends PublicDashboardSettings {
dashboardUid: string;
timeSettings?: object;
share: PublicDashboardShareType;
recipients?: string[];
recipients?: Array<{ uid: string; recipient: string }>;
}
// Instance methods