mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
admin: inspect an S3 object's versions, retention and chunk volume health (#13078)
* admin: inspect an S3 object's versions, retention and chunk volumes For a bucket and key, collect the base entry and every entry under <key>.versions, decode version id, delete marker, ETag, client checksum, Object Lock mode, retain-until, legal hold and the WORM enforcement time, and map each chunk to its volume. One filtered VolumeList then reports, per volume, replicas present versus the replica placement, or the EC shards present and missing against the data shard count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: serve the S3 object inspection at /api/s3/buckets/{bucket}/objects/inspect Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: add an Inspect Object page for a bucket and key /object-store/buckets/{bucket}/inspect?key= renders the inspection: volume health per chunk volume with a link to the volume or EC volume page, then every version with size, mtime, ETag, client checksum, lock mode, retain-until, legal hold, WORM time and its chunk file ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: link each bucket to the object inspector Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: inspect a key that is also a prefix of other keys The filer keeps such an object on a directory entry marked as a prefix object, so the base entry lookup must accept it like a file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count only S3 version entries as an object's history A sibling named <key>.versions is history only when it is a directory, and only children with a version id (attribute or v_ file name, as VersionIdFromEntry reads them) are versions. Without a base object or any such version the inspection is not found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: mark the newest version latest when the pointer is missing When the base object is gone and .versions has no latest pointer (for example after deleting a current null version), pick the latest with the S3 gateway's own version ordering, exported as SelectLatestVersionId, instead of leaving every version noncurrent. A truncated listing marks none, since it may not hold the newest version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report the ETag the S3 gateway returns Use objectETag, exported as ObjectETag, so remote-only entries show their remote ETag and entries without a stored ETag or MD5 show the chunk-derived one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: read the buckets path with the inspection's request context Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report the filer's logical size for each inspected version filer.FileSize also covers chunk extents past a stale attribute size and a newer remote size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: drop EC shard state once a volume also reports a replica Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: let the latest-version pointer outrank the null-is-latest flag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: page the inspector's version scan past non-version entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: judge an inspected EC volume by its newest encode run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ebe5c8ac91
commit
ef633dcc4d
9 files changed
+1823
-98
No files matched your search
@@ -0,0 +1,451 @@
|
||||
package dash
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/seaweedfs/seaweedfs/weed/filer"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/super_block"
|
||||
)
|
||||
|
||||
const (
|
||||
maxInspectedS3ObjectVersions = 10000
|
||||
inspectedS3ObjectVersionsPageSize = 1024
|
||||
)
|
||||
|
||||
type S3ObjectInspection struct {
|
||||
Bucket string `json:"bucket"`
|
||||
Key string `json:"key"`
|
||||
Versioned bool `json:"versioned"`
|
||||
Truncated bool `json:"truncated,omitempty"`
|
||||
Versions []S3ObjectVersionInspection `json:"versions"`
|
||||
Volumes []S3ObjectVolumeHealth `json:"volumes"`
|
||||
}
|
||||
|
||||
type S3ObjectVersionInspection struct {
|
||||
VersionId string `json:"versionId"`
|
||||
Path string `json:"path"`
|
||||
IsLatest bool `json:"isLatest"`
|
||||
IsDeleteMarker bool `json:"isDeleteMarker"`
|
||||
Size uint64 `json:"size"`
|
||||
ModifiedAt time.Time `json:"modifiedAt"`
|
||||
ETag string `json:"etag,omitempty"`
|
||||
ChecksumAlgorithm string `json:"checksumAlgorithm,omitempty"`
|
||||
ChecksumValue string `json:"checksumValue,omitempty"`
|
||||
ChecksumType string `json:"checksumType,omitempty"`
|
||||
ObjectLockMode string `json:"objectLockMode,omitempty"`
|
||||
RetainUntil *time.Time `json:"retainUntil,omitempty"`
|
||||
LegalHold string `json:"legalHold,omitempty"`
|
||||
WormEnforcedAt *time.Time `json:"wormEnforcedAt,omitempty"`
|
||||
InlineBytes int `json:"inlineBytes,omitempty"`
|
||||
RemoteStorage string `json:"remoteStorage,omitempty"`
|
||||
Chunks []S3ObjectChunkInspection `json:"chunks"`
|
||||
}
|
||||
|
||||
type S3ObjectChunkInspection struct {
|
||||
FileId string `json:"fileId"`
|
||||
VolumeId uint32 `json:"volumeId"`
|
||||
Offset int64 `json:"offset"`
|
||||
Size uint64 `json:"size"`
|
||||
IsManifest bool `json:"isManifest,omitempty"`
|
||||
}
|
||||
|
||||
type S3ObjectVolumeHealth struct {
|
||||
VolumeId uint32 `json:"volumeId"`
|
||||
Collection string `json:"collection,omitempty"`
|
||||
Kind string `json:"kind"`
|
||||
Servers []string `json:"servers,omitempty"`
|
||||
CopiesPresent int `json:"copiesPresent,omitempty"`
|
||||
CopiesExpected int `json:"copiesExpected,omitempty"`
|
||||
ReadOnly bool `json:"readOnly,omitempty"`
|
||||
EcShardsPresent int `json:"ecShardsPresent,omitempty"`
|
||||
EcDataShards int `json:"ecDataShards,omitempty"`
|
||||
EcTotalShards int `json:"ecTotalShards,omitempty"`
|
||||
EcMissingShards []uint32 `json:"ecMissingShards,omitempty"`
|
||||
Healthy bool `json:"healthy"`
|
||||
}
|
||||
|
||||
const (
|
||||
s3ObjectVolumeReplicated = "replicated"
|
||||
s3ObjectVolumeEc = "ec"
|
||||
s3ObjectVolumeMissing = "missing"
|
||||
)
|
||||
|
||||
func (s *AdminServer) InspectS3ObjectAPI(w http.ResponseWriter, r *http.Request) {
|
||||
bucket := mux.Vars(r)["bucket"]
|
||||
key := r.URL.Query().Get("key")
|
||||
if err := validateInspectedS3Object(bucket, key); err != nil {
|
||||
writeJSONError(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
inspection, err := s.InspectS3Object(r.Context(), bucket, strings.TrimPrefix(key, "/"))
|
||||
if err != nil {
|
||||
if errors.Is(err, filer_pb.ErrNotFound) {
|
||||
writeJSONError(w, http.StatusNotFound, err.Error())
|
||||
return
|
||||
}
|
||||
writeJSONError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, inspection)
|
||||
}
|
||||
|
||||
func validateInspectedS3Object(bucket, key string) error {
|
||||
if bucket == "" || strings.ContainsAny(bucket, "/\\") || bucket == "." || bucket == ".." {
|
||||
return fmt.Errorf("invalid bucket name %q", bucket)
|
||||
}
|
||||
key = strings.TrimPrefix(key, "/")
|
||||
if key == "" || strings.HasSuffix(key, "/") {
|
||||
return fmt.Errorf("object key is required")
|
||||
}
|
||||
for _, segment := range strings.Split(key, "/") {
|
||||
if segment == "" || segment == "." || segment == ".." {
|
||||
return fmt.Errorf("invalid object key %q", key)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AdminServer) InspectS3Object(ctx context.Context, bucket, key string) (*S3ObjectInspection, error) {
|
||||
inspection := &S3ObjectInspection{Bucket: bucket, Key: key}
|
||||
var objectDir, objectName string
|
||||
var baseEntry, versionsEntry *filer_pb.Entry
|
||||
var versionEntries []*filer_pb.Entry
|
||||
err := s.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
config, err := client.GetFilerConfiguration(ctx, &filer_pb.GetFilerConfigurationRequest{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("get filer configuration: %w", err)
|
||||
}
|
||||
bucketsPath := s3_constants.DefaultBucketsPath
|
||||
if config.DirBuckets != "" {
|
||||
bucketsPath = config.DirBuckets
|
||||
}
|
||||
objectDir, objectName = splitInspectedS3ObjectKey(bucketsPath+"/"+bucket, key)
|
||||
versionsName := objectName + s3_constants.VersionsFolder
|
||||
versionsDir := objectDir + "/" + versionsName
|
||||
if _, err := filer_pb.LookupEntry(ctx, client, &filer_pb.LookupDirectoryEntryRequest{Directory: bucketsPath, Name: bucket}); err != nil {
|
||||
return fmt.Errorf("bucket %s: %w", bucket, err)
|
||||
}
|
||||
if resp, err := filer_pb.LookupEntry(ctx, client, &filer_pb.LookupDirectoryEntryRequest{Directory: objectDir, Name: objectName}); err == nil {
|
||||
if !resp.Entry.IsDirectory || resp.Entry.IsPrefixObject() {
|
||||
baseEntry = resp.Entry
|
||||
}
|
||||
} else if !errors.Is(err, filer_pb.ErrNotFound) {
|
||||
return fmt.Errorf("lookup %s/%s: %w", objectDir, objectName, err)
|
||||
}
|
||||
if resp, err := filer_pb.LookupEntry(ctx, client, &filer_pb.LookupDirectoryEntryRequest{Directory: objectDir, Name: versionsName}); err == nil {
|
||||
if resp.Entry.IsDirectory {
|
||||
versionsEntry = resp.Entry
|
||||
}
|
||||
} else if !errors.Is(err, filer_pb.ErrNotFound) {
|
||||
return fmt.Errorf("lookup %s: %w", versionsDir, err)
|
||||
}
|
||||
if versionsEntry == nil {
|
||||
return nil
|
||||
}
|
||||
versionEntries, inspection.Truncated, err = listInspectedS3ObjectVersions(ctx, client, versionsDir)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if baseEntry == nil && len(versionEntries) == 0 {
|
||||
return nil, fmt.Errorf("object %s/%s: %w", bucket, key, filer_pb.ErrNotFound)
|
||||
}
|
||||
|
||||
inspection.Versioned = versionsEntry != nil
|
||||
inspection.Versions = assembleS3ObjectVersions(objectDir, objectName, baseEntry, versionsEntry, versionEntries, inspection.Truncated)
|
||||
|
||||
volumeIds := s3ObjectVolumeIds(inspection.Versions)
|
||||
if len(volumeIds) == 0 {
|
||||
return inspection, nil
|
||||
}
|
||||
var topology *master_pb.TopologyInfo
|
||||
err = s.WithMasterClient(func(client master_pb.SeaweedClient) error {
|
||||
resp, err := pb.CollectVolumeList(ctx, client, &master_pb.VolumeListRequest{VolumeIds: volumeIds})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
topology = resp.TopologyInfo
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("volume list: %w", err)
|
||||
}
|
||||
inspection.Volumes = summarizeS3ObjectVolumes(volumeIds, topology)
|
||||
return inspection, nil
|
||||
}
|
||||
|
||||
// listInspectedS3ObjectVersions pages through versionsDir, skipping entries
|
||||
// without a version id, until it holds maxInspectedS3ObjectVersions versions.
|
||||
func listInspectedS3ObjectVersions(ctx context.Context, client filer_pb.SeaweedFilerClient, versionsDir string) (versions []*filer_pb.Entry, truncated bool, err error) {
|
||||
startFrom := ""
|
||||
for {
|
||||
listed, last := 0, false
|
||||
err = filer_pb.SeaweedList(ctx, client, versionsDir, "", func(entry *filer_pb.Entry, isLast bool) error {
|
||||
listed++
|
||||
last = isLast
|
||||
startFrom = entry.Name
|
||||
if s3api.VersionIdFromEntry(entry) == "" {
|
||||
return nil
|
||||
}
|
||||
if len(versions) >= maxInspectedS3ObjectVersions {
|
||||
truncated = true
|
||||
return nil
|
||||
}
|
||||
versions = append(versions, entry)
|
||||
return nil
|
||||
}, startFrom, false, inspectedS3ObjectVersionsPageSize)
|
||||
if err != nil || truncated || last || listed == 0 {
|
||||
return versions, truncated, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func splitInspectedS3ObjectKey(bucketDir, key string) (dir, name string) {
|
||||
if i := strings.LastIndex(key, "/"); i >= 0 {
|
||||
return bucketDir + "/" + key[:i], key[i+1:]
|
||||
}
|
||||
return bucketDir, key
|
||||
}
|
||||
|
||||
func assembleS3ObjectVersions(objectDir, objectName string, baseEntry, versionsEntry *filer_pb.Entry, versionEntries []*filer_pb.Entry, truncated bool) []S3ObjectVersionInspection {
|
||||
var latestVersionId string
|
||||
nullIsLatest := versionsEntry == nil
|
||||
if versionsEntry != nil {
|
||||
latestVersionId = string(versionsEntry.Extended[s3_constants.ExtLatestVersionIdKey])
|
||||
nullIsLatest = latestVersionId == ""
|
||||
}
|
||||
if baseEntry == nil && latestVersionId == "" {
|
||||
nullIsLatest = false
|
||||
if !truncated {
|
||||
latestVersionId = s3api.SelectLatestVersionId(versionEntries)
|
||||
}
|
||||
}
|
||||
|
||||
var versions []S3ObjectVersionInspection
|
||||
if baseEntry != nil {
|
||||
version := inspectS3ObjectVersion(objectDir+"/"+objectName, baseEntry)
|
||||
if version.VersionId == "" {
|
||||
version.VersionId = "null"
|
||||
}
|
||||
version.IsLatest = nullIsLatest || version.VersionId == latestVersionId
|
||||
versions = append(versions, version)
|
||||
}
|
||||
versionsDir := objectDir + "/" + objectName + s3_constants.VersionsFolder
|
||||
for _, entry := range versionEntries {
|
||||
version := inspectS3ObjectVersion(versionsDir+"/"+entry.Name, entry)
|
||||
version.VersionId = s3api.VersionIdFromEntry(entry)
|
||||
version.IsLatest = !nullIsLatest && version.VersionId == latestVersionId
|
||||
versions = append(versions, version)
|
||||
}
|
||||
sort.SliceStable(versions, func(i, j int) bool {
|
||||
if versions[i].IsLatest != versions[j].IsLatest {
|
||||
return versions[i].IsLatest
|
||||
}
|
||||
return versions[i].ModifiedAt.After(versions[j].ModifiedAt)
|
||||
})
|
||||
return versions
|
||||
}
|
||||
|
||||
func inspectS3ObjectVersion(path string, entry *filer_pb.Entry) S3ObjectVersionInspection {
|
||||
ext := entry.Extended
|
||||
version := S3ObjectVersionInspection{
|
||||
VersionId: string(ext[s3_constants.ExtVersionIdKey]),
|
||||
Path: path,
|
||||
IsDeleteMarker: string(ext[s3_constants.ExtDeleteMarkerKey]) == "true",
|
||||
ETag: strings.Trim(s3api.ObjectETag(entry), `"`),
|
||||
ChecksumAlgorithm: string(ext[s3_constants.ExtChecksumAlgorithm]),
|
||||
ChecksumValue: string(ext[s3_constants.ExtChecksumValue]),
|
||||
ChecksumType: string(ext[s3_constants.ExtChecksumType]),
|
||||
ObjectLockMode: string(ext[s3_constants.ExtObjectLockModeKey]),
|
||||
LegalHold: string(ext[s3_constants.ExtLegalHoldKey]),
|
||||
InlineBytes: len(entry.Content),
|
||||
Size: filer.FileSize(entry),
|
||||
}
|
||||
if attr := entry.Attributes; attr != nil {
|
||||
version.ModifiedAt = time.Unix(attr.Mtime, int64(attr.MtimeNs)).UTC()
|
||||
}
|
||||
if entry.WormEnforcedAtTsNs > 0 {
|
||||
t := time.Unix(0, entry.WormEnforcedAtTsNs).UTC()
|
||||
version.WormEnforcedAt = &t
|
||||
}
|
||||
if raw := string(ext[s3_constants.ExtRetentionUntilDateKey]); raw != "" {
|
||||
if seconds, err := strconv.ParseInt(raw, 10, 64); err == nil {
|
||||
t := time.Unix(seconds, 0).UTC()
|
||||
version.RetainUntil = &t
|
||||
}
|
||||
}
|
||||
if entry.RemoteEntry != nil {
|
||||
version.RemoteStorage = entry.RemoteEntry.StorageName
|
||||
}
|
||||
for _, chunk := range entry.Chunks {
|
||||
c := S3ObjectChunkInspection{
|
||||
FileId: chunk.GetFileIdString(),
|
||||
Offset: chunk.Offset,
|
||||
Size: chunk.Size,
|
||||
IsManifest: chunk.IsChunkManifest,
|
||||
}
|
||||
if chunk.Fid != nil {
|
||||
c.VolumeId = chunk.Fid.VolumeId
|
||||
} else if fid, err := filer_pb.ToFileIdObject(chunk.FileId); err == nil {
|
||||
c.VolumeId = fid.VolumeId
|
||||
}
|
||||
version.Chunks = append(version.Chunks, c)
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
func s3ObjectVolumeIds(versions []S3ObjectVersionInspection) []uint32 {
|
||||
seen := make(map[uint32]bool)
|
||||
var ids []uint32
|
||||
for _, version := range versions {
|
||||
for _, chunk := range version.Chunks {
|
||||
if chunk.VolumeId == 0 || seen[chunk.VolumeId] {
|
||||
continue
|
||||
}
|
||||
seen[chunk.VolumeId] = true
|
||||
ids = append(ids, chunk.VolumeId)
|
||||
}
|
||||
}
|
||||
sort.Slice(ids, func(i, j int) bool { return ids[i] < ids[j] })
|
||||
return ids
|
||||
}
|
||||
|
||||
func summarizeS3ObjectVolumes(volumeIds []uint32, topology *master_pb.TopologyInfo) []S3ObjectVolumeHealth {
|
||||
health := make(map[uint32]*S3ObjectVolumeHealth, len(volumeIds))
|
||||
for _, id := range volumeIds {
|
||||
health[id] = &S3ObjectVolumeHealth{VolumeId: id, Kind: s3ObjectVolumeMissing}
|
||||
}
|
||||
ecRuns := make(map[uint32]map[int64]*s3ObjectEcRun)
|
||||
if topology != nil {
|
||||
for _, dc := range topology.DataCenterInfos {
|
||||
for _, rack := range dc.RackInfos {
|
||||
for _, node := range rack.DataNodeInfos {
|
||||
for _, disk := range node.DiskInfos {
|
||||
for _, v := range disk.VolumeInfos {
|
||||
h := health[v.Id]
|
||||
if h == nil {
|
||||
continue
|
||||
}
|
||||
h.Kind = s3ObjectVolumeReplicated
|
||||
h.Collection = v.Collection
|
||||
h.Servers = append(h.Servers, node.Id)
|
||||
h.CopiesPresent++
|
||||
h.ReadOnly = h.ReadOnly || v.ReadOnly
|
||||
if rp, err := super_block.NewReplicaPlacementFromByte(byte(v.ReplicaPlacement)); err == nil {
|
||||
h.CopiesExpected = rp.GetCopyCount()
|
||||
}
|
||||
}
|
||||
for _, ec := range disk.EcShardInfos {
|
||||
h := health[ec.Id]
|
||||
if h == nil || h.Kind == s3ObjectVolumeReplicated {
|
||||
continue
|
||||
}
|
||||
h.Kind = s3ObjectVolumeEc
|
||||
h.Collection = ec.Collection
|
||||
if ecRuns[ec.Id] == nil {
|
||||
ecRuns[ec.Id] = make(map[int64]*s3ObjectEcRun)
|
||||
}
|
||||
run := ecRuns[ec.Id][ec.EncodeTsNs]
|
||||
if run == nil {
|
||||
run = &s3ObjectEcRun{}
|
||||
ecRuns[ec.Id][ec.EncodeTsNs] = run
|
||||
}
|
||||
run.servers = append(run.servers, node.Id)
|
||||
run.dataShards = erasure_coding.EcShardsVolumeDataShards(ec)
|
||||
run.totalShards = run.dataShards + erasure_coding.EcShardsVolumeParityShards(ec)
|
||||
run.bits |= erasure_coding.ShardBits(ec.EcIndexBits)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result := make([]S3ObjectVolumeHealth, 0, len(volumeIds))
|
||||
for _, id := range volumeIds {
|
||||
h := health[id]
|
||||
switch h.Kind {
|
||||
case s3ObjectVolumeReplicated:
|
||||
h.Healthy = h.CopiesPresent >= h.CopiesExpected
|
||||
case s3ObjectVolumeEc:
|
||||
run := currentS3ObjectEcRun(ecRuns[id])
|
||||
h.Servers = run.servers
|
||||
h.EcDataShards = run.dataShards
|
||||
h.EcTotalShards = run.totalShards
|
||||
bits := run.bits
|
||||
for shardId := 0; shardId < h.EcTotalShards; shardId++ {
|
||||
if bits.Has(erasure_coding.ShardId(shardId)) {
|
||||
h.EcShardsPresent++
|
||||
} else {
|
||||
h.EcMissingShards = append(h.EcMissingShards, uint32(shardId))
|
||||
}
|
||||
}
|
||||
h.Healthy = h.EcShardsPresent >= h.EcDataShards
|
||||
}
|
||||
sort.Strings(h.Servers)
|
||||
result = append(result, *h)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
type s3ObjectEcRun struct {
|
||||
bits erasure_coding.ShardBits
|
||||
dataShards int
|
||||
totalShards int
|
||||
servers []string
|
||||
}
|
||||
|
||||
// currentS3ObjectEcRun returns the newest encode run of a volume's EC shards,
|
||||
// joined by shards whose server reports no encode run.
|
||||
func currentS3ObjectEcRun(runs map[int64]*s3ObjectEcRun) s3ObjectEcRun {
|
||||
var newest int64
|
||||
for encodeTsNs := range runs {
|
||||
newest = max(newest, encodeTsNs)
|
||||
}
|
||||
current := *runs[newest]
|
||||
if unknown := runs[0]; newest != 0 && unknown != nil {
|
||||
current.bits |= unknown.bits
|
||||
current.servers = append(append([]string(nil), current.servers...), unknown.servers...)
|
||||
}
|
||||
return current
|
||||
}
|
||||
|
||||
type S3ObjectInspectorData struct {
|
||||
Username string `json:"username"`
|
||||
Bucket string `json:"bucket"`
|
||||
Key string `json:"key"`
|
||||
Inspection *S3ObjectInspection `json:"inspection,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
func (s *AdminServer) GetS3ObjectInspectorData(ctx context.Context, bucket, key string) S3ObjectInspectorData {
|
||||
data := S3ObjectInspectorData{Bucket: bucket, Key: key}
|
||||
if key == "" {
|
||||
return data
|
||||
}
|
||||
if err := validateInspectedS3Object(bucket, key); err != nil {
|
||||
data.Error = err.Error()
|
||||
return data
|
||||
}
|
||||
inspection, err := s.InspectS3Object(ctx, bucket, strings.TrimPrefix(key, "/"))
|
||||
if err != nil {
|
||||
data.Error = err.Error()
|
||||
return data
|
||||
}
|
||||
data.Inspection = inspection
|
||||
return data
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package dash
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func TestValidateInspectedS3Object(t *testing.T) {
|
||||
valid := [][2]string{{"b", "k"}, {"b", "/a/b.txt"}, {"b", "a/b c/d"}}
|
||||
for _, c := range valid {
|
||||
if err := validateInspectedS3Object(c[0], c[1]); err != nil {
|
||||
t.Errorf("validateInspectedS3Object(%q, %q) = %v", c[0], c[1], err)
|
||||
}
|
||||
}
|
||||
invalid := [][2]string{{"", "k"}, {"a/b", "k"}, {"..", "k"}, {"b", ""}, {"b", "dir/"}, {"b", "a/../k"}, {"b", "a//k"}, {"b", "./k"}}
|
||||
for _, c := range invalid {
|
||||
if err := validateInspectedS3Object(c[0], c[1]); err == nil {
|
||||
t.Errorf("validateInspectedS3Object(%q, %q) accepted", c[0], c[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitInspectedS3ObjectKey(t *testing.T) {
|
||||
dir, name := splitInspectedS3ObjectKey("/buckets/b", "a/b/c.txt")
|
||||
if dir != "/buckets/b/a/b" || name != "c.txt" {
|
||||
t.Fatalf("got %q %q", dir, name)
|
||||
}
|
||||
dir, name = splitInspectedS3ObjectKey("/buckets/b", "c.txt")
|
||||
if dir != "/buckets/b" || name != "c.txt" {
|
||||
t.Fatalf("got %q %q", dir, name)
|
||||
}
|
||||
}
|
||||
|
||||
func inspectorTestEntry(name string, mtime int64, ext map[string]string, chunks ...*filer_pb.FileChunk) *filer_pb.Entry {
|
||||
extended := make(map[string][]byte, len(ext))
|
||||
for k, v := range ext {
|
||||
extended[k] = []byte(v)
|
||||
}
|
||||
return &filer_pb.Entry{
|
||||
Name: name,
|
||||
Attributes: &filer_pb.FuseAttributes{FileSize: 10, Mtime: mtime},
|
||||
Extended: extended,
|
||||
Chunks: chunks,
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssembleS3ObjectVersions(t *testing.T) {
|
||||
versionsEntry := inspectorTestEntry("k.versions", 0, map[string]string{s3_constants.ExtLatestVersionIdKey: "v2"})
|
||||
locked := inspectorTestEntry("v_v1", 100, map[string]string{
|
||||
s3_constants.ExtVersionIdKey: "v1",
|
||||
s3_constants.ExtETagKey: `"abc"`,
|
||||
s3_constants.ExtChecksumAlgorithm: "SHA256",
|
||||
s3_constants.ExtChecksumValue: "c2hh",
|
||||
s3_constants.ExtObjectLockModeKey: s3_constants.RetentionModeCompliance,
|
||||
s3_constants.ExtRetentionUntilDateKey: "1893456000",
|
||||
s3_constants.ExtLegalHoldKey: s3_constants.LegalHoldOn,
|
||||
}, &filer_pb.FileChunk{FileId: "7,01637037d6", Size: 10}, &filer_pb.FileChunk{Fid: &filer_pb.FileId{VolumeId: 9, FileKey: 1, Cookie: 2}, Offset: 10, Size: 5, IsChunkManifest: true})
|
||||
locked.WormEnforcedAtTsNs = time.Unix(200, 0).UnixNano()
|
||||
marker := inspectorTestEntry("v_v2", 300, map[string]string{
|
||||
s3_constants.ExtVersionIdKey: "v2",
|
||||
s3_constants.ExtDeleteMarkerKey: "true",
|
||||
})
|
||||
base := inspectorTestEntry("k", 50, nil, &filer_pb.FileChunk{FileId: "3,02637037d6", Size: 10})
|
||||
|
||||
versions := assembleS3ObjectVersions("/buckets/b/d", "k", base, versionsEntry, []*filer_pb.Entry{locked, marker}, false)
|
||||
if len(versions) != 3 {
|
||||
t.Fatalf("got %d versions", len(versions))
|
||||
}
|
||||
if v := versions[0]; v.VersionId != "v2" || !v.IsLatest || !v.IsDeleteMarker || v.Path != "/buckets/b/d/k.versions/v_v2" {
|
||||
t.Fatalf("latest = %+v", v)
|
||||
}
|
||||
v1 := versions[1]
|
||||
if v1.VersionId != "v1" || v1.IsLatest || v1.ETag != "abc" || v1.ChecksumAlgorithm != "SHA256" || v1.ChecksumValue != "c2hh" {
|
||||
t.Fatalf("v1 = %+v", v1)
|
||||
}
|
||||
if v1.ObjectLockMode != s3_constants.RetentionModeCompliance || v1.LegalHold != s3_constants.LegalHoldOn {
|
||||
t.Fatalf("v1 lock = %+v", v1)
|
||||
}
|
||||
if v1.RetainUntil == nil || !v1.RetainUntil.Equal(time.Unix(1893456000, 0)) {
|
||||
t.Fatalf("v1 retain until = %v", v1.RetainUntil)
|
||||
}
|
||||
if v1.WormEnforcedAt == nil || !v1.WormEnforcedAt.Equal(time.Unix(200, 0)) {
|
||||
t.Fatalf("v1 worm = %v", v1.WormEnforcedAt)
|
||||
}
|
||||
if len(v1.Chunks) != 2 || v1.Chunks[0].VolumeId != 7 || v1.Chunks[1].VolumeId != 9 || !v1.Chunks[1].IsManifest || v1.Chunks[1].FileId == "" {
|
||||
t.Fatalf("v1 chunks = %+v", v1.Chunks)
|
||||
}
|
||||
if v := versions[2]; v.VersionId != "null" || v.IsLatest || v.Path != "/buckets/b/d/k" {
|
||||
t.Fatalf("null = %+v", v)
|
||||
}
|
||||
if ids := s3ObjectVolumeIds(versions); !reflect.DeepEqual(ids, []uint32{3, 7, 9}) {
|
||||
t.Fatalf("volume ids = %v", ids)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssembleS3ObjectVersionsNullLatest(t *testing.T) {
|
||||
base := inspectorTestEntry("k", 50, nil)
|
||||
if versions := assembleS3ObjectVersions("/buckets/b", "k", base, nil, nil, false); len(versions) != 1 || !versions[0].IsLatest || versions[0].VersionId != "null" {
|
||||
t.Fatalf("unversioned = %+v", versions)
|
||||
}
|
||||
versionsEntry := inspectorTestEntry("k.versions", 0, map[string]string{
|
||||
s3_constants.ExtLatestVersionIdKey: "v1",
|
||||
s3_constants.ExtNullVersionIsLatestKey: "true",
|
||||
})
|
||||
v1 := inspectorTestEntry("v_v1", 100, map[string]string{s3_constants.ExtVersionIdKey: "v1"})
|
||||
versions := assembleS3ObjectVersions("/buckets/b", "k", base, versionsEntry, []*filer_pb.Entry{v1}, false)
|
||||
if len(versions) != 2 || versions[0].VersionId != "v1" || !versions[0].IsLatest || versions[1].IsLatest {
|
||||
t.Fatalf("pointer with stale null flag = %+v", versions)
|
||||
}
|
||||
suspended := inspectorTestEntry("k.versions", 0, map[string]string{s3_constants.ExtNullVersionIsLatestKey: "true"})
|
||||
versions = assembleS3ObjectVersions("/buckets/b", "k", base, suspended, []*filer_pb.Entry{v1}, false)
|
||||
if len(versions) != 2 || versions[0].VersionId != "null" || !versions[0].IsLatest || versions[1].IsLatest {
|
||||
t.Fatalf("suspended = %+v", versions)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssembleS3ObjectVersionsWithoutPointer(t *testing.T) {
|
||||
older := inspectorTestEntry("v_6713f0ad56f535bcb4717d38b89d2800", 200, map[string]string{s3_constants.ExtVersionIdKey: "6713f0ad56f535bcb4717d38b89d2800"})
|
||||
newer := inspectorTestEntry("v_6713f0ad569d387d178b2ca8fab47783", 100, map[string]string{s3_constants.ExtVersionIdKey: "6713f0ad569d387d178b2ca8fab47783"})
|
||||
versionsEntry := inspectorTestEntry("k.versions", 0, map[string]string{s3_constants.ExtNullVersionIsLatestKey: "true"})
|
||||
|
||||
versions := assembleS3ObjectVersions("/buckets/b", "k", nil, versionsEntry, []*filer_pb.Entry{older, newer}, false)
|
||||
if len(versions) != 2 || versions[0].VersionId != newer.Name[2:] || !versions[0].IsLatest || versions[1].IsLatest {
|
||||
t.Fatalf("recovered = %+v", versions)
|
||||
}
|
||||
for _, v := range assembleS3ObjectVersions("/buckets/b", "k", nil, versionsEntry, []*filer_pb.Entry{older, newer}, true) {
|
||||
if v.IsLatest {
|
||||
t.Fatalf("truncated scan marked %s latest", v.VersionId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestInspectS3ObjectVersionRemoteETag(t *testing.T) {
|
||||
entry := inspectorTestEntry("k", 1, nil)
|
||||
entry.RemoteEntry = &filer_pb.RemoteEntry{StorageName: "s3remote", RemoteETag: "abc", RemoteSize: 10}
|
||||
if v := inspectS3ObjectVersion("/buckets/b/k", entry); v.ETag != "abc" || v.RemoteStorage != "s3remote" {
|
||||
t.Fatalf("remote = %+v", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInspectS3ObjectVersionSizeFromChunks(t *testing.T) {
|
||||
entry := inspectorTestEntry("k", 1, nil, &filer_pb.FileChunk{FileId: "3,02637037d6", Offset: 0, Size: 64})
|
||||
entry.Attributes.FileSize = 0
|
||||
if v := inspectS3ObjectVersion("/buckets/b/k", entry); v.Size != 64 {
|
||||
t.Fatalf("size = %d", v.Size)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSummarizeS3ObjectVolumes(t *testing.T) {
|
||||
node := func(id string, disks ...*master_pb.DiskInfo) *master_pb.DataNodeInfo {
|
||||
m := make(map[string]*master_pb.DiskInfo)
|
||||
for i, d := range disks {
|
||||
m[string(rune('a'+i))] = d
|
||||
}
|
||||
return &master_pb.DataNodeInfo{Id: id, DiskInfos: m}
|
||||
}
|
||||
topology := &master_pb.TopologyInfo{DataCenterInfos: []*master_pb.DataCenterInfo{{
|
||||
Id: "dc1",
|
||||
RackInfos: []*master_pb.RackInfo{{
|
||||
Id: "r1",
|
||||
DataNodeInfos: []*master_pb.DataNodeInfo{
|
||||
node("s1:8080", &master_pb.DiskInfo{
|
||||
VolumeInfos: []*master_pb.VolumeInformationMessage{{Id: 1, Collection: "b", ReplicaPlacement: 1}, {Id: 2, ReplicaPlacement: 0}, {Id: 99}},
|
||||
EcShardInfos: []*master_pb.VolumeEcShardInformationMessage{{Id: 3, Collection: "b", EcIndexBits: 0x3ff}},
|
||||
}),
|
||||
node("s2:8080", &master_pb.DiskInfo{
|
||||
EcShardInfos: []*master_pb.VolumeEcShardInformationMessage{{Id: 3, Collection: "b", EcIndexBits: 0x400}, {Id: 4, EcIndexBits: 0x1ff}},
|
||||
}),
|
||||
},
|
||||
}},
|
||||
}}}
|
||||
|
||||
got := summarizeS3ObjectVolumes([]uint32{1, 2, 3, 4, 5}, topology)
|
||||
if len(got) != 5 {
|
||||
t.Fatalf("got %d volumes", len(got))
|
||||
}
|
||||
if v := got[0]; v.Kind != s3ObjectVolumeReplicated || v.CopiesPresent != 1 || v.CopiesExpected != 2 || v.Healthy {
|
||||
t.Errorf("volume 1 = %+v", v)
|
||||
}
|
||||
if v := got[1]; v.Kind != s3ObjectVolumeReplicated || v.CopiesPresent != 1 || v.CopiesExpected != 1 || !v.Healthy {
|
||||
t.Errorf("volume 2 = %+v", v)
|
||||
}
|
||||
if v := got[2]; v.Kind != s3ObjectVolumeEc || v.EcShardsPresent != 11 || !v.Healthy || !reflect.DeepEqual(v.EcMissingShards, []uint32{11, 12, 13}) || !reflect.DeepEqual(v.Servers, []string{"s1:8080", "s2:8080"}) {
|
||||
t.Errorf("volume 3 = %+v", v)
|
||||
}
|
||||
if v := got[3]; v.Kind != s3ObjectVolumeEc || v.EcShardsPresent != 9 || v.Healthy {
|
||||
t.Errorf("volume 4 = %+v", v)
|
||||
}
|
||||
if v := got[4]; v.Kind != s3ObjectVolumeMissing || v.Healthy {
|
||||
t.Errorf("volume 5 = %+v", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSummarizeS3ObjectVolumesPrefersReplicaOverEcShards(t *testing.T) {
|
||||
topology := &master_pb.TopologyInfo{DataCenterInfos: []*master_pb.DataCenterInfo{{
|
||||
RackInfos: []*master_pb.RackInfo{{
|
||||
DataNodeInfos: []*master_pb.DataNodeInfo{
|
||||
{Id: "a-ec:8080", DiskInfos: map[string]*master_pb.DiskInfo{"": {EcShardInfos: []*master_pb.VolumeEcShardInformationMessage{{Id: 6, EcIndexBits: 0x3fff}}}}},
|
||||
{Id: "b-vol:8080", DiskInfos: map[string]*master_pb.DiskInfo{"": {VolumeInfos: []*master_pb.VolumeInformationMessage{{Id: 6}}}}},
|
||||
},
|
||||
}},
|
||||
}}}
|
||||
got := summarizeS3ObjectVolumes([]uint32{6}, topology)
|
||||
if v := got[0]; v.Kind != s3ObjectVolumeReplicated || !reflect.DeepEqual(v.Servers, []string{"b-vol:8080"}) || v.EcTotalShards != 0 || v.EcShardsPresent != 0 || !v.Healthy {
|
||||
t.Fatalf("volume 6 = %+v", v)
|
||||
}
|
||||
}
|
||||
|
||||
type inspectorListStream struct {
|
||||
grpc.ServerStreamingClient[filer_pb.ListEntriesResponse]
|
||||
entries []*filer_pb.Entry
|
||||
}
|
||||
|
||||
func (s *inspectorListStream) Recv() (*filer_pb.ListEntriesResponse, error) {
|
||||
if len(s.entries) == 0 {
|
||||
return nil, io.EOF
|
||||
}
|
||||
e := s.entries[0]
|
||||
s.entries = s.entries[1:]
|
||||
return &filer_pb.ListEntriesResponse{Entry: e}, nil
|
||||
}
|
||||
|
||||
func (s *inspectorListStream) Trailer() metadata.MD { return nil }
|
||||
|
||||
type inspectorListClient struct {
|
||||
filer_pb.SeaweedFilerClient
|
||||
entries []*filer_pb.Entry
|
||||
}
|
||||
|
||||
func (c *inspectorListClient) ListEntries(ctx context.Context, in *filer_pb.ListEntriesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[filer_pb.ListEntriesResponse], error) {
|
||||
i := sort.Search(len(c.entries), func(i int) bool { return c.entries[i].Name > in.StartFromFileName })
|
||||
end := min(len(c.entries), i+int(in.Limit))
|
||||
return &inspectorListStream{entries: c.entries[i:end]}, nil
|
||||
}
|
||||
|
||||
func TestListInspectedS3ObjectVersionsSkipsNonVersionEntries(t *testing.T) {
|
||||
versions := func(n int) []*filer_pb.Entry {
|
||||
entries := []*filer_pb.Entry{{Name: "a-not-a-version"}}
|
||||
for i := 0; i < n; i++ {
|
||||
id := fmt.Sprintf("%032x", i)
|
||||
entries = append(entries, inspectorTestEntry("v_"+id, 1, map[string]string{s3_constants.ExtVersionIdKey: id}))
|
||||
}
|
||||
return entries
|
||||
}
|
||||
ctx := context.Background()
|
||||
for _, c := range []struct {
|
||||
versions int
|
||||
want int
|
||||
truncated bool
|
||||
}{
|
||||
{0, 0, false},
|
||||
{maxInspectedS3ObjectVersions, maxInspectedS3ObjectVersions, false},
|
||||
{maxInspectedS3ObjectVersions + 1, maxInspectedS3ObjectVersions, true},
|
||||
{inspectedS3ObjectVersionsPageSize - 1, inspectedS3ObjectVersionsPageSize - 1, false},
|
||||
} {
|
||||
got, truncated, err := listInspectedS3ObjectVersions(ctx, &inspectorListClient{entries: versions(c.versions)}, "/buckets/b/k.versions")
|
||||
if err != nil || len(got) != c.want || truncated != c.truncated {
|
||||
t.Errorf("%d versions: got %d truncated=%v err=%v", c.versions, len(got), truncated, err)
|
||||
}
|
||||
}
|
||||
got, truncated, err := listInspectedS3ObjectVersions(ctx, &inspectorListClient{}, "/buckets/b/k.versions")
|
||||
if err != nil || len(got) != 0 || truncated {
|
||||
t.Errorf("empty: got %d truncated=%v err=%v", len(got), truncated, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSummarizeS3ObjectVolumesCountsOneEncodeRun(t *testing.T) {
|
||||
holder := func(id string, shards ...*master_pb.VolumeEcShardInformationMessage) *master_pb.DataNodeInfo {
|
||||
return &master_pb.DataNodeInfo{Id: id, DiskInfos: map[string]*master_pb.DiskInfo{"": {EcShardInfos: shards}}}
|
||||
}
|
||||
topology := &master_pb.TopologyInfo{DataCenterInfos: []*master_pb.DataCenterInfo{{
|
||||
RackInfos: []*master_pb.RackInfo{{
|
||||
DataNodeInfos: []*master_pb.DataNodeInfo{
|
||||
holder("old:8080", &master_pb.VolumeEcShardInformationMessage{Id: 7, EcIndexBits: 0x01f, EncodeTsNs: 100}),
|
||||
holder("new:8080", &master_pb.VolumeEcShardInformationMessage{Id: 7, EcIndexBits: 0x3e0, EncodeTsNs: 200}),
|
||||
holder("legacy:8080", &master_pb.VolumeEcShardInformationMessage{Id: 7, EcIndexBits: 0x400}),
|
||||
},
|
||||
}},
|
||||
}}}
|
||||
got := summarizeS3ObjectVolumes([]uint32{7}, topology)
|
||||
if v := got[0]; v.Kind != s3ObjectVolumeEc || v.EcShardsPresent != 6 || v.Healthy || !reflect.DeepEqual(v.Servers, []string{"legacy:8080", "new:8080"}) {
|
||||
t.Fatalf("volume 7 = %+v", v)
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,7 @@ func (h *AdminHandlers) registerUIRoutes(r *mux.Router) {
|
||||
// Object Store management routes
|
||||
r.HandleFunc("/object-store/buckets", h.ShowS3Buckets).Methods(http.MethodGet)
|
||||
r.HandleFunc("/object-store/buckets/{bucket}", h.ShowBucketDetails).Methods(http.MethodGet)
|
||||
r.HandleFunc("/object-store/buckets/{bucket}/inspect", h.ShowS3ObjectInspector).Methods(http.MethodGet)
|
||||
r.HandleFunc("/object-store/users", h.userHandlers.ShowObjectStoreUsers).Methods(http.MethodGet)
|
||||
r.HandleFunc("/object-store/policies", h.policyHandlers.ShowPolicies).Methods(http.MethodGet)
|
||||
r.HandleFunc("/object-store/groups", h.groupHandlers.ShowGroups).Methods(http.MethodGet)
|
||||
@@ -189,6 +190,7 @@ func (h *AdminHandlers) registerAPIRoutes(api *mux.Router, enforceWrite bool) {
|
||||
s3Api.Handle("/buckets/{bucket}/lifecycle", wrapWrite(h.adminServer.DeleteBucketLifecycle)).Methods(http.MethodDelete)
|
||||
s3Api.Handle("/buckets/{bucket}/quota", wrapWrite(h.adminServer.UpdateBucketQuota)).Methods(http.MethodPut)
|
||||
s3Api.Handle("/buckets/{bucket}/owner", wrapWrite(h.adminServer.UpdateBucketOwner)).Methods(http.MethodPut)
|
||||
s3Api.HandleFunc("/buckets/{bucket}/objects/inspect", h.adminServer.InspectS3ObjectAPI).Methods(http.MethodGet)
|
||||
s3Api.HandleFunc("/buckets/{bucket}/policy", h.adminServer.ShowBucketPolicy).Methods(http.MethodGet)
|
||||
s3Api.Handle("/buckets/{bucket}/policy", wrapWrite(h.adminServer.UpdateBucketPolicy)).Methods(http.MethodPut)
|
||||
s3Api.Handle("/buckets/{bucket}/policy", wrapWrite(h.adminServer.RemoveBucketPolicy)).Methods(http.MethodDelete)
|
||||
@@ -616,6 +618,18 @@ func (h *AdminHandlers) ShowBucketDetails(w http.ResponseWriter, r *http.Request
|
||||
writeJSON(w, http.StatusOK, details)
|
||||
}
|
||||
|
||||
func (h *AdminHandlers) ShowS3ObjectInspector(w http.ResponseWriter, r *http.Request) {
|
||||
username := h.getUsername(r)
|
||||
data := h.adminServer.GetS3ObjectInspectorData(r.Context(), mux.Vars(r)["bucket"], r.URL.Query().Get("key"))
|
||||
data.Username = username
|
||||
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
viewCtx := layout.NewViewContext(r, username, dash.CSRFTokenFromContext(r.Context()))
|
||||
if err := layout.Layout(viewCtx, app.S3ObjectInspector(data)).Render(r.Context(), w); err != nil {
|
||||
writeJSONError(w, http.StatusInternalServerError, "Failed to render template: "+err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// getS3BucketsData retrieves Object Store buckets data from the server with pagination
|
||||
func (h *AdminHandlers) getS3BucketsData(r *http.Request, page, pageSize int, sortBy, sortOrder string) dash.S3BucketsData {
|
||||
username := dash.UsernameFromContext(r.Context())
|
||||
|
||||
@@ -245,6 +245,11 @@ templ S3Buckets(data dash.S3BucketsData) {
|
||||
title="Browse Files">
|
||||
<i class="bi bi-folder2-open"></i>
|
||||
</a>
|
||||
<a href={dash.PUrl(ctx, fmt.Sprintf("/object-store/buckets/%s/inspect", bucket.Name))}
|
||||
class="btn btn-outline-dark btn-sm"
|
||||
title="Inspect Object">
|
||||
<i class="bi bi-search"></i>
|
||||
</a>
|
||||
<button type="button"
|
||||
class="btn btn-outline-primary btn-sm view-details-btn"
|
||||
data-bucket-name={bucket.Name}
|
||||
|
||||
@@ -570,309 +570,322 @@ func S3Buckets(data dash.S3BucketsData) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "\" class=\"btn btn-outline-success btn-sm\" title=\"Browse Files\"><i class=\"bi bi-folder2-open\"></i></a> <button type=\"button\" class=\"btn btn-outline-primary btn-sm view-details-btn\" data-bucket-name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "\" class=\"btn btn-outline-success btn-sm\" title=\"Browse Files\"><i class=\"bi bi-folder2-open\"></i></a> <a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var24 string
|
||||
templ_7745c5c3_Var24, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
templ_7745c5c3_Var24, templ_7745c5c3_Err = templruntime.NewAttributeExpression(dash.PUrl(ctx, fmt.Sprintf("/object-store/buckets/%s/inspect", bucket.Name))).ResolveURL(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 250, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 248, Col: 137}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var24)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "\" title=\"View Details\"><i class=\"bi bi-eye\"></i></button> <button type=\"button\" class=\"btn btn-outline-secondary btn-sm lifecycle-btn\" data-bucket-name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "\" class=\"btn btn-outline-dark btn-sm\" title=\"Inspect Object\"><i class=\"bi bi-search\"></i></a> <button type=\"button\" class=\"btn btn-outline-primary btn-sm view-details-btn\" data-bucket-name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var25 string
|
||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 256, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 255, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "\" title=\"Lifecycle Rules\"><i class=\"bi bi-recycle\"></i></button> <button type=\"button\" class=\"btn btn-outline-info btn-sm policy-btn\" data-bucket-name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "\" title=\"View Details\"><i class=\"bi bi-eye\"></i></button> <button type=\"button\" class=\"btn btn-outline-secondary btn-sm lifecycle-btn\" data-bucket-name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var26 string
|
||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 262, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 261, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var26)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\" title=\"Bucket Policy\"><i class=\"bi bi-shield\"></i></button> <button type=\"button\" class=\"btn btn-outline-info btn-sm owner-btn\" data-bucket-name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "\" title=\"Lifecycle Rules\"><i class=\"bi bi-recycle\"></i></button> <button type=\"button\" class=\"btn btn-outline-info btn-sm policy-btn\" data-bucket-name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var27 string
|
||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 268, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 267, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\" data-current-owner=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\" title=\"Bucket Policy\"><i class=\"bi bi-shield\"></i></button> <button type=\"button\" class=\"btn btn-outline-info btn-sm owner-btn\" data-bucket-name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var28 string
|
||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Owner).Resolve(ctx)
|
||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 269, Col: 92}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 273, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "\" title=\"Manage Owner\"><i class=\"bi bi-person-gear\"></i></button> <button type=\"button\" class=\"btn btn-outline-warning btn-sm quota-btn\" data-bucket-name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "\" data-current-owner=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var29 string
|
||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Owner).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 275, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 274, Col: 92}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "\" data-current-quota=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "\" title=\"Manage Owner\"><i class=\"bi bi-person-gear\"></i></button> <button type=\"button\" class=\"btn btn-outline-warning btn-sm quota-btn\" data-bucket-name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var30 string
|
||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", getQuotaInMB(bucket.Quota))).Resolve(ctx)
|
||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 276, Col: 125}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 280, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\" data-quota-enabled=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "\" data-current-quota=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var31 string
|
||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%t", bucket.QuotaEnabled)).Resolve(ctx)
|
||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", getQuotaInMB(bucket.Quota))).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 277, Col: 118}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 281, Col: 125}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\" title=\"Manage Quota\"><i class=\"bi bi-speedometer2\"></i></button> <button type=\"button\" class=\"btn btn-outline-danger btn-sm delete-bucket-btn\" data-bucket-name=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "\" data-quota-enabled=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var32 string
|
||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%t", bucket.QuotaEnabled)).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 283, Col: 89}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 282, Col: 118}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "\" title=\"Delete Bucket\"><i class=\"bi bi-trash\"></i></button></div></td></tr>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "\" title=\"Manage Quota\"><i class=\"bi bi-speedometer2\"></i></button> <button type=\"button\" class=\"btn btn-outline-danger btn-sm delete-bucket-btn\" data-bucket-name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var33 string
|
||||
templ_7745c5c3_Var33, templ_7745c5c3_Err = templruntime.NewAttributeExpression(bucket.Name).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 288, Col: 89}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var33)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "\" title=\"Delete Bucket\"><i class=\"bi bi-trash\"></i></button></div></td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if len(data.Buckets) == 0 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "<tr><td colspan=\"11\" class=\"text-center text-muted py-4\"><i class=\"bi bi-box icon-3x mb-3 text-muted\"></i><div><h5>No Object Store buckets found</h5><p>Create your first bucket to get started with S3 storage.</p><button type=\"button\" class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createBucketModal\"><i class=\"bi bi-plus me-1\"></i>Create Bucket</button></div></td></tr>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "<tr><td colspan=\"11\" class=\"text-center text-muted py-4\"><i class=\"bi bi-box icon-3x mb-3 text-muted\"></i><div><h5>No Object Store buckets found</h5><p>Create your first bucket to get started with S3 storage.</p><button type=\"button\" class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createBucketModal\"><i class=\"bi bi-plus me-1\"></i>Create Bucket</button></div></td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "</tbody></table></div><!-- Pagination Controls -->")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "</tbody></table></div><!-- Pagination Controls -->")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.TotalPages > 1 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "<div class=\"d-flex justify-content-between align-items-center mt-3\"><small class=\"text-muted\">Showing ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var33 string
|
||||
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", (data.CurrentPage-1)*data.PageSize+1))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 315, Col: 101}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, " to ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "<div class=\"d-flex justify-content-between align-items-center mt-3\"><small class=\"text-muted\">Showing ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var34 string
|
||||
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", minInt(data.CurrentPage*data.PageSize, data.TotalBuckets)))
|
||||
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", (data.CurrentPage-1)*data.PageSize+1))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 315, Col: 185}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 320, Col: 101}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, " of ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, " to ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var35 string
|
||||
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalBuckets))
|
||||
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", minInt(data.CurrentPage*data.PageSize, data.TotalBuckets)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 315, Col: 229}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 320, Col: 185}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, " buckets</small><nav aria-label=\"Buckets pagination\"><ul class=\"pagination pagination-sm mb-0\"><!-- Previous Button -->")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, " of ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var36 string
|
||||
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.TotalBuckets))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 320, Col: 229}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, " buckets</small><nav aria-label=\"Buckets pagination\"><ul class=\"pagination pagination-sm mb-0\"><!-- Previous Button -->")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.CurrentPage > 1 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "<li class=\"page-item\"><a class=\"page-link pagination-link\" href=\"#\" data-page=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "<li class=\"page-item\"><a class=\"page-link pagination-link\" href=\"#\" data-page=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var36 string
|
||||
templ_7745c5c3_Var36, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", data.CurrentPage-1)).Resolve(ctx)
|
||||
var templ_7745c5c3_Var37 string
|
||||
templ_7745c5c3_Var37, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", data.CurrentPage-1)).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 322, Col: 142}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 327, Col: 142}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var36)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "\"><i class=\"bi bi-chevron-left\"></i></a></li>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "\"><i class=\"bi bi-chevron-left\"></i></a></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "<li class=\"page-item disabled\"><span class=\"page-link\"><i class=\"bi bi-chevron-left\"></i></span></li>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "<li class=\"page-item disabled\"><span class=\"page-link\"><i class=\"bi bi-chevron-left\"></i></span></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "<!-- Page Numbers -->")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "<!-- Page Numbers -->")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for i := maxInt(1, data.CurrentPage-2); i <= minInt(data.TotalPages, data.CurrentPage+2); i++ {
|
||||
if i == data.CurrentPage {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "<li class=\"page-item active\"><span class=\"page-link\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var37 string
|
||||
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 338, Col: 97}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "</span></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "<li class=\"page-item\"><a class=\"page-link pagination-link\" href=\"#\" data-page=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "<li class=\"page-item active\"><span class=\"page-link\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var38 string
|
||||
templ_7745c5c3_Var38, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", i)).Resolve(ctx)
|
||||
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 342, Col: 129}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 343, Col: 97}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "</span></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "<li class=\"page-item\"><a class=\"page-link pagination-link\" href=\"#\" data-page=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var39 string
|
||||
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
|
||||
templ_7745c5c3_Var39, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", i)).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 342, Col: 152}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 347, Col: 129}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "</a></li>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var40 string
|
||||
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", i))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 347, Col: 152}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "</a></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "<!-- Next Button -->")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "<!-- Next Button -->")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.CurrentPage < data.TotalPages {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "<li class=\"page-item\"><a class=\"page-link pagination-link\" href=\"#\" data-page=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "<li class=\"page-item\"><a class=\"page-link pagination-link\" href=\"#\" data-page=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var40 string
|
||||
templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", data.CurrentPage+1)).Resolve(ctx)
|
||||
var templ_7745c5c3_Var41 string
|
||||
templ_7745c5c3_Var41, templ_7745c5c3_Err = templruntime.NewAttributeExpression(fmt.Sprintf("%d", data.CurrentPage+1)).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 350, Col: 142}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 355, Col: 142}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var41)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "\"><i class=\"bi bi-chevron-right\"></i></a></li>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "\"><i class=\"bi bi-chevron-right\"></i></a></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "<li class=\"page-item disabled\"><span class=\"page-link\"><i class=\"bi bi-chevron-right\"></i></span></li>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "<li class=\"page-item disabled\"><span class=\"page-link\"><i class=\"bi bi-chevron-right\"></i></span></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "</ul></nav></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "</ul></nav></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "</div></div></div></div><!-- Last Updated --><div class=\"row\"><div class=\"col-12\"><small class=\"text-muted\"><i class=\"bi bi-clock me-1\"></i> Last updated: ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "</div></div></div></div><!-- Last Updated --><div class=\"row\"><div class=\"col-12\"><small class=\"text-muted\"><i class=\"bi bi-clock me-1\"></i> Last updated: ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var41 string
|
||||
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(data.LastUpdated.Format("2006-01-02 15:04:05"))
|
||||
var templ_7745c5c3_Var42 string
|
||||
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(data.LastUpdated.Format("2006-01-02 15:04:05"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 375, Col: 81}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_buckets.templ`, Line: 380, Col: 81}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "</small></div></div></div><!-- Create Bucket Modal --><div class=\"modal fade\" id=\"createBucketModal\" tabindex=\"-1\" aria-labelledby=\"createBucketModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"createBucketModalLabel\"><i class=\"bi bi-plus me-2\"></i>Create New S3 Bucket</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button></div><form id=\"createBucketForm\"><div class=\"modal-body\"><div class=\"mb-3\"><label for=\"bucketName\" class=\"form-label\">Bucket Name</label> <input type=\"text\" class=\"form-control\" id=\"bucketName\" name=\"name\" placeholder=\"my-bucket-name\" required pattern=\"[a-z0-9.-]+\" title=\"Bucket name must contain only lowercase letters, numbers, dots, and hyphens\"><div class=\"form-text\">Bucket names must be between 3 and 63 characters, contain only lowercase letters, numbers, dots, and hyphens.</div></div><div class=\"mb-3\"><label for=\"bucketOwner\" class=\"form-label\">Owner (Optional)</label> <select class=\"form-select\" id=\"bucketOwner\" name=\"owner\"><option value=\"\">No owner (admin-only access)</option><!-- Options will be populated dynamically when modal opens --></select><div class=\"form-text\">The S3 identity that owns this bucket. Non-admin users can only access buckets they own.</div></div><div class=\"mb-3\"><div class=\"form-check\"><input class=\"form-check-input\" type=\"checkbox\" id=\"enableQuota\" name=\"quota_enabled\"> <label class=\"form-check-label\" for=\"enableQuota\">Enable Storage Quota</label></div></div><div class=\"mb-3\" id=\"quotaSettings\" style=\"display: none;\"><div class=\"row\"><div class=\"col-md-8\"><label for=\"quotaSize\" class=\"form-label\">Quota Size</label> <input type=\"number\" class=\"form-control\" id=\"quotaSize\" name=\"quota_size\" placeholder=\"1024\" min=\"1\" step=\"1\"></div><div class=\"col-md-4\"><label for=\"quotaUnit\" class=\"form-label\">Unit</label> <select class=\"form-select\" id=\"quotaUnit\" name=\"quota_unit\"><option value=\"MB\" selected>MB</option> <option value=\"GB\">GB</option> <option value=\"TB\">TB</option></select></div></div><div class=\"form-text\">Set the maximum storage size for this bucket.</div></div><div class=\"mb-3\"><div class=\"form-check\"><input class=\"form-check-input\" type=\"checkbox\" id=\"enableVersioning\" name=\"versioning_enabled\"> <label class=\"form-check-label\" for=\"enableVersioning\">Enable Object Versioning</label></div><div class=\"form-text\">Keep multiple versions of objects in this bucket.</div></div><div class=\"mb-3\"><div class=\"form-check\"><input class=\"form-check-input\" type=\"checkbox\" id=\"enableObjectLock\" name=\"object_lock_enabled\"> <label class=\"form-check-label\" for=\"enableObjectLock\">Enable Object Lock</label></div><div class=\"form-text\">Prevent objects from being deleted or overwritten for a specified period. Automatically enables versioning.</div></div><div class=\"mb-3\" id=\"objectLockSettings\" style=\"display: none;\"><div class=\"row\"><div class=\"col-md-6\"><label for=\"objectLockMode\" class=\"form-label\">Object Lock Mode</label> <select class=\"form-select\" id=\"objectLockMode\" name=\"object_lock_mode\"><option value=\"GOVERNANCE\" selected>Governance</option> <option value=\"COMPLIANCE\">Compliance</option></select><div class=\"form-text\">Governance allows override with special permissions, Compliance is immutable.</div></div><div class=\"col-md-6\"><div class=\"form-check mb-3\"><input class=\"form-check-input\" type=\"checkbox\" id=\"setDefaultRetention\" name=\"set_default_retention\"> <label class=\"form-check-label\" for=\"setDefaultRetention\">Set Default Retention</label><div class=\"form-text\">Apply default retention to all new objects in this bucket.</div></div><div id=\"defaultRetentionSettings\" style=\"display: none;\"><label for=\"objectLockDuration\" class=\"form-label\">Default Retention (days)</label> <input type=\"number\" class=\"form-control\" id=\"objectLockDuration\" name=\"object_lock_duration\" placeholder=\"30\" min=\"1\" max=\"36500\" step=\"1\"><div class=\"form-text\">Default retention period for new objects (1-36500 days).</div></div></div></div></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"submit\" class=\"btn btn-primary\"><i class=\"bi bi-plus me-1\"></i>Create Bucket</button></div></form></div></div></div><!-- Delete Confirmation Modal --><div class=\"modal fade\" id=\"deleteBucketModal\" tabindex=\"-1\" aria-labelledby=\"deleteBucketModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"deleteBucketModalLabel\"><i class=\"bi bi-exclamation-triangle me-2 text-warLine truncated
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "</small></div></div></div><!-- Create Bucket Modal --><div class=\"modal fade\" id=\"createBucketModal\" tabindex=\"-1\" aria-labelledby=\"createBucketModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"createBucketModalLabel\"><i class=\"bi bi-plus me-2\"></i>Create New S3 Bucket</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button></div><form id=\"createBucketForm\"><div class=\"modal-body\"><div class=\"mb-3\"><label for=\"bucketName\" class=\"form-label\">Bucket Name</label> <input type=\"text\" class=\"form-control\" id=\"bucketName\" name=\"name\" placeholder=\"my-bucket-name\" required pattern=\"[a-z0-9.-]+\" title=\"Bucket name must contain only lowercase letters, numbers, dots, and hyphens\"><div class=\"form-text\">Bucket names must be between 3 and 63 characters, contain only lowercase letters, numbers, dots, and hyphens.</div></div><div class=\"mb-3\"><label for=\"bucketOwner\" class=\"form-label\">Owner (Optional)</label> <select class=\"form-select\" id=\"bucketOwner\" name=\"owner\"><option value=\"\">No owner (admin-only access)</option><!-- Options will be populated dynamically when modal opens --></select><div class=\"form-text\">The S3 identity that owns this bucket. Non-admin users can only access buckets they own.</div></div><div class=\"mb-3\"><div class=\"form-check\"><input class=\"form-check-input\" type=\"checkbox\" id=\"enableQuota\" name=\"quota_enabled\"> <label class=\"form-check-label\" for=\"enableQuota\">Enable Storage Quota</label></div></div><div class=\"mb-3\" id=\"quotaSettings\" style=\"display: none;\"><div class=\"row\"><div class=\"col-md-8\"><label for=\"quotaSize\" class=\"form-label\">Quota Size</label> <input type=\"number\" class=\"form-control\" id=\"quotaSize\" name=\"quota_size\" placeholder=\"1024\" min=\"1\" step=\"1\"></div><div class=\"col-md-4\"><label for=\"quotaUnit\" class=\"form-label\">Unit</label> <select class=\"form-select\" id=\"quotaUnit\" name=\"quota_unit\"><option value=\"MB\" selected>MB</option> <option value=\"GB\">GB</option> <option value=\"TB\">TB</option></select></div></div><div class=\"form-text\">Set the maximum storage size for this bucket.</div></div><div class=\"mb-3\"><div class=\"form-check\"><input class=\"form-check-input\" type=\"checkbox\" id=\"enableVersioning\" name=\"versioning_enabled\"> <label class=\"form-check-label\" for=\"enableVersioning\">Enable Object Versioning</label></div><div class=\"form-text\">Keep multiple versions of objects in this bucket.</div></div><div class=\"mb-3\"><div class=\"form-check\"><input class=\"form-check-input\" type=\"checkbox\" id=\"enableObjectLock\" name=\"object_lock_enabled\"> <label class=\"form-check-label\" for=\"enableObjectLock\">Enable Object Lock</label></div><div class=\"form-text\">Prevent objects from being deleted or overwritten for a specified period. Automatically enables versioning.</div></div><div class=\"mb-3\" id=\"objectLockSettings\" style=\"display: none;\"><div class=\"row\"><div class=\"col-md-6\"><label for=\"objectLockMode\" class=\"form-label\">Object Lock Mode</label> <select class=\"form-select\" id=\"objectLockMode\" name=\"object_lock_mode\"><option value=\"GOVERNANCE\" selected>Governance</option> <option value=\"COMPLIANCE\">Compliance</option></select><div class=\"form-text\">Governance allows override with special permissions, Compliance is immutable.</div></div><div class=\"col-md-6\"><div class=\"form-check mb-3\"><input class=\"form-check-input\" type=\"checkbox\" id=\"setDefaultRetention\" name=\"set_default_retention\"> <label class=\"form-check-label\" for=\"setDefaultRetention\">Set Default Retention</label><div class=\"form-text\">Apply default retention to all new objects in this bucket.</div></div><div id=\"defaultRetentionSettings\" style=\"display: none;\"><label for=\"objectLockDuration\" class=\"form-label\">Default Retention (days)</label> <input type=\"number\" class=\"form-control\" id=\"objectLockDuration\" name=\"object_lock_duration\" placeholder=\"30\" min=\"1\" max=\"36500\" step=\"1\"><div class=\"form-text\">Default retention period for new objects (1-36500 days).</div></div></div></div></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"submit\" class=\"btn btn-primary\"><i class=\"bi bi-plus me-1\"></i>Create Bucket</button></div></form></div></div></div><!-- Delete Confirmation Modal --><div class=\"modal fade\" id=\"deleteBucketModal\" tabindex=\"-1\" aria-labelledby=\"deleteBucketModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"deleteBucketModalLabel\"><i class=\"bi bi-exclamation-triangle me-2 text-warLine truncated
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -880,7 +893,7 @@ func S3Buckets(data dash.S3BucketsData) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "<!-- Bucket Policy Modal --><div class=\"modal fade\" id=\"bucketPolicyModal\" tabindex=\"-1\" aria-labelledby=\"bucketPolicyModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog modal-xl\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"bucketPolicyModalLabel\"><i class=\"bi bi-file-earmark-lock me-2\"></i>Bucket Policy</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button></div><div class=\"modal-body\"><div id=\"bucketPolicyLoading\" class=\"text-center py-4\"><div class=\"spinner-border text-primary\" role=\"status\"><span class=\"visually-hidden\">Loading...</span></div><div class=\"mt-2\">Loading bucket policy...</div></div><div id=\"bucketPolicyError\" class=\"alert alert-danger\" style=\"display: none;\"></div><div id=\"bucketPolicyEditorWrapper\" style=\"display: none;\"><p class=\"text-muted small\">Every statement must specify a Principal, and every Resource must refer to this bucket. Leave the document empty and click Delete to remove the policy.</p><ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\" role=\"presentation\"><button class=\"nav-link active\" id=\"bucketPolicyEditorTabBtn\" type=\"button\" data-bs-toggle=\"tab\" data-bs-target=\"#bucketPolicyEditorTab\" role=\"tab\" aria-controls=\"bucketPolicyEditorTab\" aria-selected=\"true\">Editor</button></li><li class=\"nav-item\" role=\"presentation\"><button class=\"nav-link\" id=\"bucketPolicyJsonTabBtn\" type=\"button\" data-bs-toggle=\"tab\" data-bs-target=\"#bucketPolicyJsonTab\" role=\"tab\" aria-controls=\"bucketPolicyJsonTab\" aria-selected=\"false\">JSON</button></li></ul><div class=\"tab-content border border-top-0 rounded-bottom p-3 mb-3\"><div class=\"tab-pane fade show active\" id=\"bucketPolicyEditorTab\" role=\"tabpanel\" aria-labelledby=\"bucketPolicyEditorTabBtn\"><div id=\"bucketPolicyEditorBody\"></div><button type=\"button\" class=\"btn btn-sm btn-outline-secondary\" id=\"bucketPolicyAddStatementBtn\"><i class=\"bi bi-plus me-1\"></i>Add statement</button></div><div class=\"tab-pane fade\" id=\"bucketPolicyJsonTab\" role=\"tabpanel\" aria-labelledby=\"bucketPolicyJsonTabBtn\"><textarea class=\"form-control\" id=\"bucketPolicyDocument\" rows=\"15\" style=\"font-family: monospace;\" spellcheck=\"false\" placeholder='{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::bucket-name/*\"}]}'></textarea><div class=\"form-text\">Enter the bucket policy document as JSON</div></div></div><div class=\"mb-3\"><button type=\"button\" class=\"btn btn-outline-info btn-sm\" id=\"bucketPolicyInsertSampleBtn\"><i class=\"bi bi-file-earmark-text me-1\"></i>Use Sample Policy</button></div></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-outline-danger me-auto\" id=\"bucketPolicyDeleteBtn\"><i class=\"bi bi-trash me-1\"></i>Delete</button> <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"button\" class=\"btn btn-primary\" id=\"bucketPolicySaveBtn\"><i class=\"bi bi-floppy me-1\"></i>Save</button></div></div></div></div><!-- Manage Owner Modal --><div class=\"modal fade\" id=\"manageOwnerModal\" tabindex=\"-1\" aria-labelledby=\"manageOwnerModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"manageOwnerModalLabel\"><i class=\"bi bi-person-gear me-2\"></i>Manage Bucket Owner</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button></div><form id=\"ownerForm\"><div class=\"modal-body\"><div class=\"mb-3\"><label class=\"form-label\">Bucket Name</label> <input type=\"text\" class=\"form-control\" id=\"ownerBucketName\" readonly></div><div class=\"mb-3\"><label for=\"bucketOwnerSelect\" class=\"form-label\">Owner</label> <select class=\"form-select\" id=\"bucketOwnerSelect\" name=\"owner\"><option value=\"\">No owner (admin-only access)</option><!-- Options will be populated dynamically --></select><div class=\"form-text\">Select the S3 identity that owns this bucket. Non-admin users can only access buckets they own.</div></div><div id=\"ownerLoadingSpinner\" class=\"text-center py-2\" style=\"display: none;\"><div class=\"spinner-border spinner-border-sm text-primary\" role=\"status\"><span class=\"visually-hidden\">Loading users...</span></div><span class=\"ms-2\">Loading users...</span></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"submit\" class=\"btn btn-info\"><i class=\"bi bi-floppy me-1\"></i>Update Owner</button></div></form></div></div></div><!-- JavaScript for bucket management --><script>\n // Global state (shared between DOMContentLine truncated
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "<!-- Bucket Policy Modal --><div class=\"modal fade\" id=\"bucketPolicyModal\" tabindex=\"-1\" aria-labelledby=\"bucketPolicyModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog modal-xl\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"bucketPolicyModalLabel\"><i class=\"bi bi-file-earmark-lock me-2\"></i>Bucket Policy</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button></div><div class=\"modal-body\"><div id=\"bucketPolicyLoading\" class=\"text-center py-4\"><div class=\"spinner-border text-primary\" role=\"status\"><span class=\"visually-hidden\">Loading...</span></div><div class=\"mt-2\">Loading bucket policy...</div></div><div id=\"bucketPolicyError\" class=\"alert alert-danger\" style=\"display: none;\"></div><div id=\"bucketPolicyEditorWrapper\" style=\"display: none;\"><p class=\"text-muted small\">Every statement must specify a Principal, and every Resource must refer to this bucket. Leave the document empty and click Delete to remove the policy.</p><ul class=\"nav nav-tabs\" role=\"tablist\"><li class=\"nav-item\" role=\"presentation\"><button class=\"nav-link active\" id=\"bucketPolicyEditorTabBtn\" type=\"button\" data-bs-toggle=\"tab\" data-bs-target=\"#bucketPolicyEditorTab\" role=\"tab\" aria-controls=\"bucketPolicyEditorTab\" aria-selected=\"true\">Editor</button></li><li class=\"nav-item\" role=\"presentation\"><button class=\"nav-link\" id=\"bucketPolicyJsonTabBtn\" type=\"button\" data-bs-toggle=\"tab\" data-bs-target=\"#bucketPolicyJsonTab\" role=\"tab\" aria-controls=\"bucketPolicyJsonTab\" aria-selected=\"false\">JSON</button></li></ul><div class=\"tab-content border border-top-0 rounded-bottom p-3 mb-3\"><div class=\"tab-pane fade show active\" id=\"bucketPolicyEditorTab\" role=\"tabpanel\" aria-labelledby=\"bucketPolicyEditorTabBtn\"><div id=\"bucketPolicyEditorBody\"></div><button type=\"button\" class=\"btn btn-sm btn-outline-secondary\" id=\"bucketPolicyAddStatementBtn\"><i class=\"bi bi-plus me-1\"></i>Add statement</button></div><div class=\"tab-pane fade\" id=\"bucketPolicyJsonTab\" role=\"tabpanel\" aria-labelledby=\"bucketPolicyJsonTabBtn\"><textarea class=\"form-control\" id=\"bucketPolicyDocument\" rows=\"15\" style=\"font-family: monospace;\" spellcheck=\"false\" placeholder='{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::bucket-name/*\"}]}'></textarea><div class=\"form-text\">Enter the bucket policy document as JSON</div></div></div><div class=\"mb-3\"><button type=\"button\" class=\"btn btn-outline-info btn-sm\" id=\"bucketPolicyInsertSampleBtn\"><i class=\"bi bi-file-earmark-text me-1\"></i>Use Sample Policy</button></div></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-outline-danger me-auto\" id=\"bucketPolicyDeleteBtn\"><i class=\"bi bi-trash me-1\"></i>Delete</button> <button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"button\" class=\"btn btn-primary\" id=\"bucketPolicySaveBtn\"><i class=\"bi bi-floppy me-1\"></i>Save</button></div></div></div></div><!-- Manage Owner Modal --><div class=\"modal fade\" id=\"manageOwnerModal\" tabindex=\"-1\" aria-labelledby=\"manageOwnerModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"manageOwnerModalLabel\"><i class=\"bi bi-person-gear me-2\"></i>Manage Bucket Owner</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button></div><form id=\"ownerForm\"><div class=\"modal-body\"><div class=\"mb-3\"><label class=\"form-label\">Bucket Name</label> <input type=\"text\" class=\"form-control\" id=\"ownerBucketName\" readonly></div><div class=\"mb-3\"><label for=\"bucketOwnerSelect\" class=\"form-label\">Owner</label> <select class=\"form-select\" id=\"bucketOwnerSelect\" name=\"owner\"><option value=\"\">No owner (admin-only access)</option><!-- Options will be populated dynamically --></select><div class=\"form-text\">Select the S3 identity that owns this bucket. Non-admin users can only access buckets they own.</div></div><div id=\"ownerLoadingSpinner\" class=\"text-center py-2\" style=\"display: none;\"><div class=\"spinner-border spinner-border-sm text-primary\" role=\"status\"><span class=\"visually-hidden\">Loading users...</span></div><span class=\"ms-2\">Loading users...</span></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"submit\" class=\"btn btn-info\"><i class=\"bi bi-floppy me-1\"></i>Update Owner</button></div></form></div></div></div><!-- JavaScript for bucket management --><script>\n // Global state (shared between DOMContentLine truncated
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/admin/dash"
|
||||
)
|
||||
|
||||
templ S3ObjectInspector(data dash.S3ObjectInspectorData) {
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<div>
|
||||
<h1 class="h2 mb-0">
|
||||
<i class="bi bi-search me-2"></i>Inspect Object
|
||||
</h1>
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-0 mt-1">
|
||||
<li class="breadcrumb-item"><a href={ dash.PUrl(ctx, "/object-store/buckets") }>Buckets</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{ data.Bucket }</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<form class="row g-2 mb-4" method="get" action={ dash.PUrl(ctx, fmt.Sprintf("/object-store/buckets/%s/inspect", data.Bucket)) }>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" name="key" placeholder="object key, e.g. backups/2026/db.tar" value={ data.Key } required/>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="submit" class="btn btn-primary w-100"><i class="bi bi-search me-1"></i>Inspect</button>
|
||||
</div>
|
||||
if data.Key != "" {
|
||||
<div class="col-md-2">
|
||||
<a class="btn btn-outline-secondary w-100" href={ dash.PUrl(ctx, fmt.Sprintf("/api/s3/buckets/%s/objects/inspect?key=%s", data.Bucket, url.QueryEscape(data.Key))) }><i class="bi bi-filetype-json me-1"></i>JSON</a>
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
if data.Error != "" {
|
||||
<div class="alert alert-danger"><i class="bi bi-exclamation-triangle me-2"></i>{ data.Error }</div>
|
||||
}
|
||||
if data.Inspection != nil {
|
||||
@s3ObjectVolumesCard(data.Inspection)
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">
|
||||
<i class="bi bi-clock-history me-2"></i>Versions ({ fmt.Sprintf("%d", len(data.Inspection.Versions)) })
|
||||
if !data.Inspection.Versioned {
|
||||
<span class="badge bg-secondary ms-2">unversioned</span>
|
||||
}
|
||||
if data.Inspection.Truncated {
|
||||
<span class="badge bg-warning text-dark ms-2">truncated</span>
|
||||
}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Version</th>
|
||||
<th>Size</th>
|
||||
<th>Modified</th>
|
||||
<th>ETag / Checksum</th>
|
||||
<th>Object Lock</th>
|
||||
<th>Chunks</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
for _, v := range data.Inspection.Versions {
|
||||
<tr>
|
||||
<td>
|
||||
<code class="small">{ v.VersionId }</code>
|
||||
if v.IsLatest {
|
||||
<span class="badge bg-success ms-1">latest</span>
|
||||
}
|
||||
if v.IsDeleteMarker {
|
||||
<span class="badge bg-dark ms-1">delete marker</span>
|
||||
}
|
||||
<div class="small text-muted text-break">{ v.Path }</div>
|
||||
</td>
|
||||
<td>{ formatBytes(int64(v.Size)) }</td>
|
||||
<td class="small">{ formatS3ObjectTime(v.ModifiedAt) }</td>
|
||||
<td class="small">
|
||||
if v.ETag != "" {
|
||||
<div><code>{ v.ETag }</code></div>
|
||||
}
|
||||
if v.ChecksumValue != "" {
|
||||
<div>{ strings.TrimPrefix(strings.ToUpper(v.ChecksumAlgorithm), "X-AMZ-CHECKSUM-") }: <code>{ v.ChecksumValue }</code></div>
|
||||
}
|
||||
</td>
|
||||
<td class="small">
|
||||
if v.ObjectLockMode != "" {
|
||||
<div><span class="badge bg-info text-dark">{ v.ObjectLockMode }</span></div>
|
||||
}
|
||||
if v.RetainUntil != nil {
|
||||
<div>until { formatS3ObjectTime(*v.RetainUntil) }</div>
|
||||
}
|
||||
if v.LegalHold != "" {
|
||||
<div>legal hold { v.LegalHold }</div>
|
||||
}
|
||||
if v.WormEnforcedAt != nil {
|
||||
<div>WORM since { formatS3ObjectTime(*v.WormEnforcedAt) }</div>
|
||||
}
|
||||
</td>
|
||||
<td class="small">
|
||||
if v.InlineBytes > 0 {
|
||||
<div>inline ({ formatBytes(int64(v.InlineBytes)) })</div>
|
||||
}
|
||||
if v.RemoteStorage != "" {
|
||||
<div>remote: { v.RemoteStorage }</div>
|
||||
}
|
||||
for _, c := range v.Chunks {
|
||||
<div>
|
||||
<code>{ c.FileId }</code>
|
||||
if c.IsManifest {
|
||||
<span class="badge bg-secondary ms-1">manifest</span>
|
||||
}
|
||||
<span class="text-muted">{ formatBytes(int64(c.Size)) }</span>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ s3ObjectVolumesCard(inspection *dash.S3ObjectInspection) {
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary"><i class="bi bi-hdd-stack me-2"></i>Volumes</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
if len(inspection.Volumes) == 0 {
|
||||
<p class="text-muted mb-0">No chunks stored on volumes.</p>
|
||||
} else {
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Volume</th>
|
||||
<th>Kind</th>
|
||||
<th>Copies / Shards</th>
|
||||
<th>Servers</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
for _, vol := range inspection.Volumes {
|
||||
<tr>
|
||||
<td>
|
||||
if link := s3ObjectVolumeLink(vol); link != "" {
|
||||
<a href={ dash.PUrl(ctx, link) }>{ fmt.Sprintf("%d", vol.VolumeId) }</a>
|
||||
} else {
|
||||
{ fmt.Sprintf("%d", vol.VolumeId) }
|
||||
}
|
||||
</td>
|
||||
<td>{ vol.Kind }</td>
|
||||
<td>
|
||||
switch vol.Kind {
|
||||
case "replicated":
|
||||
{ fmt.Sprintf("%d / %d copies", vol.CopiesPresent, vol.CopiesExpected) }
|
||||
if vol.ReadOnly {
|
||||
<span class="badge bg-secondary ms-1">read-only</span>
|
||||
}
|
||||
case "ec":
|
||||
{ fmt.Sprintf("%d / %d shards", vol.EcShardsPresent, vol.EcTotalShards) }
|
||||
if len(vol.EcMissingShards) > 0 {
|
||||
<div class="small text-muted">missing { fmt.Sprint(vol.EcMissingShards) }</div>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td class="small">{ strings.Join(vol.Servers, ", ") }</td>
|
||||
<td>
|
||||
if vol.Healthy {
|
||||
<span class="badge bg-success">ok</span>
|
||||
} else {
|
||||
<span class="badge bg-danger">{ s3ObjectVolumeProblem(vol) }</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
func formatS3ObjectTime(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return "-"
|
||||
}
|
||||
return t.UTC().Format("2006-01-02 15:04:05 UTC")
|
||||
}
|
||||
|
||||
func s3ObjectVolumeLink(vol dash.S3ObjectVolumeHealth) string {
|
||||
switch {
|
||||
case vol.Kind == "ec":
|
||||
return fmt.Sprintf("/storage/ec-volumes/%d", vol.VolumeId)
|
||||
case vol.Kind == "replicated" && len(vol.Servers) > 0:
|
||||
return fmt.Sprintf("/storage/volumes/%d/%s", vol.VolumeId, vol.Servers[0])
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func s3ObjectVolumeProblem(vol dash.S3ObjectVolumeHealth) string {
|
||||
switch vol.Kind {
|
||||
case "replicated":
|
||||
return "under-replicated"
|
||||
case "ec":
|
||||
return "not decodable"
|
||||
default:
|
||||
return "not found"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,713 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.3.1100
|
||||
|
||||
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"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/admin/dash"
|
||||
)
|
||||
|
||||
func S3ObjectInspector(data dash.S3ObjectInspectorData) 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)
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\"><div><h1 class=\"h2 mb-0\"><i class=\"bi bi-search me-2\"></i>Inspect Object</h1><nav aria-label=\"breadcrumb\"><ol class=\"breadcrumb mb-0 mt-1\"><li class=\"breadcrumb-item\"><a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(dash.PUrl(ctx, "/object-store/buckets")).ResolveURL(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 20, Col: 82}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\">Buckets</a></li><li class=\"breadcrumb-item active\" aria-current=\"page\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Bucket)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 21, Col: 73}
|
||||
}
|
||||
_, 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, 3, "</li></ol></nav></div></div><form class=\"row g-2 mb-4\" method=\"get\" action=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templruntime.NewAttributeExpression(dash.PUrl(ctx, fmt.Sprintf("/object-store/buckets/%s/inspect", data.Bucket))).ResolveURL(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 26, Col: 126}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\"><div class=\"col-md-8\"><input type=\"text\" class=\"form-control\" name=\"key\" placeholder=\"object key, e.g. backups/2026/db.tar\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templruntime.NewAttributeExpression(data.Key).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 28, Col: 121}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" required></div><div class=\"col-md-2\"><button type=\"submit\" class=\"btn btn-primary w-100\"><i class=\"bi bi-search me-1\"></i>Inspect</button></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.Key != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<div class=\"col-md-2\"><a class=\"btn btn-outline-secondary w-100\" href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(dash.PUrl(ctx, fmt.Sprintf("/api/s3/buckets/%s/objects/inspect?key=%s", data.Bucket, url.QueryEscape(data.Key)))).ResolveURL(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 35, Col: 166}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\"><i class=\"bi bi-filetype-json me-1\"></i>JSON</a></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</form>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if data.Error != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<div class=\"alert alert-danger\"><i class=\"bi bi-exclamation-triangle me-2\"></i>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(data.Error)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 40, Col: 93}
|
||||
}
|
||||
_, 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, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if data.Inspection != nil {
|
||||
templ_7745c5c3_Err = s3ObjectVolumesCard(data.Inspection).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<div class=\"card shadow mb-4\"><div class=\"card-header py-3\"><h6 class=\"m-0 font-weight-bold text-primary\"><i class=\"bi bi-clock-history me-2\"></i>Versions (")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", len(data.Inspection.Versions)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 47, Col: 105}
|
||||
}
|
||||
_, 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, 12, ") ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !data.Inspection.Versioned {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<span class=\"badge bg-secondary ms-2\">unversioned</span> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if data.Inspection.Truncated {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<span class=\"badge bg-warning text-dark ms-2\">truncated</span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</h6></div><div class=\"card-body\"><div class=\"table-responsive\"><table class=\"table table-sm table-hover align-middle\"><thead><tr><th>Version</th><th>Size</th><th>Modified</th><th>ETag / Checksum</th><th>Object Lock</th><th>Chunks</th></tr></thead> <tbody>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, v := range data.Inspection.Versions {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<tr><td><code class=\"small\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(v.VersionId)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 73, Col: 43}
|
||||
}
|
||||
_, 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, 17, "</code> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if v.IsLatest {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<span class=\"badge bg-success ms-1\">latest</span> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if v.IsDeleteMarker {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<span class=\"badge bg-dark ms-1\">delete marker</span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<div class=\"small text-muted text-break\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(v.Path)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 80, Col: 59}
|
||||
}
|
||||
_, 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, 21, "</div></td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(formatBytes(int64(v.Size)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 82, Col: 41}
|
||||
}
|
||||
_, 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, 22, "</td><td class=\"small\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(formatS3ObjectTime(v.ModifiedAt))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 83, Col: 61}
|
||||
}
|
||||
_, 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, 23, "</td><td class=\"small\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if v.ETag != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "<div><code>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(v.ETag)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 86, Col: 30}
|
||||
}
|
||||
_, 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, 25, "</code></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if v.ChecksumValue != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(strings.TrimPrefix(strings.ToUpper(v.ChecksumAlgorithm), "X-AMZ-CHECKSUM-"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 89, Col: 93}
|
||||
}
|
||||
_, 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, 27, ": <code>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(v.ChecksumValue)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 89, Col: 120}
|
||||
}
|
||||
_, 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, 28, "</code></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</td><td class=\"small\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if v.ObjectLockMode != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "<div><span class=\"badge bg-info text-dark\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(v.ObjectLockMode)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 94, Col: 72}
|
||||
}
|
||||
_, 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, 31, "</span></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if v.RetainUntil != nil {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<div>until ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(formatS3ObjectTime(*v.RetainUntil))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 97, Col: 58}
|
||||
}
|
||||
_, 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, 33, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if v.LegalHold != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<div>legal hold ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(v.LegalHold)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 100, Col: 40}
|
||||
}
|
||||
_, 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, 35, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if v.WormEnforcedAt != nil {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<div>WORM since ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(formatS3ObjectTime(*v.WormEnforcedAt))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 103, Col: 66}
|
||||
}
|
||||
_, 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, 37, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</td><td class=\"small\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if v.InlineBytes > 0 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div>inline (")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(formatBytes(int64(v.InlineBytes)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 108, Col: 59}
|
||||
}
|
||||
_, 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, 40, ")</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if v.RemoteStorage != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<div>remote: ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 string
|
||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(v.RemoteStorage)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 111, Col: 41}
|
||||
}
|
||||
_, 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, 42, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
for _, c := range v.Chunks {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "<div><code>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var22 string
|
||||
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(c.FileId)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 115, Col: 28}
|
||||
}
|
||||
_, 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, 44, "</code> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if c.IsManifest {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<span class=\"badge bg-secondary ms-1\">manifest</span> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "<span class=\"text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var23 string
|
||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(formatBytes(int64(c.Size)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 119, Col: 65}
|
||||
}
|
||||
_, 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, 47, "</span></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</tbody></table></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func s3ObjectVolumesCard(inspection *dash.S3ObjectInspection) 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)
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<div class=\"card shadow mb-4\"><div class=\"card-header py-3\"><h6 class=\"m-0 font-weight-bold text-primary\"><i class=\"bi bi-hdd-stack me-2\"></i>Volumes</h6></div><div class=\"card-body\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if len(inspection.Volumes) == 0 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<p class=\"text-muted mb-0\">No chunks stored on volumes.</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "<div class=\"table-responsive\"><table class=\"table table-sm align-middle\"><thead><tr><th>Volume</th><th>Kind</th><th>Copies / Shards</th><th>Servers</th><th>Status</th></tr></thead> <tbody>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, vol := range inspection.Volumes {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<tr><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if link := s3ObjectVolumeLink(vol); link != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var25 string
|
||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templruntime.NewAttributeExpression(dash.PUrl(ctx, link)).ResolveURL(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 158, Col: 41}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var26 string
|
||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", vol.VolumeId))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 158, Col: 77}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</a>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
var templ_7745c5c3_Var27 string
|
||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", vol.VolumeId))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 160, Col: 44}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var28 string
|
||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(vol.Kind)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 163, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
switch vol.Kind {
|
||||
case "replicated":
|
||||
var templ_7745c5c3_Var29 string
|
||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d / %d copies", vol.CopiesPresent, vol.CopiesExpected))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 167, Col: 82}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, " ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if vol.ReadOnly {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "<span class=\"badge bg-secondary ms-1\">read-only</span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
case "ec":
|
||||
var templ_7745c5c3_Var30 string
|
||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d / %d shards", vol.EcShardsPresent, vol.EcTotalShards))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 172, Col: 83}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, " ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if len(vol.EcMissingShards) > 0 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "<div class=\"small text-muted\">missing ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var31 string
|
||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(vol.EcMissingShards))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 174, Col: 84}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</td><td class=\"small\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var32 string
|
||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(vol.Servers, ", "))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 178, Col: 60}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if vol.Healthy {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "<span class=\"badge bg-success\">ok</span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "<span class=\"badge bg-danger\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var33 string
|
||||
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(s3ObjectVolumeProblem(vol))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/s3_object_inspector.templ`, Line: 183, Col: 69}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "</span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "</tbody></table></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func formatS3ObjectTime(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return "-"
|
||||
}
|
||||
return t.UTC().Format("2006-01-02 15:04:05 UTC")
|
||||
}
|
||||
|
||||
func s3ObjectVolumeLink(vol dash.S3ObjectVolumeHealth) string {
|
||||
switch {
|
||||
case vol.Kind == "ec":
|
||||
return fmt.Sprintf("/storage/ec-volumes/%d", vol.VolumeId)
|
||||
case vol.Kind == "replicated" && len(vol.Servers) > 0:
|
||||
return fmt.Sprintf("/storage/volumes/%d/%s", vol.VolumeId, vol.Servers[0])
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func s3ObjectVolumeProblem(vol dash.S3ObjectVolumeHealth) string {
|
||||
switch vol.Kind {
|
||||
case "replicated":
|
||||
return "under-replicated"
|
||||
case "ec":
|
||||
return "not decodable"
|
||||
default:
|
||||
return "not found"
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -2884,6 +2884,11 @@ func (s3a *S3ApiServer) getObjectETag(entry *filer_pb.Entry) string {
|
||||
return objectETag(entry)
|
||||
}
|
||||
|
||||
// ObjectETag exposes objectETag to callers outside this package.
|
||||
func ObjectETag(entry *filer_pb.Entry) string {
|
||||
return objectETag(entry)
|
||||
}
|
||||
|
||||
func objectETag(entry *filer_pb.Entry) string {
|
||||
// Try to get ETag from Extended attributes first
|
||||
if etagBytes, hasETag := entry.Extended[s3_constants.ExtETagKey]; hasETag {
|
||||
|
||||
@@ -2218,6 +2218,13 @@ func VersionIdFromEntry(entry *filer_pb.Entry) string {
|
||||
return versionIdFromEntry(entry)
|
||||
}
|
||||
|
||||
// SelectLatestVersionId exposes selectLatestVersion's ordering to callers
|
||||
// outside this package that rescan .versions without writing a pointer.
|
||||
func SelectLatestVersionId(entries []*filer_pb.Entry) string {
|
||||
_, versionId, _, _ := selectLatestVersion(entries)
|
||||
return versionId
|
||||
}
|
||||
|
||||
// versionIdFromEntry returns a .versions child entry's version id, preferring
|
||||
// the Seaweed-X-Amz-Version-Id attribute and falling back to the v_<versionId>
|
||||
// file name so entries written outside the normal PUT path still self-heal.
|
||||
|
||||
Reference in new issue
Block a user