diff --git a/public/app/features/alerting/unified/TODO.md b/public/app/features/alerting/unified/TODO.md index 872f725b53d..180125b1701 100644 --- a/public/app/features/alerting/unified/TODO.md +++ b/public/app/features/alerting/unified/TODO.md @@ -18,6 +18,7 @@ If the item needs more rationale and you feel like a single sentence is inedequa - Get rid of "+ Add new" in drop-downs : Let's see if is there a way we can make it work with ` - )} - control={control} - name="groupWaitValue" - rules={{ - validate: optionalPositiveInteger, - }} - /> - ( - - )} - control={control} - name="groupIntervalValue" - rules={{ - validate: optionalPositiveInteger, - }} - /> - ( - - )} - control={control} - name="repeatIntervalValue" - rules={{ - validate: optionalPositiveInteger, - }} - /> - ( - {/* @ts-ignore-check: react-hook-form made me do this */} @@ -96,7 +94,6 @@ export const AmRoutesExpandedForm = ({ {fields.length > 0 && (
{fields.map((field, index) => { - const localPath = `object_matchers[${index}]`; return ( @@ -134,7 +131,7 @@ export const AmRoutesExpandedForm = ({ error={errors.object_matchers?.[index]?.value?.message} > @@ -225,38 +222,11 @@ export const AmRoutesExpandedForm = ({ invalid={!!errors.groupWaitValue} error={errors.groupWaitValue?.message} > - <> -
- ( - - )} - control={control} - name="groupWaitValue" - rules={{ - validate: optionalPositiveInteger, - }} - /> - ( - - )} - control={control} - name="groupIntervalValue" - rules={{ - validate: optionalPositiveInteger, - }} - /> - ( - - )} - control={control} - name="repeatIntervalValue" - rules={{ - validate: optionalPositiveInteger, - }} - /> - ( - { diff --git a/public/app/features/alerting/unified/components/notification-policies/Modals.tsx b/public/app/features/alerting/unified/components/notification-policies/Modals.tsx index 29bebec48c7..074ba61b7d0 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Modals.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Modals.tsx @@ -21,6 +21,7 @@ import { AmRoutesExpandedForm } from './EditNotificationPolicyForm'; import { Matchers } from './Matchers'; type ModalHook = [JSX.Element, (item: T) => void, () => void]; +type EditModalHook = [JSX.Element, (item: RouteWithID, isDefaultRoute?: boolean) => void, () => void]; const useAddPolicyModal = ( receivers: Receiver[] = [], @@ -81,7 +82,7 @@ const useEditPolicyModal = ( receivers: Receiver[], handleSave: (route: Partial) => void, loading: boolean -): ModalHook => { +): EditModalHook => { const [showModal, setShowModal] = useState(false); const [isDefaultPolicy, setIsDefaultPolicy] = useState(false); const [route, setRoute] = useState(); diff --git a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx index 06b04a18396..6fbeba09612 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx @@ -30,12 +30,7 @@ import { Spacer } from '../Spacer'; import { Strong } from '../Strong'; import { Matchers } from './Matchers'; - -type TimingOptions = { - group_wait?: string; - group_interval?: string; - repeat_interval?: string; -}; +import { TimingOptions, TIMING_OPTIONS_DEFAULTS } from './timingOptions'; type InhertitableProperties = Pick< Route, @@ -184,7 +179,14 @@ const Policy: FC = ({ } > -