From 1fbb63c39751543edce641e92f6190a540959ce4 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Wed, 23 Jul 2025 22:05:37 +0200 Subject: [PATCH] Add auto restart configuration fields to InstanceModal and zodFormUtils --- ui/src/components/InstanceModal.tsx | 74 +++++++++++++++++++++-------- ui/src/lib/zodFormUtils.ts | 10 ++++ 2 files changed, 65 insertions(+), 19 deletions(-) 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