connectivity warning changed the logic and added helper file
This commit is contained in:
parent
193519abc0
commit
f582b10ee5
2 changed files with 20 additions and 15 deletions
|
|
@ -16,6 +16,7 @@ import sanitize from 'utils/sanitize';
|
|||
|
||||
import { getSlackMessage } from './DefaultPageLayout.helpers';
|
||||
import { SlackError } from './DefaultPageLayout.types';
|
||||
import { getIfChatOpsConnected } from './helper';
|
||||
|
||||
import styles from './DefaultPageLayout.module.css';
|
||||
|
||||
|
|
@ -61,6 +62,9 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = observer((props) => {
|
|||
const { currentTeam } = teamStore;
|
||||
const { currentUser } = userStore;
|
||||
|
||||
const isChatOpsConnected = getIfChatOpsConnected(currentUser);
|
||||
const isPhoneVerified = currentUser?.cloud_connection_status === 3 ? true : currentUser?.verified_phone_number;
|
||||
|
||||
return (
|
||||
<div className={cx('root')}>
|
||||
<div className={styles.alerts_horizontal}>
|
||||
|
|
@ -117,9 +121,7 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = observer((props) => {
|
|||
currentTeam &&
|
||||
currentUser &&
|
||||
store.isUserActionAllowed(UserAction.UpdateOwnSettings) &&
|
||||
(!currentUser.verified_phone_number ||
|
||||
!currentUser.slack_user_identity ||
|
||||
currentUser.cloud_connection_status !== 3) &&
|
||||
(!isPhoneVerified || !isChatOpsConnected) &&
|
||||
!getItem(AlertID.CONNECTIVITY_WARNING)
|
||||
) && (
|
||||
<Alert
|
||||
|
|
@ -131,21 +133,17 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = observer((props) => {
|
|||
>
|
||||
{
|
||||
<>
|
||||
{!currentTeam.slack_team_identity && (
|
||||
{!isChatOpsConnected && (
|
||||
<>
|
||||
Slack Integration is not installed. Please fix it in{' '}
|
||||
<PluginLink query={{ page: 'chat-ops' }}>Slack Settings</PluginLink>
|
||||
{'. '}
|
||||
Communication channels are not connected. Configure at least one channel to receive notifications.
|
||||
</>
|
||||
)}
|
||||
{!isPhoneVerified && (
|
||||
<>
|
||||
Your phone number is not verified. You can change your configuration in{' '}
|
||||
<PluginLink query={{ page: 'users', id: 'me' }}>User settings</PluginLink>
|
||||
</>
|
||||
)}
|
||||
{currentUser.cloud_connection_status !== 3 &&
|
||||
!currentUser.verified_phone_number &&
|
||||
'Your phone number is not verified. '}
|
||||
{currentTeam.slack_team_identity &&
|
||||
!currentUser.slack_user_identity &&
|
||||
'Your slack account is not connected. '}
|
||||
You can change your configuration in{' '}
|
||||
<PluginLink query={{ page: 'users', id: 'me' }}>User settings</PluginLink>
|
||||
</>
|
||||
}
|
||||
</Alert>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
import React from 'react';
|
||||
|
||||
import { User } from 'models/user/user.types';
|
||||
|
||||
export const getIfChatOpsConnected = (user: User) => {
|
||||
return user?.slack_user_identity || user?.telegram_configuration;
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue