Skip to content

refactor: fix ui template lint and unused test symbols - #1670

Open
VLukiantsev wants to merge 2 commits into
refactor/split-screenshot-test-utilsfrom
refactor/fix-ui-templates-and-unused-lint
Open

VLukiantsev wants to merge 2 commits into
refactor/split-screenshot-test-utilsfrom
refactor/fix-ui-templates-and-unused-lint

Conversation

@VLukiantsev

@VLukiantsev VLukiantsev commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Replace inline style= attributes, attribute string interpolations (class="{{ ... }}"), and complex template expressions in Angular .ng.html templates with SCSS classes, STATUS_COLOR_MAP/RESOURCE_COLOR_MAP/removeRowAriaLabels computed() signals, and [class]/[attr.aria-label] bindings; clean up unused imports/variables/properties in UI components, tests, and mocks; and add unit coverage for StatusChip, ResourceChip, and SmartResourceFinderComponent remove-button labels.

Motivation & Context

Eliminating inline styles, template branching logic, and unused symbols aligns UI templates with Angular best practices and prepares the UI codebase for stricter ESLint template and test rules.

Key Changes

Modified/added 24 file(s):

  • cmd/ui/app/common/components/artifact_card/artifact_card.ng.html
  • cmd/ui/app/common/components/artifact_card/artifact_card.scss
  • cmd/ui/app/common/components/dashboard/dashboard_grid/dashboard_grid_test.ts
  • cmd/ui/app/common/components/resource_chip/resource_chip.ng.html
  • cmd/ui/app/common/components/resource_chip/resource_chip.ts
  • cmd/ui/app/common/components/resource_chip/resource_chip_test.ts
  • cmd/ui/app/common/components/status_chip/status_chip.ng.html
  • cmd/ui/app/common/components/status_chip/status_chip.ts
  • cmd/ui/app/common/components/status_chip/status_chip_test.ts (new Karma spec covering all 15 StatusOption classes, mat-mdc-chip host preservation, and dynamic updates)
  • cmd/ui/app/common/components/status_message/status_message.ng.html
  • cmd/ui/app/common/components/status_message/status_message.ts
  • cmd/ui/app/common/components/work_units_status_bar/work_units_status_bar.ng.html
  • cmd/ui/app/resource_dashboard/components/smart_resource_finder/smart_resource_finder.ng.html
  • cmd/ui/app/resource_dashboard/components/smart_resource_finder/smart_resource_finder.ts
  • cmd/ui/app/resource_dashboard/components/smart_resource_finder/smart_resource_finder_test.ts
  • cmd/ui/app/service/auth.service_test.ts
  • cmd/ui/app/service/resource_service_test.ts
  • cmd/ui/app/service/testing/mock_status_message_service.ts
  • cmd/ui/app/service/testing/mock_work_units_service.ts
  • cmd/ui/app/side_panel/contents/queue_jobs_table/queue_jobs_pipes_test.ts
  • cmd/ui/app/side_panel/contents/queue_jobs_table/queue_jobs_table_test.ts
  • cmd/ui/app/testing/test.ts
  • cmd/ui/app/testing/testing.d.ts
  • cmd/ui/app/work_unit_page/work_unit_page_test.ts

Assumptions

  • Converting template class bindings/interpolations and inline styles in status_message, work_units_status_bar, and artifact_card produces identical DOM classes, CSS specificity (artifact_card.scss), and rendered pixels — status_chip_test.ts and resource_chip_test.ts verify mat-mdc-chip and color class transitions in Karma, while the other components lack CSS/visual unit assertions and Playwright screenshot tests were not run locally — if wrong, icon-link or bar styling could drift visually and fail CI Playwright screenshot specs.
  • Adding _ prefixes to unused mock/ambient helper parameters (mock_work_units_service.ts, testing.d.ts, test.ts) and removing template-only StatusOption/ResourceType class fields preserves runtime and test API contracts — checked via git grep across cmd/ui/ — any external consumer inspecting those removed instance properties would fail tsc.

Verification & Testing

  • Commands Executed: bazel test //cmd/ui:ui_unit_tests, Prettier check on all 24 touched UI files, npm run lint, tsc --noEmit -p tsconfig.json, tsc --noEmit -p tsconfig.spec.json, and ./.githooks/pre-commit
  • Coverage & Test Status: //cmd/ui:ui_unit_tests, targeted Prettier check, ESLint (including @angular-eslint/template/no-duplicate-attributes, conditional-complexity, and no-interpolation-in-attributes), tsc, and 316/316 Bazel backend tests passed (pre-existing repo-wide Prettier formatting debt in unrelated UI files is cleaned up in the next stacked PRs).

Related Issues / Bugs

  • Added TODO in cmd/ui/app/common/components/status_chip/status_chip.ts tracking missing .light-green and .grey CSS rules in status_chip.scss.

TAG=agy
CONV=ba8411ef-c093-4f45-950a-b3bc1899268c

Stack created with GitHub Stacks CLI • Give Feedback 💬

