Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix linting errors

Benjamin Bädorf064dea24b364
diff --git a/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts b/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts
index afb33b1523a..3b6d7c5191e 100644
--- a/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts
+++ b/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts
@@ -58,7 +58,7 @@ export class PreviewTriggerService {
{ workPackageLink: href, event: e },
true,
).subscribe((previewModal) => {
- this.modalElement = previewModal.elementRef.nativeElement;
+ this.modalElement = previewModal.elementRef.nativeElement as HTMLElement;
previewModal.reposition(jQuery(this.modalElement), el);
});
});
diff --git a/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts b/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts
index 58fb9f9d7f0..5386c79cea5 100644
--- a/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts
+++ b/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts
@@ -33,7 +33,7 @@ function registerListener(
form:JQuery,
$event:JQuery.TriggeredEvent,
opModalService:OpModalService,
- modal:typeof PasswordConfirmationModalComponent,
+ passwordModal:typeof PasswordConfirmationModalComponent,
) {
const passwordConfirm = form.find('_password_confirmation');
@@ -42,7 +42,7 @@ function registerListener(
}
$event.preventDefault();
- opModalService.show(modal, 'global')
+ opModalService.show(passwordModal, 'global')
.subscribe((modal) => modal.closingEvent.subscribe(() => {
if (!modal.confirmed) {
return;
diff --git a/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts b/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts
index e8ab4d4c41b..a3b42f8960b 100644
--- a/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts
+++ b/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts
@@ -61,7 +61,7 @@ export class BoardConfigurationModalComponent extends OpModalComponent implement
}
ngOnInit() {
- this.$element = this.elementRef.nativeElement;
+ this.$element = this.elementRef.nativeElement as HTMLElement;
this.tabPortalHost = new TabPortalOutlet(
this.boardConfigurationService.tabs,
@@ -116,7 +116,7 @@ export class BoardConfigurationModalComponent extends OpModalComponent implement
return true;
}
- protected get afterFocusOn() {
+ protected get afterFocusOn():HTMLElement {
return this.$element;
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
index 55568a4e8a1..acd11707d5b 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
@@ -92,7 +92,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
}
ngOnInit() {
- this.$element = this.elementRef.nativeElement;
+ this.$element = this.elementRef.nativeElement as HTMLElement;
this.tabPortalHost = new TabPortalOutlet(
this.wpTableConfigurationService.tabs,
@@ -146,7 +146,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
return true;
}
- protected get afterFocusOn() {
+ protected get afterFocusOn():HTMLElement {
return this.$element;
}
diff --git a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts
index 206cb792b94..e9862cc875d 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts
@@ -88,15 +88,13 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
});
}
- public openConfigurationModal(onUpdated:() => void) {
- this.querySpace.query
- .valuesPromise()
- .then(() => {
- this.opModalService
- .show(WpTableConfigurationModalComponent, this.injector)
- // Detach this component when the modal closes and pass along the query data
- .subscribe((modal) => modal.onDataUpdated.subscribe(onUpdated));
- });
+ public async openConfigurationModal(onUpdated:() => void) {
+ await this.querySpace.query.valuesPromise();
+
+ this.opModalService
+ .show(WpTableConfigurationModalComponent, this.injector)
+ // Detach this component when the modal closes and pass along the query data
+ .subscribe((modal) => modal.onDataUpdated.subscribe(onUpdated));
}
protected initializeStates(query:QueryResource) {
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
index 33e2fa41e20..d2cd8ee08d6 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
@@ -49,8 +49,8 @@ export class CombinedDateEditFieldComponent extends DatePickerEditFieldComponent
super.showDatePickerModal();
this
- .modal?.
- onDataUpdated
+ .modal
+ ?.onDataUpdated
.subscribe((dates:string) => {
this.dates = dates;
this.cdRef.detectChanges();
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
index 7085879402b..5a6c5c6f09c 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
@@ -71,8 +71,7 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent im
public showDatePickerModal():void {
const component = this.change.schema.isMilestone ? SingleDateModalComponent : MultiDateModalComponent;
- this
- .opModalService
+ this.opModalService
.show<SingleDateModalComponent|MultiDateModalComponent>(
component,
this.injector,
diff --git a/frontend/src/app/shared/components/grids/grid/grid.component.ts b/frontend/src/app/shared/components/grids/grid/grid.component.ts
index dbfc198fe6d..bd2ff29c2ac 100644
--- a/frontend/src/app/shared/components/grids/grid/grid.component.ts
+++ b/frontend/src/app/shared/components/grids/grid/grid.component.ts
@@ -20,7 +20,7 @@ export interface WidgetRegistration {
identifier:string;
title:string;
component:{ new (...args:any[]):AbstractWidgetComponent };
- properties?:any;
+ properties?:Record<string, unknown>;
}
export const GRID_PROVIDERS = [
diff --git a/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts b/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts
index d5b92d0893b..9d5190140f3 100644
--- a/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts
@@ -40,7 +40,7 @@ import { GridAreaService } from 'core-app/shared/components/grids/grid/area.serv
@Directive()
export abstract class WidgetWpSetMenuComponent extends WidgetAbstractMenuComponent {
- protected configurationComponent:ComponentType<OpModalComponent>;
+ protected configurationComponent:ComponentType<WpGraphConfigurationModalComponent>;
@Output()
onConfigured:EventEmitter<any> = new EventEmitter();
@@ -64,10 +64,11 @@ export abstract class WidgetWpSetMenuComponent extends WidgetAbstractMenuCompone
return {
linkText: this.i18n.t('js.toolbar.settings.configure_view'),
onClick: () => {
- this.opModalService.show(this.configurationComponent, this.injector, this.locals)
- .subscribe((modal) => modal.closingEvent.subscribe((modal:WpGraphConfigurationModalComponent) => {
- this.onConfigured.emit(modal.configuration);
- }));
+ this.opModalService
+ .show(this.configurationComponent, this.injector, this.locals)
+ .subscribe((modal) => modal.closingEvent.subscribe(() => {
+ this.onConfigured.emit(modal.configuration);
+ }));
return true;
},
};
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts
index 7618f4a4b32..ec52f4bf841 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts
@@ -65,13 +65,11 @@ export class WidgetTimeEntriesCurrentUserMenuComponent extends WidgetAbstractMen
onClick: () => {
this.opModalService.show(TimeEntriesCurrentUserConfigurationModalComponent, this.injector, this.locals)
.subscribe(
- (modal) => modal.closingEvent.subscribe(
- (modal:TimeEntriesCurrentUserConfigurationModalComponent) => {
- if (modal.options) {
- this.onConfigured.emit(modal.options);
- }
- },
- )
+ (modal) => modal.closingEvent.subscribe(() => {
+ if (modal.options) {
+ this.onConfigured.emit(modal.options);
+ }
+ }),
);
return true;
},
diff --git a/frontend/src/app/shared/components/modal/modal-overlay.component.ts b/frontend/src/app/shared/components/modal/modal-overlay.component.ts
index 7287a34a8fd..089ff215a7a 100644
--- a/frontend/src/app/shared/components/modal/modal-overlay.component.ts
+++ b/frontend/src/app/shared/components/modal/modal-overlay.component.ts
@@ -54,10 +54,13 @@ export class OpModalOverlayComponent implements OnInit {
public notFullscreen = false;
@ViewChild(CdkPortalOutlet) portalOutlet:CdkPortalOutlet;
+
@ViewChild('overlay') overlay:ElementRef;
activeModalData$ = this.modalService.activeModalData$;
+
activeModalInstance$ = this.modalService.activeModalInstance$;
+
activeModalRef$ = new ReplaySubject<OpModalComponent|null>();
constructor(
@@ -67,52 +70,52 @@ export class OpModalOverlayComponent implements OnInit {
ngOnInit():void {
this.activeModalData$
- .subscribe((modalData) => {
- this.notFullscreen = false;
+ .subscribe((modalData) => {
+ this.notFullscreen = false;
- if (modalData === null) {
- const ref = (this.portalOutlet.attachedRef as ComponentRef<OpModalComponent>);
- if (!ref) {
- return;
- }
+ if (modalData === null) {
+ const ref = (this.portalOutlet.attachedRef as ComponentRef<OpModalComponent>);
+ if (!ref) {
+ return;
+ }
+
+ if (!ref.instance.onClose()) {
+ return;
+ }
+
+ ref.instance.closingEvent.emit(ref.instance);
+ this.activeModalRef$.next(null);
+ this.activeModalInstance$.next(null);
+
+ this.portalOutlet.detach();
- if (!ref.instance.onClose()) {
return;
}
-
- ref.instance.closingEvent.emit(ref.instance);
- this.activeModalRef$.next(null);
- this.activeModalInstance$.next(null);
-
- this.portalOutlet.detach();
-
- return;
- }
-
- const {
- modal,
- injector,
- notFullscreen,
- } = modalData;
- this.notFullscreen = notFullscreen;
- const portal = new ComponentPortal(modal, null, injector);
- const ref = this.portalOutlet.attach(portal);
- const instance = ref.instance;
- this.activeModalRef$.next(instance);
-
- this.activeModalInstance$.next(instance);
- setTimeout(() => {
- this.overlay.nativeElement.focus();
- // Focus on the first element
- instance && instance.onOpen();
-
- // Trigger another round of change detection in the modal
- ref.changeDetectorRef.detectChanges();
- }, 0);
- });
+
+ const {
+ modal,
+ injector,
+ notFullscreen,
+ } = modalData;
+ this.notFullscreen = notFullscreen;
+ const portal = new ComponentPortal(modal, null, injector);
+ const ref = this.portalOutlet.attach(portal);
+ const instance = ref.instance;
+ this.activeModalRef$.next(instance);
+
+ this.activeModalInstance$.next(instance);
+ setTimeout(() => {
+ (this.overlay.nativeElement as HTMLElement).focus();
+ // Focus on the first element
+ instance && instance.onOpen();
+
+ // Trigger another round of change detection in the modal
+ ref.changeDetectorRef.detectChanges();
+ }, 0);
+ });
}
- public close() {
+ public close():void {
this.modalService.close();
}
}
diff --git a/frontend/src/app/shared/components/modal/modal.component.ts b/frontend/src/app/shared/components/modal/modal.component.ts
index 17a66a766bd..6e41e6103ec 100644
--- a/frontend/src/app/shared/components/modal/modal.component.ts
+++ b/frontend/src/app/shared/components/modal/modal.component.ts
@@ -37,7 +37,7 @@ export abstract class OpModalComponent extends UntilDestroyedMixin implements On
}
ngOnInit() {
- this.$element = this.elementRef.nativeElement;
+ this.$element = this.elementRef.nativeElement as HTMLElement;
}
ngOnDestroy() {
diff --git a/frontend/src/app/shared/components/modal/modal.service.ts b/frontend/src/app/shared/components/modal/modal.service.ts
index ae215f0e1d9..070fc4034c8 100644
--- a/frontend/src/app/shared/components/modal/modal.service.ts
+++ b/frontend/src/app/shared/components/modal/modal.service.ts
@@ -42,6 +42,7 @@ export const OpModalLocalsToken = new InjectionToken<any>('OP_MODAL_LOCALS');
@Injectable({ providedIn: 'root' })
export class OpModalService {
public activeModalInstance$ = new ReplaySubject<OpModalComponent|null>(1);
+
public activeModalData$ = new ReplaySubject<{
modal:ComponentType<OpModalComponent>,
injector:Injector,
diff --git a/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts b/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts
index ce517fd6a22..e7a42044256 100644
--- a/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts
+++ b/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts
@@ -49,7 +49,7 @@ export class EditorMacrosService {
WpButtonMacroModalComponent,
this.injector,
{ type: typeName, classes },
- ).subscribe((modal) => modal.closingEvent.subscribe((modal:WpButtonMacroModalComponent) => {
+ ).subscribe((modal) => modal.closingEvent.subscribe(() => {
if (modal.changed) {
resolve({ type: modal.type, classes: modal.classes });
}
@@ -68,7 +68,7 @@ export class EditorMacrosService {
WikiIncludePageMacroModalComponent,
this.injector,
{ page: pageValue },
- ).subscribe((modal) => modal.closingEvent.subscribe((modal:WikiIncludePageMacroModalComponent) => {
+ ).subscribe((modal) => modal.closingEvent.subscribe(() => {
if (modal.changed) {
resolve(modal.page);
}
@@ -86,7 +86,7 @@ export class EditorMacrosService {
CodeBlockMacroModalComponent,
this.injector,
{ content, languageClass },
- ).subscribe((modal) => modal.closingEvent.subscribe((modal:CodeBlockMacroModalComponent) => {
+ ).subscribe((modal) => modal.closingEvent.subscribe(() => {
if (modal.changed) {
resolve({ languageClass: modal.languageClass, content: modal.content });
}
@@ -101,10 +101,10 @@ export class EditorMacrosService {
public configureChildPages(page:string, includeParent:string):Promise<object> {
return new Promise<object>((resolve, _) => {
this.opModalService.show(
- ChildPagesMacroModalComponent,
- this.injector,
+ ChildPagesMacroModalComponent,
+ this.injector,
{ page, includeParent },
- ).subscribe((modal) => modal.closingEvent.subscribe((modal:ChildPagesMacroModalComponent) => {
+ ).subscribe((modal) => modal.closingEvent.subscribe(() => {
if (modal.changed) {
resolve({
page: modal.page,
diff --git a/frontend/src/app/shared/components/time_entries/edit/edit.service.ts b/frontend/src/app/shared/components/time_entries/edit/edit.service.ts
index ff2af81d566..f0d3f1faf77 100644
--- a/frontend/src/app/shared/components/time_entries/edit/edit.service.ts
+++ b/frontend/src/app/shared/components/time_entries/edit/edit.service.ts
@@ -37,23 +37,21 @@ export class TimeEntryEditService {
this.injector,
{ ...options, changeset },
)
- .subscribe((modal) => {
- modal
- .closingEvent
- .pipe(take(1))
- .subscribe(() => {
- if (modal.destroyedEntry) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
- modal.destroyedEntry.delete().then(() => {
- resolve({ entry: modal.destroyedEntry, action: 'destroy' });
- });
- } else if (modal.modifiedEntry) {
- resolve({ entry: modal.modifiedEntry, action: 'update' });
- } else {
- reject();
- }
- });
- });
+ .subscribe((modal) => modal
+ .closingEvent
+ .pipe(take(1))
+ .subscribe(() => {
+ if (modal.destroyedEntry) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
+ void modal.destroyedEntry.delete().then(() => {
+ resolve({ entry: modal.destroyedEntry, action: 'destroy' });
+ });
+ } else if (modal.modifiedEntry) {
+ resolve({ entry: modal.modifiedEntry, action: 'update' });
+ } else {
+ reject();
+ }
+ }));
});
});
}
diff --git a/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts b/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts
index bbf25b4b33a..30af5cc521a 100644
--- a/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts
+++ b/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts
@@ -79,7 +79,7 @@ export class WpGraphConfigurationModalComponent extends OpModalComponent impleme
}
ngOnInit():void {
- this.$element = this.elementRef.nativeElement;
+ this.$element = this.elementRef.nativeElement as HTMLElement;
this.loadingIndicator.indicator('modal').promise = this.graphConfiguration.loadForms()
.then(() => {