Merge pull request #754 from grafana/slack-wrongworkspace-warning

live settings availability check has been added
This commit is contained in:
Yulia Shanyrova 2022-11-07 10:22:46 +01:00 committed by GitHub
commit 88f736beaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View file

@ -5,7 +5,7 @@ import { Team } from 'models/team/team.types';
import { SlackError } from './DefaultPageLayout.types';
export function getSlackMessage(slackError: SlackError, team: Team) {
export function getSlackMessage(slackError: SlackError, team: Team, hasLiveSettingsFeature: boolean) {
if (slackError === SlackError.WRONG_WORKSPACE) {
return (
<>
@ -30,8 +30,12 @@ export function getSlackMessage(slackError: SlackError, team: Team) {
return (
<>
An error has occurred with Slack authentication.{' '}
<PluginLink query={{ page: 'live-settings' }}>Check ENV variables</PluginLink> related to Slack and try again
please.
{hasLiveSettingsFeature && (
<>
<PluginLink query={{ page: 'live-settings' }}>Check ENV variables</PluginLink> related to Slack and try
again please.
</>
)}
</>
);
}

View file

@ -9,6 +9,7 @@ import { observer } from 'mobx-react';
import PluginLink from 'components/PluginLink/PluginLink';
import { getIfChatOpsConnected } from 'containers/DefaultPageLayout/helper';
import { AppFeature } from 'state/features';
import { useStore } from 'state/useStore';
import { UserAction } from 'state/userAction';
import { GRAFANA_LICENSE_OSS } from 'utils/consts';
@ -79,7 +80,11 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = observer((props) => {
// @ts-ignore
title="Slack integration warning"
>
{getSlackMessage(showSlackInstallAlert, store.teamStore.currentTeam)}
{getSlackMessage(
showSlackInstallAlert,
store.teamStore.currentTeam,
store.hasFeature(AppFeature.LiveSettings)
)}
</Alert>
)}
{currentTeam?.banner.title != null && !getItem(currentTeam?.banner.title) && (

View file

@ -95,9 +95,11 @@ const TelegramInfo = observer((_props: TelegramInfoProps) => {
</Text>
</VerticalGroup>
</Block>
<PluginLink query={{ page: 'live-settings' }}>
<Button variant="primary">Setup ENV Variables</Button>
</PluginLink>
{store.hasFeature(AppFeature.LiveSettings) && (
<PluginLink query={{ page: 'live-settings' }}>
<Button variant="primary">Setup ENV Variables</Button>
</PluginLink>
)}
</VerticalGroup>
)}
</>