You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							622 lines
						
					
					
						
							32 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							622 lines
						
					
					
						
							32 KiB
						
					
					
				| // Code generated by templ - DO NOT EDIT. | |
|  | |
| // templ: version: v0.3.960 | |
| package app | |
| 
 | |
| //lint:file-ignore SA4006 This context is only used if a nested component is present. | |
|  | |
| import "github.com/a-h/templ" | |
| import templruntime "github.com/a-h/templ/runtime" | |
| 
 | |
| import ( | |
| 	"fmt" | |
| 	"github.com/seaweedfs/seaweedfs/weed/admin/config" | |
| 	"github.com/seaweedfs/seaweedfs/weed/admin/maintenance" | |
| 	"github.com/seaweedfs/seaweedfs/weed/admin/view/components" | |
| ) | |
| 
 | |
| func MaintenanceConfigSchema(data *maintenance.MaintenanceConfigData, schema *maintenance.MaintenanceConfigSchema) templ.Component { | |
| 	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | |
| 		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context | |
| 		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { | |
| 			return templ_7745c5c3_CtxErr | |
| 		} | |
| 		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | |
| 		if !templ_7745c5c3_IsBuffer { | |
| 			defer func() { | |
| 				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) | |
| 				if templ_7745c5c3_Err == nil { | |
| 					templ_7745c5c3_Err = templ_7745c5c3_BufErr | |
| 				} | |
| 			}() | |
| 		} | |
| 		ctx = templ.InitializeContext(ctx) | |
| 		templ_7745c5c3_Var1 := templ.GetChildren(ctx) | |
| 		if templ_7745c5c3_Var1 == nil { | |
| 			templ_7745c5c3_Var1 = templ.NopComponent | |
| 		} | |
| 		ctx = templ.ClearChildren(ctx) | |
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"container-fluid\"><div class=\"row mb-4\"><div class=\"col-12\"><div class=\"d-flex justify-content-between align-items-center\"><h2 class=\"mb-0\"><i class=\"fas fa-cogs me-2\"></i> Maintenance Configuration</h2><div class=\"btn-group\"><a href=\"/maintenance/tasks\" class=\"btn btn-outline-primary\"><i class=\"fas fa-tasks me-1\"></i> View Tasks</a></div></div></div></div><div class=\"row\"><div class=\"col-12\"><div class=\"card\"><div class=\"card-header\"><h5 class=\"mb-0\">System Settings</h5></div><div class=\"card-body\"><form id=\"maintenanceConfigForm\"><!-- Dynamically render all schema fields in order -->") | |
| 		if templ_7745c5c3_Err != nil { | |
| 			return templ_7745c5c3_Err | |
| 		} | |
| 		for _, field := range schema.Fields { | |
| 			templ_7745c5c3_Err = ConfigField(field, data.Config).Render(ctx, templ_7745c5c3_Buffer) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 		} | |
| 		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<div class=\"d-flex gap-2\"><button type=\"button\" class=\"btn btn-primary\" onclick=\"saveConfiguration()\"><i class=\"fas fa-save me-1\"></i> Save Configuration</button> <button type=\"button\" class=\"btn btn-secondary\" onclick=\"resetToDefaults()\"><i class=\"fas fa-undo me-1\"></i> Reset to Defaults</button></div></form></div></div></div></div><!-- Task Configuration Cards --><div class=\"row mt-4\"><div class=\"col-md-4\"><div class=\"card\"><div class=\"card-header\"><h5 class=\"mb-0\"><i class=\"fas fa-broom me-2\"></i> Volume Vacuum</h5></div><div class=\"card-body\"><p class=\"card-text\">Reclaims disk space by removing deleted files from volumes.</p><a href=\"/maintenance/config/vacuum\" class=\"btn btn-primary\">Configure</a></div></div></div><div class=\"col-md-4\"><div class=\"card\"><div class=\"card-header\"><h5 class=\"mb-0\"><i class=\"fas fa-balance-scale me-2\"></i> Volume Balance</h5></div><div class=\"card-body\"><p class=\"card-text\">Redistributes volumes across servers to optimize storage utilization.</p><a href=\"/maintenance/config/balance\" class=\"btn btn-primary\">Configure</a></div></div></div><div class=\"col-md-4\"><div class=\"card\"><div class=\"card-header\"><h5 class=\"mb-0\"><i class=\"fas fa-shield-alt me-2\"></i> Erasure Coding</h5></div><div class=\"card-body\"><p class=\"card-text\">Converts volumes to erasure coded format for improved durability.</p><a href=\"/maintenance/config/erasure_coding\" class=\"btn btn-primary\">Configure</a></div></div></div></div></div><script>\n        function saveConfiguration() {\n            const form = document.getElementById('maintenanceConfigForm');\n            const formData = new FormData(form);\n            \n            // Convert form data to JSON, handling interval fields specially\n            const config = {};\n            \n            for (let [key, value] of formData.entries()) {\n                if (key.endsWith('_value')) {\n                    // This is an interval value part\n                    const baseKey = key.replace('_value', '');\n                    const unitKey = baseKey + '_unit';\n                    const unitValue = formData.get(unitKey);\n                    \n                    if (unitValue) {\n                        // Convert to seconds based on unit\n                        const numValue = parseInt(value) || 0;\n                        let seconds = numValue;\n                        switch(unitValue) {\n                            case 'minutes':\n                                seconds = numValue * 60;\n                                break;\n                            case 'hours':\n                                seconds = numValue * 3600;\n                                break;\n                            case 'days':\n                                seconds = numValue * 24 * 3600;\n                                break;\n                        }\n                        config[baseKey] = seconds;\n                    }\n                } else if (key.endsWith('_unit')) {\n                    // Skip unit keys - they're handled with their corresponding value\n                    continue;\n                } else {\n                    // Regular field\n                    if (form.querySelector(`[name=\"${key}\"]`).type === 'checkbox') {\n                        config[key] = form.querySelector(`[name=\"${key}\"]`).checked;\n                    } else {\n                        const numValue = parseFloat(value);\n                        config[key] = isNaN(numValue) ? value : numValue;\n                    }\n                }\n            }\n\n            fetch('/api/maintenance/config', {\n                method: 'PUT',\n                headers: {\n                    'Content-Type': 'application/json',\n                },\n                body: JSON.stringify(config)\n            })\n            .then(response => {\n                if (response.status === 401) {\n                    alert('Authentication required. Please log in first.');\n                    window.location.href = '/login';\n                    return;\n                }\n                return response.json();\n            })\n            .then(data => {\n                if (!data) return; // Skip if redirected to login\n                if (data.success) {\n                    alert('Configuration saved successfully!');\n                    location.reload();\n                } else {\n                    alert('Error saving configuration: ' + (data.error || 'Unknown error'));\n                }\n            })\n            .catch(error => {\n                console.error('Error:', error);\n                alert('Error saving configuration: ' + error.message);\n            });\n        }\n\n        function resetToDefaults() {\n            if (confirm('Are you sure you want to reset to default configuration? This will overwrite your current settings.')) {\n                fetch('/maintenance/config/defaults', {\n                    method: 'POST',\n                    headers: {\n                        'Content-Type': 'application/json',\n                    }\n                })\n                .then(response => response.json())\n                .then(data => {\n                    if (data.success) {\n                        alert('Configuration reset to defaults!');\n                        location.reload();\n                    } else {\n                        alert('Error resetting configuration: ' + (data.error || 'Unknown error'));\n                    }\n                })\n                .catch(error => {\n                    console.error('Error:', error);\n                    alert('Error resetting configuration: ' + error.message);\n                });\n            }\n        }\n    </script>") | |
| 		if templ_7745c5c3_Err != nil { | |
| 			return templ_7745c5c3_Err | |
| 		} | |
| 		return nil | |
| 	}) | |
| } | |
| 
 | |
