diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-12-05 08:11:42 +0200 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-12-05 08:28:04 +0200 |
commit | 7cdf685b0b8726e9ee2233d189692dbeb7e434f5 (patch) | |
tree | da3b454ea0421df9f71edca988204ef907fa0da6 /vid-webpack-master/src/app/instantiationStatus | |
parent | 3aa4e38c1b2a69ea84bfad991ac9af09f2b0bb20 (diff) |
support build recreate url in instantiationStatus service
Issue-ID: VID-724
Change-Id: I95891a7b2e9e16bd123408d3451df38a89796714
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/instantiationStatus')
2 files changed, 61 insertions, 44 deletions
diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts index 27d3f419b..a5e6fab89 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts @@ -1,16 +1,5 @@ import {getTestBed, TestBed} from '@angular/core/testing'; -import { - COMPLETED_WITH_ERRORS, - INPROGRESS, - InstantiationStatusComponentService, - PAUSE, - PENDING, - ServiceStatus, - STOPPED, - SUCCESS_CIRCLE, - UNKNOWN, - X_O -} from './instantiationStatus.component.service'; +import {COMPLETED_WITH_ERRORS, INPROGRESS, InstantiationStatusComponentService, PAUSE, PENDING, ServiceStatus, STOPPED, SUCCESS_CIRCLE, UNKNOWN, X_O} from './instantiationStatus.component.service'; import {ServiceInfoModel} from '../shared/server/serviceInfo/serviceInfo.model'; import {AaiService} from "../shared/services/aaiService/aai.service"; import {MsoService} from "../shared/services/msoService/mso.service"; @@ -101,33 +90,48 @@ describe('Instantiation Status Service', () => { }); }); - test('click on "Open" button should open new view edit' , ()=>{ - const item = { - serviceModelId : 'serviceModelId', - serviceInstanceId : 'serviceInstanceId', - serviceType : 'serviceType', - subscriberId : 'subscriberId' - }; - let params:UrlTree = service.getNewViewEditUrlTree(<any>item, DrawingBoardModes.VIEW); - expect(params.toString().startsWith('/servicePlanning/VIEW')).toBeTruthy(); - expect(params.queryParams).toEqual( - { - serviceModelId: item.serviceModelId, - serviceInstanceId: item.serviceInstanceId, - serviceType : item.serviceType, - subscriberId : item.subscriberId - }); - }); + describe('navigations tests:', () => { - test('build the View Edit url' , ()=>{ const item = { - serviceModelId : '28aeb8f6-5620-4148-8bfb-a5fb406f0309', + serviceModelId: '28aeb8f6-5620-4148-8bfb-a5fb406f0309', + serviceInstanceId: 'myInstanceId', + serviceType: 'myService', + subscriberId: 'mySubscriber', + jobId: 'aJobId' }; - let serviceModelUrl: string = '/servicePlanning/EDIT?serviceModelId=28aeb8f6-5620-4148-8bfb-a5fb406f0309'; - let suffix:string = '../../serviceModels.htm#'; - let tree:UrlTree = service.getNewViewEditUrlTree(<any>item, DrawingBoardModes.EDIT); - let result = service.getViewEditUrl(tree); - expect (suffix + serviceModelUrl).toEqual(result); + + test('click on "Open" button should open new view edit', () => { + let params: UrlTree = service.getNewViewEditUrlTree(<any>item, DrawingBoardModes.VIEW); + expect(params.toString().startsWith('/servicePlanning/VIEW')).toBeTruthy(); + expect(params.queryParams).toEqual( + { + serviceModelId: item.serviceModelId, + serviceInstanceId: item.serviceInstanceId, + serviceType: item.serviceType, + subscriberId: item.subscriberId, + jobId: item.jobId + }); + }); + + test('build the View Edit url', () => { + + let serviceModelUrl: string = '/servicePlanning/EDIT?serviceModelId=28aeb8f6-5620-4148-8bfb-a5fb406f0309' + + '&serviceInstanceId=myInstanceId&serviceType=myService&subscriberId=mySubscriber&jobId=aJobId'; + let prefix: string = '../../serviceModels.htm#'; + let tree: UrlTree = service.getNewViewEditUrlTree(<any>item, DrawingBoardModes.EDIT); + let result = service.getViewEditUrl(tree); + expect(result).toEqual(prefix + serviceModelUrl); + }); + + test('recreate url shall contains mode RECREATE and only jobId and serviceModelId', () =>{ + let params: UrlTree = service.getNewViewEditUrlTree(<any>item, DrawingBoardModes.RECREATE); + expect(params.toString().startsWith('/servicePlanning/RECREATE')).toBeTruthy(); + expect(params.queryParams).toEqual( + { + serviceModelId: item.serviceModelId, + jobId: item.jobId + }); + }); }); for (let [status, tooltip] of Object.entries({ diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts index ffc2e681a..6848a9948 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts @@ -122,19 +122,31 @@ export class InstantiationStatusComponentService { ['/servicePlanning/' + mode], { queryParams: - { - serviceModelId: item.serviceModelId, - serviceInstanceId: item.serviceInstanceId, - serviceType : item.serviceType, - subscriberId : item.subscriberId, - jobId: item.jobId - } + mode==DrawingBoardModes.RECREATE ? + this.getRecreateQueryParams(item) : + this.getDefaultViewEditQueryParams(item) }); } + private getDefaultViewEditQueryParams(item: ServiceInfoModel) { + return { + serviceModelId: item.serviceModelId, + serviceInstanceId: item.serviceInstanceId, + serviceType: item.serviceType, + subscriberId: item.subscriberId, + jobId: item.jobId + }; + } + + private getRecreateQueryParams(item: ServiceInfoModel) { + return { + serviceModelId: item.serviceModelId, + jobId: item.jobId + }; + } + getViewEditUrl(viewEditUrlTree:UrlTree): string { return '../../serviceModels.htm#' + viewEditUrlTree.toString(); - } getStatus(status : string) : ServiceStatus { @@ -162,6 +174,7 @@ export class InstantiationStatusComponentService { retry(item: ServiceInfoModel): void { this.navigateToNewViewEdit(item, DrawingBoardModes.RETRY_EDIT); } + } |