Skip to content

Commit 3dd556a

Browse files
authored
refactor(frontend): convert all components to standalone (#4873)
### What changes were proposed in this PR? Run Angular's official `ng generate @angular/core:standalone --mode=convert-to-standalone --defaults` across the frontend. Flips every `@Component({ standalone: false })` to `standalone: true`, auto-derives per-component `imports: [...]` from each template's directive usage, and updates `AppModule.declarations` accordingly. Plus one manual fixup: 5 components (admin-user, filters, user-dataset, user-workflow, menu) reference `<nz-button-group>` / `[nzBorderless]` which ng-zorro-antd v21 has removed. The legacy builder didn't catch these latent dead-code refs; the new strict builder does. Add `schemas: [CUSTOM_ELEMENTS_SCHEMA]` to keep this PR focused — replacing with `<nz-space-compact>` belongs in its own follow-up. ### Any related issues, documentation, discussions? Closes #4864. After this and #4862 land, the 43 component specs + 13 service specs currently excluded for the NgModule-scope template-check failure can come off the exclusion list in a follow-up. ### How was this PR tested? `yarn run build` exits 0 with a clean prod bundle. Given the lack of test suites in frontend, I manually tests this locally. Tested login, create dataset, file upload, create workflow, run workflow, etc. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Opus 4.7 (1M context)
1 parent 9223ddf commit 3dd556a

100 files changed

Lines changed: 2147 additions & 232 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

frontend/src/app/app.module.ts

Lines changed: 70 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,79 @@ import { UserComputingUnitListItemComponent } from "./dashboard/component/user/u
194194
registerLocaleData(en);
195195

196196
@NgModule({
197-
declarations: [
197+
declarations: [AppComponent],
198+
imports: [
199+
BrowserModule,
200+
AppRoutingModule,
201+
HttpClientModule,
202+
JwtModule.forRoot({
203+
config: {
204+
tokenGetter: AuthService.getAccessToken,
205+
skipWhenExpired: false,
206+
throwNoTokenError: false,
207+
disallowedRoutes: ["forum/api/users"],
208+
},
209+
}),
210+
BrowserAnimationsModule,
211+
RouterModule,
212+
FormsModule,
213+
ReactiveFormsModule,
214+
FormlyModule.forRoot(TEXERA_FORMLY_CONFIG),
215+
FormlyNgZorroAntdModule,
216+
OverlayModule,
217+
NzDatePickerModule,
218+
NzDropDownModule,
219+
NzButtonModule,
220+
NzAutocompleteModule,
221+
NzIconModule,
222+
NzFormModule,
223+
NzListModule,
224+
NzInputModule,
225+
NzPopoverModule,
226+
NzCollapseModule,
227+
NzTooltipModule,
228+
NzTableModule,
229+
NzSelectModule,
230+
NzSpaceModule,
231+
NzBadgeModule,
232+
NzUploadModule,
233+
NgxJsonViewerModule,
234+
NzModalModule,
235+
NzDescriptionsModule,
236+
NzCardModule,
237+
NzTagModule,
238+
NzPopconfirmModule,
239+
NzAvatarModule,
240+
NzTabsModule,
241+
NzPaginationModule,
242+
NzCommentModule,
243+
ColorPickerModule,
244+
NzSwitchModule,
245+
NzRadioModule,
246+
NzLayoutModule,
247+
NzSliderModule,
248+
MarkdownModule.forRoot(),
249+
DragDropModule,
250+
NzAlertModule,
251+
NzResizableModule,
252+
NzSpinModule,
253+
NgxFileDropModule,
254+
NzTreeModule,
255+
NzTreeViewModule,
256+
NzNoAnimationModule,
257+
TreeModule,
258+
SocialLoginModule,
259+
GoogleSigninButtonModule,
260+
NzEmptyModule,
261+
NzDividerModule,
262+
NzProgressModule,
263+
NzInputNumberModule,
264+
NzCheckboxModule,
265+
NzGridModule,
266+
ScrollingModule,
198267
FormlyRepeatDndComponent,
199268
AdminGmailComponent,
200269
PublicProjectComponent,
201-
AppComponent,
202270
WorkspaceComponent,
203271
MenuComponent,
204272
OperatorMenuComponent,
@@ -291,76 +359,6 @@ registerLocaleData(en);
291359
UserComputingUnitComponent,
292360
UserComputingUnitListItemComponent,
293361
],
294-
imports: [
295-
BrowserModule,
296-
AppRoutingModule,
297-
HttpClientModule,
298-
JwtModule.forRoot({
299-
config: {
300-
tokenGetter: AuthService.getAccessToken,
301-
skipWhenExpired: false,
302-
throwNoTokenError: false,
303-
disallowedRoutes: ["forum/api/users"],
304-
},
305-
}),
306-
BrowserAnimationsModule,
307-
RouterModule,
308-
FormsModule,
309-
ReactiveFormsModule,
310-
FormlyModule.forRoot(TEXERA_FORMLY_CONFIG),
311-
FormlyNgZorroAntdModule,
312-
OverlayModule,
313-
NzDatePickerModule,
314-
NzDropDownModule,
315-
NzButtonModule,
316-
NzAutocompleteModule,
317-
NzIconModule,
318-
NzFormModule,
319-
NzListModule,
320-
NzInputModule,
321-
NzPopoverModule,
322-
NzCollapseModule,
323-
NzTooltipModule,
324-
NzTableModule,
325-
NzSelectModule,
326-
NzSpaceModule,
327-
NzBadgeModule,
328-
NzUploadModule,
329-
NgxJsonViewerModule,
330-
NzModalModule,
331-
NzDescriptionsModule,
332-
NzCardModule,
333-
NzTagModule,
334-
NzPopconfirmModule,
335-
NzAvatarModule,
336-
NzTabsModule,
337-
NzPaginationModule,
338-
NzCommentModule,
339-
ColorPickerModule,
340-
NzSwitchModule,
341-
NzRadioModule,
342-
NzLayoutModule,
343-
NzSliderModule,
344-
MarkdownModule.forRoot(),
345-
DragDropModule,
346-
NzAlertModule,
347-
NzResizableModule,
348-
NzSpinModule,
349-
NgxFileDropModule,
350-
NzTreeModule,
351-
NzTreeViewModule,
352-
NzNoAnimationModule,
353-
TreeModule,
354-
SocialLoginModule,
355-
GoogleSigninButtonModule,
356-
NzEmptyModule,
357-
NzDividerModule,
358-
NzProgressModule,
359-
NzInputNumberModule,
360-
NzCheckboxModule,
361-
NzGridModule,
362-
ScrollingModule,
363-
],
364362
providers: [
365363
provideNzI18n(en_US),
366364
AuthGuardService,

frontend/src/app/common/formly/array.type.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
*/
99

1010
import { Component } from "@angular/core";
11-
import { FieldArrayType } from "@ngx-formly/core";
11+
import { FieldArrayType, FormlyModule } from "@ngx-formly/core";
12+
import { NgFor } from "@angular/common";
13+
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
14+
import { NzButtonComponent } from "ng-zorro-antd/button";
15+
import { NzWaveDirective } from "ng-zorro-antd/core/wave";
16+
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
17+
import { NzIconDirective } from "ng-zorro-antd/icon";
1218

1319
@Component({
1420
template: `
@@ -47,6 +53,14 @@ import { FieldArrayType } from "@ngx-formly/core";
4753
nzType="plus"></span>
4854
</button>
4955
`,
50-
standalone: false,
56+
imports: [
57+
NgFor,
58+
FormlyModule,
59+
NzSpaceCompactItemDirective,
60+
NzButtonComponent,
61+
NzWaveDirective,
62+
ɵNzTransitionPatchDirective,
63+
NzIconDirective,
64+
],
5165
})
5266
export class ArrayTypeComponent extends FieldArrayType {}

frontend/src/app/common/formly/collab-wrapper/collab-wrapper/collab-wrapper.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import * as Y from "yjs";
2626
import { QuillBinding } from "y-quill";
2727
import QuillCursors from "quill-cursors";
2828
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
29+
import { NgStyle } from "@angular/common";
2930

3031
// Quill related definitions
3132
export const COLLAB_DEBOUNCE_TIME_MS = 10;
@@ -66,7 +67,7 @@ Quill.register("modules/cursors", QuillCursors);
6667
@Component({
6768
templateUrl: "./collab-wrapper.component.html",
6869
styleUrls: ["./collab-wrapper.component.css"],
69-
standalone: false,
70+
imports: [NgStyle],
7071
})
7172
export class CollabWrapperComponent extends FieldWrapper<FieldTypeConfig> implements AfterContentInit {
7273
private quill?: Quill;

frontend/src/app/common/formly/multischema.type.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
*/
99

1010
import { Component } from "@angular/core";
11-
import { FieldType } from "@ngx-formly/core";
11+
import { FieldType, FormlyModule } from "@ngx-formly/core";
12+
import { NgIf, NgFor } from "@angular/common";
1213

1314
@Component({
1415
// selector: 'formly-multi-schema-type',
@@ -29,6 +30,6 @@ import { FieldType } from "@ngx-formly/core";
2930
</div>
3031
</div>
3132
`,
32-
standalone: false,
33+
imports: [NgIf, FormlyModule, NgFor],
3334
})
3435
export class MultiSchemaTypeComponent extends FieldType {}

frontend/src/app/common/formly/null.type.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ import { FieldType, FieldTypeConfig } from "@ngx-formly/core";
1313
@Component({
1414
// selector: 'formly-null-type',
1515
template: "",
16-
standalone: false,
1716
})
1817
export class NullTypeComponent extends FieldType<FieldTypeConfig> {}

frontend/src/app/common/formly/object.type.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
*/
99

1010
import { Component } from "@angular/core";
11-
import { FieldType, FieldTypeConfig } from "@ngx-formly/core";
11+
import { FieldType, FieldTypeConfig, FormlyModule } from "@ngx-formly/core";
12+
import { NgIf, NgFor } from "@angular/common";
1213

1314
@Component({
1415
// selector: 'formly-object-type',
@@ -27,7 +28,7 @@ import { FieldType, FieldTypeConfig } from "@ngx-formly/core";
2728
[field]="f"></formly-field>
2829
</div>
2930
`,
30-
standalone: false,
31+
imports: [NgIf, FormlyModule, NgFor],
3132
})
3233
export class ObjectTypeComponent extends FieldType<FieldTypeConfig> {
3334
defaultOptions = {

frontend/src/app/common/formly/preset-wrapper/preset-wrapper.component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ import { debounceTime, filter, first, takeUntil } from "rxjs/operators";
2525
import { Preset, PresetService } from "src/app/workspace/service/preset/preset.service";
2626
import { asType } from "../../util/assert";
2727
import { NzMessageService } from "ng-zorro-antd/message";
28+
import { NzDropdownDirective, NzDropdownMenuComponent } from "ng-zorro-antd/dropdown";
29+
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
30+
import { NzButtonComponent } from "ng-zorro-antd/button";
31+
import { NzWaveDirective } from "ng-zorro-antd/core/wave";
32+
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
33+
import { NzIconDirective } from "ng-zorro-antd/icon";
34+
import { NzMenuDirective, NzMenuItemComponent } from "ng-zorro-antd/menu";
35+
import { NgFor } from "@angular/common";
2836

2937
/**
3038
* PresetWrapperComponent is a custom formly form field wrapper: https://formly.dev/guide/custom-formly-wrapper
@@ -52,7 +60,18 @@ export interface PresetKey {
5260
@Component({
5361
templateUrl: "./preset-wrapper.component.html",
5462
styleUrls: ["./preset-wrapper.component.scss"],
55-
standalone: false,
63+
imports: [
64+
NzDropdownDirective,
65+
NzSpaceCompactItemDirective,
66+
NzButtonComponent,
67+
NzWaveDirective,
68+
ɵNzTransitionPatchDirective,
69+
NzIconDirective,
70+
NzDropdownMenuComponent,
71+
NzMenuDirective,
72+
NgFor,
73+
NzMenuItemComponent,
74+
],
5675
})
5776
export class PresetWrapperComponent extends FieldWrapper implements OnInit, OnDestroy {
5877
public searchResults: Preset[] = []; // the list of presets shown in the dropdown

frontend/src/app/common/formly/repeat-dnd/repeat-dnd.component.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,31 @@
1818
*/
1919

2020
import { Component } from "@angular/core";
21-
import { FieldArrayType } from "@ngx-formly/core";
22-
import { CdkDragDrop, moveItemInArray } from "@angular/cdk/drag-drop";
21+
import { FieldArrayType, FormlyModule } from "@ngx-formly/core";
22+
import { CdkDragDrop, moveItemInArray, CdkDropList, CdkDrag, CdkDragHandle } from "@angular/cdk/drag-drop";
23+
import { NgFor } from "@angular/common";
24+
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
25+
import { NzIconDirective } from "ng-zorro-antd/icon";
26+
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
27+
import { NzButtonComponent } from "ng-zorro-antd/button";
28+
import { NzWaveDirective } from "ng-zorro-antd/core/wave";
2329

2430
@Component({
2531
selector: "texera-formly-repeat-section-dnd",
2632
templateUrl: "./repeat-dnd.component.html",
2733
styleUrls: ["./repeat-dnd.component.css"],
28-
standalone: false,
34+
imports: [
35+
CdkDropList,
36+
NgFor,
37+
CdkDrag,
38+
CdkDragHandle,
39+
ɵNzTransitionPatchDirective,
40+
NzIconDirective,
41+
FormlyModule,
42+
NzSpaceCompactItemDirective,
43+
NzButtonComponent,
44+
NzWaveDirective,
45+
],
2946
})
3047
export class FormlyRepeatDndComponent extends FieldArrayType {
3148
onDrop(event: CdkDragDrop<string[]>) {

frontend/src/app/common/service/user/registration-request-modal/registration-request-modal.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919

2020
import { Component, Inject, Input, TemplateRef, ViewChild } from "@angular/core";
2121
import { NZ_MODAL_DATA } from "ng-zorro-antd/modal";
22+
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
23+
import { NzInputDirective } from "ng-zorro-antd/input";
24+
import { FormsModule } from "@angular/forms";
2225

2326
@Component({
2427
selector: "texera-registration-request-modal",
2528
templateUrl: "./registration-request-modal.component.html",
2629
styleUrls: ["./registration-request-modal.component.scss"],
27-
standalone: false,
30+
imports: [NzSpaceCompactItemDirective, NzInputDirective, FormsModule],
2831
})
2932

3033
// Component for registration form modal

frontend/src/app/dashboard/component/admin/execution/admin-execution.component.ts

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,57 @@ import { Component, OnDestroy, OnInit } from "@angular/core";
2121
import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy";
2222
import { AdminExecutionService } from "../../../service/admin/execution/admin-execution.service";
2323
import { Execution } from "../../../../common/type/execution";
24-
import { NzTableFilterFn, NzTableQueryParams } from "ng-zorro-antd/table";
24+
import {
25+
NzTableFilterFn,
26+
NzTableQueryParams,
27+
NzTableComponent,
28+
NzTheadComponent,
29+
NzTrDirective,
30+
NzTableCellDirective,
31+
NzThMeasureDirective,
32+
NzThAddOnComponent,
33+
NzTbodyComponent,
34+
} from "ng-zorro-antd/table";
2535
import { NzModalService } from "ng-zorro-antd/modal";
2636
import { WorkflowExecutionHistoryComponent } from "../../user/user-workflow/ngbd-modal-workflow-executions/workflow-execution-history.component";
2737
import { WorkflowWebsocketService } from "../../../../workspace/service/workflow-websocket/workflow-websocket.service";
2838
import { GuiConfigService } from "../../../../common/service/gui-config.service";
39+
import { NzCardComponent } from "ng-zorro-antd/card";
40+
import { NgFor, NgIf, NgStyle } from "@angular/common";
41+
import { NzSpaceCompactItemDirective } from "ng-zorro-antd/space";
42+
import { NzButtonComponent } from "ng-zorro-antd/button";
43+
import { NzWaveDirective } from "ng-zorro-antd/core/wave";
44+
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";
45+
import { NzTooltipDirective } from "ng-zorro-antd/tooltip";
46+
import { NzIconDirective } from "ng-zorro-antd/icon";
47+
import { NzSpinComponent } from "ng-zorro-antd/spin";
2948

3049
export const NO_SORT = "NO_SORTING";
3150

3251
@UntilDestroy()
3352
@Component({
3453
templateUrl: "./admin-execution.component.html",
3554
styleUrls: ["./admin-execution.component.scss"],
36-
standalone: false,
55+
imports: [
56+
NzCardComponent,
57+
NzTableComponent,
58+
NzTheadComponent,
59+
NzTrDirective,
60+
NzTableCellDirective,
61+
NzThMeasureDirective,
62+
NzThAddOnComponent,
63+
NzTbodyComponent,
64+
NgFor,
65+
NgIf,
66+
NgStyle,
67+
NzSpaceCompactItemDirective,
68+
NzButtonComponent,
69+
NzWaveDirective,
70+
ɵNzTransitionPatchDirective,
71+
NzTooltipDirective,
72+
NzIconDirective,
73+
NzSpinComponent,
74+
],
3775
})
3876
export class AdminExecutionComponent implements OnInit, OnDestroy {
3977
listOfExecutions: ReadonlyArray<Execution> = [];

0 commit comments

Comments
 (0)