diff --git a/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.helpers.ts b/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.helpers.ts new file mode 100644 index 00000000..4313ec5f --- /dev/null +++ b/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.helpers.ts @@ -0,0 +1,11 @@ +import { LocationHelper } from 'utils/LocationHelper'; +import { openErrorNotification } from 'utils/utils'; + +export const handleChatOpsQueryParamError = () => { + const error = LocationHelper.getQueryParam('error'); + + if (error) { + openErrorNotification(error); + LocationHelper.update({ error: undefined }, 'partial'); + } +}; diff --git a/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx b/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx index b43e7510..1441017b 100644 --- a/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx +++ b/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx @@ -15,6 +15,8 @@ import { useStore } from 'state/useStore'; import { withMobXProviderContext } from 'state/withStore'; import { LocationHelper } from 'utils/LocationHelper'; +import { handleChatOpsQueryParamError } from './ChatOps.helpers'; + import styles from './ChatOps.module.css'; const cx = cn.bind(styles); @@ -38,6 +40,7 @@ export class _ChatOpsPage extends React.Component { componentDidMount() { const tab = LocationHelper.getQueryParam('chatOpsTab'); + handleChatOpsQueryParamError(); this.handleChatopsTabChange(tab || ChatOpsTab.Slack); }