From 443844348ee9dcd80d5789912f68f8c0a339b15e Mon Sep 17 00:00:00 2001 From: Dominik Broj Date: Mon, 22 Jul 2024 18:26:17 +0200 Subject: [PATCH] hide forbidden actions from Add menu in schedule (#4708) # What this PR does hide forbidden actions from Add menu in schedule ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] Added the relevant release notes label (see labels prefixed w/ `release:`). These labels dictate how your PR will show up in the autogenerated release notes. --- .../src/pages/schedule/Schedule.tsx | 89 ++++++++++++------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/grafana-plugin/src/pages/schedule/Schedule.tsx b/grafana-plugin/src/pages/schedule/Schedule.tsx index 997cbb30b1..893f35b4f4 100644 --- a/grafana-plugin/src/pages/schedule/Schedule.tsx +++ b/grafana-plugin/src/pages/schedule/Schedule.tsx @@ -22,6 +22,7 @@ import { RouteComponentProps, withRouter } from 'react-router-dom'; import { PageErrorHandlingWrapper } from 'components/PageErrorHandlingWrapper/PageErrorHandlingWrapper'; import { PluginLink } from 'components/PluginLink/PluginLink'; +import { RenderConditionally } from 'components/RenderConditionally/RenderConditionally'; import { ScheduleFilters } from 'components/ScheduleFilters/ScheduleFilters'; import { ScheduleFiltersType } from 'components/ScheduleFilters/ScheduleFilters.types'; import { ScheduleQuality } from 'components/ScheduleQuality/ScheduleQuality'; @@ -232,40 +233,64 @@ class _SchedulePage extends React.Component - {layers?.map((layer, index) => ( - { - scrollToElement(document.getElementById(HTML_ID.SCHEDULE_ROTATIONS)); - - this.handleShowRotationForm('new', layer.priority); - }} - /> - ))} - { - scrollToElement(document.getElementById(HTML_ID.SCHEDULE_ROTATIONS)); - - this.handleShowRotationForm('new', nextPriority); - }} + + layers?.map((layer, index) => ( + { + scrollToElement(document.getElementById(HTML_ID.SCHEDULE_ROTATIONS)); + + this.handleShowRotationForm('new', layer.priority); + }} + /> + )) + } /> - { - scrollToElement(document.getElementById(HTML_ID.SCHEDULE_OVERRIDES_AND_SWAPS)); - - this.handleShowShiftSwapForm('new'); - }} + ( + { + scrollToElement(document.getElementById(HTML_ID.SCHEDULE_ROTATIONS)); + + this.handleShowRotationForm('new', nextPriority); + }} + /> + )} /> - { - scrollToElement(document.getElementById(HTML_ID.SCHEDULE_OVERRIDES_AND_SWAPS)); - - this.handleShowOverridesForm('new'); - }} + ( + { + scrollToElement( + document.getElementById(HTML_ID.SCHEDULE_OVERRIDES_AND_SWAPS) + ); + + this.handleShowShiftSwapForm('new'); + }} + /> + )} + /> + ( + { + scrollToElement( + document.getElementById(HTML_ID.SCHEDULE_OVERRIDES_AND_SWAPS) + ); + + this.handleShowOverridesForm('new'); + }} + /> + )} /> }