From fd55acfea4ae01382753b41b7aa2d23478fd2111 Mon Sep 17 00:00:00 2001 From: Yulia Shanyrova Date: Wed, 2 Nov 2022 10:30:00 +0100 Subject: [PATCH] live settings availability check has been added --- .../DefaultPageLayout/DefaultPageLayout.helpers.tsx | 12 +++++++++--- .../DefaultPageLayout/DefaultPageLayout.tsx | 2 +- .../parts/tabs/TelegramInfo/TelegramInfo.tsx | 8 +++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.helpers.tsx b/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.helpers.tsx index 983597c3..a89dc451 100644 --- a/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.helpers.tsx +++ b/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.helpers.tsx @@ -2,10 +2,12 @@ import React from 'react'; import PluginLink from 'components/PluginLink/PluginLink'; import { Team } from 'models/team/team.types'; +import { RootStore } from 'state'; +import { AppFeature } from 'state/features'; import { SlackError } from './DefaultPageLayout.types'; -export function getSlackMessage(slackError: SlackError, team: Team) { +export function getSlackMessage(slackError: SlackError, team: Team, store: RootStore) { if (slackError === SlackError.WRONG_WORKSPACE) { return ( <> @@ -30,8 +32,12 @@ export function getSlackMessage(slackError: SlackError, team: Team) { return ( <> An error has occurred with Slack authentication.{' '} - Check ENV variables related to Slack and try again - please. + {store.hasFeature(AppFeature.LiveSettings) && ( + <> + Check ENV variables related to Slack and try + again please. + + )} ); } diff --git a/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx b/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx index 95d6d253..d9e395ff 100644 --- a/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx +++ b/grafana-plugin/src/containers/DefaultPageLayout/DefaultPageLayout.tsx @@ -79,7 +79,7 @@ const DefaultPageLayout: FC = observer((props) => { // @ts-ignore title="Slack integration warning" > - {getSlackMessage(showSlackInstallAlert, store.teamStore.currentTeam)} + {getSlackMessage(showSlackInstallAlert, store.teamStore.currentTeam, store)} )} {currentTeam?.banner.title != null && !getItem(currentTeam?.banner.title) && ( diff --git a/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx b/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx index f0750886..3c186429 100644 --- a/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx +++ b/grafana-plugin/src/containers/UserSettings/parts/tabs/TelegramInfo/TelegramInfo.tsx @@ -95,9 +95,11 @@ const TelegramInfo = observer((_props: TelegramInfoProps) => { - - - + {store.hasFeature(AppFeature.LiveSettings) && ( + + + + )} )}