| // ConfigField renders a single configuration field based on schema with typed value lookup | |
| func ConfigField(field *config.Field, config *maintenance.MaintenanceConfig) templ.Component { | |
| 	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | |
| 		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context | |
| 		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { | |
| 			return templ_7745c5c3_CtxErr | |
| 		} | |
| 		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | |
| 		if !templ_7745c5c3_IsBuffer { | |
| 			defer func() { | |
| 				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) | |
| 				if templ_7745c5c3_Err == nil { | |
| 					templ_7745c5c3_Err = templ_7745c5c3_BufErr | |
| 				} | |
| 			}() | |
| 		} | |
| 		ctx = templ.InitializeContext(ctx) | |
| 		templ_7745c5c3_Var2 := templ.GetChildren(ctx) | |
| 		if templ_7745c5c3_Var2 == nil { | |
| 			templ_7745c5c3_Var2 = templ.NopComponent | |
| 		} | |
| 		ctx = templ.ClearChildren(ctx) | |
| 		if field.InputType == "interval" { | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<!-- Interval field with number input + unit dropdown --> <div class=\"mb-3\"><label for=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var3 string | |
| 			templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 212, Col: 39} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" class=\"form-label\">") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var4 string | |
| 			templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(field.DisplayName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 213, Col: 35} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " ") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Required { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<span class=\"text-danger\">*</span>") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</label><div class=\"input-group\"><input type=\"number\" class=\"form-control\" id=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var5 string | |
| 			templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName + "_value") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 222, Col: 50} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\" name=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var6 string | |
| 			templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName + "_value") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 223, Col: 52} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\" value=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var7 string | |
| 			templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.0f", components.ConvertInt32SecondsToDisplayValue(getMaintenanceInt32Field(config, field.JSONName)))) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 224, Col: 143} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" step=\"1\" min=\"1\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Required { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " required") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "> <select class=\"form-select\" id=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var8 string | |
| 			templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName + "_unit") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 233, Col: 49} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "\" name=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var9 string | |
| 			templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName + "_unit") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 234, Col: 51} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "\" style=\"max-width: 120px;\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Required { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " required") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "><option value=\"minutes\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if components.GetInt32DisplayUnit(getMaintenanceInt32Field(config, field.JSONName)) == "minutes" { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " selected") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, ">Minutes</option> <option value=\"hours\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if components.GetInt32DisplayUnit(getMaintenanceInt32Field(config, field.JSONName)) == "hours" { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " selected") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, ">Hours</option> <option value=\"days\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if components.GetInt32DisplayUnit(getMaintenanceInt32Field(config, field.JSONName)) == "days" { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " selected") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, ">Days</option></select></div>") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Description != "" { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<div class=\"form-text text-muted\">") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				var templ_7745c5c3_Var10 string | |
| 				templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(field.Description) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 267, Col: 69} | |
| 				} | |
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</div>") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "</div>") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 		} else if field.InputType == "checkbox" { | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<!-- Checkbox field --> <div class=\"mb-3\"><div class=\"form-check form-switch\"><input class=\"form-check-input\" type=\"checkbox\" id=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var11 string | |
| 			templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 277, Col: 39} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "\" name=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var12 string | |
| 			templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 278, Col: 41} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if getMaintenanceBoolField(config, field.JSONName) { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " checked") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "> <label class=\"form-check-label\" for=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var13 string | |
| 			templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 283, Col: 68} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "\"><strong>") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var14 string | |
| 			templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(field.DisplayName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 284, Col: 47} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</strong></label></div>") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Description != "" { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<div class=\"form-text text-muted\">") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				var templ_7745c5c3_Var15 string | |
| 				templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(field.Description) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 288, Col: 69} | |
| 				} | |
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</div>") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</div>") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 		} else { | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<!-- Number field --> <div class=\"mb-3\"><label for=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var16 string | |
| 			templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 294, Col: 39} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\" class=\"form-label\">") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var17 string | |
| 			templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(field.DisplayName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 295, Col: 35} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, " ") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Required { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<span class=\"text-danger\">*</span>") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</label> <input type=\"number\" class=\"form-control\" id=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var18 string | |
| 			templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 303, Col: 35} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "\" name=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var19 string | |
| 			templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(field.JSONName) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 304, Col: 37} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "\" value=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var20 string | |
| 			templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", getMaintenanceInt32Field(config, field.JSONName))) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 305, Col: 91} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\" placeholder=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var21 string | |
| 			templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(field.Placeholder) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 306, Col: 47} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.MinValue != nil { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, " min=\"") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				var templ_7745c5c3_Var22 string | |
| 				templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%v", field.MinValue)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 308, Col: 59} | |
| 				} | |
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "\"") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			if field.MaxValue != nil { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, " max=\"") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				var templ_7745c5c3_Var23 string | |
| 				templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%v", field.MaxValue)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 311, Col: 59} | |
| 				} | |
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "\"") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, " step=\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			var templ_7745c5c3_Var24 string | |
| 			templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(getNumberStep(field)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 313, Col: 43} | |
| 			} | |
| 			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "\"") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Required { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, " required") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "> ") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 			if field.Description != "" { | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<div class=\"form-text text-muted\">") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				var templ_7745c5c3_Var25 string | |
| 				templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(field.Description) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 319, Col: 69} | |
| 				} | |
| 				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "</div>") | |
| 				if templ_7745c5c3_Err != nil { | |
| 					return templ_7745c5c3_Err | |
| 				} | |
| 			} | |
| 			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "</div>") | |
| 			if templ_7745c5c3_Err != nil { | |
| 				return templ_7745c5c3_Err | |
| 			} | |
| 		} | |
| 		return nil | |
| 	}) | |
| } | |
| 
 | |
