mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Authentication UI: Add metric for the first usage (#69779)
This commit is contained in:
parent
38863844e7
commit
c731d9fe2c
@ -4,6 +4,7 @@ import React, { useEffect } from 'react';
|
|||||||
import { connect, ConnectedProps } from 'react-redux';
|
import { connect, ConnectedProps } from 'react-redux';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { StoreState } from 'app/types';
|
import { StoreState } from 'app/types';
|
||||||
@ -63,7 +64,13 @@ export const AuthConfigPageUnconnected = ({ providerStatuses, isLoading, loadSet
|
|||||||
documentation.
|
documentation.
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
||||||
const subTitle = <span>Manage your auth settings and configure single sign-on. Find out more in our {docsLink}</span>;
|
const subTitle = <span>Manage your auth settings and configure single sign-on. Find out more in our {docsLink}</span>;
|
||||||
|
|
||||||
|
const onCTAClick = () => {
|
||||||
|
reportInteraction('authentication_ui_created', { provider: firstAvailableProvider?.type });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page navId="authentication" subTitle={subTitle}>
|
<Page navId="authentication" subTitle={subTitle}>
|
||||||
<Page.Contents isLoading={isLoading}>
|
<Page.Contents isLoading={isLoading}>
|
||||||
@ -92,6 +99,7 @@ export const AuthConfigPageUnconnected = ({ providerStatuses, isLoading, loadSet
|
|||||||
description={`Important: if you have ${firstAvailableProvider.type} configuration enabled via the .ini file Grafana is using it.
|
description={`Important: if you have ${firstAvailableProvider.type} configuration enabled via the .ini file Grafana is using it.
|
||||||
Configuring ${firstAvailableProvider.type} via UI will take precedence over any configuration in the .ini file.
|
Configuring ${firstAvailableProvider.type} via UI will take precedence over any configuration in the .ini file.
|
||||||
No changes will be written into .ini file.`}
|
No changes will be written into .ini file.`}
|
||||||
|
onClick={onCTAClick}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!!configuresProviders?.length && (
|
{!!configuresProviders?.length && (
|
||||||
|
@ -12,6 +12,7 @@ export interface Props {
|
|||||||
buttonTitle: string;
|
buttonTitle: string;
|
||||||
buttonDisabled?: boolean;
|
buttonDisabled?: boolean;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConfigureAuthCTA: React.FunctionComponent<Props> = ({
|
const ConfigureAuthCTA: React.FunctionComponent<Props> = ({
|
||||||
@ -21,6 +22,7 @@ const ConfigureAuthCTA: React.FunctionComponent<Props> = ({
|
|||||||
buttonTitle,
|
buttonTitle,
|
||||||
buttonDisabled,
|
buttonDisabled,
|
||||||
description,
|
description,
|
||||||
|
onClick,
|
||||||
}) => {
|
}) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const footer = description ? <span key="proTipFooter">{description}</span> : '';
|
const footer = description ? <span key="proTipFooter">{description}</span> : '';
|
||||||
@ -34,6 +36,7 @@ const ConfigureAuthCTA: React.FunctionComponent<Props> = ({
|
|||||||
className={ctaElementClassName}
|
className={ctaElementClassName}
|
||||||
data-testid={selectors.components.CallToActionCard.buttonV2(buttonTitle)}
|
data-testid={selectors.components.CallToActionCard.buttonV2(buttonTitle)}
|
||||||
disabled={buttonDisabled}
|
disabled={buttonDisabled}
|
||||||
|
onClick={() => onClick && onClick()}
|
||||||
>
|
>
|
||||||
{buttonTitle}
|
{buttonTitle}
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
|
Loading…
Reference in New Issue
Block a user