# What this PR does Move ms teams related models, containers, components etc to oncall ## Which issue(s) this PR fixes https://github.com/grafana/oncall-private/issues/2144 ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
|
|
import cn from 'classnames/bind';
|
|
import { observer } from 'mobx-react';
|
|
|
|
import Text from 'components/Text/Text';
|
|
import MSTeamsInstructions from 'containers/MSTeams/MSTeamsInstructions';
|
|
import { useStore } from 'state/useStore';
|
|
|
|
import styles from 'containers/UserSettings/parts/tabs/MSTeamsInfo/MSTeamsInfo.module.css';
|
|
|
|
const cx = cn.bind(styles);
|
|
|
|
const MSTeamsInfo = observer(() => {
|
|
const { userStore, msteamsChannelStore } = useStore();
|
|
|
|
const [verificationCode, setVerificationCode] = useState<string>();
|
|
const [onCallisAdded, setOnCallisAdded] = useState(false);
|
|
|
|
useEffect(() => {
|
|
userStore.sendBackendConfirmationCode(userStore.currentUserPk, 'MSTEAMS').then(setVerificationCode);
|
|
msteamsChannelStore.updateItems().then(() => {
|
|
const connectedChannels = msteamsChannelStore.getSearchResult();
|
|
if (connectedChannels?.length) {
|
|
setOnCallisAdded(true);
|
|
}
|
|
});
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
return () => {
|
|
userStore.loadCurrentUser();
|
|
};
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
<Text.Title level={2} className={cx('heading')}>
|
|
Connect MS Teams workspace
|
|
</Text.Title>
|
|
<MSTeamsInstructions
|
|
personalSettings
|
|
onCallisAdded={onCallisAdded}
|
|
showInfoBox
|
|
verificationCode={verificationCode}
|
|
/>
|
|
</>
|
|
);
|
|
});
|
|
|
|
export default MSTeamsInfo;
|