From 46990b51b32366b59c5bfa7fd7f28dcd48e58ce7 Mon Sep 17 00:00:00 2001 From: Yulia Shanyrova Date: Mon, 24 Oct 2022 14:34:27 +0200 Subject: [PATCH] Schedules polishing: count of esc chains deleted when it is 0, warning column has been added --- .../src/pages/schedules_NEW/Schedules.tsx | 86 +++++++++++++------ 1 file changed, 61 insertions(+), 25 deletions(-) diff --git a/grafana-plugin/src/pages/schedules_NEW/Schedules.tsx b/grafana-plugin/src/pages/schedules_NEW/Schedules.tsx index 8c7ed34a..06c94d78 100644 --- a/grafana-plugin/src/pages/schedules_NEW/Schedules.tsx +++ b/grafana-plugin/src/pages/schedules_NEW/Schedules.tsx @@ -1,7 +1,16 @@ import React, { SyntheticEvent } from 'react'; import { getLocationSrv } from '@grafana/runtime'; -import { Button, HorizontalGroup, IconButton, LoadingPlaceholder, VerticalGroup } from '@grafana/ui'; +import { + Button, + HorizontalGroup, + IconButton, + LoadingPlaceholder, + VerticalGroup, + PENDING_COLOR, + Tooltip, + Icon, +} from '@grafana/ui'; import cn from 'classnames/bind'; import dayjs from 'dayjs'; import { debounce } from 'lodash-es'; @@ -82,7 +91,7 @@ class SchedulesPage extends React.Component { + if (item.warnings.length > 0) { + const tooltipContent = ( +
+ {item.warnings.map((warning: string) => ( +

{warning}

+ ))} +
+ ); + return ( + + + + ); + } + + return null; + }; + renderStatus = (item: Schedule) => { const { store: { scheduleStore }, } = this.props; const relatedEscalationChains = scheduleStore.relatedEscalationChains[item.id]; - + console.log('esc chains', item.number_of_escalation_chains); return ( - - {relatedEscalationChains ? ( - relatedEscalationChains.length ? ( - relatedEscalationChains.map((escalationChain) => ( - - {escalationChain.name} - - )) + {item.number_of_escalation_chains > 0 && ( + + {relatedEscalationChains ? ( + relatedEscalationChains.length ? ( + relatedEscalationChains.map((escalationChain) => ( + + {escalationChain.name} + + )) + ) : ( + 'Not used yet' + ) ) : ( - 'Not used yet' - ) - ) : ( - Loading related escalation chains.... - )} - - } - onHover={this.getUpdateRelatedEscalationChainsHandler(item.id)} - /> + Loading related escalation chains.... + )} + + } + onHover={this.getUpdateRelatedEscalationChainsHandler(item.id)} + /> + )} + {/*