diff options
author | Kruthi Bhat <krutbhat@att.com> | 2020-11-05 17:51:25 +0530 |
---|---|---|
committer | Rachitha Ramappa <rachitha.ramappa@att.com> | 2020-11-10 12:01:02 +0530 |
commit | 7ac7c4e9d8df491fe1aca6782103592181ef6969 (patch) | |
tree | 82862e20fb4ab5ece720c7c6d1a47f89c5303a99 /vid-webpack-master | |
parent | 545da32aba372bedd1f338ca00ce04dcd93536cf (diff) |
Fix for removing 'Show Audit Info' for individual instance on Drawing
Board
Issue-ID: VID-917
Change-Id: Ice4bde260e9b2f09fe4178fc704e89efdf6c1da8
Signed-off-by: rachitha.ramappa@att.com
Diffstat (limited to 'vid-webpack-master')
7 files changed, 95 insertions, 38 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts index cd7844ad1..15bde5ceb 100644 --- a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts @@ -128,6 +128,7 @@ function getExpectedResult() { { "requestId": "1fc2ef3b-26f0-4e62-a00a-6a31502d39e2", "instanceName": "zrdm54cfmgw01_sup_1", + "instanceId":"5fd7eb77-34c6-4cb9-adf7-03297d85e7ed", "modelType": "vfModule", "instanceType": "createInstance", "startTime": "Mon, 24 Aug 2020 22:54:29 GMT", @@ -138,6 +139,7 @@ function getExpectedResult() { { "requestId": "a4e43d9e-4813-42e4-94bf-c5c6f22ed0bc", "instanceName": "zrdm54cfmgw01_base", + "instanceId":"5fd7eb77-34c6-4cb9-adf7-03297d85e9cc", "modelType": "vfModule", "instanceType": "createInstance", "startTime": "Mon, 24 Aug 2020 22:44:42 GMT", @@ -148,6 +150,7 @@ function getExpectedResult() { { "requestId": "f1aa7175-c237-4b56-ba64-7cb728a38ff2", "instanceName": "zrdm54cfmgw01", + "instanceId":"f5c72b2c-8e32-43db-9c42-f2b7901c69d8", "modelType": "vnf", "instanceType": "createInstance", "startTime": "Mon, 24 Aug 2020 22:38:18 GMT", @@ -158,6 +161,7 @@ function getExpectedResult() { { "requestId": "7ba7900c-3e51-4d87-b1b4-3c53bdfaaa7d", "instanceName": "zrdm54cfmgw01_svc", + "instanceId":"de46c407-9f9b-4f2f-b1c3-be1c6599b957", "modelType": "service", "instanceType": "createInstance", "startTime": "Mon, 24 Aug 2020 22:37:53 GMT", diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditAddNewInstace.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditAddNewInstace.e2e.ts index d4fea70fe..d07d3cc9f 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewEditAddNewInstace.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewEditAddNewInstace.e2e.ts @@ -112,6 +112,39 @@ describe('View Edit page: Add a second instance', () =>{ }); + it(`Open Audit info modal for the service instance, verify show audit info is not available for individual instance`, () =>{ + const serviceType = 'Mobility'; + const subscriberId = 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb'; + const serviceModelId = '82255513-e19f-46e5-bdfb-957c6bf57b82'; + const serviceInstanceId = 'e6cc1c4f-05f7-49bc-8e86-ac2eb92baaaa'; + + cy.initDrawingBoardUserPermission(); + cy.route(`**/rest/models/services/${serviceModelId}`, + 'fixture:../support/jsonBuilders/mocks/jsons/add_vnf/add_vnf_model.json') + .as('serviceModelAddVnf'); + + cy.route(`**/aai_get_service_instance_topology/${subscriberId}/${serviceType}/${serviceInstanceId}`, + 'fixture:../support/jsonBuilders/mocks/jsons/add_vnf/add_vnf_instance.json') + .as('serviceInstanceAddVnf'); + + cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`); + cy.getElementByDataTestsId('node-c8087818-6f3e-4451-b339-111a1a3e7970-iperf_vnf_2002_by5924 0-menu-btn').click({force: true}).then(() => { + cy.getElementByDataTestsId('context-menu-showAuditInfo').should('not.be.visible'); + + }); + cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json').then((res) => { + cy.initAuditInfoMSOALaCarteNew(res); + cy.getElementByDataTestsId('openMenuBtn').click({force:true}).then(() => { + cy.getElementByDataTestsId('context-menu-header-audit-item').click({force: true}).then(() => { + + cy.setViewportToSmallPopup(); + }) + }) + + }); + + + }); function mockAsyncBulkResponse() { cy.server().route({ diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts index f76cf2133..588a777ee 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts @@ -67,7 +67,6 @@ describe('Drawing board tree Service', () => { const expected: TreeNodeContextMenuModel[] = [ new TreeNodeContextMenuModel('edit', 'context-menu-edit', 'Edit', 'edit-file-o'), new TreeNodeContextMenuModel('duplicate', 'context-menu-duplicate', 'Duplicate', 'copy-o'), - new TreeNodeContextMenuModel('showAuditInfo', 'context-menu-showAuditInfo', 'Show audit info', 'eye-o'), new TreeNodeContextMenuModel('addGroupMember', 'context-menu-addGroupMember', 'Add group members', 'plus'), new TreeNodeContextMenuModel('delete', 'context-menu-delete', 'Delete', 'trash-o'), new TreeNodeContextMenuModel('remove', 'context-menu-remove', 'Remove', 'trash-o'), @@ -78,7 +77,7 @@ describe('Drawing board tree Service', () => { new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion'), new TreeNodeContextMenuModel('removePause', 'context-menu-removePause', 'Remove Pause', 'pause-upon-completion') ]; - expect(options.length).toEqual(12); + expect(options.length).toEqual(11); expect(options).toEqual(expected); }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts index fe3f0932a..f90a5eab0 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts @@ -46,7 +46,6 @@ export class DrawingBoardTreeService { return [ new TreeNodeContextMenuModel('edit', 'context-menu-edit', 'Edit', 'edit-file-o'), new TreeNodeContextMenuModel('duplicate', 'context-menu-duplicate', 'Duplicate', 'copy-o'), - new TreeNodeContextMenuModel('showAuditInfo', 'context-menu-showAuditInfo', 'Show audit info', 'eye-o'), new TreeNodeContextMenuModel('addGroupMember', 'context-menu-addGroupMember', 'Add group members', 'plus'), new TreeNodeContextMenuModel('delete', 'context-menu-delete', 'Delete', 'trash-o'), new TreeNodeContextMenuModel('remove', 'context-menu-remove', 'Remove', 'trash-o'), diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html index 5bb22608b..2f0c53bda 100644 --- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html +++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html @@ -2,7 +2,7 @@ tabindex="-1" role="dialog" aria-labelledby="dialog-static-name"> <div style="width: 100%; height: 100%" id="audit-info-modal" class="" [ngStyle]="style" mwlResizable [enableGhostResize]="true" - [resizeEdges]="{ bottom: true, right: true, top: true, left: true }" (resizeEnd)="onResizeEnd($event)" + [resizeEdges]="{ bottom: true, right: true, top: true, left: true, bottomRight : true, bottomLeft : true, topLeft : true, topRight : true }" (resizeEnd)="onResizeEnd($event)" [validateResize]="validate"> <div class="modal-content"> <div class="modal-header"> @@ -28,7 +28,7 @@ <a id="glossary_link" target="_blank" href="#" (click)="onNavigate()">Building Block (BB) glossary</a> </span> - <span> + <span *ngIf="showMoreAuditInfoLink"> <a id="full_screen_link" target="_parent" title="Go to drawing board" [href]="readOnlyRetryUrl()"> <i class="fa fa-external-link"></i> </a> @@ -51,10 +51,10 @@ </thead> <tbody> <tr class="row" *ngFor="let data of msoInfoData"> - <td id="msoRequestId" class="col-md-2" style="width: 22%"> + <td id="msoRequestId" style="width: 12%"> <custom-ellipsis [id]="data?.requestId" [value]="data?.requestId" [attr.data-tests-id]="'requestId'"></custom-ellipsis> </td> - <td id="msoInstanceName" *ngIf="isAlaCarte && isALaCarteFlagOn" class="msoInstanceName col-md-2" style="width: 10%"> + <td id="msoInstanceName" *ngIf="isAlaCarte && isALaCarteFlagOn" class="msoInstanceName" style="width: 10%"> <custom-ellipsis [id]="data?.instanceId" [value]="data?.instanceColumn"></custom-ellipsis> </td> <td id="msoModelType" style="width: 7%"> @@ -72,9 +72,8 @@ <td id="msoJobStatus" style="width: 8%"> <custom-ellipsis [id]="data?.jobStatus" [value]="data?.jobStatus | capitalizeAndFormat" [attr.data-tests-id]="'jobStatus'"></custom-ellipsis> </td> - <td class="col-md-2" id="msoAdditionalInfo" style="width: 33%"> + <td id="msoAdditionalInfo" style="width: 33%"> <span [innerHtml]="data?.additionalInfo"></span> - <!--<custom-ellipsis [id]="data?.additionalInfo" [value]="data?.additionalInfo" [attr.data-tests-id]="'additionalInfo'"></custom-ellipsis> --> </td> </tr> </tbody> diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.spec.ts b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.spec.ts index 5703c67bd..619988f66 100644 --- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.spec.ts +++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.spec.ts @@ -157,14 +157,16 @@ describe('Audit Info Modal Component_serviceInfoService', () => { spyOn(component, 'initializeProperties'); spyOn(component, 'setModalTitles'); spyOn(component.auditInfoModal, 'show'); - spyOn(_serviceInfoService, 'getAuditStatusForRetry'); + spyOn(_serviceInfoService, 'getInstanceAuditStatus'); jest.spyOn(_serviceInfoService, 'getInstanceAuditStatus').mockReturnValue(of([])) spyOn(AuditInfoModalComponentService, 'getInstanceModelName'); const instanceId: string = "instanceID"; const type: string = 'VNF'; const model = {}; - const instance = {}; + const instance: NodeInstance = new NodeInstance(); + instance.instanceId = 'instanceID'; + instance.isFailed= false; AuditInfoModalComponent.openInstanceAuditInfoModal.next({ instanceId: instanceId, @@ -176,7 +178,7 @@ describe('Audit Info Modal Component_serviceInfoService', () => { expect(component.showVidStatus).toEqual(false); expect(component.initializeProperties).toHaveBeenCalled(); expect(component.setModalTitles).toHaveBeenCalled(); - expect(_serviceInfoService.getInstanceAuditStatus).toHaveBeenCalledWith(instanceId, type); + expect(_serviceInfoService.getInstanceAuditStatus).toHaveBeenCalledWith(instance.instanceId, type); expect(component.auditInfoModal.show).toHaveBeenCalled(); expect(AuditInfoModalComponentService.getInstanceModelName).toHaveBeenCalledWith(model); }); diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts index 41e99aee9..27593cabf 100644 --- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts +++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts @@ -49,6 +49,9 @@ export class AuditInfoModalComponent { exportMSOStatusFeatureEnabled: boolean; dataIsReady : boolean = false; jobDataLocal : any; + isDrawingBoard :boolean = false; + serviceInstanceObject :any; + typeFromDrawingBoard: any; constructor(private _serviceInfoService: ServiceInfoService, private _iframeService : IframeService, private _auditInfoModalComponentService : AuditInfoModalComponentService, private _featureFlagsService: FeatureFlagsService, @@ -56,10 +59,11 @@ export class AuditInfoModalComponent { private spacetoUnderscore: SpaceToUnderscorePipe, private store: NgRedux<AppState>) { this.auditInfoModalComponentService = this._auditInfoModalComponentService; + this.exportMSOStatusFeatureEnabled = _featureFlagsService.getFlagState(Features.FLAG_2011_EXPORT_MSO_STATUS); AuditInfoModalComponent.openModal.subscribe((jobData: ServiceInfoModel) => { this.isALaCarteFlagOn = this.store.getState().global.flags['FLAG_A_LA_CARTE_AUDIT_INFO']; this.showMoreAuditInfoLink = _featureFlagsService.getFlagState(Features.FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO); - this.exportMSOStatusFeatureEnabled = _featureFlagsService.getFlagState(Features.FLAG_2011_EXPORT_MSO_STATUS); + this.initializeProperties(); this.showVidStatus = true; if (jobData) { @@ -83,19 +87,20 @@ export class AuditInfoModalComponent { AuditInfoModalComponent.openInstanceAuditInfoModal.subscribe(({instanceId , type , model, instance}) => { this.showVidStatus = false; this.showMoreAuditInfoLink = false; + this.isDrawingBoard = true; this.initializeProperties(); this.setModalTitles(type); this.serviceModelName = AuditInfoModalComponentService.getInstanceModelName(model); + this.serviceInstanceObject = instance; + this.typeFromDrawingBoard = type; - if (instance.isFailed) { - this._serviceInfoService.getAuditStatusForRetry(instance.trackById).subscribe((res: AuditStatus) => { - this.msoInfoData = [res]; - }); - }else{ - this._serviceInfoService.getInstanceAuditStatus(instanceId, type).subscribe((res : AuditStatus[]) =>{ - this.msoInfoData = res; - }); + this.callApi(instance, type); + + if(this.msoInfoData && Array.isArray(this.msoInfoData)) { + this.sortMsoInfo(); } + + this.modelInfoItems = this.auditInfoModalComponentService.getModelInfo(model, instance, instanceId); _iframeService.addClassOpenModal(this.parentElementClassName); this.auditInfoModal.show(); @@ -106,7 +111,7 @@ export class AuditInfoModalComponent { validate(event: ResizeEvent): boolean { console.log("event : ", event); if(event.rectangle.width && event.rectangle.height && - ( event.rectangle.width < 800 || event.rectangle.width > 1240) + ( event.rectangle.width < 600 || event.rectangle.width > 1412) ){ return false; } else{ @@ -116,7 +121,7 @@ export class AuditInfoModalComponent { onResizeEnd(event: ResizeEvent): void { console.log('Element was resized', event); this.style = { - position: 'fixed', + position: 'relative', left: `${event.rectangle.left}px`, top: `${event.rectangle.top}px`, width: `${event.rectangle.width}px`, @@ -153,10 +158,7 @@ export class AuditInfoModalComponent { .subscribe((res: AuditStatus[][]) => { this.vidInfoData = res[0]; this.msoInfoData = res[1]; - this.msoInfoData.sort(this.getSortOrder("startTime")); - this.msoInfoData.forEach((element ) => { - element.instanceColumn = element.instanceName + " | " +"<br>" + element.instanceId; - }); + this.sortMsoInfo(); this.isLoading = false; }); } @@ -167,10 +169,7 @@ export class AuditInfoModalComponent { +currentTime.getHours()+":"+currentTime.getMinutes()+":"+currentTime.getSeconds() let fileName = this.spacetoUnderscore.transform(this.serviceInstanceName)+'_'+timestamp; let msoStatusTableElement = document.getElementById('service-instantiation-audit-info-mso'); - const ws: XLSX.WorkSheet = XLSX.utils.table_to_sheet(msoStatusTableElement, { - cellDates: true, - raw: true - }); + const ws: XLSX.WorkSheet = XLSX.utils.table_to_sheet(msoStatusTableElement); const wb: XLSX.WorkBook = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); /* save to file */ @@ -191,7 +190,11 @@ export class AuditInfoModalComponent { refreshData(): void { this.dataIsReady = false; - this.initAuditInfoData(this.jobDataLocal); + if(this.isDrawingBoard) { + this.callApi(this.serviceInstanceObject, this.typeFromDrawingBoard); + } else { + this.initAuditInfoData(this.jobDataLocal); + } this.dataIsReady = true; } @@ -200,14 +203,32 @@ export class AuditInfoModalComponent { getSortOrder(timestamp) { return (obj1, obj2) =>{ - let firstObj = obj1[timestamp]; - let secondObj = obj2[timestamp]; - return ((secondObj < firstObj) ? -1 : ((secondObj > firstObj) ? 1 : 0)); + let firstObj = obj1[timestamp]; + let secondObj = obj2[timestamp]; + return ((secondObj < firstObj) ? -1 : ((secondObj > firstObj) ? 1 : 0)); } - } + } + + sortMsoInfo() { + this.msoInfoData.sort(this.getSortOrder("startTime")); + this.msoInfoData.forEach((element ) => { + element.instanceColumn = element.instanceName + " | " +"<br>" + element.instanceId; + }); + } + + callApi(instance, type) { + if (instance.isFailed) { + this._serviceInfoService.getAuditStatusForRetry(instance.trackById).subscribe((res: AuditStatus) => { + this.msoInfoData = [res]; + }); + }else{ + this._serviceInfoService.getInstanceAuditStatus(instance.instanceId, type).subscribe((res : AuditStatus[]) =>{ + this.msoInfoData = res; + }); + } + } readOnlyRetryUrl = (): string => `../../serviceModels.htm?more#/servicePlanning/RETRY?serviceModelId=${this.serviceModelId}&jobId=${this.jobId}` -} - +}
\ No newline at end of file |