console: tier editing stays reachable on a phone
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+43
−5
internal/console/opeconomics_test.go+37 −0internal/console/static/ops.css+2 −1internal/console/templates/economics_accounts.html+4 −4
diff --git a/internal/console/opeconomics_test.go b/internal/console/opeconomics_test.go| index 37079f483..62998a139 100644 |
| --- a/internal/console/opeconomics_test.go |
| +++ b/internal/console/opeconomics_test.go |
| @@ -224,3 +224,40 @@ func TestEconomicsScriptsStillFindTheirElements(t *testing.T) { |
| } |
| } |
| } |
| + |
| +var econCellTag = regexp.MustCompile(`<t[dh][\s>][^>]*>?`) |
| + |
| +// TestEconomicsTierFormShowsOnAPhone: the accounts page's Tier cell, pill |
| +// and form, is never in a column the phone layout hides (co-m-hide): an |
| +// operator on a narrow screen can still read and change a tier. Its |
| +// heading is not hidden either. |
| +func TestEconomicsTierFormShowsOnAPhone(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + seedEconomicsGolden(t, fx) |
| + c := econOperator(t, fx) |
| + body := econGet(t, fx, c, "/fleet/economics/accounts") |
| + |
| + forms := 0 |
| + for i := 0; ; { |
| + j := strings.Index(body[i:], `<form co-tier method="post" action="/fleet/economics/tier">`) |
| + if j < 0 { |
| + break |
| + } |
| + at := i + j |
| + forms++ |
| + cell := strings.LastIndex(body[:at], "<td") |
| + if cell < 0 || strings.Contains(body[cell:at], "</td>") { |
| + t.Fatalf("the tier form at %d is not inside a table cell", at) |
| + } |
| + if tag := econCellTag.FindString(body[cell:]); strings.Contains(tag, "co-m-hide") { |
| + t.Errorf("the tier form's cell %s is hidden on a phone", tag) |
| + } |
| + i = at + 1 |
| + } |
| + if forms == 0 { |
| + t.Fatalf("no tier form on the accounts page:\n%s", body) |
| + } |
| + if !strings.Contains(body, `<th scope="col">Tier</th>`) { |
| + t.Errorf("the Tier heading is missing or hidden on a phone") |
| + } |
| +} |
diff --git a/internal/console/static/ops.css b/internal/console/static/ops.css| index b131ba009..d0afcc1d7 100644 |
| --- a/internal/console/static/ops.css |
| +++ b/internal/console/static/ops.css |
| @@ -116,7 +116,8 @@ |
| @media (max-width: 800px) { |
| [co-table] [co-m-hide] { display: none; } |
| [co-table]:has([co-m-hide]) :is(th, td) { padding-inline: 0.6rem; } |
| - [co-table]:has([co-m-hide]) :is(th, td:first-child) { overflow-wrap: anywhere; white-space: normal; } |
| + [co-table]:has([co-m-hide]) th { white-space: normal; } |
| + [co-table]:has([co-m-hide]) td:first-child { overflow-wrap: anywhere; white-space: normal; } |
| } |
| [co-table] [co-wrap] { white-space: normal; } |
diff --git a/internal/console/templates/economics_accounts.html b/internal/console/templates/economics_accounts.html| index 69ef7d537..d6f9ff9aa 100644 |
| --- a/internal/console/templates/economics_accounts.html |
| +++ b/internal/console/templates/economics_accounts.html |
| @@ -72,14 +72,14 @@ |
| <th scope="col" co-m-hide title="the part of Egress GB that left its home box for a region edge first — the inter-region leg is a platform cost, absorbed, in no account's bill">Backhaul GB</th> |
| <th scope="col" co-m-hide>Storage GB-month</th> |
| <th scope="col">Cost</th> |
| - <th scope="col">Would-be revenue</th> |
| + <th scope="col" co-m-hide>Would-be revenue</th> |
| <th scope="col" co-m-hide title="Pooled rows (free-tier position "pooled") show an em-dash: their revenue is shared through the fleet pool, not individually priced, so a margin fraction has nothing to divide. Fleet-tier rows can legitimately show 100%: fleet boxes are customer-owned hardware, zero cost to the platform, by design.">Margin</th> |
| <th scope="col" co-m-hide>Free tier</th> |
| {{/* Tier (Task 6): the operator's fleet-pool ASSIGNMENT for this |
| account (store.go's validAccountTiers), distinct from the Free |
| tier column's PRICED POSITION — "pooled" over there can come from |
| any of try/pool/"" here. */}} |
| - <th scope="col" co-m-hide>Tier</th> |
| + <th scope="col">Tier</th> |
| </tr> |
| {{range .EconAccounts.Rows}} |
| {{$tier := index $.Economics.Tiers .Account}} |
| @@ -113,10 +113,10 @@ |
| <td co-m-hide>{{printf "%.2f" (index .Meters "backhaul_gb")}}</td> |
| <td co-m-hide>{{printf "%.2f" (index .Meters "storage_gb_month")}}</td> |
| <td class="js-acct-cost">{{usd .Econ.CostUSD}}</td> |
| - <td class="js-acct-revenue">{{usd .Econ.RevenueUSD}}</td> |
| + <td class="js-acct-revenue" co-m-hide>{{usd .Econ.RevenueUSD}}</td> |
| <td class="js-acct-margin" co-m-hide>{{marginCell .Econ.MarginFrac .Econ.FreeTierPos}}</td> |
| <td class="js-acct-freetier" co-m-hide>{{template "op_status" (opPill .Econ.FreeTierPos (freeTierTone .Econ.FreeTierPos))}}</td> |
| - <td co-m-hide> |
| + <td> |
| {{template "op_status" (opPill (tierWord $tier) (tierTone (tierWord $tier)))}} |
| {{if $known}} |
| {{/* Progressive: a plain <select> + submit button, no JS required — |