diff --git a/ui/src/components/InstanceModal.tsx b/ui/src/components/InstanceModal.tsx index 54317a7..7c64af0 100644 --- a/ui/src/components/InstanceModal.tsx +++ b/ui/src/components/InstanceModal.tsx @@ -109,6 +109,9 @@ const InstanceModal: React.FC = ({ setShowAdvanced(!showAdvanced) } + // Check if auto_restart is enabled + const isAutoRestartEnabled = formData.auto_restart === true + return ( @@ -146,17 +149,47 @@ const InstanceModal: React.FC = ({

- {/* Basic Fields - Automatically generated from type */} + {/* Auto Restart Configuration Section */} +
+

Auto Restart Configuration

+ + {/* Auto Restart Toggle */} + + + {/* Show restart options only when auto restart is enabled */} + {isAutoRestartEnabled && ( +
+ + +
+ )} +
+ + {/* Basic Fields - Automatically generated from type (excluding auto restart options) */}

Basic Configuration

- {basicFields.map((fieldKey) => ( - - ))} + {basicFields + .filter(fieldKey => fieldKey !== 'auto_restart') // Exclude auto_restart as it's handled above + .map((fieldKey) => ( + + ))}
{/* Advanced Fields Toggle */} @@ -173,23 +206,26 @@ const InstanceModal: React.FC = ({ )} Advanced Configuration - ({advancedFields.length} options) + ({advancedFields.filter(f => !['max_restarts', 'restart_delay'].includes(f as string)).length} options) - {/* Advanced Fields - Automatically generated from type */} + {/* Advanced Fields - Automatically generated from type (excluding restart options) */} {showAdvanced && (
- {advancedFields.sort().map((fieldKey) => ( - - ))} + {advancedFields + .filter(fieldKey => !['max_restarts', 'restart_delay'].includes(fieldKey as string)) // Exclude restart options as they're handled above + .sort() + .map((fieldKey) => ( + + ))}
)} diff --git a/ui/src/lib/zodFormUtils.ts b/ui/src/lib/zodFormUtils.ts index 1f01edc..be2afd7 100644 --- a/ui/src/lib/zodFormUtils.ts +++ b/ui/src/lib/zodFormUtils.ts @@ -11,6 +11,16 @@ export const basicFieldsConfig: Record