From 71e92376118a4fe8da73b5da37f383c2dfe34889 Mon Sep 17 00:00:00 2001 From: Rares Mardare Date: Tue, 23 May 2023 15:33:19 +0300 Subject: [PATCH] Templates tweaks (#1993) # What this PR does - Hide timeline numbering when `isDisabled` is being sent - Fixed tooltips within expanded route for escalation chains actions - Replaced GSelect with Select to allow refreshing list manually --- .../components/Timeline/Timeline.module.css | 4 ++ .../src/components/Timeline/TimelineItem.tsx | 2 +- .../src/containers/AlertRules/parts/index.tsx | 5 +- .../src/containers/GSelect/GSelect.tsx | 1 - .../ExpandedIntegrationRouteDisplay.tsx | 57 +++++++++++-------- 5 files changed, 41 insertions(+), 28 deletions(-) diff --git a/grafana-plugin/src/components/Timeline/Timeline.module.css b/grafana-plugin/src/components/Timeline/Timeline.module.css index b4ee44c7..c2f4e970 100644 --- a/grafana-plugin/src/components/Timeline/Timeline.module.css +++ b/grafana-plugin/src/components/Timeline/Timeline.module.css @@ -27,3 +27,7 @@ word-break: break-word; flex-grow: 1; } + +.content--noMargin { + margin: 0; +} diff --git a/grafana-plugin/src/components/Timeline/TimelineItem.tsx b/grafana-plugin/src/components/Timeline/TimelineItem.tsx index 1807cf28..077d1943 100644 --- a/grafana-plugin/src/components/Timeline/TimelineItem.tsx +++ b/grafana-plugin/src/components/Timeline/TimelineItem.tsx @@ -33,7 +33,7 @@ const TimelineItem: React.FC = ({ {number} )} -
{children}
+
{children}
); }; diff --git a/grafana-plugin/src/containers/AlertRules/parts/index.tsx b/grafana-plugin/src/containers/AlertRules/parts/index.tsx index 8a49b500..13268e44 100644 --- a/grafana-plugin/src/containers/AlertRules/parts/index.tsx +++ b/grafana-plugin/src/containers/AlertRules/parts/index.tsx @@ -12,10 +12,11 @@ import { getVar } from 'utils/DOM'; interface ChatOpsConnectorsProps { channelFilterId: ChannelFilter['id']; + showLineNumber?: boolean; } export const ChatOpsConnectors = (props: ChatOpsConnectorsProps) => { - const { channelFilterId } = props; + const { channelFilterId, showLineNumber = true } = props; const store = useStore(); const { telegramChannelStore } = store; @@ -29,7 +30,7 @@ export const ChatOpsConnectors = (props: ChatOpsConnectorsProps) => { } return ( - + {isSlackInstalled && } {isTelegramInstalled && } diff --git a/grafana-plugin/src/containers/GSelect/GSelect.tsx b/grafana-plugin/src/containers/GSelect/GSelect.tsx index 1570c443..16fb6db1 100644 --- a/grafana-plugin/src/containers/GSelect/GSelect.tsx +++ b/grafana-plugin/src/containers/GSelect/GSelect.tsx @@ -146,7 +146,6 @@ const GSelect = observer((props: GSelectProps) => { return (
- {/*@ts-ignore*/} { + escalationChainStore.updateItems(); + }, []); + const channelFilter = alertReceiveChannelStore.channelFilters[channelFilterId]; const channelFiltersTotal = Object.keys(alertReceiveChannelStore.channelFilters); if (!channelFilter) { @@ -152,7 +156,7 @@ const ExpandedIntegrationRouteDisplay: React.FC Publish to ChatOps - + )} @@ -162,18 +166,21 @@ const ExpandedIntegrationRouteDisplay: React.FC Escalation chain - ({ + value: escalationChainStore.items[eschalationChainId].id, + label: escalationChainStore.items[eschalationChainId].name, + }) + )} + value={channelFilter.escalation_chain} getOptionLabel={(item: SelectableValue) => { return ( <> @@ -185,18 +192,20 @@ const ExpandedIntegrationRouteDisplay: React.FC ); }} - /> + > -