Merge pull request #60 from grafana/launch-frontend-polishing

bug fixes
This commit is contained in:
Matvey Kukuy 2022-06-14 14:41:49 +03:00 committed by GitHub
commit e0dbee7fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 7 deletions

View file

@ -100,7 +100,9 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = 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)
) && (
<Alert
@ -119,7 +121,9 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = 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. '}

View file

@ -35,11 +35,10 @@ const cx = cn.bind(styles);
interface Props extends PluginConfigPageProps<AppPluginMeta<OnCallAppSettings>> {}
export const PluginConfigPage = (props: Props) => {
const grafanaUrlDefault = getItem('grafanaUrl') || window.location.origin;
const { plugin } = props;
const [onCallApiUrl, setOnCallApiUrl] = useState<string>(getItem('onCallApiUrl'));
const [onCallInvitationToken, setOnCallInvitationToken] = useState<string>();
const [grafanaUrl, setGrafanaUrl] = useState<string>(grafanaUrlDefault);
const [grafanaUrl, setGrafanaUrl] = useState<string>(getItem('grafanaUrl'));
const [pluginConfigLoading, setPluginConfigLoading] = useState<boolean>(true);
const [pluginStatusOk, setPluginStatusOk] = useState<boolean>();
const [pluginStatusMessage, setPluginStatusMessage] = useState<string>();

View file

@ -48,7 +48,7 @@ const CloudPhoneSettings = observer((props: CloudPhoneSettingsProps) => {
}, []);
const handleLinkClick = (link: string) => {
window.location.replace(link);
window.open(link, '_blank');
};
const syncUser = async () => {

View file

@ -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
</Button>

View file

@ -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<LiveSettingsProps, LiveSettingsState>
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();
}