aglinxinyuan opened a new pull request, #8752:
URL: https://github.com/apache/texera/pull/8752
### What changes were proposed in this PR?
Clicking the eye ("View") button on the hub workflow detail page switches
the view count between the compact form (`1.2k`) and the exact count (`1234`)
again. The button has done nothing since #3028.
**Root cause.** Only one method read `displayPreciseViewCount`:
`formatViewCount`. #3028 deleted it as a duplicate of the like-count formatter,
but the two were not the same. `formatViewCount` skipped the `k` abbreviation
while the flag was set. The button, its `(click)` handler and the flag were all
kept, so each click flipped a flag that nothing read.
```
Before: click eye -> "1.2k"; click again -> "1.2k"
After: click eye -> "1234"; click again -> "1.2k"
```
`formatViewCount` comes back as a thin wrapper over the shared
`formatCount`, and the view button's label uses it again. The like and clone
counts still go through `formatCount` and stay compact.
| | Default | After one click |
| --- | --- | --- |
| **Before** |  |  |
| **After** |  |  |
### History
| | |
| --- | --- |
| **Introduced by** | #2930 (2024-10-28), "Add view count to workflow": the
eye button, `changeViewDisplayStyle()`, `displayPreciseViewCount`, and
`formatViewCount`, which read the flag. The PR's demo shows the exact count
after a click |
| **Usage removed by** | #3028 (2024-11-11), "Remove duplicate and
unnecessary code": deleted `formatViewCount` and switched the label to
`formatCount` |
The toggle worked for two weeks and has done nothing for almost two years
since. The dataset detail page's copy of the button is a different case: #3269
added it after #3028, so it never worked there, and #8746 removes it.
### Any related issues, documentation, discussions?
Closes #8751
### How was this PR tested?
The old spec case only checked that the flag flipped, and it passed while
the button did nothing. It is replaced by:
| Surface | Pinned |
| --- | --- |
| `formatViewCount` | Compact by default. Exact after one toggle, compact
again after a second. `1000` shows as `1.0k` / `1000`. `0`, `1` and `999` look
the same in both styles. The compact style of `1234567` equals `formatCount`,
and the exact style is `1234567` |
| Rendered view button (real template) | Shows `1.2k` for 1234 views. A
click shows `1234`, a second click `1.2k`. Same when the page opens as a modal.
The like count stays `2.5k` after the view button is clicked |
The rendered-button cases were run against `main`'s component first and fail
there with `expected '1.2k' to be '1234'`.
From `frontend/`:
- `npx ng test --watch=false
--include='**/hub-workflow-detail.component.spec.ts'`: 51 tests, all pass.
- `yarn format:ci`: clean.
- `npx ng build`: success.
Screenshots: `ng serve` against a stub API that reports 1234 views, 56 likes
and 12 clones. Headless Chromium at 1280×720 via Playwright, with the button
row captured before and after one click on the eye. **Before** is the same page
running `main`'s component.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]