From 700ac8a7ec822f1b7a0505319e4c453ca045d2ed Mon Sep 17 00:00:00 2001 From: Liu Date: Mon, 27 Jan 2020 10:59:12 +0800 Subject: add new action configscalein for cdt Change-Id: I2f05079b7c2428351332ac84c1ea56f31d4a38d9 Issue-ID: APPC-1760 Signed-off-by: Taka Cho --- src/app/shared/pipes/vm-filtering.pipe.spec.ts | 10 ++++++++++ src/app/shared/pipes/vm-filtering.pipe.ts | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/app/shared') diff --git a/src/app/shared/pipes/vm-filtering.pipe.spec.ts b/src/app/shared/pipes/vm-filtering.pipe.spec.ts index 9c544cb..08df4de 100644 --- a/src/app/shared/pipes/vm-filtering.pipe.spec.ts +++ b/src/app/shared/pipes/vm-filtering.pipe.spec.ts @@ -37,6 +37,16 @@ describe('VmFilteringPipe', () => { ] expect(pipe.transform(objArray,"ConfigScaleOut",1, {})[0].type,).toBe("conScale") + }); + it('should return configscalein values if template id matches',()=>{ + const pipe = new VmFilteringPipe(); + + let objArray = [ + {action:"Configure","template-id":2,"type":"con"}, + {action:"ConfigScaleIn","template-id":1,"type":"conScale"} + ] + expect(pipe.transform(objArray,"ConfigScaleIn",1, {})[0].type,).toBe("conScale") + }); it('should return configure calues',()=>{ const pipe = new VmFilteringPipe(); diff --git a/src/app/shared/pipes/vm-filtering.pipe.ts b/src/app/shared/pipes/vm-filtering.pipe.ts index 6da7840..4c49eb3 100644 --- a/src/app/shared/pipes/vm-filtering.pipe.ts +++ b/src/app/shared/pipes/vm-filtering.pipe.ts @@ -25,12 +25,12 @@ export class VmFilteringPipe implements PipeTransform { transform(value: any, action: any, templateId, newVnfc): any { let filterValue - if(action == 'ConfigScaleOut'){ + if(action == 'ConfigScaleOut' || action == 'ConfigScaleIn'){ filterValue= templateId } else if(action == 'Configure' || action == 'ConfigModify' || action == 'DistributeTraffic' || action == 'DistributeTrafficCheck'){ filterValue= newVnfc } - if (action == 'ConfigScaleOut') { + if (action == 'ConfigScaleOut' || action == 'ConfigScaleIn') { let x = value.filter(obj => { //return value return obj['template-id'] == filterValue; -- cgit 1.2.3-korg