| // Helper functions for form field types | |
|  | |
| func getNumberStep(field *config.Field) string { | |
| 	if field.Type == config.FieldTypeFloat { | |
| 		return "0.01" | |
| 	} | |
| 	return "1" | |
| } | |
| 
 | |
| // Typed field getters for MaintenanceConfig - no interface{} needed | |
| func getMaintenanceInt32Field(config *maintenance.MaintenanceConfig, fieldName string) int32 { | |
| 	if config == nil { | |
| 		return 0 | |
| 	} | |
| 
 | |
| 	switch fieldName { | |
| 	case "scan_interval_seconds": | |
| 		return config.ScanIntervalSeconds | |
| 	case "worker_timeout_seconds": | |
| 		return config.WorkerTimeoutSeconds | |
| 	case "task_timeout_seconds": | |
| 		return config.TaskTimeoutSeconds | |
| 	case "retry_delay_seconds": | |
| 		return config.RetryDelaySeconds | |
| 	case "max_retries": | |
| 		return config.MaxRetries | |
| 	case "cleanup_interval_seconds": | |
| 		return config.CleanupIntervalSeconds | |
| 	case "task_retention_seconds": | |
| 		return config.TaskRetentionSeconds | |
| 	case "global_max_concurrent": | |
| 		if config.Policy != nil { | |
| 			return config.Policy.GlobalMaxConcurrent | |
| 		} | |
| 		return 0 | |
| 	default: | |
| 		return 0 | |
| 	} | |
| } | |
| 
 | |
