feat: Add forceNavigate option when navigating to new item

The DuplicateModel component in CommonUI has been updated to include a new option, forceNavigate, when navigating to a new item. This option allows for forced navigation to the new item, bypassing any checks or validations. This change provides more control over the navigation behavior and ensures consistent navigation to the new item.
This commit is contained in:
Simon Larsen 2024-06-11 12:29:50 +01:00
parent 703c4b7685
commit 3bb1d93f3e
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
3 changed files with 7 additions and 3 deletions

View File

@ -86,7 +86,10 @@ const DuplicateModel: <TBaseModel extends BaseModel>(
Navigation.navigate(
new Route(props.navigateToOnSuccess.toString()).addRoute(
`/${newItem.data.id!.toString()}`
)
),
{
forceNavigate: true,
}
);
}
} catch (err) {

View File

@ -632,7 +632,8 @@ const FormField: <T extends GenericObject>(
? (props.currentValues as any)[
props.fieldName
]
: false
: (props.field.defaultValue as boolean) ||
false
}
/>
)}

View File

@ -226,8 +226,8 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
title: 'Disable Monitor',
description:
'Should the new monitor be disabled when its duplicated?',
defaultValue: true,
fieldType: FormFieldSchemaType.Toggle,
defaultValue: true,
required: false,
},
]}