|
|
|
@ -26,8 +26,7 @@ |
|
|
|
|
// See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
|
// ++
|
|
|
|
|
|
|
|
|
|
import {Injectable, Injector, Inject} from '@angular/core'; |
|
|
|
|
import {ApiWorkPackagesService} from '../api/api-work-packages/api-work-packages.service'; |
|
|
|
|
import {Inject, Injectable, Injector} from '@angular/core'; |
|
|
|
|
import {HalResource} from 'core-app/modules/hal/resources/hal-resource'; |
|
|
|
|
import {WorkPackageCacheService} from '../work-packages/work-package-cache.service'; |
|
|
|
|
import {Observable, Subject} from 'rxjs'; |
|
|
|
@ -39,8 +38,8 @@ import {HookService} from 'core-app/modules/plugins/hook-service'; |
|
|
|
|
import {WorkPackageFilterValues} from "core-components/wp-edit-form/work-package-filter-values"; |
|
|
|
|
import {IWorkPackageEditingServiceToken} from "core-components/wp-edit-form/work-package-editing.service.interface"; |
|
|
|
|
import {WorkPackageEditingService} from "core-components/wp-edit-form/work-package-editing-service"; |
|
|
|
|
import {WorkPackageTableFiltersService} from "core-components/wp-fast-table/state/wp-table-filters.service"; |
|
|
|
|
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space"; |
|
|
|
|
import {WorkPackageDmService} from "core-app/modules/hal/dm-services/work-package-dm.service"; |
|
|
|
|
|
|
|
|
|
@Injectable() |
|
|
|
|
export class WorkPackageCreateService implements IWorkPackageCreateService { |
|
|
|
@ -55,7 +54,7 @@ export class WorkPackageCreateService implements IWorkPackageCreateService { |
|
|
|
|
protected halResourceService:HalResourceService, |
|
|
|
|
@Inject(IWorkPackageEditingServiceToken) protected readonly wpEditing:WorkPackageEditingService, |
|
|
|
|
protected readonly querySpace:IsolatedQuerySpace, |
|
|
|
|
protected apiWorkPackages:ApiWorkPackagesService) { |
|
|
|
|
protected workPackageDmService:WorkPackageDmService) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public newWorkPackageCreated(wp:WorkPackageResource) { |
|
|
|
@ -74,7 +73,7 @@ export class WorkPackageCreateService implements IWorkPackageCreateService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public createNewTypedWorkPackage(projectIdentifier:string|undefined|null, type:number) { |
|
|
|
|
return this.apiWorkPackages.typedCreateForm(type, projectIdentifier).then(form => { |
|
|
|
|
return this.workPackageDmService.typedCreateForm(type, projectIdentifier).then(form => { |
|
|
|
|
return this.fromCreateForm(form); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -110,14 +109,14 @@ export class WorkPackageCreateService implements IWorkPackageCreateService { |
|
|
|
|
public copyWorkPackage(copyFromForm:any, projectIdentifier?:string) { |
|
|
|
|
let request = copyFromForm.payload.$source; |
|
|
|
|
|
|
|
|
|
return this.apiWorkPackages.emptyCreateForm(request, projectIdentifier).then(form => { |
|
|
|
|
return this.workPackageDmService.emptyCreateForm(request, projectIdentifier).then(form => { |
|
|
|
|
return this.copyFrom(copyFromForm, form); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public getEmptyForm(projectIdentifier:string|null|undefined):Promise<HalResource> { |
|
|
|
|
if (!this.form) { |
|
|
|
|
this.form = this.apiWorkPackages.emptyCreateForm({}, projectIdentifier); |
|
|
|
|
this.form = this.workPackageDmService.emptyCreateForm({}, projectIdentifier); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return this.form; |
|
|
|
|