aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components
diff options
context:
space:
mode:
authorKruthi Bhat <krutbhat@att.com>2020-11-05 17:51:25 +0530
committerRachitha Ramappa <rachitha.ramappa@att.com>2020-11-10 12:01:02 +0530
commit7ac7c4e9d8df491fe1aca6782103592181ef6969 (patch)
tree82862e20fb4ab5ece720c7c6d1a47f89c5303a99 /vid-webpack-master/src/app/shared/components
parent545da32aba372bedd1f338ca00ce04dcd93536cf (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/src/app/shared/components')
-rw-r--r--vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html11
-rw-r--r--vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.spec.ts8
-rw-r--r--vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts73
3 files changed, 57 insertions, 35 deletions
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>
&nbsp;
- <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