From 548c5a220333c7cd666b861e737bff0b45461f18 Mon Sep 17 00:00:00 2001 From: "Stone, Avi (as206k)" Date: Sun, 3 Jun 2018 13:12:12 +0300 Subject: Update FE project Update FE to latest version so that fe can run on docker Change-Id: I9c5dee756b567dbe64fac6d3d6fd89362813bdcc Issue-ID: SDC-1359 Signed-off-by: Stone, Avi (as206k) --- .../sdc-notify-dialog.component.ts | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 public/src/app/sdc-notify-dialog/sdc-notify-dialog.component.ts (limited to 'public/src/app/sdc-notify-dialog/sdc-notify-dialog.component.ts') diff --git a/public/src/app/sdc-notify-dialog/sdc-notify-dialog.component.ts b/public/src/app/sdc-notify-dialog/sdc-notify-dialog.component.ts new file mode 100644 index 0000000..7572012 --- /dev/null +++ b/public/src/app/sdc-notify-dialog/sdc-notify-dialog.component.ts @@ -0,0 +1,72 @@ +import { Component, ElementRef, ViewChild } from '@angular/core'; +import { Router } from '@angular/router'; +import { RestApiService } from '../api/rest-api.service'; +import { MainComponent } from '../main/main.component'; +import { Store } from '../store/store'; + +@Component({ + selector: 'app-sdc-notify-dialog', + templateUrl: './sdc-notify-dialog.component.html', + styleUrls: ['./sdc-notify-dialog.component.scss'] +}) +export class SdcNotifyDialogComponent { + @ViewChild(MainComponent) mainComponent: ElementRef; + + constructor( + public store: Store, + private router: Router, + private _restApi: RestApiService + ) {} + + closeDialog() { + const currentUrl = this.router.url; + if (currentUrl.includes('main')) { + if (this.store.cdumpIsDirty) { + this.saveCDUMP(); + } else { + this.completeAndClose(); + } + } else { + this.completeAndClose(); + } + } + + saveCDUMP() { + this.store.loader = true; + this._restApi + .saveMonitoringComponent({ + contextType: this.store.sdcParmas.contextType, + serviceUuid: this.store.sdcParmas.uuid, + vfiName: this.store.vfiName, + vfcmtUuid: this.store.mcUuid, + flowType: this.store.flowType, + cdump: this.store.cdump + }) + .subscribe( + success => { + this.store.loader = false; + this.store.mcUuid = success.uuid; + this.store.ifrmaeMessenger.notify('ACTION_COMPLETED'); + }, + error => { + this.store.loader = false; + console.log(error.notes); + this.store.ifrmaeMessenger.notify('ACTION_COMPLETED'); + this.store.ErrorContent = Object.values(error.requestError); + this.store.displayErrorDialog = true; + }, + () => { + this.store.ifrmaeMessenger.notify('ACTION_COMPLETED'); + } + ); + } + + private completeAndClose() { + this.store.ifrmaeMessenger.notify('ACTION_COMPLETED'); + this.store.displaySDCDialog = false; + } + + closeforChange() { + this.completeAndClose(); + } +} -- cgit 1.2.3-korg