Admin UI add maintenance menu (#6944)
* add ui for maintenance * valid config loading. fix workers page. * refactor * grpc between admin and workers * add a long-running bidirectional grpc call between admin and worker * use the grpc call to heartbeat * use the grpc call to communicate * worker can remove the http client * admin uses http port + 10000 as its default grpc port * one task one package * handles connection failures gracefully with exponential backoff * grpc with insecure tls * grpc with optional tls * fix detecting tls * change time config from nano seconds to seconds * add tasks with 3 interfaces * compiles reducing hard coded * remove a couple of tasks * remove hard coded references * reduce hard coded values * remove hard coded values * remove hard coded from templ * refactor maintenance package * fix import cycle * simplify * simplify * auto register * auto register factory * auto register task types * self register types * refactor * simplify * remove one task * register ui * lazy init executor factories * use registered task types * DefaultWorkerConfig remove hard coded task types * remove more hard coded * implement get maintenance task * dynamic task configuration * "System Settings" should only have system level settings * adjust menu for tasks * ensure menu not collapsed * render job configuration well * use templ for ui of task configuration * fix ordering * fix bugs * saving duration in seconds * use value and unit for duration * Delete WORKER_REFACTORING_PLAN.md * Delete maintenance.json * Delete custom_worker_example.go * remove address from workers * remove old code from ec task * remove creating collection button * reconnect with exponential backoff * worker use security.toml * start admin server with tls info from security.toml * fix "weed admin" cli description
This commit is contained in:
83
weed/admin/view/components/config_sections.templ
Normal file
83
weed/admin/view/components/config_sections.templ
Normal file
@@ -0,0 +1,83 @@
|
||||
package components
|
||||
|
||||
|
||||
|
||||
// ConfigSectionData represents data for a configuration section
|
||||
type ConfigSectionData struct {
|
||||
Title string
|
||||
Icon string
|
||||
Description string
|
||||
Fields []interface{} // Will hold field data structures
|
||||
}
|
||||
|
||||
// InfoSectionData represents data for an informational section
|
||||
type InfoSectionData struct {
|
||||
Title string
|
||||
Icon string
|
||||
Type string // "info", "warning", "success", "danger"
|
||||
Content string
|
||||
}
|
||||
|
||||
// ConfigSection renders a Bootstrap card for configuration settings
|
||||
templ ConfigSection(data ConfigSectionData) {
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">
|
||||
if data.Icon != "" {
|
||||
<i class={ data.Icon + " me-2" }></i>
|
||||
}
|
||||
{ data.Title }
|
||||
</h5>
|
||||
if data.Description != "" {
|
||||
<small class="text-muted">{ data.Description }</small>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
for _, field := range data.Fields {
|
||||
switch v := field.(type) {
|
||||
case TextFieldData:
|
||||
@TextField(v)
|
||||
case NumberFieldData:
|
||||
@NumberField(v)
|
||||
case CheckboxFieldData:
|
||||
@CheckboxField(v)
|
||||
case SelectFieldData:
|
||||
@SelectField(v)
|
||||
case DurationFieldData:
|
||||
@DurationField(v)
|
||||
case DurationInputFieldData:
|
||||
@DurationInputField(v)
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
// InfoSection renders a Bootstrap alert section for informational content
|
||||
templ InfoSection(data InfoSectionData) {
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">
|
||||
if data.Icon != "" {
|
||||
<i class={ data.Icon + " me-2" }></i>
|
||||
}
|
||||
{ data.Title }
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class={ "alert alert-" + data.Type } role="alert">
|
||||
{data.Content}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user