mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-05-16 23:01:30 +00:00
123 lines
2.7 KiB
Plaintext
123 lines
2.7 KiB
Plaintext
package app
|
|
|
|
type PluginConfigPageData struct {
|
|
JobType string
|
|
Config JobTypeConfig
|
|
DetectionHistory []interface{}
|
|
ExecutionHistory []interface{}
|
|
ActiveTab string
|
|
}
|
|
|
|
type JobTypeConfig struct {
|
|
Type string
|
|
Enabled bool
|
|
Priority int
|
|
Interval int64
|
|
MaxConcurrent int
|
|
Parameters map[string]string
|
|
RequiredDetections []string
|
|
}
|
|
|
|
templ PluginConfiguration(data PluginConfigPageData) {
|
|
<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-cog me-2"></i>Configuration
|
|
</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-secondary">
|
|
<i class="fas fa-arrow-left me-1"></i>Back
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Configuration</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<form id="configForm">
|
|
<div class="mb-3">
|
|
<label class="form-label">Enabled</label>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="enabled" />
|
|
<label class="form-check-label" for="enabled">Enable this job type</label>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-primary" id="saveBtn">Save Configuration</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Detection History</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
if len(data.DetectionHistory) == 0 {
|
|
<div class="alert alert-info">No detection records</div>
|
|
} else {
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Timestamp</th>
|
|
<th>Type</th>
|
|
<th>Severity</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
for i := 0; i < len(data.DetectionHistory); i++ {
|
|
<tr>
|
|
<td>2024-01-01 12:00:00</td>
|
|
<td><code>detection</code></td>
|
|
<td><span class="badge bg-info">LOW</span></td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Execution History</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
if len(data.ExecutionHistory) == 0 {
|
|
<div class="alert alert-info">No execution records</div>
|
|
} else {
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-sm">
|
|
<thead>
|
|
<tr>
|
|
<th>Job ID</th>
|
|
<th>State</th>
|
|
<th>Created</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
for i := 0; i < len(data.ExecutionHistory); i++ {
|
|
<tr>
|
|
<td><code>job_id</code></td>
|
|
<td><span class="badge bg-success">COMPLETED</span></td>
|
|
<td>2024-01-01 12:00:00</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('saveBtn').addEventListener('click', function() {
|
|
alert('Configuration saved');
|
|
});
|
|
</script>
|
|
}
|