diff --git a/grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.module.scss b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.module.scss similarity index 100% rename from grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.module.scss rename to grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.module.scss diff --git a/grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.test.tsx b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.test.tsx similarity index 90% rename from grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.test.tsx rename to grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.test.tsx index 00a2d6aa..4967b9bb 100644 --- a/grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.test.tsx +++ b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.test.tsx @@ -8,7 +8,7 @@ import { User } from 'models/user/user.types'; import { RootStore } from 'state'; import { useStore as useStoreOriginal } from 'state/useStore'; -import MobileAppVerification from './MobileAppVerification'; +import MobileAppConnection from './MobileAppConnection'; jest.mock('state/useStore'); @@ -36,7 +36,7 @@ const mockUseStore = (rest?: any, connected = false) => { const USER_PK = '8585'; const BACKEND = 'MOBILE_APP'; -describe('MobileAppVerification', () => { +describe('MobileAppConnection', () => { beforeEach(() => { loadUserMock.mockClear(); }); @@ -46,7 +46,7 @@ describe('MobileAppVerification', () => { sendBackendConfirmationCode: jest.fn().mockResolvedValueOnce('dfd'), }); - const component = render(); + const component = render(); expect(component.container).toMatchSnapshot(); await waitFor(() => { @@ -63,7 +63,7 @@ describe('MobileAppVerification', () => { true ); - const component = render(); + const component = render(); expect(component.container).toMatchSnapshot(); await waitFor(() => { @@ -76,7 +76,7 @@ describe('MobileAppVerification', () => { sendBackendConfirmationCode: jest.fn().mockRejectedValueOnce('dfd'), }); - const component = render(); + const component = render(); await screen.findByText(/.*error fetching your QR code.*/); await waitFor(() => { @@ -92,7 +92,7 @@ describe('MobileAppVerification', () => { sendBackendConfirmationCode: jest.fn().mockResolvedValueOnce('dfd'), }); - const component = render(); + const component = render(); expect(component.container).toMatchSnapshot(); await waitFor(() => { @@ -110,7 +110,7 @@ describe('MobileAppVerification', () => { true ); - const component = render(); + const component = render(); const button = await screen.findByRole('button'); // click the disconnect button, which opens the modal @@ -138,7 +138,7 @@ describe('MobileAppVerification', () => { true ); - const component = render(); + const component = render(); const button = await screen.findByRole('button'); // click the disconnect button, which opens the modal @@ -169,7 +169,7 @@ describe('MobileAppVerification', () => { true ); - const component = render(); + const component = render(); const button = await screen.findByTestId('test__disconnect'); // click the disconnect button, which opens the modal @@ -198,7 +198,7 @@ describe('MobileAppVerification', () => { false ); - render(); + render(); await waitFor( () => { @@ -217,7 +217,7 @@ describe('MobileAppVerification', () => { true ); - render(); + render(); const button = await screen.findByRole('button'); loadUserMock.mockClear(); diff --git a/grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.tsx b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx similarity index 97% rename from grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.tsx rename to grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx index c31604a5..f09d73dc 100644 --- a/grafana-plugin/src/containers/MobileAppVerification/MobileAppVerification.tsx +++ b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx @@ -10,7 +10,7 @@ import Text from 'components/Text/Text'; import { User } from 'models/user/user.types'; import { useStore } from 'state/useStore'; -import styles from './MobileAppVerification.module.scss'; +import styles from './MobileAppConnection.module.scss'; import DisconnectButton from './parts/DisconnectButton/DisconnectButton'; import DownloadIcons from './parts/DownloadIcons'; import QRCode from './parts/QRCode/QRCode'; @@ -28,7 +28,7 @@ const INTERVAL_QUEUE_QR = process.env.MOBILE_APP_QR_INTERVAL_QUEUE const INTERVAL_POLLING = 5000; const BACKEND = 'MOBILE_APP'; -const MobileAppVerification = observer(({ userPk }: Props) => { +const MobileAppConnection = observer(({ userPk }: Props) => { const { userStore } = useStore(); const isMounted = useRef(false); @@ -233,4 +233,4 @@ function QRLoading() { ); } -export default MobileAppVerification; +export default MobileAppConnection; diff --git a/grafana-plugin/src/containers/MobileAppVerification/__snapshots__/MobileAppVerification.test.tsx.snap b/grafana-plugin/src/containers/MobileAppConnection/__snapshots__/MobileAppConnection.test.tsx.snap similarity index 99% rename from grafana-plugin/src/containers/MobileAppVerification/__snapshots__/MobileAppVerification.test.tsx.snap rename to grafana-plugin/src/containers/MobileAppConnection/__snapshots__/MobileAppConnection.test.tsx.snap index ac791478..d45f37d1 100644 --- a/grafana-plugin/src/containers/MobileAppVerification/__snapshots__/MobileAppVerification.test.tsx.snap +++ b/grafana-plugin/src/containers/MobileAppConnection/__snapshots__/MobileAppConnection.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`MobileAppVerification if we disconnect the app, it disconnects and fetches a new QR code 1`] = ` +exports[`MobileAppConnection if we disconnect the app, it disconnects and fetches a new QR code 1`] = `
`; -exports[`MobileAppVerification it shows a QR code if the app isn't already connected 1`] = ` +exports[`MobileAppConnection it shows a QR code if the app isn't already connected 1`] = `
`; -exports[`MobileAppVerification it shows a loading message if it is currently disconnecting 1`] = ` +exports[`MobileAppConnection it shows a loading message if it is currently disconnecting 1`] = `
`; -exports[`MobileAppVerification it shows a loading message if it is currently fetching the QR code 1`] = ` +exports[`MobileAppConnection it shows a loading message if it is currently fetching the QR code 1`] = `
`; -exports[`MobileAppVerification it shows a message when the mobile app is already connected 1`] = ` +exports[`MobileAppConnection it shows a message when the mobile app is already connected 1`] = `
`; -exports[`MobileAppVerification it shows an error message if there was an error disconnecting the mobile app 1`] = ` +exports[`MobileAppConnection it shows an error message if there was an error disconnecting the mobile app 1`] = `
`; -exports[`MobileAppVerification it shows an error message if there was an error fetching the QR code 1`] = ` +exports[`MobileAppConnection it shows an error message if there was an error fetching the QR code 1`] = `
diff --git a/grafana-plugin/src/containers/UserSettings/UserSettings.types.ts b/grafana-plugin/src/containers/UserSettings/UserSettings.types.ts index 028672af..e3c34ae2 100644 --- a/grafana-plugin/src/containers/UserSettings/UserSettings.types.ts +++ b/grafana-plugin/src/containers/UserSettings/UserSettings.types.ts @@ -6,7 +6,7 @@ export enum UserSettingsTab { PhoneVerification, SlackInfo, TelegramInfo, - MobileAppVerification, + MobileAppConnection, } export interface UserFormData extends Partial { diff --git a/grafana-plugin/src/containers/UserSettings/parts/connectors/MobileAppConnector.tsx b/grafana-plugin/src/containers/UserSettings/parts/connectors/MobileAppConnector.tsx index 16cb5a9e..cd50e390 100644 --- a/grafana-plugin/src/containers/UserSettings/parts/connectors/MobileAppConnector.tsx +++ b/grafana-plugin/src/containers/UserSettings/parts/connectors/MobileAppConnector.tsx @@ -21,7 +21,7 @@ const SlackConnector = (props: SlackConnectorProps) => { const store = useStore(); const handleClickConfirmMobileAppButton = useCallback(() => { - onTabChange(UserSettingsTab.MobileAppVerification); + onTabChange(UserSettingsTab.MobileAppConnection); }, [onTabChange]); if (!store.hasFeature(AppFeature.MobileApp)) { diff --git a/grafana-plugin/src/containers/UserSettings/parts/index.tsx b/grafana-plugin/src/containers/UserSettings/parts/index.tsx index 9c486a58..77692b62 100644 --- a/grafana-plugin/src/containers/UserSettings/parts/index.tsx +++ b/grafana-plugin/src/containers/UserSettings/parts/index.tsx @@ -5,7 +5,7 @@ import cn from 'classnames/bind'; import { observer } from 'mobx-react'; import Block from 'components/GBlock/Block'; -import MobileAppVerification from 'containers/MobileAppVerification/MobileAppVerification'; +import MobileAppConnection from 'containers/MobileAppConnection/MobileAppConnection'; import { UserSettingsTab } from 'containers/UserSettings/UserSettings.types'; import { SlackTab } from 'containers/UserSettings/parts/tabs//SlackTab/SlackTab'; import CloudPhoneSettings from 'containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings'; @@ -25,7 +25,7 @@ interface TabsProps { activeTab: UserSettingsTab; onTabChange: (tab: UserSettingsTab) => void; showNotificationSettingsTab: boolean; - showMobileAppVerificationTab: boolean; + showMobileAppConnectionTab: boolean; showSlackConnectionTab: boolean; showTelegramConnectionTab: boolean; } @@ -34,7 +34,7 @@ export const Tabs = ({ activeTab, onTabChange, showNotificationSettingsTab, - showMobileAppVerificationTab, + showMobileAppConnectionTab, showSlackConnectionTab, showTelegramConnectionTab, }: TabsProps) => { @@ -69,12 +69,12 @@ export const Tabs = ({ key={UserSettingsTab.PhoneVerification} onChangeTab={getTabClickHandler(UserSettingsTab.PhoneVerification)} /> - {showMobileAppVerificationTab && ( + {showMobileAppConnectionTab && ( )} {showSlackConnectionTab && ( @@ -134,7 +134,7 @@ export const TabsContent = observer(({ id, activeTab, onTabChange, isDesktopOrLa ))} {/* TODO: we should probably hide this tab when a user (ie. Admin) is viewing the user settings for another user. Would it make sense for an Admin to be able to link their mobile app to another user's profile */} - {activeTab === UserSettingsTab.MobileAppVerification && } + {activeTab === UserSettingsTab.MobileAppConnection && } {activeTab === UserSettingsTab.SlackInfo && } {activeTab === UserSettingsTab.TelegramInfo && } diff --git a/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx b/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx index efc94642..24376d0b 100644 --- a/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx +++ b/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx @@ -39,13 +39,6 @@ const TelegramInfo = observer((_props: TelegramInfoProps) => { <> {telegramConfigured || !store.hasFeature(AppFeature.LiveSettings) ? ( - {/* Connect personal Telegram - - Connect Telegram automatically - - - - */} Manual connection @@ -79,7 +72,7 @@ const TelegramInfo = observer((_props: TelegramInfoProps) => { ) : ( Connect Telegram workspace - + You can manage alert groups in your team Telegram channel or from personal direct messages.