Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2805027
Use inject() for LibraryComponent
hirokiterashima Nov 14, 2025
8208d7e
Use inject() for constraint authoring
hirokiterashima Nov 18, 2025
fee8158
Use inject() for ComponentStudent and all its children components
hirokiterashima Nov 18, 2025
367de5f
Merge branch 'develop' into use-inject-instead-of-constructor
hirokiterashima Dec 4, 2025
c610e8c
Use inject() for EditConnectedComponents and all its children components
hirokiterashima Dec 4, 2025
addc093
Use inject() for AbstractComponentAuthoring and all its children comp…
hirokiterashima Dec 5, 2025
00f92fd
Use inject() for ChooseNodeLocation and all its children components
hirokiterashima Dec 5, 2025
fc98fb1
Use inject() for ComponentService and all its children classes
hirokiterashima Dec 5, 2025
b28a5ca
Use inject() for ShareItemDialogComponent and all its children classes
hirokiterashima Dec 5, 2025
b08950e
Use inject() for AbstractTagsMenu and all its children classes
hirokiterashima Dec 5, 2025
0269953
Use inject() for ComponentShowWorkDirective and all its children classes
hirokiterashima Dec 5, 2025
06b42fa
Use inject() for AuthorBranchService and all its children classes
hirokiterashima Dec 5, 2025
1390e0d
Use inject() for WiseTinymceEditorComponent and its child classes
hirokiterashima Dec 7, 2025
145939f
Use inject() for RegisterUserForm and its child classes
hirokiterashima Dec 7, 2025
8cbfd76
Use inject() for Notebook classes
hirokiterashima Dec 7, 2025
9cbd095
Use inject() for AbstractBranchAuthoring class and its child classes
hirokiterashima Dec 7, 2025
960c3cc
Use inject() for AbstractTranslatableFieldComponent and its child cla…
hirokiterashima Dec 7, 2025
e60a858
Merge branch 'develop' into use-inject-instead-of-constructor
hirokiterashima Dec 11, 2025
d6c149b
Use inject() for EditProfileComponent and its child classes
hirokiterashima Dec 11, 2025
db9d67f
Use inject() for NodeService and its child classes
hirokiterashima Dec 12, 2025
e6eb461
Use inject() for ProjectTranslationService and its child classes
hirokiterashima Dec 12, 2025
0464462
Use inject() for AuthorPeerGroupingDialogComponent and its child classes
hirokiterashima Dec 12, 2025
1a7ddb6
Use inject() for ProjectService and its child classes. Need to update…
hirokiterashima Dec 12, 2025
5c58caa
Use inject() for AbstractClassResponsesComponent and its child classes
hirokiterashima Dec 12, 2025
889bb3c
Use inject() for DataService and its child classes
hirokiterashima Dec 12, 2025
68d02a6
Use inject() for NotificationService and its child classes
hirokiterashima Dec 18, 2025
a538f76
Use inject() for PeerGroupService and its child classes
hirokiterashima Dec 18, 2025
aa22eda
Use inject() for StepToolsComponent and its child classes
hirokiterashima Dec 18, 2025
d36fb1e
Replace constructor with inject() in StepToolsComponent
hirokiterashima Dec 18, 2025
5a905b3
Use inject() for AbstractExportComponent and its child classes
hirokiterashima Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { Component } from '@angular/core';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { EditConnectedComponentsComponent } from '../edit-connected-components/edit-connected-components.component';

