Skip to content

Name the approval levels as template pages show them - #423

Draft
tnkuehne wants to merge 5 commits into
mainfrom
connection-pages-ui-docs
Draft

tnkuehne wants to merge 5 commits into
mainfrom
connection-pages-ui-docs

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Documentation for #422, in which each template names its approval levels after what they cover in that service, such as Ask except for drafts and labels in Gmail, and templates that create nothing without asking offer only Always ask and Never ask.

Changes

  • apps/docs/docs/guides/app-templates.md:
    • The approval level list explains the per-template middle level and the templates with two levels.
    • The generator section says it leaves src/page.ts and src/approval-levels.ts alone.

Publication

Blocked until #422 is merged and released. Based on the feature branch so the diff contains only documentation.

Each template's connection page now shows the service's logo and what it
offers, then one block for the current state: setup steps for the
administrator, a connect button, or the connected account with its actions
and the approval level. The layout lives once in the template generator's
runtime as layout.ts and follows Widefleet's colors in light and dark.
When an administrator removes a client secret after someone connected, the
page shows the setup steps and still lists the saved account with Disconnect
and its approval level. Only Reconnect needs the missing settings.
Each approval level has a short name and a line that says what asks first,
so the difference between asking always and asking except for new items is
visible at once. The footer with the signed-in Widefleet user is gone; the
page no longer needs the user's name.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 374b13a Nov 26 2026, 04:39 PM

tnkuehne added a commit that referenced this pull request Nov 26, 2026
A template's connection page is the first thing people see when they
open the app, and it was hard to read: five equally weighted paragraphs
("Personal connection", "Widefleet user: …", the API description, two
explanations), then Reconnect, the approval radios and Disconnect
stacked without grouping, and "After connecting, return to your app"
even when the account was already connected. The setup state mixed
instructions for administrators into running text addressed to everyone.

## Changes

Each template writes its page and its approval levels itself; the
generator copies only the code that generated methods call.

- **`templates/*/src/page.ts`**: each OAuth template writes its own
page: the service's logo and what it offers, then one block for the
current state:
- **Setup required**: numbered steps for the administrator in the
provider's own terms, with the callback URL or domain to copy and only
the missing secrets. A saved account stays listed below them with
Disconnect and its approval level; only Reconnect waits for the
settings.
- **Not connected**: one sentence and a primary "Connect <service>"
button.
- **Connected**: the account with Reconnect and Disconnect, a note on
what disconnecting does, then the approval levels as one grouped list.
- **`templates/*/src/layout.ts`**: each template's page shell and
Widefleet's color tokens for light and dark.
- **`templates/*/src/approval-levels.ts`** (new): the levels a template
offers, its default, and each level's name and what it asks about in
that service, such as **Ask except for drafts and labels** in Gmail or
**Ask except for new files and folders** in Google Drive. Strava, Teams
and WHOOP create nothing without asking, so they offer only **Always
ask** and **Never ask**, on the page and through `setApprovalLevel`, and
default to always asking. Agents show the template's level names when
they ask to loosen the level.
- **`templates/*/src/approval-page.ts`**: owned by each template, reads
its levels; saving behavior is unchanged.
- **Garmin Connect** keeps its Personal API key form on the same layout:
the account with Disconnect, then the key form ("Replace key" once
connected).
- **Generator**: copies only `selection.ts`, `input.ts`, the API client
files and, for templates that change data, `approval.ts` and
`approval-methods.ts`, which now read the template's
`approval-levels.ts`. `connectionPage` no longer takes the user's name,
which the page no longer shows.
- **Tests**: Strava, Garmin Connect, Qonto and WHOOP assertions read the
new markup; Strava, Teams and WHOOP check that they offer no level
between always and never and reject it when saved.

## Screenshots

Gmail stands in for the OAuth templates.

| Before | After |
| --- | --- |
| ![Gmail connected
before](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-connected-before.png)
| ![Gmail connected
after](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-connected-after.png)
|
| ![Gmail not connected
before](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-disconnected-before.png)
| ![Gmail not connected
after](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-disconnected-after.png)
|
| ![Gmail setup
before](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-setup-before.png)
| ![Gmail setup
after](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-setup-after.png)
|
| ![Garmin Connect connected
before](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/garmin-connected-before.png)
| ![Garmin Connect connected
after](https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/garmin-connected-after.png)
|

Failed connection at 390 px, connected in dark mode at 390 px, and
Garmin Connect before connecting:

<img
src="https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-failed-mobile-after.png"
width="260"> <img
src="https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-connected-dark-mobile-after.png"
width="260"> <img
src="https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/garmin-disconnected-after.png"
width="420">

Strava, with only two levels, and Google Drive at 390 px:

<img
src="https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/strava-connected-after.png"
width="560"> <img
src="https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/google-drive-connected-mobile-after.png"
width="260">

A secret removed after someone connected:

<img
src="https://gist.githubusercontent.com/tnkuehne/a3f888fdeb85b01b8c7f85a6d1078e42/raw/a205b0ce70ac129b30e1260e6155f0bc12747109/gmail-setup-connected-after.png"
width="560">

## Verification

- All 14 templates pass `typecheck` and `test`;
`packages/template-generator` tests pass.
- Format and type-aware lint are clean on the changed files.
- Rendered with synthetic fixtures at 1280 and 390 px in light and dark:
Gmail in all four states plus setup with a saved account, Garmin Connect
connected, not connected and with a rejected key, Strava setup with its
callback domain, Strava and Google Drive connected.
- Not checked in a browser against a running app: the OAuth redirect
round trip and saving the approval level by clicking. Both paths keep
their markup contracts (`/connect`, `/disconnect` forms, `#approval`
fieldset) and are covered by the template tests.

## Documentation

The approval levels are documented in #423 (draft until this is
released).


<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><ruby><rp>Confidence Score: 4/5 · Map previously saved approval
choices before merging so upgraded accounts keep working.</rp></ruby><a
href="https://app.greptile.com/api/retrigger?id=120772651&amp;sig=22593848f37bb1651ea22cca918ee9eacb1e83e2fa3677b61ecfdc9b3cd9f52e"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F422&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 4/5</h2>

<!-- greptile-risk -->

Map previously saved approval choices before merging so upgraded
accounts keep working.

<h2>Findings</h2>

1. <img alt="P1"
src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9"
align="top">&nbsp;**Saved approval choices break upgrades** <a
href="https://github.com/widefleet/widefleet/pull/422#discussion_r4711238977">▶</a>

<details open><summary><h3>Summary</h3></summary>

Reworks template connection pages into clear setup, disconnected and
connected sections.
- Service connection pages group setup steps, account actions, and
service details.
- Approval choices explain service actions and use names that agents
show.
</details>

<!-- greptile_confidence_score:4 -->

<sub>Reviews (4) · Last reviewed commit: ["Let each template write its
page and
app..."](6ee5aee)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
Base automatically changed from connection-pages-ui to main November 26, 2026 17:04

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant