mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Add recipient uid to recipient list (#64076)
uid added for recipients
This commit is contained in:
parent
976db3f53f
commit
528dc28657
@ -113,9 +113,9 @@ export const publicDashboardApi = createApi({
|
||||
},
|
||||
invalidatesTags: (result, error, { dashboardUid }) => [{ type: 'PublicDashboard', id: dashboardUid }],
|
||||
}),
|
||||
deleteEmailSharing: builder.mutation<void, { recipient: string; dashboardUid: string; uid: string }>({
|
||||
query: ({ uid, recipient }) => ({
|
||||
url: `/public-dashboards/${uid}/share/recipients/${recipient}`,
|
||||
deleteEmailSharing: builder.mutation<void, { recipientUid: string; dashboardUid: string; uid: string }>({
|
||||
query: ({ uid, recipientUid }) => ({
|
||||
url: `/public-dashboards/${uid}/share/recipients/${recipientUid}`,
|
||||
method: 'DELETE',
|
||||
}),
|
||||
async onQueryStarted(_, { dispatch, queryFulfilled }) {
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user