mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Email sharing users page (#67124)
This commit is contained in:
@@ -120,7 +120,7 @@ const ConfigPublicDashboard = () => {
|
||||
{hasEmailSharingEnabled && <EmailSharingConfiguration />}
|
||||
<Field label="Dashboard URL" className={styles.publicUrl}>
|
||||
<Input
|
||||
value={generatePublicDashboardUrl(publicDashboard!)}
|
||||
value={generatePublicDashboardUrl(publicDashboard!.accessToken!)}
|
||||
readOnly
|
||||
disabled={!publicDashboard?.isEnabled}
|
||||
data-testid={selectors.CopyUrlInput}
|
||||
@@ -129,7 +129,7 @@ const ConfigPublicDashboard = () => {
|
||||
data-testid={selectors.CopyUrlButton}
|
||||
variant="primary"
|
||||
disabled={!publicDashboard?.isEnabled}
|
||||
getText={() => generatePublicDashboardUrl(publicDashboard!)}
|
||||
getText={() => generatePublicDashboardUrl(publicDashboard!.accessToken!)}
|
||||
>
|
||||
Copy
|
||||
</ClipboardButton>
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('generatePublicDashboardUrl', () => {
|
||||
updateConfig({ appUrl });
|
||||
let pubdash = { accessToken } as PublicDashboard;
|
||||
|
||||
expect(generatePublicDashboardUrl(pubdash)).toEqual(`${appUrl}public-dashboards/${accessToken}`);
|
||||
expect(generatePublicDashboardUrl(pubdash.accessToken!)).toEqual(`${appUrl}public-dashboards/${accessToken}`);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -25,6 +25,18 @@ export interface PublicDashboard extends PublicDashboardSettings {
|
||||
recipients?: Array<{ uid: string; recipient: string }>;
|
||||
}
|
||||
|
||||
export interface SessionDashboard {
|
||||
dashboardTitle: string;
|
||||
dashboardUid: string;
|
||||
publicDashboardAccessToken: string;
|
||||
}
|
||||
|
||||
export interface SessionUser {
|
||||
email: string;
|
||||
firstSeenAtAge: string;
|
||||
totalDashboards: number;
|
||||
}
|
||||
|
||||
// Instance methods
|
||||
export const dashboardHasTemplateVariables = (variables: VariableModel[]): boolean => {
|
||||
return variables.length > 0;
|
||||
@@ -58,10 +70,10 @@ export const getUnsupportedDashboardDatasources = (panels: PanelModel[]): string
|
||||
*
|
||||
* All app urls from the Grafana boot config end with a slash.
|
||||
*
|
||||
* @param publicDashboard
|
||||
* @param accessToken
|
||||
*/
|
||||
export const generatePublicDashboardUrl = (publicDashboard: PublicDashboard): string => {
|
||||
return `${getConfig().appUrl}public-dashboards/${publicDashboard.accessToken}`;
|
||||
export const generatePublicDashboardUrl = (accessToken: string): string => {
|
||||
return `${getConfig().appUrl}public-dashboards/${accessToken}`;
|
||||
};
|
||||
|
||||
export const validEmailRegex = /^[A-Z\d._%+-]+@[A-Z\d.-]+\.[A-Z]{2,}$/i;
|
||||
|
||||
Reference in New Issue
Block a user