use editing service token throughout the application

pull/6346/head
Jens Ulferts 6 years ago committed by Oliver Günther
parent a661ebc873
commit 0d6a1bea0b
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      frontend/src/app/angular4-modules.ts
  2. 5
      frontend/src/app/components/op-context-menu/handlers/wp-create-settings-menu.directive.ts
  3. 3
      frontend/src/app/components/op-context-menu/handlers/wp-status-dropdown-menu.directive.ts
  4. 6
      frontend/src/app/components/routing/wp-view-base/wp-view-base.controller.ts
  5. 3
      frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts
  6. 3
      frontend/src/app/components/wp-buttons/wp-status-button/wp-status-button.component.ts
  7. 1
      frontend/src/app/components/wp-edit-form/work-package-edit-field-handler.ts
  8. 5
      frontend/src/app/components/wp-edit/wp-edit-field/wp-edit-field-group.directive.ts
  9. 3
      frontend/src/app/components/wp-edit/wp-edit-field/wp-edit-field.component.ts
  10. 6
      frontend/src/app/components/wp-fast-table/builders/primary-render-pass.ts
  11. 6
      frontend/src/app/components/wp-fast-table/handlers/cell/edit-cell-handler.ts
  12. 3
      frontend/src/app/components/wp-fast-table/wp-table-editing.ts
  13. 3
      frontend/src/app/components/wp-inline-create/wp-inline-create.component.ts
  14. 8
      frontend/src/app/components/wp-new/wp-create.controller.ts
  15. 5
      frontend/src/app/modules/fields/edit/field-types/select-edit-field.ts

@ -246,7 +246,6 @@ import {OpenProjectFileUploadService} from "core-components/api/op-file-upload/o
WorkPackageRelationsService,
UrlParamsHelperService,
WorkPackageCacheService,
WorkPackageEditingService,
SchemaCacheService,
ProjectCacheService,
UserCacheService,
@ -279,7 +278,6 @@ import {OpenProjectFileUploadService} from "core-components/api/op-file-upload/o
WorkPackageTableSelection,
WorkPackageCreateService,
WorkPackageEditingService,
// Provide both serves with tokens to avoid tight dependency cycles
{ provide: IWorkPackageCreateServiceToken, useClass: WorkPackageCreateService },
{ provide: IWorkPackageEditingServiceToken, useClass: WorkPackageEditingService },

