Repository navigation
mgr/dashboard: bump angular to 20.3.29 - #66724
Conversation
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
e416273 to
df115fe
Compare
| import { Injectable } from '@angular/core'; | ||
|
|
||
| /** | ||
| * Browser-native XML parsing service. | ||
| * | ||
| * This replaces the Node-only `xml2js` library, which requires Node core | ||
| * modules (`timers`, `stream`, ...) that cannot be bundled for the browser by | ||
| * esbuild (the Angular `application` builder). It reproduces the object shape | ||
| * produced by `xml2js` when configured with `{ explicitArray: false, trim: true }`, | ||
| * which is all the dashboard relies on: | ||
| * | ||
| * - the root element name becomes the single top-level key, | ||
| * - an element with only text resolves to its trimmed text value, | ||
| * - an element with children resolves to an object keyed by child tag name, | ||
| * - a tag that appears once is a value; a tag that repeats becomes an array. | ||
| */ | ||
| @Injectable({ | ||
| providedIn: 'root' | ||
| }) | ||
| export class XmlService { | ||
| /** | ||
| * Parse an XML string into a plain object. | ||
| * | ||
| * @param xml the XML string to parse | ||
| * @returns the parsed object, or `null` when the input is empty or malformed | ||
| */ | ||
| parse(xml: string): any { | ||
| if (!xml) { | ||
| return null; | ||
| } | ||
|
|
||
| const doc = new DOMParser().parseFromString(xml, 'application/xml'); | ||
| if (doc.querySelector('parsererror') || !doc.documentElement) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
we should have this from backend. Frontend parsing raw S3 ACL XML is a smell.
have the backend convert the ACL to structured JSON
There was a problem hiding this comment.
i don't remember if there was any specific reason we chose to parse it in front-end. @Pegonzal ?
There was a problem hiding this comment.
I think this could be done in a single place from the backend, don't recall a reason not to do it right now.
Just a heads up, one of the places this is being used is for xml input validation in the rgw lifecycles, that could trigger many requests. And also being used to parser xml ACL responses from the backend.
But I suppose all of this could be properly handled from the backend
There was a problem hiding this comment.
thanks @Pegonzal. I've tested the current implementation which is working fine. I had a look at the back-end implementation too but that will introduce more changes to both UI and back-end so I will probably won't mix it with the angular PR. I opened a different tracker https://tracker.ceph.com/issues/80306 and assigned to me. I'll take care of it separately. cc: @afreen23
|
df115fe to
ab148c2
Compare
override cypress module to common, cypress is still older |
ab148c2 to
06e7762
Compare
There was a problem hiding this comment.
Pull request overview
Upgrades the Dashboard frontend to Angular 20 and Node.js 24, adopting the esbuild application builder and replacing incompatible dependencies/imports.
Changes:
- Upgrades Angular, ng-bootstrap, Node.js, and build configuration.
- Replaces
xml2jswith a browser-native XML service. - Removes unsupported deep imports and updates affected tests.
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/pybind/mgr/dashboard/frontend/tsconfig.spec.json |
Enables ES modules for tests. |
src/pybind/mgr/dashboard/frontend/tsconfig.json |
Configures bundler resolution. |
src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss |
Fixes IBM font resolution. |
src/pybind/mgr/dashboard/frontend/src/app/shared/services/xml.service.ts |
Adds browser XML parsing. |
src/pybind/mgr/dashboard/frontend/src/app/shared/services/xml.service.spec.ts |
Tests XML parsing. |
src/pybind/mgr/dashboard/frontend/src/app/shared/services/tree-view.service.ts |
Uses the local tree-node type. |
src/pybind/mgr/dashboard/frontend/src/app/shared/services/tree-view.service.spec.ts |
Updates tree service tests. |
src/pybind/mgr/dashboard/frontend/src/app/shared/services/favicon.service.ts |
Updates the DOCUMENT import. |
src/pybind/mgr/dashboard/frontend/src/app/shared/models/carbon-tree-node.ts |
Adds a local Carbon node model. |
src/pybind/mgr/dashboard/frontend/src/app/shared/components/setup-step-card/setup-step-card.component.spec.ts |
Avoids ng-reflect assertions. |
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notification-panel/notification-area/notification-area.component.spec.ts |
Updates component input assertions. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts |
Uses the local node model. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-tags-table/rgw-bucket-tags-table.component.ts |
Migrates ACL parsing. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-tags-table/rgw-bucket-tags-table.component.spec.ts |
Updates component construction. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-resource-page/rgw-bucket-resource-page.component.ts |
Migrates ACL parsing. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts |
Migrates form ACL parsing. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-form/host-form.component.ts |
Uses the supported named export. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/crushmap/crushmap.component.ts |
Uses the local node model. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts |
Uses the local node model. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts |
Updates the node import. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts |
Uses the local node model. |
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.spec.ts |
Updates the node import. |
src/pybind/mgr/dashboard/frontend/package.json |
Upgrades Angular dependencies. |
src/pybind/mgr/dashboard/frontend/cypress/tsconfig.json |
Retains CommonJS for Cypress. |
src/pybind/mgr/dashboard/frontend/CMakeLists.txt |
Updates build-time Node.js. |
src/pybind/mgr/dashboard/frontend/angular.json |
Migrates to the esbuild builder. |
src/pybind/mgr/dashboard/frontend/.nvmrc |
Updates local Node.js. |
make-dist |
Updates distribution Node.js. |
doc/dev/developer_guide/dash-devel.rst |
Documents the Node.js requirement. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "@angular/animations": "20.3.29", | ||
| "@angular/common": "20.3.29", | ||
| "@angular/compiler": "20.3.29", | ||
| "@angular/core": "20.3.29", | ||
| "@angular/forms": "20.3.29", |
There was a problem hiding this comment.
I've took care of couple of them like @carbon/charts-angular, ng-cookie-service, eslint. Jest will require even more refactoring which I can take separately. for now it works as is. we might need to bump it.
There was a problem hiding this comment.
I guess same thing for this warning, right?
▲ [WARNING] Deprecation [plugin angular-sass]
src/styles.scss:26:8:
26 │ @import './src/styles/ceph-custom/basics';
╵ ^
Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
The plugin "angular-sass" was triggered by this import
angular:styles/global:styles:2:8:
2 │ @import 'src/styles.scss';
╵ ~~~~~~~~~~~~~~~~~
▲ [WARNING] Deprecation [plugin angular-sass]
src/styles.scss:80:16:
80 │ background: darken($success, 15%);
╵ ^
Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
Use color.adjust instead.
More info and automated migrator: https://sass-lang.com/d/import
The plugin "angular-sass" was triggered by this import
angular:styles/global:styles:2:8:
2 │ @import 'src/styles.scss';
╵ ~~~~~~~~~~~~~~~~~
...
There was a problem hiding this comment.
yup, they are actually not because of this PR but from an older bump of angular. I will fix this once I finish with the angular upgrades. I am guessing I'll see some more error in the angular 21 bump.
4337c6a to
e416d9e
Compare
|
couple of more important changes.
These are the approved ones These are denied. The carbon packages are simply running the telemetry |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Migrating to new esbuild builder (we were using old webpack builder), and this could improve the build times and modernize the application. Also pretty restrictive on the angular practices so the build will make sure we don't fall short on the best practices. https://medium.com/@fahrigedik/angular-application-builder-transitioning-from-webpack-to-esbuild-82afa505a077 **ISSUES I FACED** 1. xml2js is a library that relies on node core modules (timers, stream), which the old webpack builder auto-polyfilled but esbuild does not and that fails the build with ``` Could not resolve "timers" in node_modules/xml2js/lib/parser.js ``` So I removed the xml2js dep and parsed the S3 ACL XML with browser-native DOMParser via a new XmlService (which is written with the help of claude so I don't miss anything there). Also added tests 2. ``` ✘ [ERROR] Could not resolve "~@ibm/plex/IBM-Plex-Mono/fonts/split/woff2/IBMPlexMono-Light-Cyrillic.woff2" [plugin angular-css-resource] src/styles.scss:8398:11: 8398 │ src: url("../node_modules/@carbon/styles/scss/fonts||file:~@ib... ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` which is fixed by removing `~` for `@ibm/plex` in styles scss 3. strict module resolution and deep import blockages ``` [ERROR] TS2307: Cannot find module 'carbon-components-angular/treeview/tree-node.types' or its corresponding type declarations. [plugin angular-compiler] src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts:3:21: 3 │ ...{ Node } from 'carbon-components-angular/treeview/tree-node.types'; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` I created a new tree-node model in the repo itself and left a clear explanation in its start. Also raised an issue to carbon-components angular. Similarly ``` ✘ [ERROR] TS2307: Cannot find module 'chart.js/dist/types/utils' or its corresponding type declarations. [plugin angular-compiler] node_modules/ng2-charts/lib/ng-charts.provider.d.ts:3:28: 3 │ import { DeepPartial } from 'chart.js/dist/types/utils'; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` and added the path to tsconfig.json. The solution is to bump ng2-charts to v9+ but not doing it for now.. valor-software/ng2-charts#1991 (comment) ``` ✘ [ERROR] TS2613: Module '".../brace-expansion/dist/esm/index"' has no default export. Did you mean to use 'import { expand } from "..."' instead? [plugin angular-compiler] src/app/ceph/cluster/hosts/host-form/host-form.component.ts:4:7: 4 │ import expand from 'brace-expansion'; ╵ ~~~~~~ ``` another similar issue 4. had to bump `ng-bootstrap` to 19 which is what angular 20 supports ``` ✘ [ERROR] No matching export in "node_modules/@angular/core/fesm2022/core.mjs" for import "AfterRenderPhase" node_modules/@ng-bootstrap/ng-bootstrap/fesm2022/ng-bootstrap.mjs:2:287: 2 │ ...ector, afterNextRender, AfterRenderPhase, LOCALE_ID, ViewChild, ... ╵ ~~~~~~~~~~~~~~~~ ✘ [ERROR] No matching export in "node_modules/@angular/core/fesm2022/core.mjs" for import "afterRender" node_modules/@ng-bootstrap/ng-bootstrap/fesm2022/ng-bootstrap.mjs:2:339: 2 │ ...ID, ViewChild, forwardRef, afterRender, ApplicationRef, Environm... ╵ ~~~~~~~~~~~ ``` 5. override cypress module to common, cypress is still older ``` TSError: ⨯ Unable to compile TypeScript: error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ``` Fixes: https://tracker.ceph.com/issues/79687 Signed-off-by: Nizamudeen A <[email protected]>
relying on `ng-reflex-*` is wrong since its an angular debugging attr which may/maynot exist during the testing. best way to guarantee success here is by checkng the properties of componentInstance directly. Fixes: https://tracker.ceph.com/issues/79687 Signed-off-by: Nizamudeen A <[email protected]>
this is the default angular location during the build. I can override this in angular.json through `browser: ""` which I did initially but I learned that when you run it through cli like `ng build --output-path dist/` it will override the angular config and sent the build to `dist/browser` which is what currently happens in the CI or CMakefile. So instead of fighting with angular's default, accepting that here Fixes: https://tracker.ceph.com/issues/79687 Signed-off-by: Nizamudeen A <[email protected]>
part of https://github.com/orgs/community/discussions/198547 the npm now needs to explicitly allow running post-install scripts as part of the installation for security reasons. so manually allowing and denying some packages to run the post-install scripts These are the approved ones ``` Approved cypress: added [email protected] Approved esbuild: added [email protected] Approved lmdb: added [email protected] Approved msgpackr-extract: added [email protected] Approved @parcel/watcher: added @parcel/[email protected] ``` These are denied. The carbon packages are simply running the telemetry as part of the postinstall which is fine to be disallowed. ``` Denied @scarf/scarf: added @scarf/scarf Denied @carbon/charts: added @carbon/charts Denied @carbon/colors: added @carbon/colors Denied @carbon/feature-flags: added @carbon/feature-flags Denied @carbon/grid: added @carbon/grid Denied @carbon/icons: added @carbon/icons Denied @carbon/layout: added @carbon/layout Denied @carbon/motion: added @carbon/motion Denied @carbon/styles: added @carbon/styles Denied @carbon/themes: added @carbon/themes Denied @carbon/type: added @carbon/type Denied @carbon/utils-position: added @carbon/utils-position Denied carbon-components-angular: added carbon-components-angular Denied core-js: added core-js Denied cucumber-expressions: added cucumber-expressions Denied es5-ext: added es5-ext ``` Fixes: https://tracker.ceph.com/issues/79687 Signed-off-by: Nizamudeen A <[email protected]>
01d97c4 to
2f20943
Compare
|
unrelated make check Tests (1 failure / ±0) |
|
jenkins test make check |
| "@angular/animations": "20.3.29", | ||
| "@angular/common": "20.3.29", | ||
| "@angular/compiler": "20.3.29", | ||
| "@angular/core": "20.3.29", | ||
| "@angular/forms": "20.3.29", |
There was a problem hiding this comment.
I guess same thing for this warning, right?
▲ [WARNING] Deprecation [plugin angular-sass]
src/styles.scss:26:8:
26 │ @import './src/styles/ceph-custom/basics';
╵ ^
Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
The plugin "angular-sass" was triggered by this import
angular:styles/global:styles:2:8:
2 │ @import 'src/styles.scss';
╵ ~~~~~~~~~~~~~~~~~
▲ [WARNING] Deprecation [plugin angular-sass]
src/styles.scss:80:16:
80 │ background: darken($success, 15%);
╵ ^
Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
Use color.adjust instead.
More info and automated migrator: https://sass-lang.com/d/import
The plugin "angular-sass" was triggered by this import
angular:styles/global:styles:2:8:
2 │ @import 'src/styles.scss';
╵ ~~~~~~~~~~~~~~~~~
...
bumping eslint to a supported version, ngx-cook-eservice to 21.3.1 which is what works for angular <22 and @carbon/charts-angular to 1.27.18 Fixes: https://tracker.ceph.com/issues/79687 Signed-off-by: Nizamudeen A <[email protected]>
2f20943 to
7340d42
Compare
good point, updated that. while i was at it I made a small modification to say the production build is built by |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
mgr/dashboard: bump angular to 20.3.29 Reviewed-by: Afreen Misbah <[email protected]> Reviewed-by: Pedro Gonzalez Gomez <[email protected]>
First of all, bumping node to 24.19.0
Migrating to new esbuild builder (we were using old webpack builder),
and this could improve the build times and modernize the application.
Also pretty restrictive on the angular practices so the build will make
sure we don't fall short on the best practices.
https://medium.com/@fahrigedik/angular-application-builder-transitioning-from-webpack-to-esbuild-82afa505a077
ISSUES I FACED
which the old webpack builder auto-polyfilled but esbuild does not and
that fails the build with
So I removed the xml2js dep and parsed the S3 ACL XML with
browser-native DOMParser via a new XmlService (which is written with the
help of claude so I don't miss anything there). Also added tests
which is fixed by removing
~for@ibm/plexin styles scssI created a new tree-node model in the repo itself and left a clear
explanation in its start. Also raised an issue to carbon-components
angular.
Similarly
and added the path to tsconfig.json. The solution is to bump ng2-charts
to v9+ but not doing it for now..
valor-software/ng2-charts#1991 (comment)
another similar issue
ng-bootstrapto 19 which is what angular 20 supportsFixes: https://tracker.ceph.com/issues/79687
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.