@Component({
template: ''
})
@Component({ template: ''}) // this class needs to be a component to extends parent class and be used as a base class
export class EditConnectedComponentsWithBackgroundComponent extends EditConnectedComponentsComponent {
componentTypesThatCanImportWorkAsBackground: string[] = [];

constructor(protected projectService: ProjectService) {
super(projectService);
}

canConnectedComponentTypeImportWorkAsBackground(connectedComponent: any): boolean {
return this.componentTypesThatCanImportWorkAsBackground.includes(
this.getConnectedComponentType(connectedComponent)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { EditConnectedComponentsAddButtonComponent } from '../edit-connected-components-add-button/edit-connected-components-add-button.component';
import { EditConnectedComponentDefaultSelectsComponent } from '../edit-connected-component-default-selects/edit-connected-component-default-selects.component';
Expand All @@ -22,8 +22,7 @@ export class EditConnectedComponentsComponent implements OnInit {
@Input() connectedComponents: any[] = [];
@Output() connectedComponentsChanged: EventEmitter<any> = new EventEmitter();
nodeIds: string[];

constructor(protected projectService: ProjectService) {}
protected projectService: ProjectService = inject(ProjectService);

ngOnInit(): void {
if (this.connectedComponents == null) {
Expand Down
8 changes: 3 additions & 5 deletions src/app/common/edit-profile/edit-profile.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { inject } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { UnlinkGoogleAccountConfirmComponent } from '../../modules/shared/unlink-google-account-confirm/unlink-google-account-confirm.component';

export abstract class EditProfileComponent {
changed: boolean = false;

constructor(
public dialog: MatDialog,
public snackBar: MatSnackBar
) {}
dialog = inject(MatDialog);
snackBar = inject(MatSnackBar);

handleUpdateProfileResponse(response) {
if (response.status === 'success') {
Expand Down
8 changes: 3 additions & 5 deletions src/app/modules/library/library/library.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnInit, QueryList, ViewChildren, Directive } from '@angular/core';
import { OnInit, QueryList, ViewChildren, Directive, inject } from '@angular/core';
import { LibraryService } from '../../../services/library.service';
import { LibraryProject } from '../libraryProject';
import { PageEvent, MatPaginator } from '@angular/material/paginator';
Expand All @@ -18,10 +18,8 @@ export abstract class LibraryComponent implements OnInit {
protected showFilters: boolean = false;
protected subscriptions: Subscription = new Subscription();

constructor(
protected filterValues: ProjectFilterValues,
protected libraryService: LibraryService
) {}
protected filterValues = inject(ProjectFilterValues);
protected libraryService = inject(LibraryService);

ngOnInit(): void {
this.subscriptions.add(this.filterValues.updated$.subscribe(() => this.filterUpdated()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { ApplyTagsButtonComponent } from '../../../teacher/apply-tags-button/app
import { ArchiveProjectsButtonComponent } from '../../../teacher/archive-projects-button/archive-projects-button.component';
import { ArchiveProjectService } from '../../../services/archive-project.service';
import { BehaviorSubject } from 'rxjs';
import { Component, Signal, WritableSignal, computed, signal } from '@angular/core';
import { Component, Signal, WritableSignal, computed, inject, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { LibraryComponent } from '../library/library.component';
import { LibraryProject } from '../libraryProject';
import { LibraryProjectComponent } from '../library-project/library-project.component';
import { LibraryService } from '../../../services/library.service';
import { MatDividerModule } from '@angular/material/divider';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
Expand All @@ -17,7 +16,6 @@ import { ProjectSelectionEvent } from '../../../domain/projectSelectionEvent';
import { SelectAllItemsCheckboxComponent } from '../select-all-items-checkbox/select-all-items-checkbox.component';
import { SelectTagsComponent } from '../../../teacher/select-tags/select-tags.component';
import { Tag } from '../../../domain/tag';
import { ProjectFilterValues } from '../../../domain/projectFilterValues';

@Component({
imports: [
Expand Down Expand Up @@ -54,13 +52,7 @@ export class PersonalLibraryComponent extends LibraryComponent {
protected sharedProjects: LibraryProject[] = [];
protected showArchivedView: boolean = false;

constructor(
private archiveProjectService: ArchiveProjectService,
protected filterValues: ProjectFilterValues,
protected libraryService: LibraryService
) {
super(filterValues, libraryService);
}
private archiveProjectService = inject(ArchiveProjectService);

ngOnInit(): void {
super.ngOnInit();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnInit, Inject, Directive } from '@angular/core';
import { OnInit, Directive, inject } from '@angular/core';
import { FormControl } from '@angular/forms';
import { BehaviorSubject, Observable } from 'rxjs';
import { TeacherService } from '../../../teacher/teacher.service';
Expand All @@ -10,6 +10,8 @@ import { copy } from '../../../../assets/wise5/common/object/object';

@Directive()
export abstract class ShareItemDialogComponent implements OnInit {
public data = inject(MAT_DIALOG_DATA);
public dialogRef = inject(MatDialogRef<ShareItemDialogComponent>);
project: Project;
projectId: number;
runId: number;
Expand All @@ -19,19 +21,13 @@ export abstract class ShareItemDialogComponent implements OnInit {
owner: any;
sharedOwners: any[] = [];
private sharedOwners$: BehaviorSubject<any[]> = new BehaviorSubject<any[]>(this.sharedOwners);
public snackBar = inject(MatSnackBar);
public teacherService = inject(TeacherService);

constructor(
public dialogRef: MatDialogRef<ShareItemDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
public teacherService: TeacherService,
public snackBar: MatSnackBar
) {
ngOnInit(): void {
this.teacherService.retrieveAllTeacherUsernames().subscribe((teacherUsernames) => {
this.allTeacherUsernames = teacherUsernames;
});
}

ngOnInit() {
this.filteredTeacherUsernames = this.teacherSearchControl.valueChanges.pipe(
debounceTime(1000),
map((value) => this._filter(value))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { Component, Inject } from '@angular/core';
import { Component, inject } from '@angular/core';
import {
MAT_DIALOG_DATA,
MatDialogRef,
MatDialogTitle,
MatDialogContent,
MatDialogActions,
MatDialogClose
} from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import {
MatTableDataSource,
MatTable,
Expand All @@ -21,7 +18,6 @@ import {
MatRowDef,
MatRow
} from '@angular/material/table';
import { TeacherService } from '../../../teacher/teacher.service';
import { LibraryService } from '../../../services/library.service';
import { ShareItemDialogComponent } from '../share-item-dialog/share-item-dialog.component';
import { Project } from '../../../domain/project';
Expand Down Expand Up @@ -88,25 +84,16 @@ export class ShareProjectDialogComponent extends ShareItemDialogComponent {
dataSource: MatTableDataSource<any[]> = new MatTableDataSource<any[]>();
displayedColumns: string[] = ['name', 'permissions'];
duplicate: boolean = false;
public libraryService = inject(LibraryService);

constructor(
public dialogRef: MatDialogRef<ShareItemDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
public libraryService: LibraryService,
public teacherService: TeacherService,
public snackBar: MatSnackBar
) {
super(dialogRef, data, teacherService, snackBar);
this.project = data.project;
this.projectId = data.project.id;
ngOnInit(): void {
super.ngOnInit();
this.project = this.data.project;
this.projectId = this.data.project.id;
this.libraryService.getProjectInfo(this.projectId).subscribe((project: Project) => {
this.project = project;
this.populateSharedOwners(project.sharedOwners);
});
}

ngOnInit() {
super.ngOnInit();
this.getSharedOwners().subscribe((sharedOwners) => {
let owners = [...sharedOwners];
owners.reverse();
Expand Down
14 changes: 6 additions & 8 deletions src/app/notebook/notebook-item/notebook-item.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { Subscription } from 'rxjs';
import { DialogWithConfirmComponent } from '../../../assets/wise5/directives/dialog-with-confirm/dialog-with-confirm.component';
Expand All @@ -25,6 +25,11 @@ import { MatButtonModule } from '@angular/material/button';
templateUrl: 'notebook-item.component.html'
})
export class NotebookItemComponent {
private configService = inject(ConfigService);
private dialog = inject(MatDialog);
private notebookService = inject(NotebookService);
private projectService = inject(ProjectService);

protected canDelete: boolean;
protected canRevive: boolean;
protected color: string;
Expand All @@ -39,13 +44,6 @@ export class NotebookItemComponent {
@Output() onSelect: EventEmitter<any> = new EventEmitter<any>();
private type: string;

constructor(
private configService: ConfigService,
private dialog: MatDialog,
private notebookService: NotebookService,
private projectService: ProjectService
) {}

ngOnInit(): void {
this.item = this.note;
this.type = this.item ? this.item.type : null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, inject } from '@angular/core';
import { NotebookService } from '../../../assets/wise5/services/notebookService';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { Subscription } from 'rxjs';
Expand All @@ -12,15 +12,13 @@ import { MatTooltipModule } from '@angular/material/tooltip';
templateUrl: 'notebook-launcher.component.html'
})
export class NotebookLauncherComponent {
private notebookService = inject(NotebookService);
private projectService = inject(ProjectService);

protected label: string = '';
@Input() notebookConfig: any;
private subscription: Subscription = new Subscription();

constructor(
private notebookService: NotebookService,
private projectService: ProjectService
) {}

ngOnInit(): void {
this.setLabel();
this.subscription.add(this.projectService.projectParsed$.subscribe(() => this.setLabel()));
Expand Down
34 changes: 13 additions & 21 deletions src/app/notebook/notebook-notes/notebook-notes.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Component, Input, ViewEncapsulation, inject } from '@angular/core';
import { Subscription } from 'rxjs';
import { ConfigService } from '../../../assets/wise5/services/configService';
import { NotebookService } from '../../../assets/wise5/services/notebookService';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { StudentDataService } from '../../../assets/wise5/services/studentDataService';
import { NotebookParentComponent } from '../notebook-parent/notebook-parent.component';
Expand Down Expand Up @@ -31,6 +29,9 @@ import { MatIconModule } from '@angular/material/icon';
encapsulation: ViewEncapsulation.None
})
export class NotebookNotesComponent extends NotebookParentComponent {
private dataService = inject(StudentDataService);
private projectService = inject(ProjectService);

protected groups = [];
private groupNameToGroup = {};
protected hasPrivateNotes: boolean = false;
Expand All @@ -42,15 +43,6 @@ export class NotebookNotesComponent extends NotebookParentComponent {
private subscriptions: Subscription = new Subscription();
@Input() viewOnly: boolean;

constructor(
configService: ConfigService,
private dataService: StudentDataService,
NotebookService: NotebookService,
private projectService: ProjectService
) {
super(configService, NotebookService);
}

ngOnInit(): void {
super.ngOnInit();
this.setLabel();
Expand All @@ -59,7 +51,7 @@ export class NotebookNotesComponent extends NotebookParentComponent {
this.hasPrivateNotes = this.isHasPrivateNotes();

this.subscriptions.add(
this.NotebookService.notebookUpdated$.subscribe(({ notebookItem }) => {
this.notebookService.notebookUpdated$.subscribe(({ notebookItem }) => {
if (
(notebookItem.groups == null || notebookItem.groups.length === 0) &&
notebookItem.type === 'note'
Expand All @@ -74,7 +66,7 @@ export class NotebookNotesComponent extends NotebookParentComponent {
);

this.subscriptions.add(
this.NotebookService.insertMode$.subscribe((args) => {
this.notebookService.insertMode$.subscribe((args) => {
this.insertArgs = args;
if (args.visibleSpace) {
this.selectedTabIndex = args.visibleSpace === 'public' ? 1 : 0;
Expand All @@ -83,10 +75,10 @@ export class NotebookNotesComponent extends NotebookParentComponent {
);

this.subscriptions.add(
this.NotebookService.publicNotebookItemsRetrieved$.subscribe(() => {
this.notebookService.publicNotebookItemsRetrieved$.subscribe(() => {
for (const group of this.groups) {
if (group.name !== 'private') {
group.items = this.NotebookService.publicNotebookItems[group.name];
group.items = this.notebookService.publicNotebookItems[group.name];
}
}
})
Expand All @@ -99,7 +91,7 @@ export class NotebookNotesComponent extends NotebookParentComponent {
})
);

this.NotebookService.retrievePublicNotebookItems('public');
this.notebookService.retrievePublicNotebookItems('public');
}

ngOnDestroy(): void {
Expand Down Expand Up @@ -209,20 +201,20 @@ export class NotebookNotesComponent extends NotebookParentComponent {
}

protected addNote(): void {
this.NotebookService.addNote(this.dataService.getCurrentNodeId());
this.notebookService.addNote(this.dataService.getCurrentNodeId());
}

protected select({ event, note }: any): void {
if (this.insertArgs.insertMode) {
this.insertArgs.notebookItem = note;
this.NotebookService.broadcastNotebookItemChosen(this.insertArgs);
this.notebookService.broadcastNotebookItemChosen(this.insertArgs);
} else {
const isEditMode = !this.viewOnly;
this.NotebookService.editNote(this.dataService.getCurrentNodeId(), note, isEditMode);
this.notebookService.editNote(this.dataService.getCurrentNodeId(), note, isEditMode);
}
}

protected close(): void {
this.NotebookService.closeNotes();
this.notebookService.closeNotes();
}
}
Loading
Loading