Upgrade client API versions to R3 latest
[portal/ric-dashboard.git] / webapp-frontend / src / app / services / ui / confirm-dialog.service.ts
index 0eccc63..b542de1 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * O-RAN-SC
  * %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * Copyright (C) 2019 AT&T Intellectual Property
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 import { Injectable } from '@angular/core';
-import { MatDialog } from '@angular/material';
-import { ConfirmDialogComponent } from './../../ui/confirm-dialog/confirm-dialog.component'
+import { MatDialog } from '@angular/material/dialog';
+import { ConfirmDialogComponent } from './../../ui/confirm-dialog/confirm-dialog.component';
+import { UiService } from './ui.service';
 
 @Injectable({
   providedIn: 'root'
 })
-export class ConfirmDialogService {
+export class ConfirmDialogService  {
 
-  constructor(private dialog: MatDialog) { }
+  darkMode: boolean;
+  panelClass: string;
 
-  openConfirmDialog(msg) {
+  constructor(private dialog: MatDialog,
+    public ui: UiService) { }
+
+  openConfirmDialog(msg: string) {
+    this.ui.darkModeState.subscribe((isDark) => {
+      this.darkMode = isDark;
+    });
+    if (this.darkMode) {
+      this.panelClass = 'dark-theme';
+    } else {
+      this.panelClass = '';
+    }
     return this.dialog.open(ConfirmDialogComponent, {
+      panelClass: this.panelClass,
       width: '480px',
-      position: { top: "100px" },
+      position: { top: '100px' },
       data: {
         message: msg
       }