mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-05-16 23:01:30 +00:00
- Fix ShowPlugins handler to fetch plugins from registry instead of returning empty
- Update PluginsPageData struct to use []map[string]interface{} for proper data handling
- Rewrite plugins.templ to properly iterate and display plugin details
- Plugin count now displays correctly in the card header
- Plugin table shows ID, Name, Status, Version, Capabilities, and Actions
- Plugin worker successfully connects and displays in admin dashboard
fix: Add plugin routes to non-auth section and resolve route conflicts
- Plugin routes were only registered when authRequired=true (password set)
- When no admin password was set, auth was disabled and routes were skipped
- Also changed route paths to avoid conflicts in Gin router:
- Changed /jobs/:type to /jobs/by-type/:type to avoid conflict with /jobs/:id/cancel
- Changed /jobs/:type/trigger-detection to /trigger-detection/:type
- Changed /jobs/:id/cancel to /cancel-job/:id
- Plugin UI now accessible at http://localhost:23646/plugins
feat: Add plugin_worker command for new plugin system
- Create new generic plugin worker that connects to admin server via gRPC
- Supports multiple plugins: erasure_coding, vacuum, balance
- Replaces old task-based worker system with plugin-based approach
- Automatically registers with admin server on startup
- Sends periodic health reports to admin server
- Configuration saved in working directory
- Usage: weed plugin_worker -admin=localhost:33650 -plugins=erasure_coding,vacuum,balance
fix: Initialize plugin manager and register PluginService on gRPC server
- Initialize plugin manager in admin_server.initPluginManager() instead of placeholder
- Create plugin configuration directory in admin dataDir/plugins
- Register PluginService, AdminQueryService, and AdminCommandService on worker gRPC server
- Plugin worker can now connect and register with admin server
Changes:
- weed/admin/dash/admin_server.go: Properly initialize plugin manager
- weed/admin/dash/worker_grpc_server.go: Register plugin services on gRPC server
Testing:
- Plugin worker connects successfully to admin server
- Plugin capabilities are registered correctly
- Health reporting works as expected
93 lines
2.2 KiB
Plaintext
93 lines
2.2 KiB
Plaintext
package app
|
|
|
|
import "fmt"
|
|
|
|
type PluginsPageData struct {
|
|
Plugins []map[string]interface{}
|
|
JobTypes map[string]interface{}
|
|
}
|
|
|
|
templ PluginsOverview(data PluginsPageData) {
|
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
|
<h1 class="h2">
|
|
<i class="fas fa-plug me-2"></i>Plugins
|
|
</h1>
|
|
<div class="btn-toolbar mb-2 mb-md-0">
|
|
<div class="btn-group me-2">
|
|
<a href="/plugins" class="btn btn-sm btn-outline-primary">
|
|
<i class="fas fa-sync-alt me-1"></i>Refresh
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mb-4">
|
|
<div class="col-md-3 mb-4">
|
|
<div class="card border-left-primary shadow h-100 py-2">
|
|
<div class="card-body">
|
|
<div class="row no-gutters align-items-center">
|
|
<div class="col mr-2">
|
|
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Connected Plugins</div>
|
|
<div class="h3 mb-0">{ fmt.Sprintf("%d", len(data.Plugins)) }</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<i class="fas fa-plug fa-2x text-gray-300"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Connected Plugins</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
if len(data.Plugins) == 0 {
|
|
<div class="alert alert-info">No plugins connected</div>
|
|
} else {
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Plugin ID</th>
|
|
<th>Name</th>
|
|
<th>Status</th>
|
|
<th>Version</th>
|
|
<th>Capabilities</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
for _, p := range data.Plugins {
|
|
<tr>
|
|
<td><code>{ p["id"].(string) }</code></td>
|
|
<td>{ p["name"].(string) }</td>
|
|
<td>
|
|
if p["status"].(string) == "CONNECTED" {
|
|
<span class="badge bg-success">Connected</span>
|
|
} else {
|
|
<span class="badge bg-warning">{ p["status"].(string) }</span>
|
|
}
|
|
</td>
|
|
<td>{ p["version"].(string) }</td>
|
|
<td>
|
|
for _, cap := range p["capabilities"].([]string) {
|
|
<span class="badge bg-info me-1">{ cap }</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
<a href={ templ.SafeURL("/plugins/jobs/" + p["id"].(string)) } class="btn btn-sm btn-primary">Jobs</a>
|
|
<a href={ templ.SafeURL("/plugins/config/" + p["id"].(string)) } class="btn btn-sm btn-secondary">Config</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|