Files
s3/weed/admin/view/app/subscribers.templ
zooqueen dd74d3e6d6 Replace AGPL MinIO fork with Apache-2.0 SeaweedFS fork; rebrand CLI weed->s3
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.

- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
  "Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
  SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
  (replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
  keep their upstream import paths with zero churn. Internal identifiers and
  import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
  help/usage/flag strings, shell autocomplete program name, and the product name
  in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
  (e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
  `cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
  updated to ignore the `s3` build output.
2026-06-18 23:41:25 -07:00

151 lines
7.8 KiB
Templ

package app
import "fmt"
import "github.com/seaweedfs/seaweedfs/weed/admin/dash"
templ Subscribers(data dash.SubscribersData) {
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">Message Queue Subscribers</h1>
<small class="text-muted">Last updated: {data.LastUpdated.Format("2006-01-02 15:04:05")}</small>
</div>
<!-- Summary Cards -->
<div class="row mb-4">
<div class="col-md-4">
<div class="card text-center">
<div class="card-body">
<h5 class="card-title">Total Subscribers</h5>
<h3 class="text-primary">{fmt.Sprintf("%d", data.TotalSubscribers)}</h3>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-center">
<div class="card-body">
<h5 class="card-title">Active Subscribers</h5>
<h3 class="text-success">{fmt.Sprintf("%d", data.ActiveSubscribers)}</h3>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-center">
<div class="card-body">
<h5 class="card-title">Inactive Subscribers</h5>
<h3 class="text-warning">{fmt.Sprintf("%d", data.TotalSubscribers - data.ActiveSubscribers)}</h3>
</div>
</div>
</div>
</div>
<!-- Subscribers Table -->
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">Subscribers</h5>
<div>
<button class="btn btn-sm btn-outline-secondary" onclick="exportSubscribersCSV()">
<i class="fas fa-download me-1"></i>Export CSV
</button>
</div>
</div>
<div class="card-body">
if len(data.Subscribers) == 0 {
<div class="text-center py-4">
<i class="fas fa-user-friends fa-3x text-muted mb-3"></i>
<h5>No Subscribers Found</h5>
<p class="text-muted">No message queue subscribers are currently active.</p>
</div>
} else {
<div class="table-responsive">
<table class="table table-striped" id="subscribersTable">
<thead>
<tr>
<th>Subscriber Name</th>
<th>Topic</th>
<th>Consumer Group</th>
<th>Status</th>
<th>Messages Processed</th>
<th>Last Seen</th>
<th>Created</th>
</tr>
</thead>
<tbody>
for _, subscriber := range data.Subscribers {
<tr>
<td>
<strong>{subscriber.Name}</strong>
</td>
<td>
<span class="badge bg-info">{subscriber.Topic}</span>
</td>
<td>{subscriber.ConsumerGroup}</td>
<td>
if subscriber.Status == "active" {
<span class="badge bg-success">Active</span>
} else if subscriber.Status == "inactive" {
<span class="badge bg-warning">Inactive</span>
} else {
<span class="badge bg-secondary">{subscriber.Status}</span>
}
</td>
<td>{fmt.Sprintf("%d", subscriber.MessageCount)}</td>
<td>
if !subscriber.LastSeen.IsZero() {
<span class="text-muted">{subscriber.LastSeen.Format("2006-01-02 15:04:05")}</span>
} else {
<span class="text-muted">Never</span>
}
</td>
<td>
<span class="text-muted">{subscriber.CreatedAt.Format("2006-01-02 15:04:05")}</span>
</td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
</div>
</div>
</div>
</div>
<script>
function exportSubscribersCSV() {
const table = document.getElementById('subscribersTable');
if (!table) return;
let csv = 'Subscriber Name,Topic,Consumer Group,Status,Messages Processed,Last Seen,Created\n';
const rows = table.querySelectorAll('tbody tr');
rows.forEach(row => {
const cells = row.querySelectorAll('td');
if (cells.length >= 7) {
const rowData = [
cells[0].querySelector('strong')?.textContent || '',
cells[1].querySelector('.badge')?.textContent || '',
cells[2].textContent || '',
cells[3].querySelector('.badge')?.textContent || '',
cells[4].textContent || '',
cells[5].querySelector('span')?.textContent || '',
cells[6].querySelector('span')?.textContent || ''
];
csv += rowData.map(field => `"${field.replace(/"/g, '""')}"`).join(',') + '\n';
}
});
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', 'subscribers.csv');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
}