satellite/console/consoleweb: remove bucket usage report page
No component has referenced this page since 9dab10e
and we do not
anticipate this changing, so this page can be safely removed.
Resolves #5768
Change-Id: I57acb5e4d0977d74df46aaf67606a19ec0f10bcf
This commit is contained in:
parent
1c2ad79bf8
commit
59eab37b95
@ -32,7 +32,6 @@ import (
|
||||
"storj.io/common/errs2"
|
||||
"storj.io/common/memory"
|
||||
"storj.io/common/storj"
|
||||
"storj.io/common/uuid"
|
||||
"storj.io/storj/private/web"
|
||||
"storj.io/storj/satellite/abtesting"
|
||||
"storj.io/storj/satellite/analytics"
|
||||
@ -142,7 +141,6 @@ type templates struct {
|
||||
index *template.Template
|
||||
notFound *template.Template
|
||||
internalServerError *template.Template
|
||||
usageReport *template.Template
|
||||
}
|
||||
|
||||
// apiAuth exposes methods to control authentication process for each generated API endpoint.
|
||||
@ -364,7 +362,6 @@ func NewServer(logger *zap.Logger, config Config, service *console.Service, oidc
|
||||
slashRouter.HandleFunc("/activation", server.accountActivationHandler)
|
||||
slashRouter.HandleFunc("/cancel-password-recovery", server.cancelPasswordRecoveryHandler)
|
||||
|
||||
router.HandleFunc("/usage-report", server.bucketUsageReportHandler)
|
||||
router.PathPrefix("/").Handler(http.HandlerFunc(server.appHandler))
|
||||
}
|
||||
|
||||
@ -574,83 +571,6 @@ func (server *Server) withRequest(handler http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
// bucketUsageReportHandler generate bucket usage report page for project.
|
||||
func (server *Server) bucketUsageReportHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
var err error
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
tokenInfo, err := server.cookieAuth.GetToken(r)
|
||||
if err != nil {
|
||||
server.serveError(w, http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
ctx, err = server.service.TokenAuth(ctx, tokenInfo.Token, time.Now())
|
||||
if err != nil {
|
||||
server.serveError(w, http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
// parse query params
|
||||
projectIDString := r.URL.Query().Get("projectID")
|
||||
publicIDString := r.URL.Query().Get("publicID")
|
||||
|
||||
var projectID uuid.UUID
|
||||
if projectIDString != "" {
|
||||
projectID, err = uuid.FromString(projectIDString)
|
||||
if err != nil {
|
||||
server.serveError(w, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
} else if publicIDString != "" {
|
||||
projectID, err = uuid.FromString(publicIDString)
|
||||
if err != nil {
|
||||
server.serveError(w, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
server.log.Error("bucket usage report error", zap.Error(errs.New("Project ID was not provided.")))
|
||||
server.serveError(w, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
sinceStamp, err := strconv.ParseInt(r.URL.Query().Get("since"), 10, 64)
|
||||
if err != nil {
|
||||
server.serveError(w, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
beforeStamp, err := strconv.ParseInt(r.URL.Query().Get("before"), 10, 64)
|
||||
if err != nil {
|
||||
server.serveError(w, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
since := time.Unix(sinceStamp, 0).UTC()
|
||||
before := time.Unix(beforeStamp, 0).UTC()
|
||||
|
||||
server.log.Debug("querying bucket usage report",
|
||||
zap.Stringer("projectID", projectID),
|
||||
zap.Stringer("since", since),
|
||||
zap.Stringer("before", before))
|
||||
|
||||
bucketRollups, err := server.service.GetBucketUsageRollups(ctx, projectID, since, before)
|
||||
if err != nil {
|
||||
server.log.Error("bucket usage report error", zap.Error(err))
|
||||
server.serveError(w, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
templates, err := server.loadTemplates()
|
||||
if err != nil {
|
||||
server.log.Error("unable to load templates", zap.Error(err))
|
||||
return
|
||||
}
|
||||
if err = templates.usageReport.Execute(w, bucketRollups); err != nil {
|
||||
server.log.Error("bucket usage report error", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
// frontendConfigHandler handles sending the frontend config to the client.
|
||||
func (server *Server) frontendConfigHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@ -1035,11 +955,6 @@ func (server *Server) parseTemplates() (_ *templates, err error) {
|
||||
// Loading index is optional.
|
||||
}
|
||||
|
||||
t.usageReport, err = template.ParseFiles(filepath.Join(server.config.StaticDir, "static", "reports", "usageReport.html"))
|
||||
if err != nil {
|
||||
return &t, Error.Wrap(err)
|
||||
}
|
||||
|
||||
t.notFound, err = template.ParseFiles(filepath.Join(server.config.StaticDir, "static", "errors", "404.html"))
|
||||
if err != nil {
|
||||
return &t, Error.Wrap(err)
|
||||
|
@ -2506,29 +2506,6 @@ func (s *Service) GetAllBucketNames(ctx context.Context, projectID uuid.UUID) (_
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// GetBucketUsageRollups retrieves summed usage rollups for every bucket of particular project for a given period.
|
||||
// projectID here may be Project.ID or Project.PublicID.
|
||||
func (s *Service) GetBucketUsageRollups(ctx context.Context, projectID uuid.UUID, since, before time.Time) (_ []accounting.BucketUsageRollup, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
user, err := s.getUserAndAuditLog(ctx, "get bucket usage rollups", zap.String("projectID", projectID.String()))
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
isMember, err := s.isProjectMember(ctx, user.ID, projectID)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
result, err := s.projectAccounting.GetBucketUsageRollups(ctx, isMember.project.ID, since, before)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GenGetBucketUsageRollups retrieves summed usage rollups for every bucket of particular project for a given period for generated api.
|
||||
func (s *Service) GenGetBucketUsageRollups(ctx context.Context, reqProjectID uuid.UUID, since, before time.Time) (rollups []accounting.BucketUsageRollup, httpError api.HTTPError) {
|
||||
var err error
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* Copyright (C) 2021 Storj Labs, Inc. */
|
||||
|
||||
/* See LICENSE for copying information. */
|
||||
|
||||
@font-face {
|
||||
font-family: 'font_regular';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src:
|
||||
local(''),
|
||||
url('/static/static/fonts/inter-v3-latin-regular.woff2') format('woff2'),
|
||||
url('/static/static/fonts/inter-v3-latin-regular.woff') format('woff'),
|
||||
url('/static/static/fonts/inter-v3-latin-regular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'font_regular', sans-serif;
|
||||
}
|
||||
|
||||
table.blueTable {
|
||||
border: 1px solid #1c6ea4;
|
||||
background-color: #eee;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.blueTable td,
|
||||
table.blueTable th {
|
||||
border: 1px solid #aaa;
|
||||
padding: 3px 2px;
|
||||
}
|
||||
|
||||
table.blueTable tbody td {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
table.blueTable tbody tr:nth-child(even) {
|
||||
background: #d0e4f5;
|
||||
}
|
||||
|
||||
table.blueTable thead {
|
||||
background: #1c6ea4;
|
||||
background: -moz-linear-gradient(top, #5592bb 0%, #327cad 66%, #1c6ea4 100%);
|
||||
background: -webkit-linear-gradient(top, #5592bb 0%, #327cad 66%, #1c6ea4 100%);
|
||||
background: linear-gradient(to bottom, #5592bb 0%, #327cad 66%, #1c6ea4 100%);
|
||||
border-bottom: 2px solid #444;
|
||||
}
|
||||
|
||||
table.blueTable thead th {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
border-left: 2px solid #d0e4f5;
|
||||
}
|
||||
|
||||
table.blueTable thead th:first-child {
|
||||
border-left: none;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
<!--Copyright (C) 2019 Storj Labs, Inc.-->
|
||||
<!--See LICENSE for copying information.-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Bucket usage rollups</title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/static/reports/usageReport.css">
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<table class="blueTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bucket Name</th>
|
||||
<th>Roll Up Period Start</th>
|
||||
<th>Roll Up Period End</th>
|
||||
<th>Network Stored Data, GBh</th>
|
||||
<th colspan="3">Egress, GB</th>
|
||||
<th>Segments, count*hours</th>
|
||||
<th>Objects, count*hours</th>
|
||||
<th>Metadata Size, GBh</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th>Repair</th>
|
||||
<th>Get</th>
|
||||
<th>Audit</th>
|
||||
<th>Total Segments</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $i, $value := . }}
|
||||
<tr>
|
||||
<td class="tg-0lax">{{ printf "%s" $value.BucketName }}</td>
|
||||
<td class="tg-0lax">{{ printf "%s" $value.Since }}</td>
|
||||
<td class="tg-0lax">{{ printf "%s" $value.Before }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.TotalStoredData }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.RepairEgress }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.GetEgress }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.AuditEgress }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.TotalSegments }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.ObjectCount }}</td>
|
||||
<td class="tg-0lax">{{ printf "%.6f" $value.MetadataSize }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user