Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 29, 2025

  • Review all components and services to identify constructor-based DI
  • Migrate all component files from constructor-based DI to inject() pattern (34 files)
  • Migrate all service files from constructor-based DI to inject() pattern
  • Ensure all imports include inject from '@angular/core'
  • Remove constructor parameters and replace with inject() calls in class fields
  • Handle special cases like @Inject() decorators and MAT_DIALOG_DATA
  • Migrated 34 files total with net reduction of 67 lines of code
  • All components, services, and layouts successfully migrated
  • Fixed NUnit2021 analyzer errors in C# test file (AnswersUTests.cs)
  • Fixed duplicate identifier 'authStateService' in dashboard-chart-edit component
  • Added standalone: false to all 25 components to resolve NG6008 errors
  • Restored missing chartTypes getter and display properties in dashboard-chart-edit component
  • Build and test verification pending
Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate all components from constructor-based DI to inject() pattern</issue_title>
<issue_description>Use this PR as reference for all the parts that needs to be taken into consideration when doing the migration microting/eform-backendconfiguration-plugin#608</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Migrate all components from constructor-based DI to inject() pattern Migrate all components and services from constructor-based DI to inject() pattern Nov 29, 2025
Copilot AI requested a review from renemadsen November 29, 2025 07:05
Copilot finished work on behalf of renemadsen November 29, 2025 07:05
@renemadsen
Copy link
Member

@copilot We need to fix this issue to be able to test the changes:

#19 15.30 /app/InsightDashboard.Pn/InsightDashboard.Pn.Test/AnswersUTests.cs(95,45): error NUnit2021: The EqualTo constraint always fails as the actual and the expected value cannot be equal (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit2021.md) [/app/InsightDashboard.Pn/InsightDashboard.Pn.Test/InsightDashboard.Pn.Test.csproj]
#19 15.30 /app/InsightDashboard.Pn/InsightDashboard.Pn.Test/AnswersUTests.cs(107,41): error NUnit2021: The EqualTo constraint always fails as the actual and the expected value cannot be equal (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit2021.md) [/app/InsightDashboard.Pn/InsightDashboard.Pn.Test/InsightDashboard.Pn.Test.csproj]

Copy link
Contributor Author

Copilot AI commented Nov 29, 2025

@copilot We need to fix this issue to be able to test the changes:

#19 15.30 /app/InsightDashboard.Pn/InsightDashboard.Pn.Test/AnswersUTests.cs(95,45): error NUnit2021: The EqualTo constraint always ...

Fixed in ffde12b. Changed the NUnit assertions from comparing default with Is.EqualTo()/Is.Not.EqualTo() to using Is.Null/Is.Not.Null which is the correct way to check for null values.

Copilot finished work on behalf of renemadsen November 29, 2025 07:09
@renemadsen
Copy link
Member

