summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2018-08-29 17:01:32 +0300
committerIttay Stern <ittay.stern@att.com>2019-02-18 18:35:30 +0200
commit6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch)
tree936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts
parent67d99f816cc583643c35193197594cf78d8ce60a (diff)
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts')
-rw-r--r--vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts122
1 files changed, 122 insertions, 0 deletions
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
new file mode 100644
index 000000000..cf385d767
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts
@@ -0,0 +1,122 @@
+import {Component, ViewChild} from '@angular/core';
+import {Subject} from 'rxjs/Subject';
+import {ModalDirective} from 'ngx-bootstrap'
+import {ModelInformationItem} from '../model-information/model-information.component';
+import {ServiceModel} from '../../models/serviceModel';
+import {ServiceInfoService} from '../../server/serviceInfo/serviceInfo.service';
+import {ServiceInfoModel} from '../../server/serviceInfo/serviceInfo.model';
+import {AuditStatus} from '../../server/serviceInfo/AuditStatus.model';
+import {IframeService} from "../../utils/iframe.service";
+import {NgRedux} from "@angular-redux/store";
+import {AppState} from "../../store/reducers";
+import {AuditInfoModalComponentService} from "./auditInfoModal.component.service";
+
+@Component({
+ selector: 'audit-info-modal',
+ templateUrl: './auditInfoModal.component.html',
+ styleUrls: ['./auditInfoModal.component.scss']
+})
+export class AuditInfoModalComponent {
+ static openModal: Subject<ServiceInfoModel> = new Subject<ServiceInfoModel>();
+ static openInstanceAuditInfoModal: Subject<{instanceId , type, model, instance, isInstanceFailed?, trackById?}> = new Subject<{instanceId , type, model, instance, isInstanceFailed, trackById}>();
+ @ViewChild('auditInfoModal') public auditInfoModal: ModalDirective;
+ title: string = 'Service Instantiation Information';
+ modelInfoItems: ModelInformationItem[] = [];
+ serviceModel: ServiceModel;
+ serviceModelName: string;
+ vidInfoData: AuditStatus[] = [];
+ msoInfoData: AuditStatus[] = [];
+ isAlaCarte: boolean;
+ parentElementClassName = 'content';
+ isLoading = true;
+ model: any;
+ instanceId: string;
+ isALaCarteFlagOn: boolean;
+ type : string = "Service";
+ showVidStatus : boolean = true;
+ auditInfoModalComponentService : AuditInfoModalComponentService;
+ constructor(private _serviceInfoService: ServiceInfoService, private _iframeService : IframeService,
+ private _auditInfoModalComponentService : AuditInfoModalComponentService,
+ private store: NgRedux<AppState>) {
+ this.auditInfoModalComponentService = this._auditInfoModalComponentService;
+ AuditInfoModalComponent.openModal.subscribe((jobData: ServiceInfoModel) => {
+ this.isALaCarteFlagOn = this.store.getState().global.flags['FLAG_A_LA_CARTE_AUDIT_INFO'];
+ this.initializeProperties();
+ this.showVidStatus = true;
+ if (jobData) {
+ this.isAlaCarte = jobData.aLaCarte;
+ this.openAuditInfoModal(jobData);
+ _iframeService.addClassOpenModal(this.parentElementClassName);
+ this.serviceModelName = jobData.serviceModelName ? jobData.serviceModelName : '';
+ this.auditInfoModal.show();
+ } else {
+ _iframeService.removeClassCloseModal(this.parentElementClassName);
+ this.auditInfoModal.hide();
+ }
+ });
+
+ AuditInfoModalComponent.openInstanceAuditInfoModal.subscribe(({instanceId , type , model, instance, isInstanceFailed, trackById}) => {
+ this.showVidStatus = false;
+ this.initializeProperties();
+ this.setModalTitles(type);
+ this.serviceModelName = AuditInfoModalComponentService.getInstanceModelName(model);
+
+ if (isInstanceFailed) {
+ this._serviceInfoService.getAuditStatusForRetry(trackById).subscribe((res: AuditStatus) => {
+ this.msoInfoData = [res];
+ });
+ }else{
+ this._serviceInfoService.getInstanceAuditStatus(instanceId, type).subscribe((res : AuditStatus[]) =>{
+ this.msoInfoData = res;
+ });
+ }
+ this.modelInfoItems = this.auditInfoModalComponentService.getModelInfo(model, instance, instanceId);
+ _iframeService.addClassOpenModal(this.parentElementClassName);
+ this.auditInfoModal.show();
+ });
+ }
+
+
+ setModalTitles(type : string) : void{
+ this.type = AuditInfoModalComponentService.setModalTitlesType(type) ;
+ this.title = AuditInfoModalComponentService.setModalTitle(type);
+ }
+
+ initializeProperties() : void {
+ this.modelInfoItems = null;
+ this.vidInfoData = [];
+ this.msoInfoData = [];
+ this.isLoading = true;
+ }
+
+ openAuditInfoModal(jobData: ServiceInfoModel): void {
+ this.modelInfoItems = AuditInfoModalComponentService.createModelInformationItemsJob(jobData);
+ this.initAuditInfoData(jobData);
+ this.auditInfoModal.onHide.subscribe(()=>{
+ this._iframeService.removeClassCloseModal(this.parentElementClassName);
+ this.initializeProperties();
+ });
+ this.auditInfoModal.show();
+ }
+
+ initAuditInfoData(jobData: ServiceInfoModel) {
+ this._serviceInfoService.getJobAuditStatus(jobData)
+ .subscribe((res: AuditStatus[][]) => {
+ this.vidInfoData = res[0];
+ this.msoInfoData = res[1];
+ this.isLoading = false;
+ });
+ }
+
+ onCancelClick() {
+ this._iframeService.removeClassCloseModal(this.parentElementClassName);
+ this.initializeProperties();
+ this.auditInfoModal.hide();
+ }
+
+
+ onNavigate(){
+ window.open("https://wiki.onap.org/display/DW/SO+Building+blocks", "_blank");
+ }
+}
+