From fe97f63e0610bd99b4a77f6760c5afa99aa58dc3 Mon Sep 17 00:00:00 2001 From: Yulia Shanyrova Date: Mon, 20 Feb 2023 15:43:37 +0100 Subject: [PATCH] Explanation message added to confirmation of deleting rotation (#1308) # What this PR does Message explaning what will happen has been added to confirmation modal while deleting rotation ## Which issue(s) this PR fixes https://github.com/grafana/oncall/issues/1008 ## Checklist - [ ] Tests updated - [ ] Documentation added - [ ] `CHANGELOG.md` updated --- .../RotationForm/RotationForm.module.css | 4 ++ .../containers/RotationForm/RotationForm.tsx | 49 +++++++++++++++++-- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.module.css b/grafana-plugin/src/containers/RotationForm/RotationForm.module.css index a37c588e..976ff2c8 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.module.css +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.module.css @@ -72,3 +72,7 @@ .content { margin: 8px 0 16px 0; } + +.confirmation-modal { + width: 500px; +} diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx index c84be627..e2b69877 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx @@ -1,6 +1,15 @@ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { IconButton, VerticalGroup, HorizontalGroup, Field, Button, Select, InlineSwitch } from '@grafana/ui'; +import { + IconButton, + VerticalGroup, + HorizontalGroup, + Field, + Button, + Select, + InlineSwitch, + Modal as GrafanaModal, +} from '@grafana/ui'; import cn from 'classnames/bind'; import dayjs from 'dayjs'; import { observer } from 'mobx-react'; @@ -9,7 +18,6 @@ import Draggable from 'react-draggable'; import Modal from 'components/Modal/Modal'; import Text from 'components/Text/Text'; import UserGroups from 'components/UserGroups/UserGroups'; -import WithConfirm from 'components/WithConfirm/WithConfirm'; import WorkingHours from 'components/WorkingHours/WorkingHours'; import RemoteSelect from 'containers/RemoteSelect/RemoteSelect'; import { getFromString } from 'models/schedule/schedule.helpers'; @@ -72,6 +80,7 @@ const RotationForm: FC = observer((props) => { const [rotationStart, setRotationStart] = useState(shiftMoment); const [endLess, setEndless] = useState(true); const [rotationEnd, setRotationEnd] = useState(shiftMoment.add(1, 'month')); + const [showDeleteRotationConfirmation, setShowDeleteRotationConfirmation] = useState(false); const store = useStore(); const shift = store.scheduleStore.shifts[shiftId]; @@ -278,9 +287,12 @@ const RotationForm: FC = observer((props) => { {shiftId !== 'new' && ( - - - + setShowDeleteRotationConfirmation(true)} + /> )} @@ -410,6 +422,33 @@ const RotationForm: FC = observer((props) => { + {showDeleteRotationConfirmation && ( + setShowDeleteRotationConfirmation(false)} + title="Delete rotation" + className={cx('confirmation-modal')} + > + + + This action will delete all shifts in the rotation which are greater than current timestamp. + + + All past shifts will remain in the schedule for history reasons because there were events during this + period. + + + + + + + + + )} ); });