|
|
|
@ -28,7 +28,7 @@ |
|
|
|
|
|
|
|
|
|
import {Transition} from '@uirouter/core'; |
|
|
|
|
import {WorkPackageCacheService} from 'core-components/work-packages/work-package-cache.service'; |
|
|
|
|
import {Component, Inject, OnDestroy} from '@angular/core'; |
|
|
|
|
import {Component, Inject, Input, OnDestroy} from '@angular/core'; |
|
|
|
|
import {I18nToken} from '../../../angular4-transition-utils'; |
|
|
|
|
import {WorkPackageResourceInterface} from 'core-components/api/api-v3/hal-resources/work-package-resource.service'; |
|
|
|
|
import {componentDestroyed} from 'ng2-rx-componentdestroyed'; |
|
|
|
@ -38,18 +38,21 @@ import {componentDestroyed} from 'ng2-rx-componentdestroyed'; |
|
|
|
|
selector: 'wp-relations-tab', |
|
|
|
|
}) |
|
|
|
|
export class WorkPackageRelationsTabComponent implements OnDestroy { |
|
|
|
|
public workPackageId:string; |
|
|
|
|
@Input() public workPackageId?:string; |
|
|
|
|
public workPackage:WorkPackageResourceInterface; |
|
|
|
|
|
|
|
|
|
public constructor(@Inject(I18nToken) readonly I18n:op.I18n, |
|
|
|
|
readonly $transition:Transition, |
|
|
|
|
readonly wpCacheService:WorkPackageCacheService) { |
|
|
|
|
|
|
|
|
|
this.workPackageId = this.$transition.params('to').workPackageId; |
|
|
|
|
wpCacheService.loadWorkPackage(this.workPackageId) |
|
|
|
|
const wpId = this.workPackageId || this.$transition.params('to').workPackageId; |
|
|
|
|
wpCacheService.loadWorkPackage(wpId) |
|
|
|
|
.values$() |
|
|
|
|
.takeUntil(componentDestroyed(this)) |
|
|
|
|
.subscribe((wp) => this.workPackage = wp); |
|
|
|
|
.subscribe((wp) => { |
|
|
|
|
this.workPackageId = wp.id; |
|
|
|
|
this.workPackage = wp; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|