Fix closing split-view when saving through inline-create

pull/6346/head
Oliver Günther 6 years ago
parent ac85c0df2b
commit a0c06ddc57
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 1
      frontend/src/app/angular4-modules.ts
  2. 5
      frontend/src/app/components/op-context-menu/handlers/op-types-context-menu.directive.ts
  3. 15
      frontend/src/app/components/wp-edit/wp-edit-field/wp-edit-field-group.directive.ts
  4. 3
      frontend/src/app/components/wp-new/wp-create.controller.ts
  5. 3
      frontend/src/app/modules/hal/resources/work-package-resource.ts

@ -280,7 +280,6 @@ import {WorkPackageEmbeddedTableEntryComponent} from "core-components/wp-table/e
WorkPackageTableFocusService,
WorkPackageTableSelection,
WorkPackageCreateService,
// Provide both serves with tokens to avoid tight dependency cycles
{ provide: IWorkPackageCreateServiceToken, useClass: WorkPackageCreateService },
{ provide: IWorkPackageEditingServiceToken, useClass: WorkPackageEditingService },

@ -29,11 +29,12 @@
import {WorkPackageCreateService} from '../../wp-new/wp-create.service';
import {StateService} from '@uirouter/core';
import {OPContextMenuService} from "core-components/op-context-menu/op-context-menu.service";
import {Directive, ElementRef, Input} from "@angular/core";
import {Directive, ElementRef, Inject, Input} from "@angular/core";
import {LinkHandling} from "core-app/modules/common/link-handling/link-handling";
import {OpContextMenuTrigger} from "core-components/op-context-menu/handlers/op-context-menu-trigger.directive";
import {TypeResource} from 'core-app/modules/hal/resources/type-resource';
import {CollectionResource} from 'core-app/modules/hal/resources/collection-resource';
import {IWorkPackageCreateServiceToken} from "core-components/wp-new/wp-create.service.interface";
@Directive({
selector: '[opTypesCreateDropdown]'
@ -47,7 +48,7 @@ export class OpTypesContextMenuDirective extends OpContextMenuTrigger {
constructor(readonly elementRef:ElementRef,
readonly opContextMenu:OPContextMenuService,
readonly $state:StateService,
protected wpCreate:WorkPackageCreateService) {
@Inject(IWorkPackageCreateServiceToken) protected wpCreate:WorkPackageCreateService) {
super(elementRef, opContextMenu);
}

@ -44,6 +44,7 @@ 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";
import {IWorkPackageCreateServiceToken} from "core-components/wp-new/wp-create.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,
@Inject(IWorkPackageCreateServiceToken) protected wpCreate:WorkPackageCreateService,
@Inject(IWorkPackageEditingServiceToken) protected wpEditing:WorkPackageEditingService,
protected wpNotificationsService:WorkPackageNotificationService,
protected wpTableSelection:WorkPackageTableSelection,
@ -117,6 +118,18 @@ export class WorkPackageEditFieldGroupComponent implements OnInit, OnDestroy {
if (this.inEditMode) {
this.start();
}
// Stop editing whenever a work package was saved
if (this.inEditMode && this.workPackage.isNew) {
this.wpCreate.onNewWorkPackage()
.pipe(
takeUntil(componentDestroyed(this))
)
.subscribe((wp:WorkPackageResource) => {
this.form.editMode = false;
this.stopEditingAndLeave(wp, true);
});
}
}
public get editMode() {

@ -47,6 +47,7 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {
IWorkPackageEditingServiceToken
} from "../wp-edit-form/work-package-editing.service.interface";
import {IWorkPackageCreateServiceToken} from "core-components/wp-new/wp-create.service.interface";
@Injectable()
@ -69,7 +70,7 @@ export class WorkPackageCreateController implements OnInit, OnDestroy {
readonly injector:Injector,
protected wpNotificationsService:WorkPackageNotificationService,
protected states:States,
protected wpCreate:WorkPackageCreateService,
@Inject(IWorkPackageCreateServiceToken) protected wpCreate:WorkPackageCreateService,
protected wpTableFilters:WorkPackageTableFiltersService,
protected wpCacheService:WorkPackageCacheService,
protected pathHelper:PathHelperService,

@ -46,6 +46,7 @@ import {WorkPackageNotificationService} from 'core-components/wp-edit/wp-notific
import {WorkPackageCreateService} from 'core-components/wp-new/wp-create.service';
import {PathHelperService} from 'core-app/modules/common/path-helper/path-helper.service';
import {NotificationsService} from 'core-app/modules/common/notifications/notifications.service';
import {IWorkPackageCreateServiceToken} from "core-components/wp-new/wp-create.service.interface";
interface WorkPackageResourceEmbedded {
activities:CollectionResource;
@ -131,7 +132,7 @@ export class WorkPackageResource extends HalResource {
readonly NotificationsService:NotificationsService = this.injector.get(NotificationsService);
readonly wpNotificationsService:WorkPackageNotificationService = this.injector.get(
WorkPackageNotificationService);
readonly wpCreate:WorkPackageCreateService = this.injector.get(WorkPackageCreateService);
readonly wpCreate:WorkPackageCreateService = this.injector.get<WorkPackageCreateService>(IWorkPackageCreateServiceToken);
readonly pathHelper:PathHelperService = this.injector.get(PathHelperService);
readonly opFileUpload:OpenProjectFileUploadService = this.injector.get(OpenProjectFileUploadService);

Loading…
Cancel
Save