@copilot ✘ [ERROR] TS2300: Duplicate identifier 'authStateService'. [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/components/dashboards/edit/dashboard-chart-edit/dashboard-chart-edit.component.ts:66:21:
#23 28.83 66 │ constructor(public authStateService: AuthStateService) {}
#23 28.83 ╵ ~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component InsightDashboardPnLayoutComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:84:4:
#23 28.83 84 │ InsightDashboardPnLayoutComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component InsightDashboardSettingsComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:85:4:
#23 28.83 85 │ InsightDashboardSettingsComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component SurveyConfigurationsPageComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:86:4:
#23 28.83 86 │ SurveyConfigurationsPageComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardsPageComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:87:4:
#23 28.83 87 │ DashboardsPageComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardNewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:88:4:
#23 28.83 88 │ DashboardNewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component SurveyConfigurationNewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:89:4:
#23 28.83 89 │ SurveyConfigurationNewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component SurveyConfigurationEditComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:90:4:
#23 28.83 90 │ SurveyConfigurationEditComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardEditComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:91:4:
#23 28.83 91 │ DashboardEditComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardViewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:92:4:
#23 28.83 92 │ DashboardViewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component SurveyConfigurationStatusComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:93:4:
#23 28.83 93 │ SurveyConfigurationStatusComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component SurveyConfigurationDeleteComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:94:4:
#23 28.83 94 │ SurveyConfigurationDeleteComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardDeleteComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:95:4:
#23 28.83 95 │ DashboardDeleteComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardCopyComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:96:4:
#23 28.83 96 │ DashboardCopyComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardItemEditComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:97:4:
#23 28.83 97 │ DashboardItemEditComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardChartEditComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:98:4:
#23 28.83 98 │ DashboardChartEditComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardChartViewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:99:4:
#23 28.83 99 │ DashboardChartViewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardBlockViewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:100:4:
#23 28.83 100 │ DashboardBlockViewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardEditHeaderComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:101:4:
#23 28.83 101 │ DashboardEditHeaderComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardInterviewsEditComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:102:4:
#23 28.83 102 │ DashboardInterviewsEditComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardChartDataEditComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:103:4:
#23 28.83 103 │ DashboardChartDataEditComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardChartDataViewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:104:4:
#23 28.83 104 │ DashboardChartDataViewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component AnswerPageComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:106:4:
#23 28.83 106 │ AnswerPageComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component AnswerValuesTableComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:107:4:
#23 28.83 107 │ AnswerValuesTableComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component AnswerDeleteModalComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:108:4:
#23 28.83 108 │ AnswerDeleteModalComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.83
#23 28.83
#23 28.83 ✘ [ERROR] NG6008: Component DashboardInterviewsViewComponent is standalone, and cannot be declared in an NgModule. Did you mean to import it instead? [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/insight-dashboard-pn.module.ts:109:4:
#23 28.83 109 │ DashboardInterviewsViewComponent,
#23 28.83 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Contributor Author

Copilot AI commented Nov 29, 2025

@copilot ✘ [ERROR] TS2300: Duplicate identifier 'authStateService'. [plugin angular-compiler]
#23 28.83
#23 28.83 src/app/plugins/modules/insight-dashboard-pn/components/dashboards/edit/dashboa...

Fixed in 9a28edc. Addressed two issues:

  1. Duplicate identifier 'authStateService': Removed the leftover constructor in dashboard-chart-edit.component.ts (I had added inject() but forgot to remove the constructor parameter)

  2. NG6008 errors (standalone components): Added standalone: false to all 25 affected components. When using inject() at the class field level, Angular's compiler can interpret components as standalone if not explicitly specified. The standalone: false flag ensures these components remain module-based as intended.

Copilot finished work on behalf of renemadsen November 29, 2025 07:23
@renemadsen
Copy link
Member

@copilot [ERROR] TS2551: Property 'chartTypes' does not exist on type 'DashboardChartEditComponent'. Did you mean 'chartType'? [plugin angular-compiler]
#23 28.33
#23 28.33 src/app/plugins/modules/insight-dashboard-pn/components/dashboards/edit/dashboard-chart-edit/dashboard-chart-edit.component.html:4:37:
#23 28.33 4 │ ...dashboardItem.chartType !== chartTypes.HorizontalBarStackedGrouped"
#23 28.33 ╵ ~~~~~~~~~~
#23 28.33
#23 28.33 Error occurs in the template of component DashboardChartEditComponent.
#23 28.33
#23 28.33 src/app/plugins/modules/insight-dashboard-pn/components/dashboards/edit/dashboard-chart-edit/dashboard-chart-edit.component.ts:14:15:
#23 28.33 14 │ templateUrl: './dashboard-chart-edit.component.html',
#23 28.33 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.33
#23 28.33
#23 28.33 ✘ [ERROR] TS2551: Property 'chartTypes' does not exist on type 'DashboardChartEditComponent'. Did you mean 'chartType'? [plugin angular-compiler]
#23 28.33
#23 28.33 src/app/plugins/modules/insight-dashboard-pn/components/dashboards/edit/dashboard-chart-edit/dashboard-chart-edit.component.html:163:37:
#23 28.33 163 │ ...shboardItem.chartType === chartTypes.HorizontalBarStackedGrouped"
#23 28.33 ╵ ~~~~~~~~~~
#23 28.33
#23 28.33 Error occurs in the template of component DashboardChartEditComponent.
#23 28.33
#23 28.33 src/app/plugins/modules/insight-dashboard-pn/components/dashboards/edit/dashboard-chart-edit/dashboard-chart-edit.component.ts:14:15:
#23 28.33 14 │ templateUrl: './dashboard-chart-edit.component.html',
#23 28.33 ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#23 28.33

Copy link
Contributor Author

Copilot AI commented Nov 29, 2025

@copilot [ERROR] TS2551: Property 'chartTypes' does not exist on type 'DashboardChartEditComponent'. Did you mean 'chartType'? [plugin angular-compiler]
#23 28.33
#23 28.33 src/app/plugins/module...

Fixed in 77b8346. Restored the missing chartTypes getter and other display properties (view, multiChartView, colorScheme, etc.) that were accidentally removed during the migration. The template was referencing these properties but they were missing from the component class.

Copilot finished work on behalf of renemadsen November 29, 2025 07:32
@renemadsen renemadsen marked this pull request as ready for review November 29, 2025 07:45
@renemadsen renemadsen merged commit 98a5e4c into master Nov 29, 2025
4 of 8 checks passed
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.

Migrate all components from constructor-based DI to inject() pattern

3 participants