| func getMaintenanceBoolField(config *maintenance.MaintenanceConfig, fieldName string) bool { | |
| 	if config == nil { | |
| 		return false | |
| 	} | |
| 
 | |
| 	switch fieldName { | |
| 	case "enabled": | |
| 		return config.Enabled | |
| 	default: | |
| 		return false | |
| 	} | |
| } | |
| 
 | |
| // Helper function to convert schema to JSON for JavaScript | |
| func schemaToJSON(schema *maintenance.MaintenanceConfigSchema) templ.Component { | |
| 	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { | |
| 		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context | |
| 		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { | |
| 			return templ_7745c5c3_CtxErr | |
| 		} | |
| 		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) | |
| 		if !templ_7745c5c3_IsBuffer { | |
| 			defer func() { | |
| 				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) | |
| 				if templ_7745c5c3_Err == nil { | |
| 					templ_7745c5c3_Err = templ_7745c5c3_BufErr | |
| 				} | |
| 			}() | |
| 		} | |
| 		ctx = templ.InitializeContext(ctx) | |
| 		templ_7745c5c3_Var26 := templ.GetChildren(ctx) | |
| 		if templ_7745c5c3_Var26 == nil { | |
| 			templ_7745c5c3_Var26 = templ.NopComponent | |
| 		} | |
| 		ctx = templ.ClearChildren(ctx) | |
| 		var templ_7745c5c3_Var27 string | |
| 		templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(`{}`) | |
| 		if templ_7745c5c3_Err != nil { | |
| 			return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/maintenance_config_schema.templ`, Line: 380, Col: 9} | |
| 		} | |
| 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) | |
| 		if templ_7745c5c3_Err != nil { | |
| 			return templ_7745c5c3_Err | |
| 		} | |
| 		return nil | |
| 	}) | |
| } | |
| 
 | |
| var _ = templruntime.GeneratedTemplate
 |