@ -27,11 +27,12 @@
//++
import {OPContextMenuService} from "core-components/op-context-menu/op-context-menu.service";
import {Directive, ElementRef} from "@angular/core";
import {Directive, ElementRef, Inject} from "@angular/core";
import {OpContextMenuTrigger} from "core-components/op-context-menu/handlers/op-context-menu-trigger.directive";
import {WorkPackageEditingService} from "core-components/wp-edit-form/work-package-editing-service";
import {States} from "core-components/states.service";
import {FormResource} from 'core-app/modules/hal/resources/form-resource';
import {IWorkPackageEditingServiceToken} from "../../wp-edit-form/work-package-editing.service.interface";
@Directive({
selector: '[wpCreateSettingsMenu]'
@ -41,7 +42,7 @@ export class WorkPackageCreateSettingsMenuDirective extends OpContextMenuTrigger
constructor(readonly elementRef:ElementRef,
readonly opContextMenu:OPContextMenuService,
readonly states:States,
readonly wpEditing:WorkPackageEditingService) {
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService) {
super(elementRef, opContextMenu);
}

@ -36,6 +36,7 @@ import {WorkPackageNotificationService} from "core-components/wp-edit/wp-notific
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
import {HalResource} from 'core-app/modules/hal/resources/hal-resource';
import {CollectionResource} from 'core-app/modules/hal/resources/collection-resource';
import {IWorkPackageEditingServiceToken} from "../../wp-edit-form/work-package-editing.service.interface";
@Directive({
selector: '[wpStatusDropdown]'
@ -46,8 +47,8 @@ export class WorkPackageStatusDropdownDirective extends OpContextMenuTrigger {
constructor(readonly elementRef:ElementRef,
readonly opContextMenu:OPContextMenuService,
readonly $state:StateService,
protected wpEditing:WorkPackageEditingService,
protected wpNotificationsService:WorkPackageNotificationService,
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService,
protected wpTableRefresh:WorkPackageTableRefreshService) {
super(elementRef, opContextMenu);

@ -41,6 +41,10 @@ import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-r
import {ProjectCacheService} from 'core-components/projects/project-cache.service';
import {OpTitleService} from 'core-components/html/op-title.service';
import {AuthorisationService} from "core-app/modules/common/model-auth/model-auth.service";
import {
IWorkPackageEditingService,
IWorkPackageEditingServiceToken
} from "../../wp-edit-form/work-package-editing.service.interface";
export class WorkPackageViewController implements OnDestroy {
@ -50,7 +54,7 @@ export class WorkPackageViewController implements OnDestroy {
public keepTab:KeepTabService = this.injector.get(KeepTabService);
public PathHelper:PathHelperService = this.injector.get(PathHelperService);
public wpTableRefresh:WorkPackageTableRefreshService = this.injector.get(WorkPackageTableRefreshService);
protected wpEditing:WorkPackageEditingService = this.injector.get(WorkPackageEditingService);
protected wpEditing:IWorkPackageEditingService = this.injector.get(IWorkPackageEditingServiceToken);
protected wpTableFocus:WorkPackageTableFocusService = this.injector.get(WorkPackageTableFocusService);
protected projectCacheService:ProjectCacheService = this.injector.get(ProjectCacheService);
protected authorisationService:AuthorisationService = this.injector.get(AuthorisationService);

@ -41,6 +41,7 @@ import {input} from 'reactivestates';
import {DisplayFieldService} from "core-app/modules/fields/display/display-field.service";
import {DisplayField} from "core-app/modules/fields/display/display-field.module";
import {QueryResource} from "core-app/modules/hal/resources/query-resource";
import {IWorkPackageEditingServiceToken} from "../../wp-edit-form/work-package-editing.service.interface";
export interface FieldDescriptor {
name:string;
@ -113,7 +114,7 @@ export class WorkPackageSingleViewComponent implements OnInit, OnDestroy {
protected currentProject:CurrentProjectService,
protected PathHelper:PathHelperService,
protected states:States,
protected wpEditing:WorkPackageEditingService,
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService,
protected displayFieldService:DisplayFieldService,
protected wpCacheService:WorkPackageCacheService) {
}

@ -30,6 +30,7 @@ import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-r
import {WorkPackageEditingService} from 'core-components/wp-edit-form/work-package-editing-service';
import {Component, Inject, Input} from '@angular/core';
import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
import {IWorkPackageEditingServiceToken} from "../../wp-edit-form/work-package-editing.service.interface";
@Component({
selector: 'wp-status-button',
@ -44,7 +45,7 @@ export class WorkPackageStatusButtonComponent {
};
constructor(readonly I18n:I18nService,
protected wpEditing:WorkPackageEditingService) {
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService) {
}
public isDisabled() {

@ -35,7 +35,6 @@ import {Injector} from '@angular/core';
import {FocusHelperService} from 'core-app/modules/common/focus/focus-helper';
import {EditField} from "core-app/modules/fields/edit/edit.field.module";
import {IEditFieldHandler} from "core-app/modules/fields/edit/editing-portal/edit-field-handler.interface";
import HTML = Mocha.reporters.HTML;
import {ClickPositionMapper} from "core-app/modules/common/set-click-position/set-click-position";
import {debugLog} from "core-app/helpers/debug_output";

@ -26,7 +26,7 @@
// See doc/COPYRIGHT.rdoc for more details.
// ++
import {Component, Injector, Input, OnDestroy, OnInit} from '@angular/core';
import {Component, Inject, Injector, Input, OnDestroy, OnInit} from '@angular/core';
import {StateService, Transition, TransitionService} from '@uirouter/core';
import {ConfigurationService} from 'core-app/modules/common/config/configuration.service';
import {WorkPackageEditFieldComponent} from 'core-components/wp-edit/wp-edit-field/wp-edit-field.component';
@ -43,6 +43,7 @@ import {WorkPackageTableSelection} from '../../wp-fast-table/state/wp-table-sele
import {WorkPackageNotificationService} from '../wp-notification.service';
import {WorkPackageCreateService} from './../../wp-new/wp-create.service';
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {IWorkPackageEditingServiceToken} from "../../wp-edit-form/work-package-editing.service.interface";
@Component({
selector: 'wp-edit-field-group,[wp-edit-field-group]',
@ -61,7 +62,7 @@ export class WorkPackageEditFieldGroupComponent implements OnInit, OnDestroy {
constructor(protected states:States,
protected injector:Injector,
protected wpCreate:WorkPackageCreateService,
protected wpEditing:WorkPackageEditingService,
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService,
protected wpNotificationsService:WorkPackageNotificationService,
protected wpTableSelection:WorkPackageTableSelection,
protected wpTableFocus:WorkPackageTableFocusService,

@ -48,6 +48,7 @@ import {NotificationsService} from 'core-app/modules/common/notifications/notifi
import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
import {IFieldSchema} from "core-app/modules/fields/field.base";
import {ClickPositionMapper} from "core-app/modules/common/set-click-position/set-click-position";
import {IWorkPackageEditingServiceToken} from "../../wp-edit-form/work-package-editing.service.interface";
@Component({
selector: 'wp-edit-field',
@ -74,7 +75,7 @@ export class WorkPackageEditFieldComponent implements OnInit {
protected wpNotificationsService:WorkPackageNotificationService,
protected ConfigurationService:ConfigurationService,
protected opContextMenu:OPContextMenuService,
protected wpEditing:WorkPackageEditingService,
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService,
protected wpCacheService:WorkPackageCacheService,
// Get parent field group from injector
protected wpEditFieldGroup:WorkPackageEditFieldGroupComponent,

@ -8,6 +8,10 @@ import {WorkPackageTable} from '../wp-fast-table';
import {RelationRenderInfo, RelationsRenderPass} from './relations/relations-render-pass';
import {SingleRowBuilder} from './rows/single-row-builder';
import {TimelineRenderPass} from './timeline/timeline-render-pass';
import {
IWorkPackageEditingService,
IWorkPackageEditingServiceToken
} from "../../wp-edit-form/work-package-editing.service.interface";
export type RenderedRowType = 'primary' | 'relations';
@ -33,7 +37,7 @@ export type RenderedRow = { classIdentifier:string, workPackageId:string | null,
export abstract class PrimaryRenderPass {
public wpEditing:WorkPackageEditingService = this.injector.get(WorkPackageEditingService);
public wpEditing:WorkPackageEditingService = this.injector.get<WorkPackageEditingService>(IWorkPackageEditingServiceToken);
public states:States = this.injector.get(States);
public I18n:I18nService = this.injector.get(I18nService);

@ -8,12 +8,16 @@ 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 {
IWorkPackageEditingService,
IWorkPackageEditingServiceToken
} from "../../../wp-edit-form/work-package-editing.service.interface";
export class EditCellHandler extends ClickOrEnterHandler implements TableEventHandler {
// Injections
public states:States = this.injector.get(States);
public wpEditing:WorkPackageEditingService = this.injector.get(WorkPackageEditingService);
public wpEditing:WorkPackageEditingService = this.injector.get<WorkPackageEditingService>(IWorkPackageEditingServiceToken);
// Keep a reference to all

@ -5,10 +5,11 @@ import {TableRowEditContext} from '../wp-edit-form/table-row-edit-context';
import {WorkPackageEditForm} from '../wp-edit-form/work-package-edit-form';
import {WorkPackageEditingService} from '../wp-edit-form/work-package-editing-service';
import {WorkPackageTable} from 'core-components/wp-fast-table/wp-fast-table';
import {IWorkPackageEditingServiceToken} from "../wp-edit-form/work-package-editing.service.interface";
export class WorkPackageTableEditingContext {
public wpEditing:WorkPackageEditingService = this.injector.get(WorkPackageEditingService);
public wpEditing:WorkPackageEditingService = this.injector.get<WorkPackageEditingService>(IWorkPackageEditingServiceToken);
constructor(readonly table:WorkPackageTable,
readonly injector:Injector) {

@ -61,6 +61,7 @@ import {TableState} from 'core-components/wp-table/table-state/table-state';
import {componentDestroyed} from 'ng2-rx-componentdestroyed';
import {I18nService} from 'core-app/modules/common/i18n/i18n.service';
import {FocusHelperService} from 'core-app/modules/common/focus/focus-helper';
import {IWorkPackageEditingServiceToken} from "../wp-edit-form/work-package-editing.service.interface";
@Component({
selector: '[wpInlineCreate]',
@ -97,7 +98,7 @@ export class WorkPackageInlineCreateComponent implements OnInit, OnChanges, OnDe
readonly I18n:I18nService,
readonly tableState:TableState,
readonly wpCacheService:WorkPackageCacheService,
readonly wpEditing:WorkPackageEditingService,
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService,
readonly wpCreate:WorkPackageCreateService,
readonly wpTableColumns:WorkPackageTableColumnsService,
readonly wpTableFilters:WorkPackageTableFiltersService,

@ -26,7 +26,7 @@
// See doc/COPYRIGHT.rdoc for more details.
// ++
import {Injectable, OnDestroy, OnInit} from '@angular/core';
import {Inject, Injectable, Injector, OnDestroy, OnInit} from '@angular/core';
import {StateService, Transition} from '@uirouter/core';
import {PathHelperService} from 'core-app/modules/common/path-helper/path-helper.service';
import {componentDestroyed} from 'ng2-rx-componentdestroyed';
@ -44,6 +44,9 @@ import {takeUntil} from 'rxjs/operators';
import {RootDmService} from 'core-app/modules/hal/dm-services/root-dm.service';
import {OpTitleService} from 'core-components/html/op-title.service';
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {
IWorkPackageEditingServiceToken
} from "../wp-edit-form/work-package-editing.service.interface";
@Injectable()
@ -52,6 +55,7 @@ export class WorkPackageCreateController implements OnInit, OnDestroy {
public newWorkPackage:WorkPackageResource;
public parentWorkPackage:WorkPackageResource;
public changeset:WorkPackageChangeset;
protected wpEditing:WorkPackageEditingService = this.injector.get<WorkPackageEditingService>(IWorkPackageEditingServiceToken);
public stateParams = this.$transition.params('to');
public text = {
@ -62,10 +66,10 @@ export class WorkPackageCreateController implements OnInit, OnDestroy {
readonly $state:StateService,
readonly I18n:I18nService,
readonly titleService:OpTitleService,
readonly injector:Injector,
protected wpNotificationsService:WorkPackageNotificationService,
protected states:States,
protected wpCreate:WorkPackageCreateService,
protected wpEditing:WorkPackageEditingService,
protected wpTableFilters:WorkPackageTableFiltersService,
protected wpCacheService:WorkPackageCacheService,
protected pathHelper:PathHelperService,

@ -27,11 +27,14 @@
// ++
import {Component} from "@angular/core";
import {EditFieldComponent} from "core-app/modules/fields/edit/edit-field.component";
import {HalResourceSortingService} from "core-app/modules/hal/services/hal-resource-sorting.service";
import {CollectionResource} from "core-app/modules/hal/resources/collection-resource";
import {HalResource} from "core-app/modules/hal/resources/hal-resource";
import {EditField} from "core-app/modules/fields/edit/edit.field.module";
import {WorkPackageEditingService} from "../../../../components/wp-edit-form/work-package-editing-service";
import {componentDestroyed} from "ng2-rx-componentdestroyed";
import {takeUntil} from "rxjs/internal/operators";
import {EditFieldComponent} from "../edit-field.component";
export interface ValueOption {
name:string;

Loading…
Cancel
Save