Skip to content

Commit

Permalink
show chatops proxy error (#4719)
Browse files Browse the repository at this point in the history
# What this PR does

show chatops proxy error if present in query params

## Which issue(s) this PR closes

Related to grafana/oncall-gateway#255

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
  • Loading branch information
brojd authored Jul 24, 2024
1 parent ed57c30 commit 53556bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.helpers.ts
Original file line number Diff line number Diff line change
@@ -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');
}
};
3 changes: 3 additions & 0 deletions grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -38,6 +40,7 @@ export class _ChatOpsPage extends React.Component<ChatOpsProps, ChatOpsState> {
componentDidMount() {
const tab = LocationHelper.getQueryParam('chatOpsTab');

handleChatOpsQueryParamError();
this.handleChatopsTabChange(tab || ChatOpsTab.Slack);
}

Expand Down

0 comments on commit 53556bd

Please sign in to comment.