diff --git a/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx b/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx index 7d446ef1..7b2c23a6 100644 --- a/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx +++ b/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx @@ -100,7 +100,9 @@ const DefaultPageLayout: FC = observer((props) => { currentTeam && currentUser && store.isUserActionAllowed(UserAction.UpdateOwnSettings) && - (!currentUser.verified_phone_number || !currentUser.slack_user_identity) && + (!currentUser.verified_phone_number || + !currentUser.slack_user_identity || + currentUser.cloud_connection_status !== 3) && !getItem(AlertID.CONNECTIVITY_WARNING) ) && ( = observer((props) => { {'. '} )} - {!currentUser.verified_phone_number && 'Your phone number is not verified. '} + {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. '} diff --git a/grafana-plugin/src/containers/PluginConfigPage/PluginConfigPage.tsx b/grafana-plugin/src/containers/PluginConfigPage/PluginConfigPage.tsx index 5ca6d87d..d4664d4e 100644 --- a/grafana-plugin/src/containers/PluginConfigPage/PluginConfigPage.tsx +++ b/grafana-plugin/src/containers/PluginConfigPage/PluginConfigPage.tsx @@ -35,11 +35,10 @@ const cx = cn.bind(styles); interface Props extends PluginConfigPageProps> {} export const PluginConfigPage = (props: Props) => { - const grafanaUrlDefault = getItem('grafanaUrl') || window.location.origin; const { plugin } = props; const [onCallApiUrl, setOnCallApiUrl] = useState(getItem('onCallApiUrl')); const [onCallInvitationToken, setOnCallInvitationToken] = useState(); - const [grafanaUrl, setGrafanaUrl] = useState(grafanaUrlDefault); + const [grafanaUrl, setGrafanaUrl] = useState(getItem('grafanaUrl')); const [pluginConfigLoading, setPluginConfigLoading] = useState(true); const [pluginStatusOk, setPluginStatusOk] = useState(); const [pluginStatusMessage, setPluginStatusMessage] = useState(); diff --git a/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx b/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx index 724b4712..74438027 100644 --- a/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx +++ b/grafana-plugin/src/containers/UserSettings/parts/tabs/CloudPhoneSettings/CloudPhoneSettings.tsx @@ -48,7 +48,7 @@ const CloudPhoneSettings = observer((props: CloudPhoneSettingsProps) => { }, []); const handleLinkClick = (link: string) => { - window.location.replace(link); + window.open(link, '_blank'); }; const syncUser = async () => { diff --git a/grafana-plugin/src/pages/cloud/CloudPage.tsx b/grafana-plugin/src/pages/cloud/CloudPage.tsx index d81ce0c9..0ba8f093 100644 --- a/grafana-plugin/src/pages/cloud/CloudPage.tsx +++ b/grafana-plugin/src/pages/cloud/CloudPage.tsx @@ -105,7 +105,7 @@ const CloudPage = observer((props: CloudPageProps) => { }; const handleLinkClick = (link: string) => { - window.location.replace(link); + window.open(link, '_blank'); }; const renderButtons = (user: Cloud) => { @@ -133,7 +133,7 @@ const CloudPage = observer((props: CloudPageProps) => { icon="external-link-alt" size="sm" className={cx('table-button')} - onClick={() => handleLinkClick(user?.cloud_data?.link)} + onClick={() => getLocationSrv().update({ query: { page: 'users', p: page, id: user.id } })} > Configure notifications diff --git a/grafana-plugin/src/pages/livesettings/LiveSettingsPage.tsx b/grafana-plugin/src/pages/livesettings/LiveSettingsPage.tsx index af261122..9542253f 100644 --- a/grafana-plugin/src/pages/livesettings/LiveSettingsPage.tsx +++ b/grafana-plugin/src/pages/livesettings/LiveSettingsPage.tsx @@ -14,7 +14,9 @@ import { } from '@grafana/ui'; import cn from 'classnames/bind'; import { omit } from 'lodash-es'; +import { observe } from 'mobx'; import { observer } from 'mobx-react'; +import { Lambda } from 'mobx/lib/internal'; import { AlignType } from 'rc-table/lib/interface'; import { Redirect } from 'react-router-dom'; @@ -46,6 +48,23 @@ class LiveSettings extends React.Component hideValues: true, }; + disposer: Lambda; + + constructor(props: LiveSettingsProps) { + super(props); + + const { store } = props; + + this.disposer = observe(store.userStore, (change) => { + if (change.name === 'currentUserPk') { + this.update(); + } + }); + } + + componentWillUnmount() { + this.disposer(); + } componentDidMount() { this.update(); }