diff --git a/CHANGELOG.md b/CHANGELOG.md index b359f5cc..e1956153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added banner on the ChatOps screen for OSS to let the user know if no chatops integration is enabled + ([#1735](https://github.com/grafana/oncall/issues/1735)) + ## v1.3.16 (2023-07-21) ### Added diff --git a/grafana-plugin/src/jest/utils.ts b/grafana-plugin/src/jest/utils.ts index b187f6e9..63e2c541 100644 --- a/grafana-plugin/src/jest/utils.ts +++ b/grafana-plugin/src/jest/utils.ts @@ -5,9 +5,3 @@ export function mockUseStore() { }), })); } - -export function mockGrafanaLocationSrv() { - jest.mock('@grafana/runtime', () => ({ - getLocationSrv: jest.fn(), - })); -} diff --git a/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx b/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx index 3c91d5f7..824e9191 100644 --- a/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx +++ b/grafana-plugin/src/pages/settings/tabs/ChatOps/ChatOps.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { AppRootProps } from '@grafana/data'; -import { HorizontalGroup, Icon } from '@grafana/ui'; +import { Alert, HorizontalGroup, Icon } from '@grafana/ui'; import cn from 'classnames/bind'; import { observer } from 'mobx-react'; @@ -9,6 +9,7 @@ import VerticalTabsBar, { VerticalTab } from 'components/VerticalTabsBar/Vertica import SlackSettings from 'pages/settings/tabs/ChatOps/tabs/SlackSettings/SlackSettings'; import TelegramSettings from 'pages/settings/tabs/ChatOps/tabs/TelegramSettings/TelegramSettings'; import { AppFeature } from 'state/features'; +import { WithStoreProps } from 'state/types'; import { useStore } from 'state/useStore'; import { withMobXProviderContext } from 'state/withStore'; import LocationHelper from 'utils/LocationHelper'; @@ -21,7 +22,7 @@ export enum ChatOpsTab { Slack = 'Slack', Telegram = 'Telegram', } -interface ChatOpsProps extends AppRootProps {} +interface ChatOpsProps extends AppRootProps, WithStoreProps {} interface ChatOpsState { activeTab: ChatOpsTab; } @@ -44,6 +45,11 @@ class ChatOpsPage extends React.Component { render() { const { activeTab } = this.state; + const { store } = this.props; + + if (!this.isChatOpsConfigured() && store.isOpenSource()) { + return this.renderNoChatOpsBannerInfo(); + } return (
@@ -57,6 +63,29 @@ class ChatOpsPage extends React.Component { ); } + renderNoChatOpsBannerInfo() { + return ( +
+ + ChatOps is disabled because no chat integration is enabled. See{' '} + + Telegram + {' '} + and{' '} + + Slack + {' '} + docs for more information. + +
+ ); + } + + isChatOpsConfigured(): boolean { + const { store } = this.props; + return store.hasFeature(AppFeature.Slack) || store.hasFeature(AppFeature.Telegram); + } + handleChatopsTabChange(tab: ChatOpsTab) { this.setState({ activeTab: tab }); LocationHelper.update({ tab: tab }, 'partial');