package app import ( "fmt" "net/url" "strings" "time" "github.com/seaweedfs/seaweedfs/weed/admin/dash" ) templ S3ObjectInspector(data dash.S3ObjectInspectorData) {

Inspect Object

if data.Key != "" {
JSON
}
if data.Error != "" {
{ data.Error }
} if data.Inspection != nil { @s3ObjectVolumesCard(data.Inspection)
Versions ({ fmt.Sprintf("%d", len(data.Inspection.Versions)) }) if !data.Inspection.Versioned { unversioned } if data.Inspection.Truncated { truncated }
for _, v := range data.Inspection.Versions { }
Version Size Modified ETag / Checksum Object Lock Chunks
{ v.VersionId } if v.IsLatest { latest } if v.IsDeleteMarker { delete marker }
{ v.Path }
{ formatBytes(int64(v.Size)) } { formatS3ObjectTime(v.ModifiedAt) } if v.ETag != "" {
{ v.ETag }
} if v.ChecksumValue != "" {
{ strings.TrimPrefix(strings.ToUpper(v.ChecksumAlgorithm), "X-AMZ-CHECKSUM-") }: { v.ChecksumValue }
}
if v.ObjectLockMode != "" {
{ v.ObjectLockMode }
} if v.RetainUntil != nil {
until { formatS3ObjectTime(*v.RetainUntil) }
} if v.LegalHold != "" {
legal hold { v.LegalHold }
} if v.WormEnforcedAt != nil {
WORM since { formatS3ObjectTime(*v.WormEnforcedAt) }
}
if v.InlineBytes > 0 {
inline ({ formatBytes(int64(v.InlineBytes)) })
} if v.RemoteStorage != "" {
remote: { v.RemoteStorage }
} for _, c := range v.Chunks {
{ c.FileId } if c.IsManifest { manifest } { formatBytes(int64(c.Size)) }
}
} } templ s3ObjectVolumesCard(inspection *dash.S3ObjectInspection) {
Volumes
if len(inspection.Volumes) == 0 {

No chunks stored on volumes.

} else {
for _, vol := range inspection.Volumes { }
Volume Kind Copies / Shards Servers Status
if link := s3ObjectVolumeLink(vol); link != "" { { fmt.Sprintf("%d", vol.VolumeId) } } else { { fmt.Sprintf("%d", vol.VolumeId) } } { vol.Kind } switch vol.Kind { case "replicated": { fmt.Sprintf("%d / %d copies", vol.CopiesPresent, vol.CopiesExpected) } if vol.ReadOnly { read-only } case "ec": { fmt.Sprintf("%d / %d shards", vol.EcShardsPresent, vol.EcTotalShards) } if len(vol.EcMissingShards) > 0 {
missing { fmt.Sprint(vol.EcMissingShards) }
} }
{ strings.Join(vol.Servers, ", ") } if vol.Healthy { ok } else { { s3ObjectVolumeProblem(vol) } }
}
} 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" } }