Skip to content

Commit 995014d

Browse files
committed
misc layout and visual improvements
1 parent ece0447 commit 995014d

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

cmd/preview-admin/main.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ func (m *mockService) getMockStats(node did.DID, multiplier float64) *service.St
2121
now := time.Now().UTC()
2222
currentYear, currentMonth, currentDay := now.Date()
2323

24-
// Mock data - showing realistic egress values with variation per provider
25-
baseEgress := uint64(float64(156784325632) * multiplier)
24+
// Mock data - showing large egress values (TiB to PiB range) with variation per provider
25+
// Base is ~50 TiB, multipliers will create range from ~15 TiB to ~1.25 PiB
26+
baseEgress := uint64(float64(54975581388800) * multiplier)
2627

2728
return &service.Stats{
2829
PreviousMonth: service.PeriodStats{
@@ -63,32 +64,37 @@ func (m *mockService) GetAllProvidersStats(ctx context.Context, limit int, start
6364
Provider: must(did.Parse("did:key:z6MkrZ1r5XBFZjBU34qyD8fueMbMRkKw17BZaq2ivKFjnz2z")),
6465
OperatorEmail: "[email protected]",
6566
Endpoint: "https://node1.storage.example.com",
67+
WalletAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
6668
},
6769
{
6870
Provider: must(did.Parse("did:key:z6MkwCQm4mGfvAQJ9FzQb5nR5qZ7VHmGQG3dFfvGH5xnU3Rr")),
6971
OperatorEmail: "[email protected]",
7072
Endpoint: "https://node2.storage.example.com",
73+
WalletAddress: "0x8Ba1f109551bD432803012645Ac136ddd64DBA72",
7174
},
7275
{
7376
Provider: must(did.Parse("did:key:z6MkfQ7kBJpPFZzLvXHGmF2nqC9v8eUxPRjzUgVZYQxQz3Kk")),
7477
OperatorEmail: "[email protected]",
7578
Endpoint: "https://node3.storage.example.com",
79+
WalletAddress: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed",
7680
},
7781
{
7882
Provider: must(did.Parse("did:key:z6MkpTRfBGbZGJtQ2VXmV5qZ7VHmFxZ9LkH4JcNz8QdKr2Mm")),
7983
OperatorEmail: "[email protected]",
8084
Endpoint: "https://node4.storage.example.com",
85+
WalletAddress: "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359",
8186
},
8287
{
8388
Provider: must(did.Parse("did:key:z6MknHN3fvBZzG9QrZ5nJ8LxHmFxZ9LkH4JcNz8QdKr2Yy7p")),
8489
OperatorEmail: "[email protected]",
8590
Endpoint: "https://node5.storage.example.com",
91+
WalletAddress: "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB",
8692
},
8793
}
8894

8995
// Build providers with stats - with varied data
9096
providersWithStats := make([]service.ProviderWithStats, 0, len(mockProviders))
91-
multipliers := []float64{1.5, 0.8, 2.1, 0.3, 1.0} // Different traffic levels
97+
multipliers := []float64{1.5, 5.0, 12.0, 0.3, 25.0} // Different traffic levels from ~15 TiB to ~1.25 PiB
9298
for i, provider := range mockProviders {
9399
stats := m.getMockStats(provider.Provider, multipliers[i])
94100
providersWithStats = append(providersWithStats, service.ProviderWithStats{
@@ -119,7 +125,7 @@ func (m *mockService) GetAllAccountsStats(ctx context.Context, limit int, startT
119125

120126
// Build accounts with stats - with varied data
121127
accountsWithStats := make([]service.AccountStats, 0, len(mockAccounts))
122-
multipliers := []float64{2.5, 1.8, 0.9, 3.2, 0.5, 1.2, 0.7} // Different usage levels
128+
multipliers := []float64{8.0, 3.5, 0.8, 15.0, 1.2, 20.0, 0.4} // Different usage levels from ~20 TiB to ~1 PiB
123129
for i, account := range mockAccounts {
124130
stats := m.getMockStats(account, multipliers[i])
125131
accountsWithStats = append(accountsWithStats, service.AccountStats{

web/admin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ func formatBytes(b uint64) string {
108108
div *= unit
109109
exp++
110110
}
111-
return fmt.Sprintf("%.2f %cB", float64(b)/float64(div), "KMGTPE"[exp])
111+
return fmt.Sprintf("%.2f %ciB", float64(b)/float64(div), "KMGTPE"[exp])
112112
}
113113

114114
func formatDate(t interface{}) string {
115115
// Handle time.Time
116116
if v, ok := t.(interface{ Format(string) string }); ok {
117-
return v.Format("2006-01-02 15:04 MST")
117+
return v.Format("2006-01-02")
118118
}
119119
return fmt.Sprintf("%v", t)
120120
}

web/static/css/admin.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body {
1212
}
1313

1414
.container {
15-
max-width: 1400px;
15+
max-width: 1600px;
1616
margin: 0 auto;
1717
padding: 0;
1818
}
@@ -305,6 +305,13 @@ button:active {
305305
min-width: 400px;
306306
}
307307

308+
.providers-table td.wallet-address {
309+
font-family: 'DM Mono', 'Courier New', monospace;
310+
font-size: 0.85em;
311+
color: #666;
312+
white-space: nowrap;
313+
}
314+
308315
.providers-table td.account-did {
309316
font-family: 'DM Mono', 'Courier New', monospace;
310317
font-size: 0.85em;

web/templates/admin.html.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
{{with (index .Providers 0).Stats}}
3737
<div class="period-info">
3838
<div class="period-item">
39-
<strong>Current Day:</strong> {{.CurrentDay.Period.From | formatDate}} - {{.CurrentDay.Period.To | formatDate}}
39+
<strong>Current Day:</strong> {{.CurrentDay.Period.From | formatDate}}
4040
</div>
4141
<div class="period-item">
4242
<strong>Current Week:</strong> {{.CurrentWeek.Period.From | formatDate}} - {{.CurrentWeek.Period.To | formatDate}}
@@ -109,7 +109,7 @@
109109
{{with (index .Accounts 0).Stats}}
110110
<div class="period-info">
111111
<div class="period-item">
112-
<strong>Current Day:</strong> {{.CurrentDay.Period.From | formatDate}} - {{.CurrentDay.Period.To | formatDate}}
112+
<strong>Current Day:</strong> {{.CurrentDay.Period.From | formatDate}}
113113
</div>
114114
<div class="period-item">
115115
<strong>Current Week:</strong> {{.CurrentWeek.Period.From | formatDate}} - {{.CurrentWeek.Period.To | formatDate}}

0 commit comments

Comments
 (0)