Repository navigation
feat: show a local mode notice in Settings instead of account and billing panels - #59
Merged
Conversation
…ling panels In local mode there is no account, and local FaaS has no refresh-token, password or billing routes, so the Settings panels could only fail or show placeholders. Render a LocalModeSettings card with the FaaS URL instead, and skip the billing requests.
Collaborator
|
LGTM :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In local mode (
metacall launchpad) there's no account, but Settings still showed the email, CLI token, password form, VAT, billing and subscription panels. None of them work against a local FaaS: Refresh Token showed a raw HTML 404 page in the error banner, the password update always failed, and the email was theexample@gmail.complaceholder.Now, when
isLocalMode()is true, Settings renders a newLocalModeSettingscomponent instead. It shows the FaaS URL the dashboard is using (getBaseUrl()), explains that account, password, CLI token and billing settings are on the hosted dashboard, and links to dashboard.metacall.io. Settings also skips thelistSubscriptions,inspectandlistSubscriptionsDeployscalls in local mode.The change in
SettingsPage.tsxis small: an early return after all the hooks, and a guard in the fetch effect. The existing panels aren't touched, so the hosted dashboard looks exactly the same.isLocalMode()is only true when/__launchpad/configreturnsmode: "local", and that probe is skipped on dashboard.metacall.io.I added four tests to
settings_page_test.tsx. In local mode the notice and FaaS URL are shown, the account, security and billing panels are hidden, and no billing requests are made. A fourth test checks the panels still render outside local mode. The three local mode tests fail onmasterand pass with this change.Test results:
npm run unitpasses (146/146), and lint,format:check, typecheck and build pass.npm run test(Playwright) is 96/97. The only failure isdashboard.spec.ts:96("three paid plan slot cards are rendered"), which also fails on a cleanmasterand isn't related to this change.How to test:
npm ci.cd cli && npm ci && npm run build && node dist/index.js.No login is needed in local mode. Before this change you get the full account page, and clicking Refresh Token shows the 404 page. After it you get the Local Mode card. With
npm run dev:fast(not local mode) Settings is unchanged.This covers the two Settings items under "Local Triad / Launchpad Support" in
TODO.md. I didn't editTODO.md, so you can tick them the way you prefer.Fixes #58
Part of #28
Type of Change
fix:Bug fix (non-breaking change which fixes an issue)feat:New feature (non-breaking change which adds functionality)refactor:Code refactor (no functional changes, no API changes)docs:Documentation updatetest:Adding or updating testschore:Maintenance (CI, dependencies, tooling)Screenshots / Recordings
Checklist
npm run unit, 146/146).npm run lint).format:check, typecheck and build).npm run test). One pre-existing failure remains atdashboard.spec.ts:96; it also fails on a cleanmasterand is unrelated to this change.fix: resolve login redirect).