diff options
author | 2019-12-04 16:10:34 +0200 | |
---|---|---|
committer | 2019-12-04 16:16:25 +0200 | |
commit | 1df91a571e683fa069a4968954dc7dcc61467145 (patch) | |
tree | 7a95d76ea17d56cf11fa046739f42c7f9289d3ca /vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts | |
parent | 74f309f00ee86d768378573598cb9c338fffbd9f (diff) |
Extract subscriber-name only when it is not defined
This solves the Recreate issue when subscriber-name is already
provided by the template, but Redux is not populated with
`service.subscribers`.
Issue-ID: VID-724
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Change-Id: Id3bfd705015270352aef674d2119fc77838a3ddb
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts')
-rw-r--r-- | vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts index 7923313bf..8228f9531 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.component.ts @@ -180,7 +180,7 @@ export class DrawingBoardHeader { } } - extractOwningEntityNameAccordingtoId(id:String): string { + extractOwningEntityNameAccordingToId(id:String): string { let owningEntityName; _.forEach(this.store.getState().service.categoryParameters.owningEntityList,(owningEntity: OwningEntity) => { if (owningEntity.id === id) { @@ -190,12 +190,20 @@ export class DrawingBoardHeader { return owningEntityName; } + private extractSubscriberNameByGlobalSubscriberId(globalSubscriberId: string) { + return this.store.getState().service.subscribers.find(sub => sub.id === globalSubscriberId).name; + } + extractServiceFields(): any { let instanceFields : ServiceInstance; instanceFields = this.store.getState().service.serviceInstance[this.serviceModelId]; if (instanceFields.action === ServiceInstanceActions.Create) { - instanceFields.subscriberName = this.store.getState().service.subscribers.find(sub => sub.id === instanceFields.globalSubscriberId).name; - instanceFields.owningEntityName = this.extractOwningEntityNameAccordingtoId(instanceFields.owningEntityId); + if(_.isNil(instanceFields.subscriberName)) { + instanceFields.subscriberName = this.extractSubscriberNameByGlobalSubscriberId(instanceFields.globalSubscriberId); + } + if (_.isNil(instanceFields.owningEntityName)) { + instanceFields.owningEntityName = this.extractOwningEntityNameAccordingToId(instanceFields.owningEntityId); + } } return _.omit(instanceFields,['optionalGroupMembersMap', 'upgradedVFMSonsCounter', 'isUpgraded', 'latestAvailableVersion']); } |