@VLukiantsev
VLukiantsev added this pull request to stack #1675 November 12, 2026 19:46

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several Angular components to improve template readability and maintainability by moving complex class-binding logic into computed properties and helper methods. It also cleans up unused imports, variables, and assignments across multiple test and mock files. The review feedback suggests further simplifying class bindings in both status_chip and resource_chip components by binding computed color strings directly to the [class] attribute, and combining separate boolean checks into a single computed property.

@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from e5a8452 to beb0fa4 Compare November 12, 2026 23:01
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several Angular components to improve code quality, readability, and maintainability. Key changes include moving inline styles to a dedicated CSS class in artifact_card, extracting complex template logic into computed signals for resource_chip, status_chip, and status_message, and cleaning up unused imports and variables across multiple test and mock files. Additionally, unused parameters and variables are now prefixed with underscores to satisfy linting rules. Feedback on the changes highlights a missing TODO comment in status_chip.ts that was mentioned in the PR description but not included in the code.

@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several Angular components (such as ResourceChip, StatusChip, and StatusMessage) to use computed signals, helper methods, and cleaner class bindings instead of complex inline template expressions. It also cleans up unused imports, variables, and parameters across various test files and mock services. The review feedback suggests further improving consistency by refactoring ResourceChip to use a single mapping object and a chipColor computed signal, matching the design pattern implemented in StatusChip.

@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several Angular components to clean up templates, extract inline styles into CSS classes, and utilize computed signals for dynamic class and attribute bindings. It also cleans up unused imports, variables, and parameters across various test files. The review feedback suggests further template optimizations: binding the statusColor() signal directly to [class] in status_chip.ng.html, avoiding calling component methods directly in templates in smart_resource_finder to prevent performance issues, and leveraging Angular's automatic class merging in work_units_status_bar.ng.html by separating static and dynamic classes.

@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from f81ab5a to 0cf22d4 Compare November 12, 2026 23:39
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several Angular components (such as artifact_card, resource_chip, status_chip, status_message, and smart_resource_finder) to use computed signals for dynamic classes and attributes, cleans up unused imports and variables, and adds new unit tests. The review feedback correctly identifies a visual bug in the status_chip component where an undefined replicas count results in an unwanted leading space (e.g., ' Running' instead of 'Running'), and suggests adding a corresponding unit test to prevent regressions.

@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 0cf22d4 to 1da1de3 Compare November 13, 2026 08:22
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 1da1de3 to 3041c20 Compare November 13, 2026 09:19
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 3041c20 to a7bb40f Compare November 13, 2026 10:14
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from a7bb40f to 5a574b9 Compare November 13, 2026 10:56
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 5a574b9 to 2c08ebd Compare November 13, 2026 11:58
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch 2 times, most recently from 0c7ed1b to 5f9ba37 Compare November 13, 2026 13:16
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 5f9ba37 to c1613b4 Compare November 13, 2026 14:12
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from c1613b4 to 0f49b9a Compare November 13, 2026 14:58
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch 2 times, most recently from b667d42 to 96787ba Compare November 16, 2026 09:17
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 96787ba to e1a5e2c Compare November 16, 2026 11:13
@VLukiantsev
VLukiantsev removed this pull request from stack #1675 November 16, 2026 11:16
@VLukiantsev
VLukiantsev added this pull request to stack #1702 November 16, 2026 11:16
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from e1a5e2c to 9024339 Compare November 16, 2026 11:44
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from 9024339 to cf99098 Compare November 16, 2026 12:36
@VLukiantsev
VLukiantsev marked this pull request as ready for review November 16, 2026 19:22
@github-actions
github-actions Bot requested a review from AntonTyb November 16, 2026 19:23
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch 2 times, most recently from ecb5073 to fe00599 Compare November 16, 2026 20:08
TAG=agy
CONV=ba8411ef-c093-4f45-950a-b3bc1899268c
…, memoize aria labels, and add unit tests

- Bind `<mat-chip [class]="statusColor()">` in `status_chip.ng.html` and `<mat-chip [class]="chipColor()">` backed by `RESOURCE_COLOR_MAP` in `resource_chip.ts` / `resource_chip.ng.html`.
- Remove unused `StatusOption` / `ResourceType` template helper fields, replace `getRemoveRowAriaLabel(...)` template method call with a memoized `removeRowAriaLabels` `computed()` signal in `smart_resource_finder.ts`, guard `(stateCount.state ?? '')` in `work_units_status_bar.ng.html`, and note missing `.light-green`/`.grey` CSS rules in `status_chip.ts`.
- Add `status_chip_test.ts` and expand `resource_chip_test.ts` and `smart_resource_finder_test.ts`.

TAG=agy
CONV=ba8411ef-c093-4f45-950a-b3bc1899268c
@VLukiantsev
VLukiantsev force-pushed the refactor/fix-ui-templates-and-unused-lint branch from fe00599 to 963d781 Compare November 17, 2026 11:37

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