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

Add InjectableField decorator

Oliver Günther0d5d295fec5e
diff --git a/frontend/src/app/components/main-menu/main-menu-toggle.component.ts b/frontend/src/app/components/main-menu/main-menu-toggle.component.ts
index 5d0008e9018..947ec1d385b 100644
--- a/frontend/src/app/components/main-menu/main-menu-toggle.component.ts
+++ b/frontend/src/app/components/main-menu/main-menu-toggle.component.ts
@@ -33,16 +33,17 @@ import {untilComponentDestroyed} from 'ng2-rx-componentdestroyed';
import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";
import {CurrentProjectService} from "core-components/projects/current-project.service";
import {DeviceService} from "app/modules/common/browser/device.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
selector: 'main-menu-toggle',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div *ngIf="this.currentProject.id !== null || this.deviceService.isMobile" id="main-menu-toggle"
- aria-haspopup="true"
- [attr.title]="toggleTitle"
- (accessibleClick)="toggleService.toggleNavigation($event)"
- tabindex="0">
+ aria-haspopup="true"
+ [attr.title]="toggleTitle"
+ (accessibleClick)="toggleService.toggleNavigation($event)"
+ tabindex="0">
<a icon="icon-hamburger">
<i class="icon-hamburger" aria-hidden="true"></i>
</a>
@@ -52,12 +53,12 @@ import {DeviceService} from "app/modules/common/browser/device.service";
export class MainMenuToggleComponent implements OnInit, OnDestroy {
toggleTitle:string = "";
- currentProject:CurrentProjectService = this.injector.get(CurrentProjectService);
+ @InjectField() currentProject:CurrentProjectService;
constructor(readonly toggleService:MainMenuToggleService,
readonly cdRef:ChangeDetectorRef,
readonly deviceService:DeviceService,
- protected injector:Injector) {
+ readonly injector:Injector) {
}
ngOnInit() {
@@ -68,7 +69,7 @@ export class MainMenuToggleComponent implements OnInit, OnDestroy {
distinctUntilChanged(),
untilComponentDestroyed(this)
)
- .subscribe( setToggleTitle => {
+ .subscribe(setToggleTitle => {
this.toggleTitle = setToggleTitle;
this.cdRef.detectChanges();
});
@@ -79,4 +80,4 @@ export class MainMenuToggleComponent implements OnInit, OnDestroy {
}
}
-DynamicBootstrapper.register({ selector: 'main-menu-toggle', cls: MainMenuToggleComponent });
+DynamicBootstrapper.register({selector: 'main-menu-toggle', cls: MainMenuToggleComponent});
diff --git a/frontend/src/app/components/main-menu/main-menu-toggle.service.ts b/frontend/src/app/components/main-menu/main-menu-toggle.service.ts
index b820aceb495..47af2972765 100644
--- a/frontend/src/app/components/main-menu/main-menu-toggle.service.ts
+++ b/frontend/src/app/components/main-menu/main-menu-toggle.service.ts
@@ -32,6 +32,7 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {CurrentProjectService} from "core-components/projects/current-project.service";
import {DeviceService} from "app/modules/common/browser/device.service";
import {Injector} from "@angular/core";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Injectable()
export class MainMenuToggleService {
@@ -40,7 +41,8 @@ export class MainMenuToggleService {
private elementWidth:number;
private readonly localStorageKey:string = 'openProject-mainMenuWidth';
private readonly defaultWidth:number = 230;
- private readonly currentProject:CurrentProjectService = this.injector.get(CurrentProjectService);
+
+ @InjectField() currentProject:CurrentProjectService;
private global = (window as any);
private htmlNode = document.getElementsByTagName('html')[0];
@@ -59,7 +61,7 @@ export class MainMenuToggleService {
private resizeSubscription$:Subscription;
constructor(protected I18n:I18nService,
- protected injector:Injector,
+ public injector:Injector,
readonly deviceService:DeviceService) {
}
@@ -107,7 +109,7 @@ export class MainMenuToggleService {
// Set focus on first visible main menu item.
// This needs to be called after AngularJS has rendered the menu, which happens some when after(!) we leave this
// method here. So we need to set the focus after a timeout.
- setTimeout(function() {
+ setTimeout(function () {
jQuery('#main-menu [class*="-menu-item"]:visible').first().focus();
}, 500);
}
@@ -121,7 +123,8 @@ export class MainMenuToggleService {
public closeWhenOnMobile():void {
if (this.deviceService.isMobile) {
this.closeMenu()
- };
+ }
+ ;
}
private setToggleTitle():void {
@@ -186,6 +189,6 @@ export class MainMenuToggleService {
}
private get isGlobalPage():boolean {
- return this.currentProject.id? false : true;
+ return this.currentProject.id ? false : true;
}
}
diff --git a/frontend/src/app/components/op-context-menu/wp-context-menu/wp-table-context-menu.directive.ts b/frontend/src/app/components/op-context-menu/wp-context-menu/wp-table-context-menu.directive.ts
index 9c1d8f9daa2..f822b7178ba 100644
--- a/frontend/src/app/components/op-context-menu/wp-context-menu/wp-table-context-menu.directive.ts
+++ b/frontend/src/app/components/op-context-menu/wp-context-menu/wp-table-context-menu.directive.ts
@@ -3,12 +3,13 @@ import {WorkPackageAction} from "core-components/wp-table/context-menu-helper/wp
import {WorkPackageTable} from "core-components/wp-fast-table/wp-fast-table";
import {WorkPackageViewContextMenu} from "core-components/op-context-menu/wp-context-menu/wp-view-context-menu.directive";
import {WorkPackageViewHierarchyIdentationService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy-indentation.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageTableContextMenu extends WorkPackageViewContextMenu {
- private wpViewIndentation = this.injector.get(WorkPackageViewHierarchyIdentationService);
+ @InjectField() wpViewIndentation:WorkPackageViewHierarchyIdentationService;
- constructor(protected injector:Injector,
+ constructor(public injector:Injector,
protected workPackageId:string,
protected $element:JQuery,
protected additionalPositionArgs:any = {},
diff --git a/frontend/src/app/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts b/frontend/src/app/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts
index 93020d8da06..9874357292e 100644
--- a/frontend/src/app/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts
+++ b/frontend/src/app/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts
@@ -18,15 +18,16 @@ import {PERMITTED_CONTEXT_MENU_ACTIONS} from "core-components/op-context-menu/wp
import {OpModalService} from "core-components/op-modals/op-modal.service";
import {WpDestroyModal} from "core-components/modals/wp-destroy-modal/wp-destroy.modal";
import {StateService} from "@uirouter/core";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageViewContextMenu extends OpContextMenuHandler {
- protected states = this.injector.get(States);
- protected wpRelationsHierarchyService = this.injector.get(WorkPackageRelationsHierarchyService);
- protected opModalService:OpModalService = this.injector.get(OpModalService);
- protected $state:StateService = this.injector.get(StateService);
- protected wpTableSelection = this.injector.get(WorkPackageViewSelectionService);
- protected WorkPackageContextMenuHelper = this.injector.get(WorkPackageContextMenuHelperService);
+ @InjectField() protected states:States;
+ @InjectField() protected wpRelationsHierarchyService:WorkPackageRelationsHierarchyService;
+ @InjectField() protected opModalService:OpModalService;
+ @InjectField() protected $state:StateService;
+ @InjectField() protected wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() protected WorkPackageContextMenuHelper:WorkPackageContextMenuHelperService;
protected workPackage = this.states.workPackages.get(this.workPackageId).value!;
protected selectedWorkPackages = this.getSelectedWorkPackages();
@@ -37,7 +38,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
);
protected items = this.buildItems();
- constructor(protected injector:Injector,
+ constructor(public injector:Injector,
protected workPackageId:string,
protected $element:JQuery,
protected additionalPositionArgs:any = {},
@@ -46,7 +47,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
}
public get locals():OpContextMenuLocalsMap {
- return { contextMenuId: 'work-package-context-menu', items: this.items};
+ return {contextMenuId: 'work-package-context-menu', items: this.items};
}
public positionArgs(evt:JQuery.TriggeredEvent) {
@@ -84,7 +85,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
private deleteSelectedWorkPackages() {
let selected = this.getSelectedWorkPackages();
- this.opModalService.show(WpDestroyModal, this.injector, { workPackages: selected });
+ this.opModalService.show(WpDestroyModal, this.injector, {workPackages: selected});
}
private editSelectedWorkPackages(link:any) {
@@ -159,7 +160,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {
this.$state.go(
'work-packages.show',
- { workPackageId: this.workPackageId }
+ {workPackageId: this.workPackageId}
);
return true;
}
diff --git a/frontend/src/app/components/work-packages/work-package-comment/wp-comment-field.component.ts b/frontend/src/app/components/work-packages/work-package-comment/wp-comment-field.component.ts
index c3f80ddc651..e66699f9fef 100644
--- a/frontend/src/app/components/work-packages/work-package-comment/wp-comment-field.component.ts
+++ b/frontend/src/app/components/work-packages/work-package-comment/wp-comment-field.component.ts
@@ -32,6 +32,7 @@ import {
FormattableEditFieldComponent,
formattableFieldTemplate
} from "core-app/modules/fields/edit/field-types/formattable-edit-field.component";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
template: formattableFieldTemplate
@@ -39,7 +40,7 @@ import {
export class WorkPackageCommentFieldComponent extends FormattableEditFieldComponent implements OnInit {
public isBusy:boolean = false;
- public ConfigurationService:ConfigurationService = this.injector.get(ConfigurationService);
+ @InjectField() public ConfigurationService:ConfigurationService;
public get name() {
return 'comment';
diff --git a/frontend/src/app/components/wp-card-view/event-handler/click-handler.ts b/frontend/src/app/components/wp-card-view/event-handler/click-handler.ts
index c5e1a5cfc5a..a4e8b9455ba 100644
--- a/frontend/src/app/components/wp-card-view/event-handler/click-handler.ts
+++ b/frontend/src/app/components/wp-card-view/event-handler/click-handler.ts
@@ -6,15 +6,16 @@ import {WorkPackageViewFocusService} from "core-app/modules/work_packages/routin
import {WorkPackageCardViewService} from "core-components/wp-card-view/services/wp-card-view.service";
import {StateService} from "@uirouter/core";
import {DeviceService} from "core-app/modules/common/browser/device.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class CardClickHandler implements CardEventHandler {
// Injections
- public deviceService:DeviceService = this.injector.get(DeviceService);
- public $state:StateService = this.injector.get(StateService);
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
- public wpTableFocus:WorkPackageViewFocusService = this.injector.get(WorkPackageViewFocusService);
- public wpCardView:WorkPackageCardViewService = this.injector.get(WorkPackageCardViewService);
+ @InjectField() deviceService:DeviceService;
+ @InjectField() $state:StateService;
+ @InjectField() wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() wpTableFocus:WorkPackageViewFocusService;
+ @InjectField() wpCardView:WorkPackageCardViewService;
constructor(public readonly injector:Injector,
card:WorkPackageCardViewComponent) {
diff --git a/frontend/src/app/components/wp-card-view/event-handler/double-click-handler.ts b/frontend/src/app/components/wp-card-view/event-handler/double-click-handler.ts
index 6bf7e1e0d4b..08b89cdd65e 100644
--- a/frontend/src/app/components/wp-card-view/event-handler/double-click-handler.ts
+++ b/frontend/src/app/components/wp-card-view/event-handler/double-click-handler.ts
@@ -3,12 +3,11 @@ import {CardEventHandler} from "core-components/wp-card-view/event-handler/card-
import {WorkPackageCardViewComponent} from "core-components/wp-card-view/wp-card-view.component";
import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";
import {StateService} from "@uirouter/core";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class CardDblClickHandler implements CardEventHandler {
-
- // Injections
- public $state:StateService = this.injector.get(StateService);
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
+ @InjectField() $state:StateService;
+ @InjectField() wpTableSelection:WorkPackageViewSelectionService;
constructor(public readonly injector:Injector,
card:WorkPackageCardViewComponent) {
diff --git a/frontend/src/app/components/wp-card-view/event-handler/right-click-handler.ts b/frontend/src/app/components/wp-card-view/event-handler/right-click-handler.ts
index 40d4a1713ef..223c341f607 100644
--- a/frontend/src/app/components/wp-card-view/event-handler/right-click-handler.ts
+++ b/frontend/src/app/components/wp-card-view/event-handler/right-click-handler.ts
@@ -7,13 +7,14 @@ import {debugLog} from "core-app/helpers/debug_output";
import {WorkPackageCardViewService} from "core-components/wp-card-view/services/wp-card-view.service";
import {OPContextMenuService} from "core-components/op-context-menu/op-context-menu.service";
import {WorkPackageViewContextMenu} from "core-components/op-context-menu/wp-context-menu/wp-view-context-menu.directive";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class CardRightClickHandler implements CardEventHandler {
// Injections
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
- public wpCardView:WorkPackageCardViewService = this.injector.get(WorkPackageCardViewService);
- public opContextMenu:OPContextMenuService = this.injector.get(OPContextMenuService);
+ @InjectField() wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() wpCardView:WorkPackageCardViewService;
+ @InjectField() opContextMenu:OPContextMenuService;
constructor(public readonly injector:Injector,
card:WorkPackageCardViewComponent) {
diff --git a/frontend/src/app/components/wp-card-view/services/wp-card-drag-and-drop.service.ts b/frontend/src/app/components/wp-card-view/services/wp-card-drag-and-drop.service.ts
index 126e1d3833f..f2e064541e6 100644
--- a/frontend/src/app/components/wp-card-view/services/wp-card-drag-and-drop.service.ts
+++ b/frontend/src/app/components/wp-card-view/services/wp-card-drag-and-drop.service.ts
@@ -1,4 +1,4 @@
-import {Inject, Injectable, Injector} from '@angular/core';
+import {Inject, Injectable, Injector, Optional} from '@angular/core';
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
import {WorkPackageViewOrderService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-order.service";
import {States} from "core-components/states.service";
@@ -24,7 +24,6 @@ export class WorkPackageCardDragAndDropService {
/** A reference to the component in use, to have access to the current input variables */
public cardView:WorkPackageCardViewComponent;
- public readonly dragService = this.injector.get(DragAndDropService, null);
public constructor(readonly states:States,
readonly injector:Injector,
@@ -33,6 +32,7 @@ export class WorkPackageCardDragAndDropService {
readonly notificationService:WorkPackageNotificationService,
readonly wpCacheService:WorkPackageCacheService,
readonly currentProject:CurrentProjectService,
+ @Optional() readonly dragService:DragAndDropService,
readonly wpInlineCreate:WorkPackageInlineCreateService) {
}
diff --git a/frontend/src/app/components/wp-copy/wp-copy.controller.ts b/frontend/src/app/components/wp-copy/wp-copy.controller.ts
index cce12698059..63dd7a64660 100644
--- a/frontend/src/app/components/wp-copy/wp-copy.controller.ts
+++ b/frontend/src/app/components/wp-copy/wp-copy.controller.ts
@@ -36,6 +36,7 @@ import {HalResourceEditingService} from "core-app/modules/fields/edit/services/h
import {WorkPackageChangeset} from "core-components/wp-edit/work-package-changeset";
import {ChangeDetectionStrategy} from "@angular/core";
import {WorkPackageCreateService} from "core-components/wp-new/wp-create.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageCopyController extends WorkPackageCreateController {
private __initialized_at:Number;
@@ -44,9 +45,8 @@ export class WorkPackageCopyController extends WorkPackageCreateController {
/** Are we in the copying substates ? */
public copying = true;
- private wpRelations:WorkPackageRelationsService = this.injector.get(WorkPackageRelationsService);
- protected halEditing:HalResourceEditingService = this.injector.get(HalResourceEditingService);
- protected wpCreate:WorkPackageCreateService = this.injector.get(WorkPackageCreateService);
+ @InjectField() wpRelations:WorkPackageRelationsService;
+ @InjectField() halEditing:HalResourceEditingService;
ngOnInit() {
super.ngOnInit();
diff --git a/frontend/src/app/components/wp-edit-form/display-field-renderer.ts b/frontend/src/app/components/wp-edit-form/display-field-renderer.ts
index 22b36655840..04c3b043d65 100644
--- a/frontend/src/app/components/wp-edit-form/display-field-renderer.ts
+++ b/frontend/src/app/components/wp-edit-form/display-field-renderer.ts
@@ -8,6 +8,7 @@ import {ProgressTextDisplayField} from "core-app/modules/fields/display/field-ty
import {MultipleLinesUserFieldModule} from "core-app/modules/fields/display/field-types/multiple-lines-user-display-field.module";
import {ResourceChangeset} from "core-app/modules/fields/changeset/resource-changeset";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const editableClassName = '-editable';
export const requiredClassName = '-required';
@@ -19,8 +20,8 @@ export const cellEmptyPlaceholder = '-';
export class DisplayFieldRenderer<T extends HalResource = HalResource> {
- readonly displayFieldService:DisplayFieldService = this.injector.get(DisplayFieldService);
- readonly I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() displayFieldService:DisplayFieldService;
+ @InjectField() I18n:I18nService;
/** We cache the previously used fields to avoid reinitialization */
private fieldCache:{ [key:string]:DisplayField } = {};
@@ -194,7 +195,7 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {
private getDefaultPlaceholder(fieldSchema:IFieldSchema):string {
if (fieldSchema.type === 'Formattable') {
- return this.I18n.t('js.work_packages.placeholders.formattable', { name: fieldSchema.name });
+ return this.I18n.t('js.work_packages.placeholders.formattable', {name: fieldSchema.name});
}
return cellEmptyPlaceholder;
diff --git a/frontend/src/app/components/wp-edit-form/table-edit-form.ts b/frontend/src/app/components/wp-edit-form/table-edit-form.ts
index 904583b77a0..df1842ce146 100644
--- a/frontend/src/app/components/wp-edit-form/table-edit-form.ts
+++ b/frontend/src/app/components/wp-edit-form/table-edit-form.ts
@@ -47,29 +47,28 @@ import {EditForm} from "core-app/modules/fields/edit/edit-form/edit-form";
import {editModeClassName} from "core-app/modules/fields/edit/edit-field.component";
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
import {WorkPackageCacheService} from "core-components/work-packages/work-package-cache.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const activeFieldContainerClassName = 'inline-edit--active-field';
export const activeFieldClassName = 'inline-edit--field';
export class TableEditForm extends EditForm<WorkPackageResource> {
-
- // Injections
- public wpTableColumns:WorkPackageViewColumnsService = this.injector.get(WorkPackageViewColumnsService);
- public wpCacheService:WorkPackageCacheService = this.injector.get(WorkPackageCacheService);
- public states:States = this.injector.get(States);
- public FocusHelper:FocusHelperService = this.injector.get(FocusHelperService);
- public editingPortalService:EditingPortalService = this.injector.get(EditingPortalService);
+ @InjectField() public wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() public wpCacheService:WorkPackageCacheService;
+ @InjectField() public states:States;
+ @InjectField() public FocusHelper:FocusHelperService;
+ @InjectField() public editingPortalService:EditingPortalService;
// Use cell builder to reset edit fields
private cellBuilder = new CellBuilder(this.injector);
// Subscription
private resourceSubscription:Subscription = this.wpCacheService
- .requireAndStream(this.workPackageId)
- .subscribe((wp) => this.resource = wp);
+ .requireAndStream(this.workPackageId)
+ .subscribe((wp) => this.resource = wp);
- constructor(protected readonly injector:Injector,
- protected readonly table:WorkPackageTable,
+ constructor(public injector:Injector,
+ public table:WorkPackageTable,
public workPackageId:string,
public classIdentifier:string) {
super(injector);
@@ -90,27 +89,27 @@ export class TableEditForm extends EditForm<WorkPackageResource> {
public activateField(form:EditForm, schema:IFieldSchema, fieldName:string, errors:string[]):Promise<EditFieldHandler> {
return this.waitForContainer(fieldName)
- .then((cell) => {
-
- // Forcibly set the width since the edit field may otherwise
- // be given more width. Thereby preserve a minimum width of 150.
- // To avoid flickering content, the padding is removed, too.
- const td = this.findCell(fieldName);
- td.addClass(editModeClassName);
- let width = parseInt(td.css('width'));
- width = width > 150 ? width - 10 : 150;
- td.css('max-width', width + 'px');
- td.css('width', width + 'px');
-
- return this.editingPortalService.create(
- cell,
- this.injector,
- form,
- schema,
- fieldName,
- errors
- );
- });
+ .then((cell) => {
+
+ // Forcibly set the width since the edit field may otherwise
+ // be given more width. Thereby preserve a minimum width of 150.
+ // To avoid flickering content, the padding is removed, too.
+ const td = this.findCell(fieldName);
+ td.addClass(editModeClassName);
+ let width = parseInt(td.css('width'));
+ width = width > 150 ? width - 10 : 150;
+ td.css('max-width', width + 'px');
+ td.css('width', width + 'px');
+
+ return this.editingPortalService.create(
+ cell,
+ this.injector,
+ form,
+ schema,
+ fieldName,
+ errors
+ );
+ });
}
public reset(fieldName:string, focus?:boolean) {
@@ -137,9 +136,9 @@ export class TableEditForm extends EditForm<WorkPackageResource> {
protected focusOnFirstError():void {
// Focus the first field that is erroneous
jQuery(this.table.tableAndTimelineContainer)
- .find(`.${activeFieldContainerClassName}.-error .${activeFieldClassName}`)
- .first()
- .trigger('focus');
+ .find(`.${activeFieldContainerClassName}.-error .${activeFieldClassName}`)
+ .first()
+ .trigger('focus');
}
// Ensure the given field is visible.
diff --git a/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts b/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts
index 9e079547d1f..e72a40d6e8c 100644
--- a/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts
+++ b/frontend/src/app/components/wp-edit-form/work-package-filter-values.ts
@@ -6,13 +6,14 @@ import {Injector} from '@angular/core';
import {AngularTrackingHelpers} from "core-components/angular/tracking-functions";
import {WorkPackageChangeset} from "core-components/wp-edit/work-package-changeset";
import compareByHrefOrString = AngularTrackingHelpers.compareByHrefOrString;
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageFilterValues {
- private currentUser:CurrentUserService = this.injector.get(CurrentUserService);
- private halResourceService:HalResourceService = this.injector.get(HalResourceService);
+ @InjectField() currentUser:CurrentUserService;
+ @InjectField() halResourceService:HalResourceService;
- constructor(private injector:Injector,
+ constructor(public injector:Injector,
private change:WorkPackageChangeset,
private filters:QueryFilterInstanceResource[],
private excluded:string[] = []) {
diff --git a/frontend/src/app/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts
index a1d3884c558..fefa3dbfc7a 100644
--- a/frontend/src/app/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass.ts
@@ -5,11 +5,12 @@ import {WorkPackageTable} from "core-components/wp-fast-table/wp-fast-table";
import {WorkPackageViewOrderService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-order.service";
import {QueryOrder} from "core-app/modules/hal/dm-services/query-order-dm.service";
import {WorkPackageViewColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class DragDropHandleRenderPass {
- public wpTableColumns = this.injector.get(WorkPackageViewColumnsService);
- public wpTableOrder = this.injector.get(WorkPackageViewOrderService);
+ @InjectField() public wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() public wpTableOrder:WorkPackageViewOrderService;
// Drag & Drop handle builder
protected dragDropHandleBuilder = new DragDropHandleBuilder(this.injector);
@@ -28,7 +29,7 @@ export class DragDropHandleRenderPass {
this.wpTableOrder.withLoadedPositions().then((positions:QueryOrder) => {
this.tablePass.renderedOrder.forEach((row:RowRenderInfo, position:number) => {
// We only care for rows that are natural work packages and are not relation sub-rows
- if (!row.workPackage || row.renderType === 'relations') {
+ if (!row.workPackage || row.renderType === 'relations') {
return;
}
diff --git a/frontend/src/app/components/wp-fast-table/builders/highlighting/row-highlight-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/highlighting/row-highlight-render-pass.ts
index 8a77fcd44dc..30ebfd976ba 100644
--- a/frontend/src/app/components/wp-fast-table/builders/highlighting/row-highlight-render-pass.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/highlighting/row-highlight-render-pass.ts
@@ -5,11 +5,12 @@ import {WorkPackageViewHighlightingService} from "core-app/modules/work_packages
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
import {Highlighting} from "core-components/wp-fast-table/builders/highlighting/highlighting.functions";
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HighlightingRenderPass {
- private readonly wpTableHighlighting:WorkPackageViewHighlightingService = this.injector.get(WorkPackageViewHighlightingService);
- private readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() wpTableHighlighting:WorkPackageViewHighlightingService;
+ @InjectField() querySpace:IsolatedQuerySpace;
constructor(public readonly injector:Injector,
private table:WorkPackageTable,
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
index 517ba5056c4..a1b1f254fd9 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
@@ -3,6 +3,7 @@ import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
import {groupName} from './grouped-rows-helpers';
import {GroupObject} from 'core-app/modules/hal/resources/wp-collection-resource';
import {rowGroupClassName} from "core-components/wp-fast-table/builders/modes/grouped/grouped-classes.constants";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export function groupClassNameFor(group:GroupObject) {
return `group-${group.identifier}`;
@@ -10,7 +11,7 @@ export function groupClassNameFor(group:GroupObject) {
export class GroupHeaderBuilder {
- public I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() public I18n:I18nService;
public text:{ collapse:string, expand:string };
constructor(public readonly injector:Injector) {
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts
index baa258f50e6..6dacc50265d 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-builder.ts
@@ -14,14 +14,15 @@ import {
rowGroupClassName
} from "core-components/wp-fast-table/builders/modes/grouped/grouped-classes.constants";
import {WorkPackageViewColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class GroupedRowsBuilder extends RowsBuilder {
// Injections
- private readonly querySpace = this.injector.get(IsolatedQuerySpace);
- public states:States = this.injector.get(States);
- public wpTableColumns:WorkPackageViewColumnsService = this.injector.get(WorkPackageViewColumnsService);
- public I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() private readonly querySpace:IsolatedQuerySpace;
+ @InjectField() public states:States;
+ @InjectField() public wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() public I18n:I18nService;
constructor(public readonly injector:Injector, workPackageTable:WorkPackageTable) {
super(injector, workPackageTable);
@@ -76,29 +77,29 @@ export class GroupedRowsBuilder extends RowsBuilder {
jQuery(this.workPackageTable.tableAndTimelineContainer)
.find(`.${rowGroupClassName}`)
.each((i:number, oldRow:Element) => {
- let groupIndex = jQuery(oldRow).data('groupIndex');
- let group = groups[groupIndex];
+ let groupIndex = jQuery(oldRow).data('groupIndex');
+ let group = groups[groupIndex];
- // Refresh the group header
- let newRow = builder.buildGroupRow(group, colspan);
+ // Refresh the group header
+ let newRow = builder.buildGroupRow(group, colspan);
- if (oldRow.parentNode) {
- oldRow.parentNode.replaceChild(newRow, oldRow);
- }
+ if (oldRow.parentNode) {
+ oldRow.parentNode.replaceChild(newRow, oldRow);
+ }
- // Set expansion state of contained rows
- const affected = jQuery(`.${groupedRowClassName(groupIndex)}`);
- affected.toggleClass(collapsedRowClass, !!group.collapsed);
+ // Set expansion state of contained rows
+ const affected = jQuery(`.${groupedRowClassName(groupIndex)}`);
+ affected.toggleClass(collapsedRowClass, !!group.collapsed);
- // Update the hidden section of the rendered state
- affected.filter(`.${tableRowClassName}`).each((i, el) => {
- // Get the index of this row
- const index = jQuery(el).index();
+ // Update the hidden section of the rendered state
+ affected.filter(`.${tableRowClassName}`).each((i, el) => {
+ // Get the index of this row
+ const index = jQuery(el).index();
- // Update the hidden state
- rendered[index].hidden = !!group.collapsed;
+ // Update the hidden state
+ rendered[index].hidden = !!group.collapsed;
+ });
});
- });
this.querySpace.tableRendered.putValue(rendered, 'Updated hidden state of rows after group change.');
}
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-render-pass.ts
index 8605eda1010..5a29b56dc33 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-render-pass.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-render-pass.ts
@@ -13,13 +13,14 @@ import {
import {WorkPackageViewHierarchies} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-table-hierarchies";
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {WorkPackageViewHierarchiesService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HierarchyRenderPass extends PrimaryRenderPass {
- protected readonly querySpace = this.injector.get(IsolatedQuerySpace);
- protected readonly states = this.injector.get(States);
- protected readonly wpCacheService = this.injector.get(WorkPackageCacheService);
- protected readonly wpTableHierarchies = this.injector.get(WorkPackageViewHierarchiesService);
+ @InjectField() querySpace:IsolatedQuerySpace;
+ @InjectField() states:States;
+ @InjectField() wpCacheService:WorkPackageCacheService;
+ @InjectField() wpTableHierarchies:WorkPackageViewHierarchiesService;
// Remember which rows were already rendered
private rendered:{ [workPackageId:string]:boolean } = {};
@@ -48,7 +49,7 @@ export class HierarchyRenderPass extends PrimaryRenderPass {
this.hierarchies = this.wpTableHierarchies.current;
- _.each(this.workPackageTable.originalRowIndex, (row, ) => {
+ _.each(this.workPackageTable.originalRowIndex, (row,) => {
row.object.ancestors.forEach((ancestor:WorkPackageResource) => {
this.parentsWithVisibleChildren[ancestor.id!] = true;
});
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-rows-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-rows-builder.ts
index 79891e92a04..253ff960ad2 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-rows-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/hierarchy-rows-builder.ts
@@ -6,13 +6,14 @@ import {HierarchyRenderPass} from './hierarchy-render-pass';
import {SingleHierarchyRowBuilder} from './single-hierarchy-row-builder';
import {WorkPackageViewHierarchiesService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy.service";
import {WorkPackageViewColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HierarchyRowsBuilder extends RowsBuilder {
// Injections
- public states = this.injector.get(States);
- public wpTableColumns = this.injector.get(WorkPackageViewColumnsService);
- public wpTableHierarchies = this.injector.get(WorkPackageViewHierarchiesService);
+ @InjectField() states:States;
+ @InjectField() wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() wpTableHierarchies:WorkPackageViewHierarchiesService;
// The group expansion state
constructor(public readonly injector:Injector, public workPackageTable:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts
index 0e0285789eb..6a77bc7d530 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts
@@ -9,6 +9,7 @@ import {
hierarchyRootClass
} from "core-components/wp-fast-table/helpers/wp-table-hierarchy-helpers";
import {WorkPackageViewHierarchiesService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const indicatorCollapsedClass = '-hierarchy-collapsed';
export const hierarchyCellClassName = 'wp-table--hierarchy-span';
@@ -18,8 +19,8 @@ export const hierarchyBaseIndentation = 25;
export class SingleHierarchyRowBuilder extends SingleRowBuilder {
// Injected
- public wpTableHierarchies = this.injector.get(WorkPackageViewHierarchiesService);
- public states = this.injector.get(States);
+ @InjectField() public wpTableHierarchies:WorkPackageViewHierarchiesService;
+ @InjectField() public states:States;
// Retain a map of hierarchy elements present in the table
// with at least a visible child
@@ -134,7 +135,7 @@ export class SingleHierarchyRowBuilder extends SingleRowBuilder {
/**
* Build the hierarchy indicator at the given indentation level.
*/
- private buildHierarchyIndicator(workPackage:WorkPackageResource, jRow:JQuery | null, level:number):HTMLElement {
+ private buildHierarchyIndicator(workPackage:WorkPackageResource, jRow:JQuery|null, level:number):HTMLElement {
const hierarchyIndicator = document.createElement('span');
const collapsed = this.wpTableHierarchies.collapsed(workPackage.id!);
const indicatorWidth = hierarchyBaseIndentation + (hierarchyIndentation * level) + 'px';
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/plain/plain-rows-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/plain/plain-rows-builder.ts
index 8f633280495..025a8693c3d 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/plain/plain-rows-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/plain/plain-rows-builder.ts
@@ -5,11 +5,12 @@ import {PrimaryRenderPass} from '../../primary-render-pass';
import {SingleRowBuilder} from '../../rows/single-row-builder';
import {RowsBuilder} from '../rows-builder';
import {PlainRenderPass} from './plain-render-pass';
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class PlainRowsBuilder extends RowsBuilder {
// Injections
- public I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() public I18n:I18nService;
// The group expansion state
constructor(public readonly injector:Injector, workPackageTable:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/rows-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/rows-builder.ts
index 2ffe3a546b4..fe38735de7f 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/rows-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/rows-builder.ts
@@ -2,10 +2,11 @@ import {Injector} from '@angular/core';
import {States} from '../../../states.service';
import {WorkPackageTable} from '../../wp-fast-table';
import {PrimaryRenderPass} from '../primary-render-pass';
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export abstract class RowsBuilder {
- public states:States = this.injector.get(States);
+ @InjectField() public states:States;
constructor(public readonly injector:Injector, public workPackageTable:WorkPackageTable) {
}
diff --git a/frontend/src/app/components/wp-fast-table/builders/primary-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/primary-render-pass.ts
index 81766538357..1c2a2e68636 100644
--- a/frontend/src/app/components/wp-fast-table/builders/primary-render-pass.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/primary-render-pass.ts
@@ -12,8 +12,9 @@ import {TimelineRenderPass} from './timeline/timeline-render-pass';
import {HighlightingRenderPass} from "core-components/wp-fast-table/builders/highlighting/row-highlight-render-pass";
import {DragDropHandleRenderPass} from "core-components/wp-fast-table/builders/drag-and-drop/drag-drop-handle-render-pass";
import {RenderedWorkPackage} from "core-app/modules/work_packages/render-info/rendered-work-package.type";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
-export type RenderedRowType = 'primary' | 'relations';
+export type RenderedRowType = 'primary'|'relations';
export interface RowRenderInfo {
// The rendered row
@@ -23,7 +24,7 @@ export interface RowRenderInfo {
// Additional classes to be added by any secondary render passes
additionalClasses:string[];
// If this row is a work package, contains a reference to the rendered WP
- workPackage:WorkPackageResource | null;
+ workPackage:WorkPackageResource|null;
// If this is an additional row not present, this contains a reference to the WP
// it originated from
belongsTo?:WorkPackageResource;
@@ -37,9 +38,9 @@ export interface RowRenderInfo {
export abstract class PrimaryRenderPass {
- protected readonly halEditing:HalResourceEditingService = this.injector.get(HalResourceEditingService);
- protected readonly states:States = this.injector.get(States);
- protected readonly I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() halEditing:HalResourceEditingService;
+ @InjectField() states:States;
+ @InjectField() I18n:I18nService;
/** The rendered order of rows of work package IDs or <null>, if not a work package row */
public renderedOrder:RowRenderInfo[];
@@ -109,7 +110,7 @@ export abstract class PrimaryRenderPass {
*/
public refresh(row:RowRenderInfo, workPackage:WorkPackageResource, body:HTMLElement) {
let oldRow = jQuery(body).find(`.${row.classIdentifier}`);
- let replacement:JQuery | null = null;
+ let replacement:JQuery|null = null;
switch (row.renderType) {
case 'primary':
diff --git a/frontend/src/app/components/wp-fast-table/builders/relation-cell-builder.ts b/frontend/src/app/components/wp-fast-table/builders/relation-cell-builder.ts
index 59e4de9dc0c..82a3294b234 100644
--- a/frontend/src/app/components/wp-fast-table/builders/relation-cell-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/relation-cell-builder.ts
@@ -6,15 +6,16 @@ import {RelationResource} from 'core-app/modules/hal/resources/relation-resource
import {QueryColumn} from '../../wp-query/query-column';
import {WorkPackageRelationsService} from '../../wp-relations/wp-relations.service';
import {WorkPackageViewRelationColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-relation-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const relationCellTdClassName = 'wp-table--relation-cell-td';
export const relationCellIndicatorClassName = 'wp-table--relation-indicator';
export class RelationCellbuilder {
- public states = this.injector.get(States);
- public wpRelations = this.injector.get(WorkPackageRelationsService);
- public wpTableRelationColumns = this.injector.get(WorkPackageViewRelationColumnsService);
+ @InjectField() states:States;
+ @InjectField() wpRelations:WorkPackageRelationsService;
+ @InjectField() wpTableRelationColumns:WorkPackageViewRelationColumnsService;
constructor(public readonly injector:Injector) {
}
diff --git a/frontend/src/app/components/wp-fast-table/builders/relations/relation-row-builder.ts b/frontend/src/app/components/wp-fast-table/builders/relations/relation-row-builder.ts
index b536654a2b2..bfec415a390 100644
--- a/frontend/src/app/components/wp-fast-table/builders/relations/relation-row-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/relations/relation-row-builder.ts
@@ -8,6 +8,7 @@ import {tdClassName} from '../cell-builder';
import {commonRowClassName, SingleRowBuilder, tableRowClassName} from '../rows/single-row-builder';
import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource';
import {RelationColumnType} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-relation-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export function relationGroupClass(workPackageId:string) {
return `__relations-expanded-from-${workPackageId}`;
@@ -21,8 +22,8 @@ export const relationCellClassName = 'wp-table--relation-cell-td';
export class RelationRowBuilder extends SingleRowBuilder {
- public states:States = this.injector.get(States);
- public I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() public states:States;
+ @InjectField() public I18n:I18nService;
constructor(public readonly injector:Injector,
protected workPackageTable:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/builders/relations/relations-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/relations/relations-render-pass.ts
index 7c473cfeeb1..4bbe58f4b70 100644
--- a/frontend/src/app/components/wp-fast-table/builders/relations/relations-render-pass.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/relations/relations-render-pass.ts
@@ -11,6 +11,7 @@ import {
RelationColumnType,
WorkPackageViewRelationColumnsService
} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-relation-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export interface RelationRenderInfo extends RowRenderInfo {
data:{
@@ -21,10 +22,9 @@ export interface RelationRenderInfo extends RowRenderInfo {
}
export class RelationsRenderPass {
-
- public wpRelations = this.injector.get(WorkPackageRelationsService);
- public wpTableColumns = this.injector.get(WorkPackageViewColumnsService);
- public wpTableRelationColumns = this.injector.get(WorkPackageViewRelationColumnsService);
+ @InjectField() wpRelations:WorkPackageRelationsService;
+ @InjectField() wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() wpTableRelationColumns:WorkPackageViewRelationColumnsService;
public relationRowBuilder:RelationRowBuilder;
diff --git a/frontend/src/app/components/wp-fast-table/builders/rows/single-row-builder.ts b/frontend/src/app/components/wp-fast-table/builders/rows/single-row-builder.ts
index 84bc19c7d7c..a72aa94fe6d 100644
--- a/frontend/src/app/components/wp-fast-table/builders/rows/single-row-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/rows/single-row-builder.ts
@@ -15,6 +15,7 @@ import {
internalContextMenuColumn,
internalSortColumn
} from "core-components/wp-fast-table/builders/internal-sort-columns";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
// Work package table row entries
export const tableRowClassName = 'wp-table--row';
@@ -24,9 +25,9 @@ export const commonRowClassName = 'wp--row';
export class SingleRowBuilder {
// Injections
- public wpTableSelection = this.injector.get(WorkPackageViewSelectionService);
- public wpTableColumns = this.injector.get(WorkPackageViewColumnsService);
- public I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() I18n:I18nService;
// Cell builder instance
protected cellBuilder = new CellBuilder(this.injector);
diff --git a/frontend/src/app/components/wp-fast-table/builders/table-action-renderer.ts b/frontend/src/app/components/wp-fast-table/builders/table-action-renderer.ts
index 40b960c7c1c..fde82ce90b4 100644
--- a/frontend/src/app/components/wp-fast-table/builders/table-action-renderer.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/table-action-renderer.ts
@@ -4,11 +4,12 @@ import {OpTableActionsService} from 'core-components/wp-table/table-actions/tabl
import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource';
import {contextMenuSpanClassName, contextMenuTdClassName} from "core-components/wp-table/table-actions/table-action";
import {internalContextMenuColumn} from "core-components/wp-fast-table/builders/internal-sort-columns";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class TableActionRenderer {
// Injections
- readonly tableActionsService:OpTableActionsService = this.injector.get(OpTableActionsService);
+ @InjectField() tableActionsService:OpTableActionsService;
constructor(public readonly injector:Injector) {
}
@@ -26,7 +27,7 @@ export class TableActionRenderer {
.render(workPackage)
.forEach((el:HTMLElement) => {
span.appendChild(el);
- });
+ });
td.appendChild(span);
return td;
diff --git a/frontend/src/app/components/wp-fast-table/builders/timeline/timeline-row-builder.ts b/frontend/src/app/components/wp-fast-table/builders/timeline/timeline-row-builder.ts
index 67893514c12..376f36f69cb 100644
--- a/frontend/src/app/components/wp-fast-table/builders/timeline/timeline-row-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/timeline/timeline-row-builder.ts
@@ -4,20 +4,21 @@ import {WorkPackageCacheService} from '../../../work-packages/work-package-cache
import {WorkPackageTable} from '../../wp-fast-table';
import {commonRowClassName} from '../rows/single-row-builder';
import {WorkPackageViewTimelineService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-timeline.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const timelineCellClassName = 'wp-timeline-cell';
export class TimelineRowBuilder {
- public states = this.injector.get(States);
- public wpTableTimeline = this.injector.get(WorkPackageViewTimelineService);
- public wpCacheService = this.injector.get(WorkPackageCacheService);
+ @InjectField() public states:States;
+ @InjectField() public wpTableTimeline:WorkPackageViewTimelineService;
+ @InjectField() public wpCacheService:WorkPackageCacheService;
constructor(public readonly injector:Injector,
protected workPackageTable:WorkPackageTable) {
}
- public build(workPackageId:string | null) {
+ public build(workPackageId:string|null) {
const cell = document.createElement('div');
cell.classList.add(timelineCellClassName, commonRowClassName);
@@ -34,8 +35,8 @@ export class TimelineRowBuilder {
* @param timelineBody
* @param rowClasses
*/
- public insert(workPackageId:string | null,
- timelineBody:DocumentFragment | HTMLElement,
+ public insert(workPackageId:string|null,
+ timelineBody:DocumentFragment|HTMLElement,
rowClasses:string[] = []) {
const cell = this.build(workPackageId);
diff --git a/frontend/src/app/components/wp-fast-table/handlers/cell/edit-cell-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/cell/edit-cell-handler.ts
index dc213b9b5d0..a1668153375 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/cell/edit-cell-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/cell/edit-cell-handler.ts
@@ -9,12 +9,13 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {ClickOrEnterHandler} from '../click-or-enter-handler';
import {TableEventHandler} from '../table-handler-registry';
import {ClickPositionMapper} from "core-app/modules/common/set-click-position/set-click-position";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class EditCellHandler extends ClickOrEnterHandler implements TableEventHandler {
// Injections
- public states:States = this.injector.get(States);
- public halEditing:HalResourceEditingService = this.injector.get(HalResourceEditingService);
+ @InjectField() public states:States;
+ @InjectField() public halEditing:HalResourceEditingService;
// Keep a reference to all
diff --git a/frontend/src/app/components/wp-fast-table/handlers/cell/relations-cell-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/cell/relations-cell-handler.ts
index 48ec430b458..4f41ab0993d 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/cell/relations-cell-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/cell/relations-cell-handler.ts
@@ -6,11 +6,12 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {ClickOrEnterHandler} from '../click-or-enter-handler';
import {TableEventHandler} from '../table-handler-registry';
import {WorkPackageViewRelationColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-relation-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class RelationsCellHandler extends ClickOrEnterHandler implements TableEventHandler {
// Injections
- public wpTableRelationColumns = this.injector.get(WorkPackageViewRelationColumnsService);
+ @InjectField() wpTableRelationColumns:WorkPackageViewRelationColumnsService;
public get EVENT() {
return 'click.table.relationsCell, keydown.table.relationsCell';
diff --git a/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-handler.ts
index 9ead287a74b..56014f9899c 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-handler.ts
@@ -4,10 +4,11 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {TableEventHandler} from '../table-handler-registry';
import {OPContextMenuService} from "core-components/op-context-menu/op-context-menu.service";
import {WorkPackageTableContextMenu} from "core-components/op-context-menu/wp-context-menu/wp-table-context-menu.directive";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export abstract class ContextMenuHandler implements TableEventHandler {
// Injections
- public opContextMenu:OPContextMenuService = this.injector.get(OPContextMenuService);
+ @InjectField() public opContextMenu:OPContextMenuService;
constructor(public readonly injector:Injector,
protected table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-rightclick-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-rightclick-handler.ts
index 99ec58dff3b..85511126537 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-rightclick-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/context-menu/context-menu-rightclick-handler.ts
@@ -6,10 +6,11 @@ import {uiStateLinkClass} from '../../builders/ui-state-link-builder';
import {WorkPackageTable} from '../../wp-fast-table';
import {ContextMenuHandler} from './context-menu-handler';
import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class ContextMenuRightClickHandler extends ContextMenuHandler {
- readonly wpTableSelection = this.injector.get(WorkPackageViewSelectionService);
+ @InjectField() readonly wpTableSelection:WorkPackageViewSelectionService;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
@@ -50,7 +51,7 @@ export class ContextMenuRightClickHandler extends ContextMenuHandler {
const wpId = element.data('workPackageId');
if (wpId) {
- let [index, ] = this.table.findRenderedRow(wpId);
+ let [index,] = this.table.findRenderedRow(wpId);
if (!this.wpTableSelection.isSelected(wpId)) {
this.wpTableSelection.setSelection(wpId, index);
diff --git a/frontend/src/app/components/wp-fast-table/handlers/row/click-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/row/click-handler.ts
index 9842fefb3e2..ea22e5645b7 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/row/click-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/row/click-handler.ts
@@ -11,15 +11,16 @@ import {TableEventHandler} from '../table-handler-registry';
import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";
import {displayClassName} from "core-components/wp-edit-form/display-field-renderer";
import {activeFieldClassName} from "core-app/modules/fields/edit/edit-form/edit-form";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class RowClickHandler implements TableEventHandler {
// Injections
- public $state:StateService = this.injector.get(StateService);
- public states:States = this.injector.get(States);
- public keepTab:KeepTabService = this.injector.get(KeepTabService);
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
- public wpTableFocus:WorkPackageViewFocusService = this.injector.get(WorkPackageViewFocusService);
+ @InjectField() public $state:StateService;
+ @InjectField() public states:States;
+ @InjectField() public keepTab:KeepTabService;
+ @InjectField() public wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() public wpTableFocus:WorkPackageViewFocusService;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/row/double-click-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/row/double-click-handler.ts
index 9764ce1b3f6..79ede1e52e8 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/row/double-click-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/row/double-click-handler.ts
@@ -11,14 +11,15 @@ import {LinkHandling} from "core-app/modules/common/link-handling/link-handling"
import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";
import {displayClassName} from "core-components/wp-edit-form/display-field-renderer";
import {activeFieldClassName} from "core-app/modules/fields/edit/edit-form/edit-form";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class RowDoubleClickHandler implements TableEventHandler {
// Injections
- public $state:StateService = this.injector.get(StateService);
- public states:States = this.injector.get(States);
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
- public wpTableFocus:WorkPackageViewFocusService = this.injector.get(WorkPackageViewFocusService);
+ @InjectField() public $state:StateService;
+ @InjectField() public states:States;
+ @InjectField() public wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() public wpTableFocus:WorkPackageViewFocusService;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/row/group-row-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/row/group-row-handler.ts
index 12a53756d86..1056429f456 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/row/group-row-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/row/group-row-handler.ts
@@ -5,11 +5,12 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {TableEventHandler} from '../table-handler-registry';
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {rowGroupClassName} from "core-components/wp-fast-table/builders/modes/grouped/grouped-classes.constants";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class GroupRowHandler implements TableEventHandler {
// Injections
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() public querySpace:IsolatedQuerySpace;
private builder:GroupedRowsBuilder;
diff --git a/frontend/src/app/components/wp-fast-table/handlers/row/hierarchy-click-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/row/hierarchy-click-handler.ts
index 7d5f7f3e794..417b52a256a 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/row/hierarchy-click-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/row/hierarchy-click-handler.ts
@@ -5,11 +5,12 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {ClickOrEnterHandler} from '../click-or-enter-handler';
import {TableEventHandler} from "core-components/wp-fast-table/handlers/table-handler-registry";
import {WorkPackageViewHierarchiesService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-hierarchy.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HierarchyClickHandler extends ClickOrEnterHandler implements TableEventHandler {
// Injections
- public states:States = this.injector.get(States);
- public wpTableHierarchies:WorkPackageViewHierarchiesService = this.injector.get(WorkPackageViewHierarchiesService);
+ @InjectField() public states:States;
+ @InjectField() public wpTableHierarchies:WorkPackageViewHierarchiesService;
constructor(public readonly injector:Injector, table:WorkPackageTable) {
super();
diff --git a/frontend/src/app/components/wp-fast-table/handlers/row/wp-state-links-handler.ts b/frontend/src/app/components/wp-fast-table/handlers/row/wp-state-links-handler.ts
index c36e6b9843a..f87f0b2a5a3 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/row/wp-state-links-handler.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/row/wp-state-links-handler.ts
@@ -9,15 +9,16 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {TableEventHandler} from '../table-handler-registry';
import {StateService} from '@uirouter/core';
import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageStateLinksHandler implements TableEventHandler {
// Injections
- public $state:StateService = this.injector.get(StateService);
- public keepTab:KeepTabService = this.injector.get(KeepTabService);
- public states:States = this.injector.get(States);
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
- public wpTableFocus:WorkPackageViewFocusService = this.injector.get(WorkPackageViewFocusService);
+ @InjectField() public $state:StateService;
+ @InjectField() public keepTab:KeepTabService;
+ @InjectField() public states:States;
+ @InjectField() public wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() public wpTableFocus:WorkPackageViewFocusService;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/columns-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/columns-transformer.ts
index bda46de5e3b..84f1337f986 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/columns-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/columns-transformer.ts
@@ -4,11 +4,12 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {takeUntil} from "rxjs/operators";
import {WorkPackageViewColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class ColumnsTransformer {
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
- public wpTableColumns:WorkPackageViewColumnsService = this.injector.get(WorkPackageViewColumnsService);
+ @InjectField() public querySpace:IsolatedQuerySpace;
+ @InjectField() public wpTableColumns:WorkPackageViewColumnsService;
constructor(public readonly injector:Injector,
public table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts
index 21909a454f9..5a9233bd7a3 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts
@@ -17,21 +17,24 @@ import {BrowserDetector} from "core-app/modules/common/browser/browser-detector.
import {WorkPackageCacheService} from "core-components/work-packages/work-package-cache.service";
import {WorkPackagesListService} from "core-components/wp-list/wp-list.service";
import {AuthorisationService} from "core-app/modules/common/model-auth/model-auth.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class DragAndDropTransformer {
- private readonly states:States = this.injector.get(States);
- private readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() private readonly states:States;
+ @InjectField() private readonly querySpace:IsolatedQuerySpace;
+ @InjectField() private readonly inlineCreateService:WorkPackageInlineCreateService;
+ @InjectField() private readonly halNotification:HalResourceNotificationService;
+ @InjectField() private readonly wpTableSortBy:WorkPackageViewSortByService;
+ @InjectField() private readonly wpTableOrder:WorkPackageViewOrderService;
+ @InjectField() private readonly browserDetector:BrowserDetector;
+ @InjectField() private readonly wpCacheService:WorkPackageCacheService;
+ @InjectField() private readonly wpListService:WorkPackagesListService;
+ @InjectField() private readonly dragActionRegistry:TableDragActionsRegistryService;
+
+ // Inject optional
private readonly dragService:DragAndDropService|null = this.injector.get(DragAndDropService, null);
- private readonly inlineCreateService = this.injector.get(WorkPackageInlineCreateService);
- private readonly halNotification = this.injector.get(HalResourceNotificationService);
- private readonly wpTableSortBy = this.injector.get(WorkPackageViewSortByService);
- private readonly wpTableOrder = this.injector.get(WorkPackageViewOrderService);
- private readonly browserDetector = this.injector.get(BrowserDetector);
- private readonly wpCacheService = this.injector.get(WorkPackageCacheService);
- private readonly wpListService = this.injector.get(WorkPackagesListService);
-
- private readonly dragActionRegistry = this.injector.get(TableDragActionsRegistryService);
+
constructor(public readonly injector:Injector,
public table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
index 325a653cf87..ecccaf30b79 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
@@ -12,11 +12,12 @@ import {
import {indicatorCollapsedClass} from "core-components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder";
import {tableRowClassName} from "core-components/wp-fast-table/builders/rows/single-row-builder";
import {WorkPackageViewHierarchies} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-table-hierarchies";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HierarchyTransformer {
- public wpTableHierarchies = this.injector.get(WorkPackageViewHierarchiesService);
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() public wpTableHierarchies:WorkPackageViewHierarchiesService;
+ @InjectField() public querySpace:IsolatedQuerySpace;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/highlighting-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/highlighting-transformer.ts
index 811cae0edfc..01c069043ef 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/highlighting-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/highlighting-transformer.ts
@@ -3,11 +3,12 @@ import {distinctUntilChanged, takeUntil} from 'rxjs/operators';
import {WorkPackageTable} from '../../wp-fast-table';
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {WorkPackageViewHighlightingService} from 'core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-highlighting.service';
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HighlightingTransformer {
- public wpTableHighlighting:WorkPackageViewHighlightingService = this.injector.get(WorkPackageViewHighlightingService);
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() public wpTableHighlighting:WorkPackageViewHighlightingService;
+ @InjectField() public querySpace:IsolatedQuerySpace;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/relations-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/relations-transformer.ts
index d1da41db8f3..574ffc50655 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/relations-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/relations-transformer.ts
@@ -3,11 +3,12 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {takeUntil} from "rxjs/operators";
import {WorkPackageViewRelationColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-relation-columns.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class RelationsTransformer {
- public wpTableRelationColumns = this.injector.get(WorkPackageViewRelationColumnsService);
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() public wpTableRelationColumns:WorkPackageViewRelationColumnsService;
+ @InjectField() public querySpace:IsolatedQuerySpace;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts
index 2edf05ff40b..35de07ed869 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/rows-transformer.ts
@@ -7,13 +7,14 @@ import {WorkPackageViewOrderService} from "core-app/modules/work_packages/routin
import {WorkPackageViewSortByService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-sort-by.service";
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
import {debugLog} from "core-app/helpers/debug_output";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class RowsTransformer {
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
- public wpTableSortBy = this.injector.get(WorkPackageViewSortByService);
- public wpTableOrder = this.injector.get(WorkPackageViewOrderService);
- public states:States = this.injector.get(States);
+ @InjectField() querySpace:IsolatedQuerySpace;
+ @InjectField() wpTableSortBy:WorkPackageViewSortByService;
+ @InjectField() wpTableOrder:WorkPackageViewOrderService;
+ @InjectField() states:States;
constructor(public readonly injector:Injector,
public table:WorkPackageTable) {
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts
index f3966a3ea65..bf47994a18d 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/selection-transformer.ts
@@ -11,13 +11,14 @@ import {
WorkPackageViewSelectionService,
WorkPackageViewSelectionState
} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-selection.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class SelectionTransformer {
- public wpTableSelection:WorkPackageViewSelectionService = this.injector.get(WorkPackageViewSelectionService);
- public wpTableFocus:WorkPackageViewFocusService = this.injector.get(WorkPackageViewFocusService);
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
- public FocusHelper:FocusHelperService = this.injector.get(FocusHelperService);
+ @InjectField() public wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() public wpTableFocus:WorkPackageViewFocusService;
+ @InjectField() public querySpace:IsolatedQuerySpace;
+ @InjectField() public FocusHelper:FocusHelperService;
constructor(public readonly injector:Injector,
public readonly table:WorkPackageTable) {
@@ -49,7 +50,9 @@ export class SelectionTransformer {
});
- this.wpTableSelection.registerSelectAllListener(() => { return table.renderedRows; });
+ this.wpTableSelection.registerSelectAllListener(() => {
+ return table.renderedRows;
+ });
this.wpTableSelection.registerDeselectAllListener();
}
diff --git a/frontend/src/app/components/wp-fast-table/handlers/state/timeline-transformer.ts b/frontend/src/app/components/wp-fast-table/handlers/state/timeline-transformer.ts
index a8916a73e83..a5e98faee28 100644
--- a/frontend/src/app/components/wp-fast-table/handlers/state/timeline-transformer.ts
+++ b/frontend/src/app/components/wp-fast-table/handlers/state/timeline-transformer.ts
@@ -4,14 +4,15 @@ import {WorkPackageTable} from '../../wp-fast-table';
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {WorkPackageViewTimelineService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-timeline.service";
import {WorkPackageTimelineState} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-table-timeline";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class TimelineTransformer {
- public querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
- public wpTableTimeline = this.injector.get(WorkPackageViewTimelineService);
+ @InjectField() public querySpace:IsolatedQuerySpace;
+ @InjectField() public wpTableTimeline:WorkPackageViewTimelineService;
- constructor(private readonly injector:Injector,
- private readonly table:WorkPackageTable) {
+ constructor(readonly injector:Injector,
+ readonly table:WorkPackageTable) {
this.wpTableTimeline
.live$()
diff --git a/frontend/src/app/components/wp-fast-table/wp-fast-table.ts b/frontend/src/app/components/wp-fast-table/wp-fast-table.ts
index 78084503c61..48eb818e04d 100644
--- a/frontend/src/app/components/wp-fast-table/wp-fast-table.ts
+++ b/frontend/src/app/components/wp-fast-table/wp-fast-table.ts
@@ -18,15 +18,15 @@ import {WorkPackageTableRow} from './wp-table.interfaces';
import {WorkPackageTableConfiguration} from 'core-app/components/wp-table/wp-table-configuration';
import {PortalCleanupService} from "core-app/modules/fields/display/display-portal/portal-cleanup.service";
import {RenderedWorkPackage} from "core-app/modules/work_packages/render-info/rendered-work-package.type";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageTable {
- private readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
-
- public wpCacheService:WorkPackageCacheService = this.injector.get(WorkPackageCacheService);
- public states:States = this.injector.get(States);
- public I18n:I18nService = this.injector.get(I18nService);
- public portalCleanupService:PortalCleanupService = this.injector.get(PortalCleanupService);
+ @InjectField() querySpace:IsolatedQuerySpace;
+ @InjectField() wpCacheService:WorkPackageCacheService;
+ @InjectField() states:States;
+ @InjectField() I18n:I18nService;
+ @InjectField() portalCleanupService:PortalCleanupService;
public originalRows:string[] = [];
public originalRowIndex:{ [id:string]:WorkPackageTableRow } = {};
diff --git a/frontend/src/app/components/wp-fast-table/wp-table-editing.ts b/frontend/src/app/components/wp-fast-table/wp-table-editing.ts
index fb93b66629d..9f815393880 100644
--- a/frontend/src/app/components/wp-fast-table/wp-table-editing.ts
+++ b/frontend/src/app/components/wp-fast-table/wp-table-editing.ts
@@ -5,10 +5,11 @@ import {WorkPackageTable} from 'core-components/wp-fast-table/wp-fast-table';
import {WorkPackageChangeset} from "core-components/wp-edit/work-package-changeset";
import {EditForm} from "core-app/modules/fields/edit/edit-form/edit-form";
import {TableEditForm} from "core-components/wp-edit-form/table-edit-form";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageTableEditingContext {
- public halEditing:HalResourceEditingService = this.injector.get(HalResourceEditingService);
+ @InjectField() public halEditing:HalResourceEditingService;
constructor(readonly table:WorkPackageTable,
readonly injector:Injector) {
diff --git a/frontend/src/app/components/wp-inline-create/inline-create-row-builder.ts b/frontend/src/app/components/wp-inline-create/inline-create-row-builder.ts
index cfcd69a71aa..e963485dd47 100644
--- a/frontend/src/app/components/wp-inline-create/inline-create-row-builder.ts
+++ b/frontend/src/app/components/wp-inline-create/inline-create-row-builder.ts
@@ -15,6 +15,7 @@ import {QueryColumn} from "core-components/wp-query/query-column";
import {tdClassName} from "core-components/wp-fast-table/builders/cell-builder";
import {internalContextMenuColumn} from "core-components/wp-fast-table/builders/internal-sort-columns";
import {EditForm} from "core-app/modules/fields/edit/edit-form/edit-form";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const inlineCreateRowClassName = 'wp-inline-create-row';
export const inlineCreateCancelClassName = 'wp-table--cancel-create-link';
@@ -22,10 +23,10 @@ export const inlineCreateCancelClassName = 'wp-table--cancel-create-link';
export class InlineCreateRowBuilder extends SingleRowBuilder {
// Injections
- public states = this.injector.get(States);
- public wpTableSelection = this.injector.get(WorkPackageViewSelectionService);
- public wpTableColumns = this.injector.get(WorkPackageViewColumnsService);
- public I18n = this.injector.get(I18nService);
+ @InjectField() public states:States;
+ @InjectField() public wpTableSelection:WorkPackageViewSelectionService;
+ @InjectField() public wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() public I18n:I18nService;
protected text:{ cancelButton:string };
diff --git a/frontend/src/app/components/wp-inline-create/wp-inline-create.service.ts b/frontend/src/app/components/wp-inline-create/wp-inline-create.service.ts
index 238d70ace09..a0652d3433b 100644
--- a/frontend/src/app/components/wp-inline-create/wp-inline-create.service.ts
+++ b/frontend/src/app/components/wp-inline-create/wp-inline-create.service.ts
@@ -32,14 +32,15 @@ import {Observable, of, Subject} from "rxjs";
import {ComponentType} from "@angular/cdk/portal";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {AuthorisationService} from "core-app/modules/common/model-auth/model-auth.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Injectable()
export class WorkPackageInlineCreateService implements OnDestroy {
- protected readonly I18n:I18nService = this.injector.get(I18nService);
- protected readonly authorisationService:AuthorisationService = this.injector.get(AuthorisationService);
+ @InjectField() protected readonly I18n:I18nService;
+ @InjectField() protected readonly authorisationService:AuthorisationService;
- constructor(protected readonly injector:Injector) {
+ constructor(readonly injector:Injector) {
}
/**
diff --git a/frontend/src/app/components/wp-new/wp-create.controller.ts b/frontend/src/app/components/wp-new/wp-create.controller.ts
index 5848d26696d..d4d49d5df7e 100644
--- a/frontend/src/app/components/wp-new/wp-create.controller.ts
+++ b/frontend/src/app/components/wp-new/wp-create.controller.ts
@@ -66,11 +66,11 @@ export class WorkPackageCreateController implements OnInit, OnDestroy {
@ViewChild(EditFormComponent, {static: false}) private editForm:EditFormComponent|undefined;
- constructor(protected readonly $transition:Transition,
+ constructor(public readonly injector:Injector,
+ protected readonly $transition:Transition,
protected readonly $state:StateService,
protected readonly I18n:I18nService,
protected readonly titleService:OpTitleService,
- protected readonly injector:Injector,
protected readonly notificationService:WorkPackageNotificationService,
protected readonly states:States,
protected readonly wpCreate:WorkPackageCreateService,
diff --git a/frontend/src/app/components/wp-relations/embedded/children/wp-children-inline-create.service.ts b/frontend/src/app/components/wp-relations/embedded/children/wp-children-inline-create.service.ts
index 7f5132c6f3c..08fb426abe9 100644
--- a/frontend/src/app/components/wp-relations/embedded/children/wp-children-inline-create.service.ts
+++ b/frontend/src/app/components/wp-relations/embedded/children/wp-children-inline-create.service.ts
@@ -36,7 +36,7 @@ import {WpRelationInlineAddExistingComponent} from "core-components/wp-relations
@Injectable()
export class WpChildrenInlineCreateService extends WorkPackageInlineCreateService implements WpRelationInlineCreateServiceInterface, OnDestroy {
- constructor(protected readonly injector:Injector,
+ constructor(readonly injector:Injector,
protected readonly wpRelationsHierarchyService:WorkPackageRelationsHierarchyService) {
super(injector);
}
diff --git a/frontend/src/app/components/wp-relations/embedded/relations/wp-relation-inline-create.service.ts b/frontend/src/app/components/wp-relations/embedded/relations/wp-relation-inline-create.service.ts
index 871531ec694..a7bebe676c8 100644
--- a/frontend/src/app/components/wp-relations/embedded/relations/wp-relation-inline-create.service.ts
+++ b/frontend/src/app/components/wp-relations/embedded/relations/wp-relation-inline-create.service.ts
@@ -34,13 +34,13 @@ import {WorkPackageRelationsHierarchyService} from "core-components/wp-relations
import {WorkPackageRelationsService} from "core-components/wp-relations/wp-relations.service";
import {RelationResource} from "core-app/modules/hal/resources/relation-resource";
import {WpRelationInlineCreateServiceInterface} from "core-components/wp-relations/embedded/wp-relation-inline-create.service.interface";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Injectable()
export class WpRelationInlineCreateService extends WorkPackageInlineCreateService implements WpRelationInlineCreateServiceInterface, OnDestroy {
+ @InjectField() wpRelations:WorkPackageRelationsService;
- protected readonly wpRelations:WorkPackageRelationsService = this.injector.get(WorkPackageRelationsService);
-
- constructor(protected readonly injector:Injector) {
+ constructor(public injector:Injector) {
super(injector);
}
diff --git a/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts b/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts
index f1f01067ba0..b519c12efe5 100644
--- a/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts
+++ b/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts
@@ -8,13 +8,14 @@ import {locatePredecessorBySelector} from "core-components/wp-fast-table/helpers
import {groupIdentifier} from "core-components/wp-fast-table/builders/modes/grouped/grouped-rows-helpers";
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class GroupByDragActionService extends TableDragActionService {
- private wpTableGroupBy = this.injector.get(WorkPackageViewGroupByService);
- private halEditing = this.injector.get<HalResourceEditingService>(HalResourceEditingService);
- private halEvents = this.injector.get<HalEventsService>(HalEventsService);
- private halNotification = this.injector.get(HalResourceNotificationService);
+ @InjectField() wpTableGroupBy:WorkPackageViewGroupByService;
+ @InjectField() halEditing:HalResourceEditingService;
+ @InjectField() halEvents:HalEventsService;
+ @InjectField() halNotification:HalResourceNotificationService;
public get applies() {
return this.wpTableGroupBy.isEnabled;
@@ -35,7 +36,7 @@ export class GroupByDragActionService extends TableDragActionService {
changeset.projectedResource[this.groupedAttribute!] = groupedValue;
return this.halEditing
.save(changeset)
- .then((saved) => this.halEvents.push(saved.resource, { eventType: 'updated' }))
+ .then((saved) => this.halEvents.push(saved.resource, {eventType: 'updated'}))
.catch(e => this.halNotification.handleRawError(e, workPackage));
}
diff --git a/frontend/src/app/components/wp-table/drag-and-drop/actions/hierarchy-drag-action.service.ts b/frontend/src/app/components/wp-table/drag-and-drop/actions/hierarchy-drag-action.service.ts
index 0bcef4cb88d..9b112f95787 100644
--- a/frontend/src/app/components/wp-table/drag-and-drop/actions/hierarchy-drag-action.service.ts
+++ b/frontend/src/app/components/wp-table/drag-and-drop/actions/hierarchy-drag-action.service.ts
@@ -8,12 +8,13 @@ import {
} from "core-components/wp-fast-table/helpers/wp-table-hierarchy-helpers";
import {WorkPackageCacheService} from "core-components/work-packages/work-package-cache.service";
import {relationRowClass} from "core-components/wp-fast-table/helpers/wp-table-row-helpers";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HierarchyDragActionService extends TableDragActionService {
- private wpTableHierarchies = this.injector.get(WorkPackageViewHierarchiesService);
- private relationHierarchyService = this.injector.get(WorkPackageRelationsHierarchyService);
- private wpCacheService = this.injector.get(WorkPackageCacheService);
+ @InjectField() private wpTableHierarchies:WorkPackageViewHierarchiesService;
+ @InjectField() private relationHierarchyService:WorkPackageRelationsHierarchyService;
+ @InjectField() private wpCacheService:WorkPackageCacheService;
public get applies() {
return this.wpTableHierarchies.isEnabled;
@@ -56,8 +57,7 @@ export class HierarchyDragActionService extends TableDragActionService {
if (this.isHiearchyRoot(previous, previousWpId)) {
// If the sibling is a hierarchy root, return that sibling as new parent.
parent = previousWpId;
- }
- else {
+ } else {
// If the sibling is no hierarchy root, return it's parent.
// Thus, the dropped element will get the same hierarchy level as the sibling
parent = this.loadParentOfWP(previousWpId);
diff --git a/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts b/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts
index 10a38ca3429..17651c7e3b1 100644
--- a/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts
+++ b/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts
@@ -9,8 +9,8 @@ export class TableDragActionService {
* @param querySpace The isolated query space for this table
* @param injector The hierarchical injector for this table
*/
- constructor(protected querySpace:IsolatedQuerySpace,
- protected injector:Injector) {
+ constructor(readonly querySpace:IsolatedQuerySpace,
+ readonly injector:Injector) {
}
/**
diff --git a/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts b/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts
index 163375367b9..663d9269430 100644
--- a/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts
+++ b/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts
@@ -12,6 +12,7 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {WorkPackagesViewBase} from "core-app/modules/work_packages/routing/wp-view-base/work-packages-view.base";
import {QueryResource} from "core-app/modules/hal/resources/query-resource";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewBase implements AfterViewInit {
@Input('configuration') protected providedConfiguration:WorkPackageTableConfigurationObject;
@@ -25,14 +26,14 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
protected initialized:boolean = false;
- readonly QueryDm:QueryDmService = this.injector.get(QueryDmService);
- readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
- readonly I18n:I18nService = this.injector.get(I18nService);
- readonly urlParamsHelper:UrlParamsHelperService = this.injector.get(UrlParamsHelperService);
- readonly loadingIndicatorService:LoadingIndicatorService = this.injector.get(LoadingIndicatorService);
- readonly wpStatesInitialization:WorkPackageStatesInitializationService = this.injector.get(WorkPackageStatesInitializationService);
- readonly currentProject:CurrentProjectService = this.injector.get(CurrentProjectService);
- readonly cdRef = this.injector.get(ChangeDetectorRef);
+ @InjectField() QueryDm:QueryDmService;
+ @InjectField() querySpace:IsolatedQuerySpace;
+ @InjectField() I18n:I18nService;
+ @InjectField() urlParamsHelper:UrlParamsHelperService;
+ @InjectField() loadingIndicatorService:LoadingIndicatorService;
+ @InjectField() wpStatesInitialization:WorkPackageStatesInitializationService;
+ @InjectField() currentProject:CurrentProjectService;
+ @InjectField() readonly cdRef:ChangeDetectorRef;
ngOnInit() {
super.ngOnInit();
diff --git a/frontend/src/app/components/wp-table/embedded/wp-embedded-table.component.ts b/frontend/src/app/components/wp-table/embedded/wp-embedded-table.component.ts
index b1d203c2235..6310c30b3c6 100644
--- a/frontend/src/app/components/wp-table/embedded/wp-embedded-table.component.ts
+++ b/frontend/src/app/components/wp-table/embedded/wp-embedded-table.component.ts
@@ -12,6 +12,7 @@ import {QueryFormResource} from "core-app/modules/hal/resources/query-form-resou
import {QueryFormDmService} from "core-app/modules/hal/dm-services/query-form-dm.service";
import {distinctUntilChanged, take, withLatestFrom, map} from "rxjs/operators";
import {untilComponentDestroyed} from "ng2-rx-componentdestroyed";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
selector: 'wp-embedded-table',
@@ -29,12 +30,12 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
/** Inform about loaded query */
@Output() public onQueryLoaded = new EventEmitter<QueryResource>();
- readonly QueryDm:QueryDmService = this.injector.get(QueryDmService);
- readonly opModalService:OpModalService = this.injector.get(OpModalService);
- readonly tableActionsService:OpTableActionsService = this.injector.get(OpTableActionsService);
- readonly wpTableTimeline:WorkPackageViewTimelineService = this.injector.get(WorkPackageViewTimelineService);
- readonly wpTablePagination:WorkPackageViewPaginationService = this.injector.get(WorkPackageViewPaginationService);
- readonly QueryFormDm:QueryFormDmService = this.injector.get(QueryFormDmService);
+ @InjectField() QueryDm:QueryDmService;
+ @InjectField() opModalService:OpModalService;
+ @InjectField() tableActionsService:OpTableActionsService;
+ @InjectField() wpTableTimeline:WorkPackageViewTimelineService;
+ @InjectField() wpTablePagination:WorkPackageViewPaginationService;
+ @InjectField() QueryFormDm:QueryFormDmService;
// Cache the form promise
private formPromise:Promise<QueryFormResource>|undefined;
@@ -64,7 +65,7 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
distinctUntilChanged(),
untilComponentDestroyed(this),
withLatestFrom(this.querySpace.query.values$())
- ).subscribe(([_, query]) => {
+ ).subscribe(([_, query]) => {
this.loadingIndicator = this.QueryDm
.loadResults(query, this.wpTablePagination.paginationObject)
.then((query) => this.initializeStates(query));
@@ -101,7 +102,7 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
// Disable compact mode when timeline active
if (this.wpTableTimeline.isVisible) {
- this.configuration = { ...this.configuration, compactTableStyle: false };
+ this.configuration = {...this.configuration, compactTableStyle: false};
}
});
}
@@ -157,7 +158,7 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
.catch((error) => {
this.error = this.I18n.t(
'js.error.embedded_table_loading',
- { message: _.get(error, 'message', error) }
+ {message: _.get(error, 'message', error)}
);
this.onError.emit(error);
});
diff --git a/frontend/src/app/components/wp-table/table-actions/table-action.ts b/frontend/src/app/components/wp-table/table-actions/table-action.ts
index c1945e651d3..9e5e6554b83 100644
--- a/frontend/src/app/components/wp-table/table-actions/table-action.ts
+++ b/frontend/src/app/components/wp-table/table-actions/table-action.ts
@@ -1,6 +1,7 @@
import {Injector} from '@angular/core';
import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource';
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export type OpTableActionFactory = (i:Injector, wp:WorkPackageResource) => OpTableAction;
export const contextMenuTdClassName = 'wp-table--context-menu-td';
@@ -10,7 +11,7 @@ export const contextColumnIcon = 'wp-table-context-menu-icon';
export abstract class OpTableAction {
- public I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() I18n:I18nService;
constructor(readonly injector:Injector,
readonly workPackage:WorkPackageResource) {
diff --git a/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts b/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
index 3eec14036b2..e0de0baa241 100644
--- a/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
+++ b/frontend/src/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
@@ -23,13 +23,14 @@ import {
import {classNameBarLabel, classNameLeftHandle, classNameRightHandle} from './wp-timeline-cell-mouse-handler';
import {WorkPackageTimelineTableController} from '../container/wp-timeline-container.directive';
import {DisplayFieldRenderer} from '../../../wp-edit-form/display-field-renderer';
-import {Injector} from '@angular/core';
+import {Inject, Injector} from '@angular/core';
import {TimezoneService} from 'core-components/datetime/timezone.service';
import {Highlighting} from "core-components/wp-fast-table/builders/highlighting/highlighting.functions";
import {HierarchyRenderPass} from "core-components/wp-fast-table/builders/modes/hierarchy/hierarchy-render-pass";
import Moment = moment.Moment;
import {WorkPackageViewTimelineService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-timeline.service";
import {WorkPackageChangeset} from "core-components/wp-edit/work-package-changeset";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export interface CellDateMovement {
// Target values to move work package to
@@ -39,11 +40,11 @@ export interface CellDateMovement {
date?:moment.Moment;
}
-export type LabelPosition = 'left' | 'right' | 'farRight';
+export type LabelPosition = 'left'|'right'|'farRight';
export class TimelineCellRenderer {
- readonly TimezoneService = this.injector.get(TimezoneService);
- readonly wpTableTimeline:WorkPackageViewTimelineService = this.injector.get(WorkPackageViewTimelineService);
+ @InjectField() wpTableTimeline:WorkPackageViewTimelineService;
+ @InjectField() TimezoneService:TimezoneService;
public fieldRenderer:DisplayFieldRenderer = new DisplayFieldRenderer(this.injector, 'timeline');
protected dateDisplaysOnMouseMove:{ left?:HTMLElement; right?:HTMLElement } = {};
@@ -105,7 +106,7 @@ export class TimelineCellRenderer {
public onDaysMoved(change:WorkPackageChangeset,
dayUnderCursor:Moment,
delta:number,
- direction:'left' | 'right' | 'both' | 'create' | 'dragright'):CellDateMovement {
+ direction:'left'|'right'|'both'|'create'|'dragright'):CellDateMovement {
const initialStartDate = change.pristineResource.startDate;
const initialDueDate = change.pristineResource.dueDate;
@@ -145,10 +146,10 @@ export class TimelineCellRenderer {
}
public onMouseDown(ev:MouseEvent,
- dateForCreate:string | null,
+ dateForCreate:string|null,
renderInfo:RenderInfo,
labels:WorkPackageCellLabels,
- elem:HTMLElement):'left' | 'right' | 'both' | 'dragright' | 'create' {
+ elem:HTMLElement):'left'|'right'|'both'|'dragright'|'create' {
// check for active selection mode
if (renderInfo.viewParams.activeSelectionMode) {
@@ -158,7 +159,7 @@ export class TimelineCellRenderer {
}
const projection = renderInfo.change.projectedResource;
- let direction:'left' | 'right' | 'both' | 'dragright';
+ let direction:'left'|'right'|'both'|'dragright';
// Update the cursor and maybe set start/due values
if (jQuery(ev.target!).hasClass(classNameLeftHandle)) {
@@ -346,7 +347,7 @@ export class TimelineCellRenderer {
// create left hover label
const labelHoverLeft = document.createElement('div');
- labelHoverLeft.classList.add(classNameLeftHoverLabel , classNameShowOnHover, classNameHoverStyle);
+ labelHoverLeft.classList.add(classNameLeftHoverLabel, classNameShowOnHover, classNameHoverStyle);
element.appendChild(labelHoverLeft);
// create right hover label
diff --git a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts
index 53536521aed..8c9d2716f31 100644
--- a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts
+++ b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts
@@ -40,6 +40,7 @@ import {LoadingIndicatorService} from "core-app/modules/common/loading-indicator
import {HalResourceEditingService} from "core-app/modules/fields/edit/services/hal-resource-editing.service";
import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const classNameLeftLabel = 'labelLeft';
export const classNameRightContainer = 'containerRight';
@@ -53,25 +54,25 @@ export const classNameHideOnHover = 'hide-on-hover';
export class WorkPackageCellLabels {
- constructor(public readonly center:HTMLDivElement | null,
+ constructor(public readonly center:HTMLDivElement|null,
public readonly left:HTMLDivElement,
- public readonly leftHover:HTMLDivElement | null,
+ public readonly leftHover:HTMLDivElement|null,
public readonly right:HTMLDivElement,
- public readonly rightHover:HTMLDivElement | null,
+ public readonly rightHover:HTMLDivElement|null,
public readonly farRight:HTMLDivElement) {
}
}
export class WorkPackageTimelineCell {
- readonly wpCacheService:WorkPackageCacheService = this.injector.get(WorkPackageCacheService);
- readonly halEditing:HalResourceEditingService = this.injector.get(HalResourceEditingService);
- readonly halEvents:HalEventsService = this.injector.get(HalEventsService);
- readonly notificationService:WorkPackageNotificationService = this.injector.get(WorkPackageNotificationService);
- readonly states:States = this.injector.get(States);
- readonly loadingIndicator:LoadingIndicatorService = this.injector.get(LoadingIndicatorService);
-
- private wpElement:HTMLDivElement | null = null;
+ @InjectField() wpCacheService:WorkPackageCacheService;
+ @InjectField() halEditing:HalResourceEditingService;
+ @InjectField() halEvents:HalEventsService;
+ @InjectField() notificationService:WorkPackageNotificationService;
+ @InjectField() states:States;
+ @InjectField() loadingIndicator:LoadingIndicatorService;
+
+ private wpElement:HTMLDivElement|null = null;
private elementShape:string;
diff --git a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cells-renderer.ts b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cells-renderer.ts
index b210e58e246..9d7450ecc25 100644
--- a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cells-renderer.ts
+++ b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cells-renderer.ts
@@ -37,12 +37,13 @@ import {WorkPackageTimelineCell} from './wp-timeline-cell';
import {HalResourceEditingService} from "core-app/modules/fields/edit/services/hal-resource-editing.service";
import {RenderedWorkPackage} from "core-app/modules/work_packages/render-info/rendered-work-package.type";
import {WorkPackageChangeset} from "core-components/wp-edit/work-package-changeset";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageTimelineCellsRenderer {
// Injections
- public states = this.injector.get(States);
- public halEditing = this.injector.get(HalResourceEditingService);
+ @InjectField() public states:States;
+ @InjectField() public halEditing:HalResourceEditingService;
public cells:{ [classIdentifier:string]:WorkPackageTimelineCell } = {};
diff --git a/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts b/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
index e388a5a768d..b6f7e1f15ca 100644
--- a/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
+++ b/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
@@ -64,15 +64,13 @@ import {
withLoadingIndicator
} from "core-app/modules/common/loading-indicator/loading-indicator.service";
import {combineLatest} from "rxjs";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
selector: 'wp-timeline-container',
templateUrl: './wp-timeline-container.html'
})
export class WorkPackageTimelineTableController implements AfterViewInit, OnDestroy {
-
- private readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
-
private $element:JQuery;
public workPackageTable:WorkPackageTable;
@@ -91,7 +89,7 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
public timelineBody:JQuery;
- private selectionParams:{ notification:INotification | null } = {
+ private selectionParams:{ notification:INotification|null } = {
notification: null
};
@@ -109,7 +107,7 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
private wpRelations:WorkPackageRelationsService,
private wpTableHierarchies:WorkPackageViewHierarchiesService,
private halEvents:HalEventsService,
- private loadingIndicator:LoadingIndicatorService,
+ private querySpace:IsolatedQuerySpace,
readonly I18n:I18nService) {
}
@@ -262,6 +260,7 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
const nonVisibleDaysLeft = Math.floor(scrollLeft / this.viewParameters.pixelPerDay);
return this.viewParameters.dateDisplayStart.clone().add(nonVisibleDaysLeft, 'days');
}
+
getLastDayInViewport() {
const outerContainer = this.getParentScrollContainer();
const scrollLeft = outerContainer.scrollLeft;
diff --git a/frontend/src/app/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts b/frontend/src/app/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts
index b4900d8738d..b3bf9e37bb3 100644
--- a/frontend/src/app/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts
+++ b/frontend/src/app/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts
@@ -42,6 +42,7 @@ import {WorkPackageTimelineTableController} from '../container/wp-timeline-conta
import {timelineElementCssClass, TimelineViewParameters} from '../wp-timeline';
import {TimelineRelationElement, workPackagePrefix} from './timeline-relation-element';
import {WorkPackageViewTimelineService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-timeline.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
const DEBUG_DRAW_RELATION_LINES_WITH_COLOR = false;
@@ -82,7 +83,7 @@ function newSegment(vp:TimelineViewParameters,
})
export class WorkPackageTableTimelineRelations implements OnInit, OnDestroy {
- private readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
+ @InjectField() querySpace:IsolatedQuerySpace;
private container:JQuery;
@@ -262,10 +263,10 @@ export class WorkPackageTableTimelineRelations implements OnInit, OnDestroy {
const targetX = endCell.getMarginLeftOfLeftSide() + endCell.getPaddingLeftForIncomingRelationLines();
// Vertical direction
- const directionY:'toUp' | 'toDown' = idxFrom < idxTo ? 'toDown' : 'toUp';
+ const directionY:'toUp'|'toDown' = idxFrom < idxTo ? 'toDown' : 'toUp';
// Horizontal direction
- const directionX:'toLeft' | 'beneath' | 'toRight' =
+ const directionX:'toLeft'|'beneath'|'toRight' =
targetX > startX ? 'toRight' : targetX < startX ? 'toLeft' : 'beneath';
// start
diff --git a/frontend/src/app/helpers/angular/inject-field.decorator.ts b/frontend/src/app/helpers/angular/inject-field.decorator.ts
new file mode 100644
index 00000000000..6511062caba
--- /dev/null
+++ b/frontend/src/app/helpers/angular/inject-field.decorator.ts
@@ -0,0 +1,24 @@
+import "reflect-metadata";
+import {Injector} from "@angular/core";
+import {debugLog} from "core-app/helpers/debug_output";
+import {prop} from "@uirouter/core";
+
+export interface InjectableClass {
+ injector:Injector;
+}
+
+export function InjectField() {
+ return (target:InjectableClass, property:string) => {
+ if (delete (target as any)[property]) {
+ Object.defineProperty(target, property, {
+ get: function(this:InjectableClass) {
+ const type = Reflect.getMetadata('design:type', target, property);
+ return this.injector.get<any>(type);
+ },
+ set: function(this:InjectableClass, val:any) {
+ debugLog("Trying to set InjectField property " + property);
+ }
+ });
+ }
+ };
+};
\ No newline at end of file
diff --git a/frontend/src/app/modules/boards/board/board-list/board-inline-create.service.ts b/frontend/src/app/modules/boards/board/board-list/board-inline-create.service.ts
index 1dd96d61e68..b2b4956a1e7 100644
--- a/frontend/src/app/modules/boards/board/board-list/board-inline-create.service.ts
+++ b/frontend/src/app/modules/boards/board/board-list/board-inline-create.service.ts
@@ -39,7 +39,7 @@ import {GonService} from "core-app/modules/common/gon/gon.service";
@Injectable()
export class BoardInlineCreateService extends WorkPackageInlineCreateService implements OnDestroy {
- constructor(protected readonly injector:Injector,
+ constructor(readonly injector:Injector,
protected readonly querySpace:IsolatedQuerySpace,
protected readonly halResourceService:HalResourceService,
protected readonly pathHelperService:PathHelperService,
diff --git a/frontend/src/app/modules/common/back-routing/back-routing.service.ts b/frontend/src/app/modules/common/back-routing/back-routing.service.ts
index d00362cf05c..a0d7563d0a4 100644
--- a/frontend/src/app/modules/common/back-routing/back-routing.service.ts
+++ b/frontend/src/app/modules/common/back-routing/back-routing.service.ts
@@ -30,6 +30,7 @@ import {Injectable, Injector} from '@angular/core';
import {StateService, Transition} from "@uirouter/core";
import {KeepTabService} from "core-components/wp-single-view-tabs/keep-tab/keep-tab.service";
import {TransitionOptions} from "@uirouter/core/lib/transition/interface";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
interface BackRouteOptions {
name:string;
@@ -39,11 +40,12 @@ interface BackRouteOptions {
@Injectable()
export class BackRoutingService {
+ @InjectField() private $state:StateService;
+ @InjectField() private keepTab:KeepTabService;
+
private _backRoute:BackRouteOptions;
- private $state:StateService = this.injector.get(StateService);
- private keepTab:KeepTabService = this.injector.get(KeepTabService);
- constructor(protected injector:Injector) {
+ constructor(readonly injector:Injector) {
}
public goBack(preferListOverSplit:boolean = false) {
@@ -73,8 +75,8 @@ export class BackRoutingService {
fromState.data &&
toState.data &&
fromState.data.parent !== toState.data.parent) {
- const paramsFromCopy = { ...transition.params('from') };
- this.backRoute = { name: fromState.name, params: paramsFromCopy, parent: fromState.data.parent };
+ const paramsFromCopy = {...transition.params('from')};
+ this.backRoute = {name: fromState.name, params: paramsFromCopy, parent: fromState.data.parent};
}
}
diff --git a/frontend/src/app/modules/common/editable-toolbar-title/editable-toolbar-title.component.ts b/frontend/src/app/modules/common/editable-toolbar-title/editable-toolbar-title.component.ts
index d0807c32e5d..3b1b9306a81 100644
--- a/frontend/src/app/modules/common/editable-toolbar-title/editable-toolbar-title.component.ts
+++ b/frontend/src/app/modules/common/editable-toolbar-title/editable-toolbar-title.component.ts
@@ -39,6 +39,7 @@ import {
} from "@angular/core";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {ContainHelpers} from "core-app/modules/common/focus/contain-helpers";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const triggerEditingEvent = 'op:selectableTitle:trigger';
export const selectableTitleIdentifier = 'editable-toolbar-title';
@@ -47,7 +48,7 @@ export const selectableTitleIdentifier = 'editable-toolbar-title';
selector: 'editable-toolbar-title',
templateUrl: './editable-toolbar-title.html',
styleUrls: ['./editable-toolbar-title.sass'],
- host: { 'class': 'title-container' }
+ host: {'class': 'title-container'}
})
export class EditableToolbarTitleComponent implements OnInit, OnChanges {
@Input('title') public inputTitle:string;
@@ -60,13 +61,13 @@ export class EditableToolbarTitleComponent implements OnInit, OnChanges {
@Output() public onSave = new EventEmitter<string>();
@Output() public onEmptySubmit = new EventEmitter<void>();
- @ViewChild('editableTitleInput', { static: false }) inputField?:ElementRef;
+ @ViewChild('editableTitleInput', {static: false}) inputField?:ElementRef;
public selectedTitle:string;
public selectableTitleIdentifier = selectableTitleIdentifier;
- protected readonly elementRef:ElementRef = this.injector.get(ElementRef);
- protected readonly I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() protected readonly elementRef:ElementRef;
+ @InjectField() protected readonly I18n:I18nService;
public text = {
click_to_edit: this.I18n.t('js.work_packages.query.click_to_edit_query_name'),
@@ -79,7 +80,7 @@ export class EditableToolbarTitleComponent implements OnInit, OnChanges {
duplicate_query_title: this.I18n.t('js.work_packages.query.errors.duplicate_query_title')
};
- constructor(protected readonly injector:Injector) {
+ constructor(readonly injector:Injector) {
}
ngOnInit() {
diff --git a/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts b/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts
index 66d93fe1dce..f4879ed7345 100644
--- a/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts
+++ b/frontend/src/app/modules/fields/edit/edit-form/edit-form.component.ts
@@ -61,10 +61,8 @@ export class EditFormComponent extends EditForm<HalResource> implements OnInit,
private registeredFields = input<string[]>();
private unregisterListener:Function;
- constructor(protected readonly injector:Injector,
+ constructor(public readonly injector:Injector,
protected readonly elementRef:ElementRef,
- protected readonly halEditing:HalResourceEditingService,
- protected readonly halNotification:HalResourceNotificationService,
protected readonly $transitions:TransitionService,
protected readonly ConfigurationService:ConfigurationService,
protected readonly editingPortalService:EditingPortalService,
diff --git a/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts b/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts
index 45fa6a19931..99b2bc41616 100644
--- a/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts
+++ b/frontend/src/app/modules/fields/edit/edit-form/edit-form.ts
@@ -26,7 +26,7 @@
// See docs/COPYRIGHT.rdoc for more details.
// ++
-import {Injector} from '@angular/core';
+import {Inject, Injector} from '@angular/core';
import {ErrorResource} from 'core-app/modules/hal/resources/error-resource';
import {Observable, Subscription} from 'rxjs';
import {States} from 'core-components/states.service';
@@ -38,6 +38,7 @@ import {EditFieldHandler} from "core-app/modules/fields/edit/editing-portal/edit
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
import {ResourceChangeset} from "core-app/modules/fields/changeset/resource-changeset";
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const activeFieldContainerClassName = 'inline-edit--active-field';
export const activeFieldClassName = 'inline-edit--field';
@@ -45,10 +46,10 @@ export const activeFieldClassName = 'inline-edit--field';
export abstract class EditForm<T extends HalResource = HalResource> {
// Injections
- protected readonly states:States = this.injector.get(States);
- protected readonly halEditing = this.injector.get(HalResourceEditingService);
- protected readonly halNotification = this.injector.get(HalResourceNotificationService);
- protected readonly halEvents = this.injector.get(HalEventsService);
+ @InjectField() states:States;
+ @InjectField() halEditing:HalResourceEditingService;
+ @InjectField() halNotification:HalResourceNotificationService;
+ @InjectField() halEvents:HalEventsService;
// All current active (open) edit fields
public activeFields:{ [fieldName:string]:EditFieldHandler } = {};
@@ -65,7 +66,7 @@ export abstract class EditForm<T extends HalResource = HalResource> {
// Subscribe to changes to the temporary edit form
protected subscription:Subscription;
- protected constructor(protected injector:Injector) {
+ protected constructor(public injector:Injector) {
}
/**
@@ -88,7 +89,7 @@ export abstract class EditForm<T extends HalResource = HalResource> {
*/
protected onSaved(isInitial:boolean, saved:HalResource):void {
const eventType = isInitial ? 'created' : 'updated';
- this.halEvents.push(saved, { eventType });
+ this.halEvents.push(saved, {eventType});
}
protected abstract focusOnFirstError():void;
diff --git a/frontend/src/app/modules/fields/edit/field-handler/hal-resource-edit-field-handler.ts b/frontend/src/app/modules/fields/edit/field-handler/hal-resource-edit-field-handler.ts
index ccf5022c5cf..0cc7ad943d5 100644
--- a/frontend/src/app/modules/fields/edit/field-handler/hal-resource-edit-field-handler.ts
+++ b/frontend/src/app/modules/fields/edit/field-handler/hal-resource-edit-field-handler.ts
@@ -39,12 +39,13 @@ import {Subject} from 'rxjs';
import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
import {EditForm} from "core-app/modules/fields/edit/edit-form/edit-form";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class HalResourceEditFieldHandler extends EditFieldHandler {
// Injections
- readonly FocusHelper:FocusHelperService = this.injector.get(FocusHelperService);
- readonly ConfigurationService = this.injector.get(ConfigurationService);
- readonly I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() FocusHelper:FocusHelperService;
+ @InjectField() ConfigurationService:ConfigurationService;
+ @InjectField() I18n:I18nService;
// Subject to fire when user demanded activation
public $onUserActivate = new Subject<void>();
@@ -227,8 +228,7 @@ export class HalResourceEditFieldHandler extends EditFieldHandler {
public get errorMessageOnLabel() {
if (!this.isErrorenous) {
return '';
- }
- else {
+ } else {
return this.I18n.t('js.inplace.errors.messages_on_field',
{messages: this.errors.join(' ')});
}
diff --git a/frontend/src/app/modules/fields/edit/field-types/date-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/date-edit-field.component.ts
index 2d7ccf2ef70..05d3d1bd4ae 100644
--- a/frontend/src/app/modules/fields/edit/field-types/date-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/date-edit-field.component.ts
@@ -30,6 +30,7 @@ import {Component} from "@angular/core";
import * as moment from "moment";
import {TimezoneService} from "core-components/datetime/timezone.service";
import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.component";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
template: `
@@ -47,14 +48,14 @@ import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.compon
[attr.required]="required"
[disabled]="inFlight"
[attr.placeholder]="placeholder"
- [id]="handler.htmlId" />
+ [id]="handler.htmlId"/>
</op-date-picker>
`
})
export class DateEditFieldComponent extends EditFieldComponent {
- readonly timezoneService = this.injector.get(TimezoneService);
+ @InjectField() readonly timezoneService:TimezoneService;
public onValueSelected(data:string) {
this.value = this.parser(data);
diff --git a/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts
index 145c5844af0..0034496b46b 100644
--- a/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/duration-edit-field.component.ts
@@ -30,6 +30,7 @@ import {TimezoneService} from 'core-components/datetime/timezone.service';
import * as moment from 'moment';
import {Component} from "@angular/core";
import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.component";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
template: `
@@ -46,7 +47,7 @@ import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.compon
`
})
export class DurationEditFieldComponent extends EditFieldComponent {
- readonly TimezoneService:TimezoneService = this.injector.get(TimezoneService);
+ @InjectField() TimezoneService:TimezoneService;
public parser(value:any) {
if (!isNaN(value)) {
diff --git a/frontend/src/app/modules/fields/edit/field-types/multi-select-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/multi-select-edit-field.component.ts
index 87346355f12..ed62792c484 100644
--- a/frontend/src/app/modules/fields/edit/field-types/multi-select-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/multi-select-edit-field.component.ts
@@ -34,14 +34,15 @@ import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.compon
import {ValueOption} from "core-app/modules/fields/edit/field-types/select-edit-field.component";
import {NgSelectComponent} from "@ng-select/ng-select";
import {untilComponentDestroyed} from "ng2-rx-componentdestroyed";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
templateUrl: './multi-select-edit-field.component.html'
})
export class MultiSelectEditFieldComponent extends EditFieldComponent implements OnInit {
@ViewChild(NgSelectComponent, { static: true }) public ngSelectComponent:NgSelectComponent;
+ @InjectField() I18n:I18nService;
- readonly I18n:I18nService = this.injector.get(I18nService);
public availableOptions:any[] = [];
public valueOptions:ValueOption[];
public text = {
diff --git a/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts
index 7cd7cac820f..fae2c4bb4d4 100644
--- a/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts
@@ -31,15 +31,15 @@ import {Component, OnInit, ViewChild} from "@angular/core";
import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.component";
import {NgSelectComponent} from "@ng-select/ng-select";
import {projectStatusCodeCssClass, projectStatusI18n} from "core-app/modules/fields/helpers/project-status-helper";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
templateUrl: './project-status-edit-field.component.html',
styleUrls: ['./project-status-edit-field.component.sass']
})
export class ProjectStatusEditFieldComponent extends EditFieldComponent implements OnInit {
- @ViewChild(NgSelectComponent, { static: true }) public ngSelectComponent:NgSelectComponent;
-
- readonly I18n:I18nService = this.injector.get(I18nService);
+ @ViewChild(NgSelectComponent, {static: true}) public ngSelectComponent:NgSelectComponent;
+ @InjectField() I18n:I18nService;
private _availableStatusCodes:string[] = ['not set', 'off track', 'at risk', 'on track'];
public currentStatusCode:string = 'not set';
diff --git a/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts
index 0ab0385a5d3..2b6d58ba358 100644
--- a/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/select-edit-field.component.ts
@@ -34,9 +34,10 @@ import {EditFieldComponent} from "../edit-field.component";
import {untilComponentDestroyed} from "ng2-rx-componentdestroyed";
import {CreateAutocompleterComponent} from "core-app/modules/common/autocomplete/create-autocompleter.component";
import {SelectAutocompleterRegisterService} from "app/modules/fields/edit/field-types/select-autocompleter-register.service";
-import { from } from 'rxjs';
-import { tap, map } from 'rxjs/operators';
+import {from} from 'rxjs';
+import {tap, map} from 'rxjs/operators';
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export interface ValueOption {
name:string;
@@ -47,8 +48,9 @@ export interface ValueOption {
templateUrl: './select-edit-field.component.html'
})
export class SelectEditFieldComponent extends EditFieldComponent implements OnInit {
- public selectAutocompleterRegister = this.injector.get(SelectAutocompleterRegisterService);
- public halNotification = this.injector.get(HalResourceNotificationService);
+ @InjectField() selectAutocompleterRegister:SelectAutocompleterRegisterService;
+ @InjectField() halNotification:HalResourceNotificationService;
+ @InjectField() halSorting:HalResourceSortingService;
public availableOptions:any[];
public valueOptions:ValueOption[];
@@ -59,8 +61,6 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnIn
public appendTo:any = null;
private hiddenOverflowContainer = '.__hidden_overflow_container';
- public halSorting:HalResourceSortingService;
-
protected _autocompleterComponent:CreateAutocompleterComponent;
public referenceOutputs:{ [key:string]:Function } = {
@@ -73,7 +73,6 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnIn
};
protected initialize() {
- this.halSorting = this.injector.get(HalResourceSortingService);
this.text = {
requiredPlaceholder: this.I18n.t('js.placeholders.selection'),
placeholder: this.I18n.t('js.placeholders.default')
@@ -160,7 +159,7 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnIn
}
}),
map(collection => {
- if (collection.count === undefined || collection.total === undefined || (!query && collection.total === collection.count) || !this.value) {
+ if (collection.count === undefined || collection.total === undefined || (!query && collection.total === collection.count) || !this.value) {
return collection.elements;
} else {
return collection.elements.concat([this.value]);
diff --git a/frontend/src/app/modules/fields/edit/field-types/te-work-package-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/te-work-package-edit-field.component.ts
index e61b3b3e44a..2de300afd53 100644
--- a/frontend/src/app/modules/fields/edit/field-types/te-work-package-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/te-work-package-edit-field.component.ts
@@ -35,6 +35,7 @@ import {
TimeEntryWorkPackageAutocompleterMode
} from "core-app/modules/common/autocomplete/te-work-package-autocompleter.component";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
const RECENT_TIME_ENTRIES_MAGIC_NUMBER = 30;
@@ -42,7 +43,8 @@ const RECENT_TIME_ENTRIES_MAGIC_NUMBER = 30;
templateUrl: './work-package-edit-field.component.html'
})
export class TimeEntryWorkPackageEditFieldComponent extends WorkPackageEditFieldComponent {
- public timeEntryDm = this.injector.get(TimeEntryDmService);
+ @InjectField() public timeEntryDm:TimeEntryDmService;
+
private recentWorkPackageIds:string[];
protected initialize() {
diff --git a/frontend/src/app/modules/global_search/title/global-search-title.component.ts b/frontend/src/app/modules/global_search/title/global-search-title.component.ts
index 6edac1d6aa6..073a6ac8be2 100644
--- a/frontend/src/app/modules/global_search/title/global-search-title.component.ts
+++ b/frontend/src/app/modules/global_search/title/global-search-title.component.ts
@@ -40,6 +40,7 @@ import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
import {GlobalSearchService} from "core-app/modules/global_search/services/global-search.service";
import {CurrentProjectService} from "core-components/projects/current-project.service";
import {Injector} from "@angular/core";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export const globalSearchTitleSelector = 'global-search-title';
@@ -53,7 +54,7 @@ export class GlobalSearchTitleComponent implements OnDestroy {
@Input() public projectScope:string;
@Input() public searchTitle:string;
- private currentProjectService:CurrentProjectService = this.injector.get(CurrentProjectService);
+ @InjectField() private currentProjectService:CurrentProjectService;
public text:{ [key:string]:string } = {
all_projects: this.I18n.t('js.global_search.title.all_projects'),
@@ -66,26 +67,26 @@ export class GlobalSearchTitleComponent implements OnDestroy {
readonly cdRef:ChangeDetectorRef,
readonly globalSearchService:GlobalSearchService,
readonly I18n:I18nService,
- protected injector:Injector) {
+ readonly injector:Injector) {
}
ngOnInit() {
// Listen on changes of search input value and project scope
combineLatest(
- this.globalSearchService.searchTerm$,
- this.globalSearchService.projectScope$
+ this.globalSearchService.searchTerm$,
+ this.globalSearchService.projectScope$
)
- .pipe(
- distinctUntilChanged(),
- untilComponentDestroyed(this)
- )
- .subscribe(([newSearchTerm, newProjectScope]) => {
- this.searchTerm = newSearchTerm;
- this.project = this.projectText(newProjectScope);
- this.searchTitle = `${this.text.search_for} ${this.searchTerm} ${this.project === '' ? '' : this.text.in} ${this.project}`;
+ .pipe(
+ distinctUntilChanged(),
+ untilComponentDestroyed(this)
+ )
+ .subscribe(([newSearchTerm, newProjectScope]) => {
+ this.searchTerm = newSearchTerm;
+ this.project = this.projectText(newProjectScope);
+ this.searchTitle = `${this.text.search_for} ${this.searchTerm} ${this.project === '' ? '' : this.text.in} ${this.project}`;
- this.cdRef.detectChanges();
- });
+ this.cdRef.detectChanges();
+ });
}
ngOnDestroy() {
diff --git a/frontend/src/app/modules/hal/resources/hal-resource.ts b/frontend/src/app/modules/hal/resources/hal-resource.ts
index 82847b85e97..5ed4fb07727 100644
--- a/frontend/src/app/modules/hal/resources/hal-resource.ts
+++ b/frontend/src/app/modules/hal/resources/hal-resource.ts
@@ -31,6 +31,7 @@ import {HalLinkInterface} from 'core-app/modules/hal/hal-link/hal-link';
import {Injector} from '@angular/core';
import {States} from 'core-components/states.service';
import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export interface HalResourceClass<T extends HalResource = HalResource> {
new(injector:Injector,
@@ -61,8 +62,8 @@ export class HalResource {
// This is required for attributes to be correctly mapped according to their configuration.
public $halType:string;
- protected readonly states:States = this.injector.get(States);
- protected readonly I18n:I18nService = this.injector.get(I18nService);
+ @InjectField() states:States;
+ @InjectField() I18n:I18nService;
/**
* Constructs and initializes the HalResource. For this, the halResoureFactory is required.
@@ -86,7 +87,7 @@ export class HalResource {
this.$initialize($source);
}
- public static getEmptyResource(self:{ href:string | null } = {href: null}):any {
+ public static getEmptyResource(self:{ href:string|null } = {href: null}):any {
return {_links: {self: self}};
}
@@ -131,7 +132,7 @@ export class HalResource {
* - The embedded ID is actually set
* - The self link is terminated by a number.
*/
- public get id():string | null {
+ public get id():string|null {
if (this.$source.id) {
return this.$source.id.toString();
}
@@ -144,7 +145,7 @@ export class HalResource {
return null;
}
- public set id(val:string | null) {
+ public set id(val:string|null) {
this.$source.id = val;
}
@@ -216,18 +217,18 @@ export class HalResource {
/**
* Alias for $href.
*/
- public get href():string | null {
+ public get href():string|null {
return this.$link.href;
}
- public get $href():string | null {
+ public get $href():string|null {
return this.$link.href;
}
/**
* Return the associated state to this HAL resource, if any.
*/
- public get state():InputState<this> | null {
+ public get state():InputState<this>|null {
return null;
}
diff --git a/frontend/src/app/modules/hal/resources/mixins/attachable-mixin.ts b/frontend/src/app/modules/hal/resources/mixins/attachable-mixin.ts
index bd656a5884b..5391017871c 100644
--- a/frontend/src/app/modules/hal/resources/mixins/attachable-mixin.ts
+++ b/frontend/src/app/modules/hal/resources/mixins/attachable-mixin.ts
@@ -130,13 +130,13 @@ export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
* Return an updated AttachmentCollectionResource.
*/
public uploadAttachments(files:UploadFile[]):Promise<{ response:HalResource, uploadUrl:string }[]> {
- const { uploads, finished } = this.performUpload(files);
+ const {uploads, finished} = this.performUpload(files);
const message = I18n.t('js.label_upload_notification');
const notification = this.NotificationsService.addAttachmentUpload(message, uploads);
return finished
- .then((result:{response:HalResource, uploadUrl:string }[]) => {
+ .then((result:{ response:HalResource, uploadUrl:string }[]) => {
setTimeout(() => this.NotificationsService.remove(notification), 700);
this.attachments.count += result.length;
@@ -153,7 +153,7 @@ export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred.
- message = this.I18n.t('js.error_attachment_upload', { error: error });
+ message = this.I18n.t('js.error_attachment_upload', {error: error});
} else if (_.get(error, 'error._type') === 'Error') {
message = error.error.message;
} else {
@@ -185,14 +185,23 @@ export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
}
public $initialize(source:any) {
- this.NotificationsService = this.injector.get(NotificationsService);
- this.halNotification = this.injector.get( HalResourceNotificationService);
- this.opFileUpload = this.injector.get(OpenProjectFileUploadService);
- this.pathHelper = this.injector.get(PathHelperService);
+ if (!this.NotificationsService) {
+ this.NotificationsService = this.injector.get(NotificationsService);
+ }
+ if (!this.halNotification) {
+ this.halNotification = this.injector.get(HalResourceNotificationService);
+ }
+ if (!this.opFileUpload) {
+ this.opFileUpload = this.injector.get(OpenProjectFileUploadService);
+ }
+
+ if (!this.pathHelper) {
+ this.pathHelper = this.injector.get(PathHelperService);
+ }
super.$initialize(source);
- let attachments = this.attachments || { $source: {}, elements: [] };
+ let attachments = this.attachments || {$source: {}, elements: []};
this.attachments = new AttachmentCollectionResource(
this.injector,
attachments,
diff --git a/frontend/src/app/modules/hal/resources/project-resource.ts b/frontend/src/app/modules/hal/resources/project-resource.ts
index f6a5274a00b..913aaa564fb 100644
--- a/frontend/src/app/modules/hal/resources/project-resource.ts
+++ b/frontend/src/app/modules/hal/resources/project-resource.ts
@@ -29,10 +29,10 @@
import {HalResource} from 'core-app/modules/hal/resources/hal-resource';
import {SchemaResource} from "core-app/modules/hal/resources/schema-resource";
import {SchemaCacheService} from "core-components/schemas/schema-cache.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class ProjectResource extends HalResource {
-
- private schemaCacheService = this.injector.get(SchemaCacheService);
+ @InjectField() private schemaCacheService:SchemaCacheService;
public get state() {
return this.states.projects.get(this.id!) as any;
diff --git a/frontend/src/app/modules/hal/resources/time-entry-resource.ts b/frontend/src/app/modules/hal/resources/time-entry-resource.ts
index 023c101994e..7160749bddb 100644
--- a/frontend/src/app/modules/hal/resources/time-entry-resource.ts
+++ b/frontend/src/app/modules/hal/resources/time-entry-resource.ts
@@ -29,11 +29,12 @@
import {HalResource} from 'core-app/modules/hal/resources/hal-resource';
import {SchemaResource} from "core-app/modules/hal/resources/schema-resource";
import {SchemaCacheService} from "core-components/schemas/schema-cache.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class TimeEntryResource extends HalResource {
// TODO: extract the whole overridden Schema stuff into halresource or use the schemaCacheService
// to place it there
- readonly schemaCacheService:SchemaCacheService = this.injector.get(SchemaCacheService);
+ @InjectField() schemaCacheService:SchemaCacheService;
public overriddenSchema:SchemaResource|undefined = undefined;
diff --git a/frontend/src/app/modules/hal/resources/work-package-resource.ts b/frontend/src/app/modules/hal/resources/work-package-resource.ts
index 6540cb927cb..bf006e11f2c 100644
--- a/frontend/src/app/modules/hal/resources/work-package-resource.ts
+++ b/frontend/src/app/modules/hal/resources/work-package-resource.ts
@@ -49,6 +49,7 @@ import {FormResource} from "core-app/modules/hal/resources/form-resource";
import {InputState} from "reactivestates";
import {WorkPackagesActivityService} from "core-components/wp-single-view-tabs/activity-panel/wp-activity.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export interface WorkPackageResourceEmbedded {
activities:CollectionResource;
@@ -125,17 +126,16 @@ export class WorkPackageBaseResource extends HalResource {
public attachments:AttachmentCollectionResource;
public overriddenSchema:SchemaResource|undefined = undefined;
- readonly I18n:I18nService = this.injector.get(I18nService);
- readonly states:States = this.injector.get(States);
- readonly wpActivity = this.injector.get(WorkPackagesActivityService);
- readonly workPackageDmService = this.injector.get(WorkPackageDmService);
- readonly wpCacheService:WorkPackageCacheService = this.injector.get(WorkPackageCacheService);
- readonly schemaCacheService:SchemaCacheService = this.injector.get(SchemaCacheService);
- readonly NotificationsService:NotificationsService = this.injector.get(NotificationsService);
- readonly workPackageNotificationService:WorkPackageNotificationService = this.injector.get(
- WorkPackageNotificationService);
- readonly pathHelper:PathHelperService = this.injector.get(PathHelperService);
- readonly opFileUpload:OpenProjectFileUploadService = this.injector.get(OpenProjectFileUploadService);
+ @InjectField() I18n:I18nService;
+ @InjectField() tates:States;
+ @InjectField() wpActivity:WorkPackagesActivityService;
+ @InjectField() workPackageDmService:WorkPackageDmService;
+ @InjectField() wpCacheService:WorkPackageCacheService;
+ @InjectField() schemaCacheService:SchemaCacheService;
+ @InjectField() NotificationsService:NotificationsService;
+ @InjectField() workPackageNotificationService:WorkPackageNotificationService;
+ @InjectField() pathHelper:PathHelperService;
+ @InjectField() opFileUpload:OpenProjectFileUploadService;
readonly attachmentsBackend = true;
@@ -166,7 +166,7 @@ export class WorkPackageBaseResource extends HalResource {
*/
public subjectWithId(truncateSubject:number = 40):string {
const id = this.isNew ? '' : ` (#${this.id})`;
- const subject = _.truncate(this.subject, { length: truncateSubject });
+ const subject = _.truncate(this.subject, {length: truncateSubject});
return `${subject}${id}`;
}
@@ -290,7 +290,7 @@ export class WorkPackageBaseResource extends HalResource {
public $initialize(source:any) {
super.$initialize(source);
- let attachments:any = this.attachments || { $source: {}, elements: [] };
+ let attachments:any = this.attachments || {$source: {}, elements: []};
this.attachments = new AttachmentCollectionResource(
this.injector,
// Attachments MAY be an array if we're building from a form
@@ -344,7 +344,7 @@ export class WorkPackageBaseResource extends HalResource {
// If there is a parent, its view has to be updated as well
if (newValue.parent) {
- this.wpCacheService.require(newValue.parent.id!, true);
+ this.wpCacheService.require(newValue.parent.id!, true);
}
this.wpCacheService.updateWorkPackage(newValue as any);
diff --git a/frontend/src/app/modules/hal/services/hal-resource-notification.service.ts b/frontend/src/app/modules/hal/services/hal-resource-notification.service.ts
index b61ca1a269e..d0fbc2fd89c 100644
--- a/frontend/src/app/modules/hal/services/hal-resource-notification.service.ts
+++ b/frontend/src/app/modules/hal/services/hal-resource-notification.service.ts
@@ -35,17 +35,18 @@ import {NotificationsService} from 'core-app/modules/common/notifications/notifi
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {HttpErrorResponse} from "@angular/common/http";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Injectable()
export class HalResourceNotificationService {
- protected I18n = this.injector.get(I18nService);
- protected $state = this.injector.get(StateService);
- protected halResourceService = this.injector.get(HalResourceService);
- protected NotificationsService = this.injector.get(NotificationsService);
- protected loadingIndicator = this.injector.get(LoadingIndicatorService);
+ @InjectField() protected I18n:I18nService;
+ @InjectField() protected $state:StateService;
+ @InjectField() protected halResourceService:HalResourceService;
+ @InjectField() protected NotificationsService:NotificationsService;
+ @InjectField() protected loadingIndicator:LoadingIndicatorService;
- constructor(protected injector:Injector) {
+ constructor(public injector:Injector) {
}
public showSave(resource:HalResource, isCreate:boolean = false) {
diff --git a/frontend/src/app/modules/plugins/plugin-context.ts b/frontend/src/app/modules/plugins/plugin-context.ts
index 994a4993974..7083f41face 100644
--- a/frontend/src/app/modules/plugins/plugin-context.ts
+++ b/frontend/src/app/modules/plugins/plugin-context.ts
@@ -25,6 +25,7 @@ import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";
import {States} from 'core-components/states.service';
import {CKEditorPreviewService} from "core-app/modules/common/ckeditor/ckeditor-preview.service";
import {ExternalRelationQueryConfigurationService} from "core-components/wp-table/external-configuration/external-relation-query-configuration.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
/**
* Plugin context bridge for plugins outside the CLI compiler context
@@ -76,7 +77,7 @@ export class OpenProjectPluginContext {
public readonly hooks:{ [hook:string]:(callback:Function) => void } = {};
// Angular zone reference
- public readonly zone:NgZone = this.injector.get(NgZone);
+ @InjectField() public readonly zone:NgZone;
// Angular2 global injector reference
constructor(public readonly injector:Injector) {
diff --git a/frontend/src/app/modules/work_packages/notifications/work-package-notification.service.ts b/frontend/src/app/modules/work_packages/notifications/work-package-notification.service.ts
index 801dbf82c7a..51757c0b904 100644
--- a/frontend/src/app/modules/work_packages/notifications/work-package-notification.service.ts
+++ b/frontend/src/app/modules/work_packages/notifications/work-package-notification.service.ts
@@ -36,8 +36,7 @@ import {WorkPackageCacheService} from "core-components/work-packages/work-packag
@Injectable()
export class WorkPackageNotificationService extends HalResourceNotificationService {
- constructor(protected injector:Injector,
- protected $state:StateService,
+ constructor(readonly injector:Injector,
protected wpCacheService:WorkPackageCacheService) {
super(injector);
}
diff --git a/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.component.ts b/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.component.ts
index fcb475f509c..ad3bef6d11c 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-full-view/wp-full-view.component.ts
@@ -38,6 +38,7 @@ import {KeepTabService} from 'core-components/wp-single-view-tabs/keep-tab/keep-
import {FirstRouteService} from "core-app/modules/router/first-route-service";
import {WorkPackageSingleViewBase} from "core-app/modules/work_packages/routing/wp-view-base/work-package-single-view.base";
import {BackRoutingService} from "core-app/modules/common/back-routing/back-routing.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
templateUrl: './wp-full-view.html',
@@ -46,7 +47,6 @@ import {BackRoutingService} from "core-app/modules/common/back-routing/back-rout
host: { 'class': 'work-packages-page--ui-view' }
})
export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase implements OnInit {
-
// Watcher properties
public isWatched:boolean;
public displayWatchButton:boolean;
@@ -64,14 +64,9 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp
public actionsAvailable:any;
public triggerMoreMenuAction:Function;
- public backRoutingService:BackRoutingService = this.injector.get(BackRoutingService);
-
constructor(public injector:Injector,
- public states:States,
- public firstRoute:FirstRouteService,
- public keepTab:KeepTabService,
public wpTableSelection:WorkPackageViewSelectionService,
- public wpTableFocus:WorkPackageViewFocusService,
+ public backRoutingService:BackRoutingService,
readonly $state:StateService) {
super(injector, $state.params['workPackageId']);
}
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
index d980abf9d87..306a20ee89c 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-list/wp-list.component.ts
@@ -40,6 +40,7 @@ import {WorkPackageTableConfigurationObject} from "core-components/wp-table/wp-t
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
import {scrollHeaderOnMobile} from "core-app/globals/global-listeners/top-menu-scroll";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
@Component({
selector: 'wp-list',
@@ -54,6 +55,9 @@ import {scrollHeaderOnMobile} from "core-app/globals/global-listeners/top-menu-s
]
})
export class WorkPackagesListComponent extends WorkPackagesViewBase implements OnDestroy {
+ @InjectField() titleService:OpTitleService;
+ @InjectField() bcfDetectorService:BcfDetectorService;
+
text = {
'jump_to_pagination': this.I18n.t('js.work_packages.jump_marks.pagination'),
'text_jump_to_pagination': this.I18n.t('js.work_packages.jump_marks.label_pagination'),
@@ -89,8 +93,6 @@ export class WorkPackagesListComponent extends WorkPackagesViewBase implements O
/** Switch between list and card view */
private _showListView:boolean = true;
- private readonly titleService:OpTitleService = this.injector.get(OpTitleService);
- private readonly bcfDetectorService:BcfDetectorService = this.injector.get(BcfDetectorService);
public readonly wpTableConfiguration:WorkPackageTableConfigurationObject = {
dragAndDropEnabled: true
};
diff --git a/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts b/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts
index 842af7902a8..5e29f64c88b 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-view-base/work-package-single-view.base.ts
@@ -43,20 +43,21 @@ import {KeepTabService} from "core-components/wp-single-view-tabs/keep-tab/keep-
import {HalResourceEditingService} from "core-app/modules/fields/edit/services/hal-resource-editing.service";
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export class WorkPackageSingleViewBase implements OnDestroy {
- public wpCacheService:WorkPackageCacheService = this.injector.get(WorkPackageCacheService);
- public states:States = this.injector.get(States);
- public I18n:I18nService = this.injector.get(I18nService);
- public keepTab:KeepTabService = this.injector.get(KeepTabService);
- public PathHelper:PathHelperService = this.injector.get(PathHelperService);
- protected halEditing:HalResourceEditingService = this.injector.get(HalResourceEditingService);
- protected wpTableFocus:WorkPackageViewFocusService = this.injector.get(WorkPackageViewFocusService);
- protected notificationService:WorkPackageNotificationService = this.injector.get(WorkPackageNotificationService);
- protected projectCacheService:ProjectCacheService = this.injector.get(ProjectCacheService);
- protected authorisationService:AuthorisationService = this.injector.get(AuthorisationService);
- protected cdRef:ChangeDetectorRef = this.injector.get(ChangeDetectorRef);
+ @InjectField() wpCacheService:WorkPackageCacheService;
+ @InjectField() states:States;
+ @InjectField() I18n:I18nService;
+ @InjectField() keepTab:KeepTabService;
+ @InjectField() PathHelper:PathHelperService;
+ @InjectField() halEditing:HalResourceEditingService;
+ @InjectField() wpTableFocus:WorkPackageViewFocusService;
+ @InjectField() notificationService:WorkPackageNotificationService;
+ @InjectField() projectCacheService:ProjectCacheService;
+ @InjectField() authorisationService:AuthorisationService;
+ @InjectField() cdRef:ChangeDetectorRef;
// Static texts
public text:any = {};
@@ -68,7 +69,7 @@ export class WorkPackageSingleViewBase implements OnDestroy {
public focusAnchorLabel:string;
public showStaticPagePath:string;
- readonly titleService:OpTitleService = this.injector.get(OpTitleService);
+ @InjectField() readonly titleService:OpTitleService;
constructor(public injector:Injector, protected workPackageId:string) {
this.initializeTexts();
@@ -118,8 +119,8 @@ export class WorkPackageSingleViewBase implements OnDestroy {
this.projectCacheService
.require(this.workPackage.project.idFromLink)
.then(() => {
- this.projectIdentifier = this.workPackage.project.identifier;
- });
+ this.projectIdentifier = this.workPackage.project.identifier;
+ });
// Set authorisation data
this.authorisationService.initModelAuth('work_package', this.workPackage.$links);
diff --git a/frontend/src/app/modules/work_packages/routing/wp-view-base/work-packages-view.base.ts b/frontend/src/app/modules/work_packages/routing/wp-view-base/work-packages-view.base.ts
index 043ae30e391..df0d392b570 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-view-base/work-packages-view.base.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-view-base/work-packages-view.base.ts
@@ -56,38 +56,39 @@ import {HalEvent, HalEventsService} from "core-app/modules/hal/services/hal-even
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
import {DeviceService} from "core-app/modules/common/browser/device.service";
+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
export abstract class WorkPackagesViewBase implements OnInit, OnDestroy {
- readonly $state:StateService = this.injector.get(StateService);
- readonly states:States = this.injector.get(States);
- readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);
- readonly authorisationService:AuthorisationService = this.injector.get(AuthorisationService);
- readonly wpTableColumns:WorkPackageViewColumnsService = this.injector.get(WorkPackageViewColumnsService);
- readonly wpTableHighlighting:WorkPackageViewHighlightingService = this.injector.get(WorkPackageViewHighlightingService);
- readonly wpTableSortBy:WorkPackageViewSortByService = this.injector.get(WorkPackageViewSortByService);
- readonly wpTableGroupBy:WorkPackageViewGroupByService = this.injector.get(WorkPackageViewGroupByService);
- readonly wpTableFilters:WorkPackageViewFiltersService = this.injector.get(WorkPackageViewFiltersService);
- readonly wpTableSum:WorkPackageViewSumService = this.injector.get(WorkPackageViewSumService);
- readonly wpTableTimeline:WorkPackageViewTimelineService = this.injector.get(WorkPackageViewTimelineService);
- readonly wpTableHierarchies:WorkPackageViewHierarchiesService = this.injector.get(WorkPackageViewHierarchiesService);
- readonly wpTablePagination:WorkPackageViewPaginationService = this.injector.get(WorkPackageViewPaginationService);
- readonly wpTableOrder:WorkPackageViewOrderService = this.injector.get(WorkPackageViewOrderService);
- readonly wpListService:WorkPackagesListService = this.injector.get(WorkPackagesListService);
- readonly wpListChecksumService:WorkPackagesListChecksumService = this.injector.get(WorkPackagesListChecksumService);
- readonly loadingIndicatorService:LoadingIndicatorService = this.injector.get(LoadingIndicatorService);
- readonly $transitions:TransitionService = this.injector.get(TransitionService);
- readonly I18n:I18nService = this.injector.get(I18nService);
- readonly wpStaticQueries:WorkPackageStaticQueriesService = this.injector.get(WorkPackageStaticQueriesService);
- readonly QueryDm:QueryDmService = this.injector.get(QueryDmService);
- readonly wpStatesInitialization:WorkPackageStatesInitializationService = this.injector.get(WorkPackageStatesInitializationService);
- readonly cdRef:ChangeDetectorRef = this.injector.get(ChangeDetectorRef);
- readonly wpDisplayRepresentation:WorkPackageViewDisplayRepresentationService = this.injector.get(WorkPackageViewDisplayRepresentationService);
- readonly halEvents:HalEventsService = this.injector.get(HalEventsService);
- readonly deviceService:DeviceService = this.injector.get(DeviceService);
-
-
- constructor(protected injector:Injector) {
+ @InjectField() $state:StateService;
+ @InjectField() states:States;
+ @InjectField() querySpace:IsolatedQuerySpace;
+ @InjectField() authorisationService:AuthorisationService;
+ @InjectField() wpTableColumns:WorkPackageViewColumnsService;
+ @InjectField() wpTableHighlighting:WorkPackageViewHighlightingService;
+ @InjectField() wpTableSortBy:WorkPackageViewSortByService;
+ @InjectField() wpTableGroupBy:WorkPackageViewGroupByService;
+ @InjectField() wpTableFilters:WorkPackageViewFiltersService;
+ @InjectField() wpTableSum:WorkPackageViewSumService;
+ @InjectField() wpTableTimeline:WorkPackageViewTimelineService;
+ @InjectField() wpTableHierarchies:WorkPackageViewHierarchiesService;
+ @InjectField() wpTablePagination:WorkPackageViewPaginationService;
+ @InjectField() wpTableOrder:WorkPackageViewOrderService;
+ @InjectField() wpListService:WorkPackagesListService;
+ @InjectField() wpListChecksumService:WorkPackagesListChecksumService;
+ @InjectField() loadingIndicatorService:LoadingIndicatorService;
+ @InjectField() $transitions:TransitionService;
+ @InjectField() I18n:I18nService;
+ @InjectField() wpStaticQueries:WorkPackageStaticQueriesService;
+ @InjectField() QueryDm:QueryDmService;
+ @InjectField() wpStatesInitialization:WorkPackageStatesInitializationService;
+ @InjectField() cdRef:ChangeDetectorRef;
+ @InjectField() wpDisplayRepresentation:WorkPackageViewDisplayRepresentationService;
+ @InjectField() halEvents:HalEventsService;
+ @InjectField() deviceService:DeviceService;
+
+
+ constructor(public injector:Injector) {
}
ngOnInit() {