-
-
Couldn't load subscription status.
- Fork 5
SF-3603 Convert to angular standalone components #3535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
❌ 19 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
1346006 to
915e185
Compare
915e185 to
18ec72f
Compare
6e057b5 to
7c59b63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review has turned out to be more epic than I initially thought! I'm submitting a partial review of what I have so far.
Also, I noticed that these two files need to be updated to remove standalone: true and standalone: false:
- src/SIL.XForge.Scripture/ClientApp/src/app/shared/json-viewer/json-viewer.component.ts
- src/SIL.XForge.Scripture/ClientApp/src/app/shared/json-viewer/json-viewer.component.spec.ts
@pmachapman reviewed 203 of 305 files at r1, all commit messages.
Reviewable status: 203 of 305 files reviewed, 4 unresolved discussions
src/SIL.XForge.Scripture/ClientApp/src/app/my-projects/my-projects.stories.ts line 195 at r1 (raw file):
imports: [ UICommonModule, SharedModule.forRoot(),
I think that the change to the chromatic tests is from this removal. (I don't think we should add provideUICommon() - I just wanted to flag what I think the possible cause is)
Code quote:
UICommonModule,
SharedModule.forRoot(),src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/job-events-dialog.component.ts line 39 at r1 (raw file):
imports: [MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatIcon, JsonViewerComponent] }) export class JobEventsDialogComponent {
RE: Your merge conflict, this class is now JobDetailsDialogComponent (job-details-dialog.component.ts)
Code quote:
export class JobEventsDialogComponent {src/SIL.XForge.Scripture/ClientApp/src/app/event-metrics/event-metric-dialog.component.html line 2 at r1 (raw file):
<ng-container *transloco="let t; read: 'event_metric_dialog'"> <div [dir]="i18n.direction">
I'm guessing this was changed because <mat-dialog> is not a valid tag?
I did a quick search and this tag is still being used in:
src/SIL.XForge.Scripture/ClientApp/src/app/checking/import-questions-dialog/import-questions-confirmation-dialog/import-questions-confirmation-dialog.component.htmlsrc/SIL.XForge.Scripture/ClientApp/src/app/settings/delete-project-dialog/delete-project-dialog.component.html
Code quote:
<div [dir]="i18n.direction">src/SIL.XForge.Scripture/ClientApp/.storybook/preview.ts line 13 at r1 (raw file):
import docJson from '../documentation.json'; import { provideSFTabs } from '../src/app/shared/sf-tab-group'; import { provideUICommon } from '../src/xforge-common/ui-common-providers';
NIT: This should be:
import { provideUICommon } from 'xforge-common/ui-common-providers';Code quote:
import { provideUICommon } from '../src/xforge-common/ui-common-providers';src/SIL.XForge.Scripture/ClientApp/src/main.ts line 10 at r1 (raw file):
} from '@angular/core'; import { ExceptionHandlingService } from 'xforge-common/exception-handling.service';
NIT: If the new lines are removed from above and below this line, the imports will sort correctly.
Suggestion:
import { ExceptionHandlingService } from 'xforge-common/exception-handling.service';convert test components to standalone along with adding component imports;
…rovider functions
7c59b63 to
96691a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 203 of 305 files reviewed, 2 unresolved discussions (waiting on @pmachapman)
src/SIL.XForge.Scripture/ClientApp/.storybook/preview.ts line 13 at r1 (raw file):
Previously, pmachapman (Peter Chapman) wrote…
NIT: This should be:
import { provideUICommon } from 'xforge-common/ui-common-providers';
Done.
src/SIL.XForge.Scripture/ClientApp/src/main.ts line 10 at r1 (raw file):
Previously, pmachapman (Peter Chapman) wrote…
NIT: If the new lines are removed from above and below this line, the imports will sort correctly.
Done.
src/SIL.XForge.Scripture/ClientApp/src/app/event-metrics/event-metric-dialog.component.html line 2 at r1 (raw file):
Previously, pmachapman (Peter Chapman) wrote…
I'm guessing this was changed because
<mat-dialog>is not a valid tag?I did a quick search and this tag is still being used in:
src/SIL.XForge.Scripture/ClientApp/src/app/checking/import-questions-dialog/import-questions-confirmation-dialog/import-questions-confirmation-dialog.component.htmlsrc/SIL.XForge.Scripture/ClientApp/src/app/settings/delete-project-dialog/delete-project-dialog.component.html
Good catch, thanks!
src/SIL.XForge.Scripture/ClientApp/src/app/my-projects/my-projects.stories.ts line 195 at r1 (raw file):
Previously, pmachapman (Peter Chapman) wrote…
I think that the change to the chromatic tests is from this removal. (I don't think we should add
provideUICommon()- I just wanted to flag what I think the possible cause is)
Yeah, maybe it is related to removal of UICommonModule, although provideUICommon() is now being applied to all stories via preview.ts.
src/SIL.XForge.Scripture/ClientApp/src/app/serval-administration/job-events-dialog.component.ts line 39 at r1 (raw file):
Previously, pmachapman (Peter Chapman) wrote…
RE: Your merge conflict, this class is now
JobDetailsDialogComponent(job-details-dialog.component.ts)
Thanks for the heads up!
This PR refactors the app to use standalone components and modern Angular provider patterns. Also
AppModuleandmain.tsare migrated to the new Angular standalone bootstrapping API.Used migration script
ng g @angular/core:standalonewith all three modes:Afterwards, manual migrations were needed, following these principles:
Provider functions over Modules
provideX()functions returningProvider[]orEnvironmentProvidersinstead of Angular modules (@NgModule)provideI18nStory(),provideRouter(),provideTestRealtime()Individual Directive/Pipe imports
CommonModuleimports with specific directives:AsyncPipe,NgClass,KeyValuePipe(import only what's actually used in the component template)Routing configuration
provideRouter(routes)in providers array instead ofRouterModule.forRoot()orRouterModule.forChild()in importsTest Module wrapper elimination
@NgModuletest classes (e.g.,TestModule,DialogTestModule)configureTestingModule()imports arrayThis change is