Repository navigation
refactor: fix ui template lint and unused test symbols - #1670
VLukiantsev wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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.
e5a8452 to
beb0fa4
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
|
/gemini review |
There was a problem hiding this comment.
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.
|
/gemini review |
There was a problem hiding this comment.
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.
f81ab5a to
0cf22d4
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
0cf22d4 to
1da1de3
Compare
1da1de3 to
3041c20
Compare
3041c20 to
a7bb40f
Compare
a7bb40f to
5a574b9
Compare
5a574b9 to
2c08ebd
Compare
0c7ed1b to
5f9ba37
Compare
5f9ba37 to
c1613b4
Compare
c1613b4 to
0f49b9a
Compare
b667d42 to
96787ba
Compare
96787ba to
e1a5e2c
Compare
e1a5e2c to
9024339
Compare
9024339 to
cf99098
Compare
ecb5073 to
fe00599
Compare
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
fe00599 to
963d781
Compare
Summary
Replace inline
style=attributes, attribute string interpolations (class="{{ ... }}"), and complex template expressions in Angular.ng.htmltemplates with SCSS classes,STATUS_COLOR_MAP/RESOURCE_COLOR_MAP/removeRowAriaLabelscomputed()signals, and[class]/[attr.aria-label]bindings; clean up unused imports/variables/properties in UI components, tests, and mocks; and add unit coverage forStatusChip,ResourceChip, andSmartResourceFinderComponentremove-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.htmlcmd/ui/app/common/components/artifact_card/artifact_card.scsscmd/ui/app/common/components/dashboard/dashboard_grid/dashboard_grid_test.tscmd/ui/app/common/components/resource_chip/resource_chip.ng.htmlcmd/ui/app/common/components/resource_chip/resource_chip.tscmd/ui/app/common/components/resource_chip/resource_chip_test.tscmd/ui/app/common/components/status_chip/status_chip.ng.htmlcmd/ui/app/common/components/status_chip/status_chip.tscmd/ui/app/common/components/status_chip/status_chip_test.ts(new Karma spec covering all 15StatusOptionclasses,mat-mdc-chiphost preservation, and dynamic updates)cmd/ui/app/common/components/status_message/status_message.ng.htmlcmd/ui/app/common/components/status_message/status_message.tscmd/ui/app/common/components/work_units_status_bar/work_units_status_bar.ng.htmlcmd/ui/app/resource_dashboard/components/smart_resource_finder/smart_resource_finder.ng.htmlcmd/ui/app/resource_dashboard/components/smart_resource_finder/smart_resource_finder.tscmd/ui/app/resource_dashboard/components/smart_resource_finder/smart_resource_finder_test.tscmd/ui/app/service/auth.service_test.tscmd/ui/app/service/resource_service_test.tscmd/ui/app/service/testing/mock_status_message_service.tscmd/ui/app/service/testing/mock_work_units_service.tscmd/ui/app/side_panel/contents/queue_jobs_table/queue_jobs_pipes_test.tscmd/ui/app/side_panel/contents/queue_jobs_table/queue_jobs_table_test.tscmd/ui/app/testing/test.tscmd/ui/app/testing/testing.d.tscmd/ui/app/work_unit_page/work_unit_page_test.tsAssumptions
status_message,work_units_status_bar, andartifact_cardproduces identical DOM classes, CSS specificity (artifact_card.scss), and rendered pixels —status_chip_test.tsandresource_chip_test.tsverifymat-mdc-chipand 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._prefixes to unused mock/ambient helper parameters (mock_work_units_service.ts,testing.d.ts,test.ts) and removing template-onlyStatusOption/ResourceTypeclass fields preserves runtime and test API contracts — checked viagit grepacrosscmd/ui/— any external consumer inspecting those removed instance properties would failtsc.Verification & Testing
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//cmd/ui:ui_unit_tests, targeted Prettier check, ESLint (including@angular-eslint/template/no-duplicate-attributes,conditional-complexity, andno-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
TODOincmd/ui/app/common/components/status_chip/status_chip.tstracking missing.light-greenand.greyCSS rules instatus_chip.scss.TAG=agy
CONV=ba8411ef-c093-4f45-950a-b3bc1899268c
Stack created with GitHub Stacks CLI • Give Feedback 💬