summaryrefslogtreecommitdiffstats
path: root/public/src/app/revert-dialog
diff options
context:
space:
mode:
authorManor, Yanir (ym903w) <ym903w@intl.att.com>2018-10-21 11:00:42 +0300
committerManor, Yanir (ym903w) <ym903w@intl.att.com>2018-10-21 11:00:42 +0300
commita0c5a22d123f1bdaa8ec7bfbf75f76cbe2ace29a (patch)
tree456198ada103cd23bd57f40b6475fb3c9a86fef5 /public/src/app/revert-dialog
parent29ffa5ef26f82002bf894b9288e9a369a144388d (diff)
Update code to latest
Change-Id: I76b37c2d6d333204899c9bc87f310e5b607a5e73 Issue-ID: DCAEGEN2-836 Signed-off-by: Manor, Yanir (ym903w) <ym903w@intl.att.com>
Diffstat (limited to 'public/src/app/revert-dialog')
-rw-r--r--public/src/app/revert-dialog/revert-dialog.component.html43
-rw-r--r--public/src/app/revert-dialog/revert-dialog.component.scss17
-rw-r--r--public/src/app/revert-dialog/revert-dialog.component.ts59
3 files changed, 119 insertions, 0 deletions
diff --git a/public/src/app/revert-dialog/revert-dialog.component.html b/public/src/app/revert-dialog/revert-dialog.component.html
new file mode 100644
index 0000000..5dbeb05
--- /dev/null
+++ b/public/src/app/revert-dialog/revert-dialog.component.html
@@ -0,0 +1,43 @@
+<p-dialog [style]="{'border-top-color':'#ffb81c'}" [closable]="false" [(visible)]="store.displayRevertDialog" modal="modal"
+ styleClass="dcae-notify" width="500" [responsive]="true" data-tests-id="revert-dialog">
+ <p-header>
+ <div style="display: flex;">
+ <span style="color: #ffb81c;
+ padding-right: 15px;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;"
+ [innerHTML]="'alert-triangle' | feather:28"></span>
+ <span style="font-family: 'Open Sans', sans-serif;
+ font-size: 24px; width: 100%;" data-tests-id="revert-dialog-title">
+ Are you sure you want to revert?
+ </span>
+ <span style="
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ color:rgb(90, 90, 90);
+ align-items: center;"
+ [innerHTML]="'x' | feather:20
+ " (click)="closeDialog()"></span>
+ </div>
+ </p-header>
+
+ <div style="padding: 0 0 20px 43px; font-family: 'Open Sans', sans-serif;
+ font-size: 14px;">
+ Are you sure you want to revert the MC to the submitted version configuration?
+ This will delete only the edited version of the MC.
+ </div>
+
+ <p-footer>
+ <button mat-raised-button color="primary" style="background-color: #FFB81C; margin-right: 10px; font-size: 14px; font-family: 'Open Sans', sans-serif; height: 36px;"
+ (click)="revert()" data-tests-id="revert-btn">
+ REVERT
+ </button>
+ <button mat-raised-button class="btn-secondry" style="border-color: #FFB81C !important; color:#FFB81C !important; font-size: 14px; font-family: 'Open Sans', sans-serif;text-align: center; height: 36px;"
+ (click)="closeDialog()" data-tests-id="revert-cancel">
+ CANCEL
+ </button>
+ </p-footer>
+</p-dialog>
diff --git a/public/src/app/revert-dialog/revert-dialog.component.scss b/public/src/app/revert-dialog/revert-dialog.component.scss
new file mode 100644
index 0000000..a775398
--- /dev/null
+++ b/public/src/app/revert-dialog/revert-dialog.component.scss
@@ -0,0 +1,17 @@
+:host /deep/ .dcae-notify {
+ border-top: solid 6px #ffb81c;
+}
+:host /deep/ .ui-dialog .ui-dialog-titlebar {
+ padding-top: 15px;
+ padding-left: 20px;
+ padding-right: 12px;
+ padding-bottom: 0;
+}
+
+:host /deep/ .ui-dialog-footer {
+ padding: 10px;
+}
+
+:host /deep/ .ui-dialog.ui-widget .ui-dialog-content {
+ padding-top: 10px;
+}
diff --git a/public/src/app/revert-dialog/revert-dialog.component.ts b/public/src/app/revert-dialog/revert-dialog.component.ts
new file mode 100644
index 0000000..9cd7a7d
--- /dev/null
+++ b/public/src/app/revert-dialog/revert-dialog.component.ts
@@ -0,0 +1,59 @@
+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-revert-dialog',
+ templateUrl: './revert-dialog.component.html',
+ styleUrls: ['./revert-dialog.component.scss']
+})
+export class RevertDialogComponent {
+ @ViewChild(MainComponent) mainComponent: ElementRef;
+
+ constructor(
+ public store: Store,
+ private router: Router,
+ private _restApi: RestApiService
+ ) {}
+
+ closeDialog() {
+ this.store.displayRevertDialog = false;
+ }
+
+ revert() {
+ this.store.loader = true;
+
+ this._restApi
+ .revertMC({
+ contextType: this.store.sdcParmas.contextType,
+ serviceUuid: this.store.sdcParmas.uuid,
+ vfiName: this.store.vfiName,
+ vfcmtUuid: this.store.mcUuid,
+ submittedUuid: this.store.submittedMcUuid
+ })
+ .subscribe(
+ success => {
+ this.store.monitoringComponents = this.store.monitoringComponents.map(
+ item => {
+ if (item.invariantUuid === success.invariantUuid) {
+ item = success;
+ }
+ return item;
+ }
+ );
+ this.store.loader = false;
+ this.store.displayRevertDialog = false;
+ },
+ error => {
+ this.store.loader = false;
+ this.store.displayRevertDialog = false;
+ console.log(error.notes);
+ this.store.ErrorContent = Object.values(error.requestError);
+ this.store.displayErrorDialog = true;
+ },
+ () => {}
+ );
+ }
+}