lxbme opened a new pull request, #3457:
URL: https://github.com/apache/apisix-dashboard/pull/3457
Please answer these questions before submitting a pull request, **or your PR
will get closed**.
**Why submit this pull request?**
- [ ] Bugfix
- [x] New feature provided
- [ ] Improve performance
- [ ] Backport patches
**What changes will this PR take into?**
A resource id is the string you paste into a `curl` against the Admin API,
into a declarative config, or into another resource's `upstream_id`. Getting
one out of the dashboard meant selecting the text by hand.
Every list's identifier cell now carries a copy control — ten resources
keyed by `id`, plus consumers keyed by `username` — through a shared
`CopyableId`, so the markup and the copied/idle feedback are defined once
rather than eleven times. Because `routes` and `stream_routes` are shared list
components rendered both at their own route and under a service detail, the
eleven edits cover thirteen views.
Two new strings nest under the existing `form.btn` object, translated in all
five locales.
### Why the list cell rather than the detail page's id field
The detail page looks like the natural home, and it was the first attempt.
It does not work: detail sections render as a disabled `<fieldset>` to express
read-only — a deliberate choice, with a comment in `FormSectionGeneral`
explaining why — and the HTML spec disables every form control inside one. A
copy button there is greyed out in exactly the mode where you want to read an
id. Table cells sit outside that fieldset.
### One consequence worth flagging for review
Putting a control inside a cell changes that cell's accessible name to
`"<id> Copy"` — inherent to accessible-name computation, not specific to this
implementation. Two consumer-group specs asserted `getByRole('cell', { name:
id, exact: true })` and so needed updating. They now assert on the id **text**
inside the table, which expresses "this row exists" more directly and survives
anything else the cell may later hold.
**Related issues**
Part of #3453
**Checklist:**
- [x] Did you explain what problem does this PR solve? Or what new features
have been added?
- [x] Have you added corresponding test cases?
- [ ] Have you modified the corresponding document?
- [x] Is this PR backward compatible? If it is not backward compatible,
please discuss on the mailing list first
Tests: `e2e/tests/regression/general.copyable-id.spec.ts` seeds a route,
clicks the control, and asserts both the copied state and — reading the
clipboard — that the value copied is the id. The clipboard assertion is the
load-bearing one: a control that flips to "Copied" while writing the wrong
value, or nothing at all, would satisfy the state assertion alone.
Verified: `pnpm test`, `pnpm lint`, `pnpm exec tsc -b` and a production
`pnpm build` all clean; the full `pnpm e2e` suite green apart from pre-existing
environment flakes that pass on isolated rerun. Checked by hand in Chrome
across several rows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]