]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: create alert panel component
authorPatrick Seidensal <pseidensal@suse.com>
Wed, 11 Sep 2019 14:39:22 +0000 (16:39 +0200)
committerPatrick Seidensal <pseidensal@suse.com>
Mon, 23 Sep 2019 13:55:24 +0000 (15:55 +0200)
to integrate {warning,error,info} component into alert panel component.

Fixes: https://tracker.ceph.com/issues/41774
Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
35 files changed:
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-501/nfs-501.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-501/rgw-501.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.html [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.scss [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.html [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.scss [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.html [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.scss [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/view-cache/view-cache.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.html [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.scss [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html

index e5e7677d2b46b7fdef7f525a3c44925fef142f12..d0231f442df2db5694a22f2c42024e5ef5ae3ff2 100644 (file)
@@ -1,8 +1,9 @@
 <cd-iscsi-tabs></cd-iscsi-tabs>
 
-<cd-info-panel *ngIf="available === false"
-               title="iSCSI Targets not available"
-               i18n-title>
+<cd-alert-panel type="info"
+                *ngIf="available === false"
+                title="iSCSI Targets not available"
+                i18n-title>
   <ng-container i18n>Please consult the <a href="{{docsUrl}}"
        target="_blank">documentation</a>
     on how to configure and enable the iSCSI Targets management functionality.</ng-container>
@@ -12,7 +13,7 @@
     <span i18n>Available information:</span>
     <pre>{{ status }}</pre>
   </ng-container>
-</cd-info-panel>
+</cd-alert-panel>
 
 <cd-table #table
           *ngIf="available === true"
index 3d001956f4cc5ae02d3992e69f3ed7913c1f4164..a4fdcf0459184beb604f5b80e8b8a42cbb12eed8 100644 (file)
@@ -1,8 +1,9 @@
-<cd-info-panel *ngIf="!orchestratorExist && !checkingOrchestrator"
-               i18n>Please consult the
+<cd-alert-panel type="info"
+                *ngIf="!orchestratorExist && !checkingOrchestrator"
+                i18n>Please consult the
   <a href="{{ docsUrl }}"
      target="_blank">documentation</a> on how to
-  configure and enable the orchestrator functionality.</cd-info-panel>
+  configure and enable the orchestrator functionality.</cd-alert-panel>
 
 <ng-container *ngIf="orchestratorExist">
   <legend i18n>Devices</legend>
@@ -18,4 +19,4 @@
       </cd-table>
     </div>
   </div>
-</ng-container>
\ No newline at end of file
+</ng-container>
index 33ce5c557767916ee2c9f1292ecb853e8fb557b4..1829ef671571ab09f5469d2e244f4d5f6d3908bc 100644 (file)
@@ -1,7 +1,8 @@
 <cd-loading-panel *ngIf="loading && !error"
                   i18n>Loading configuration...</cd-loading-panel>
-<cd-error-panel *ngIf="loading && error"
-                i18n>The configuration could not be loaded.</cd-error-panel>
+<cd-alert-panel type="error"
+                *ngIf="loading && error"
+                i18n>The configuration could not be loaded.</cd-alert-panel>
 
 <div class="col-sm-12 col-lg-6"
      *ngIf="!loading && !error">
index 91fd03a2a1cc1ffcc4dd2129d872ddfe15a77c20..708b0d324368ca38c2f8f0d5fb80598611c011be 100644 (file)
@@ -14,7 +14,7 @@
                         [data]="osd.details.osd_metadata">
     </cd-table-key-value>
     <ng-template #noMetaData>
-      <cd-warning-panel i18n>Metadata not available</cd-warning-panel>
+      <cd-alert-panel type="warning" i18n>Metadata not available</cd-alert-panel>
     </ng-template>
   </tab>
 
@@ -33,8 +33,9 @@
 
   <tab heading="Histogram"
        i18n-heading>
-    <cd-warning-panel *ngIf="osd.loaded && osd.histogram_failed"
-                      i18n>Histogram not available: {{ osd.histogram_failed }}</cd-warning-panel>
+    <cd-alert-panel *ngIf="osd.loaded && osd.histogram_failed"
+                    type="warning"
+                    i18n>Histogram not available: {{ osd.histogram_failed }}</cd-alert-panel>
 
     <div class="row"
          *ngIf="osd.loaded && osd.details.histogram">
index 7b2dcd69b31bdb68a1174d002f6097fc23246f3d..1885772cc7c6755eed1e65d03c2f14cdfebfe708 100644 (file)
@@ -68,7 +68,7 @@
              let-actionDescription="actionDescription">
   <div *ngIf="!safeToDestroyResult['is_safe_to_destroy']"
        class="danger">
-  <cd-warning-panel i18n>The {selection.hasSingleSelection, select, 1 {OSD is} 0 {OSDs are}} not safe to destroy!</cd-warning-panel>
+    <cd-alert-panel type="warning" i18n>The {selection.hasSingleSelection, select, 1 {OSD is} 0 {OSDs are}} not safe to destroy!</cd-alert-panel>
   </div>
   <ng-container i18n><strong>OSD {{ getSelectedIds() | list }}</strong> will be
 <strong>{{ actionDescription }}</strong> if you proceed.</ng-container>
index fabd506cae86c7241ea39021c6532365bdc565d0..d5e3fe1688a7e86bef38761933e30cb49e202d90 100644 (file)
@@ -1,12 +1,12 @@
 <ng-container *ngIf="!loading; else isLoading">
   <ng-container *ngIf="incompatible; else isCompatible">
-    <cd-warning-panel i18n>The data received has the JSON format version 2.x and is currently incompatible with the dashboard.</cd-warning-panel>
+    <cd-alert-panel type="warning" i18n>The data received has the JSON format version 2.x and is currently incompatible with the dashboard.</cd-alert-panel>
   </ng-container>
   <ng-template #isCompatible>
     <tabset *ngFor="let device of data | keyvalue">
       <tab [heading]="device.value.device + ' (' + device.value.identifier + ')'">
         <ng-container *ngIf="device.value.error; else noError">
-          <cd-warning-panel>{{ device.value.userMessage }}</cd-warning-panel>
+          <cd-alert-panel type="warning">{{ device.value.userMessage }}</cd-alert-panel>
         </ng-container>
         <ng-template #noError>
           <tabset>
index dc897b6541b32f2e4f250ba9aa6455af3d7f415d..e495bfc6ab2bfb105facec88a6bf76bc2515360d 100644 (file)
@@ -1,8 +1,9 @@
-<cd-info-panel *ngIf="!orchestratorExist && !checkingOrchestrator"
-               i18n>Please consult the
+<cd-alert-panel type="info"
+                *ngIf="!orchestratorExist && !checkingOrchestrator"
+                i18n>Please consult the
   <a href="{{ docsUrl }}"
      target="_blank">documentation</a> on how to
-  configure and enable the orchestrator functionality.</cd-info-panel>
+  configure and enable the orchestrator functionality.</cd-alert-panel>
 
 <ng-container *ngIf="orchestratorExist">
   <cd-table [data]="services"
@@ -13,4 +14,4 @@
             (fetchData)="getServices($event)"
             selectionType="single">
   </cd-table>
-</ng-container>
\ No newline at end of file
+</ng-container>
index e3db036f1b70e361733e0b8b3a76d9a3bbbee5a2..fad7d9e470f9efcd4b103aeb6606e2a27bb83dda 100644 (file)
@@ -1,5 +1,5 @@
-<cd-info-panel>
+<cd-alert-panel type="info">
   {{ message }}<br>
   <ng-container i18n>Please consult the <a href="{{docsUrl}}" target="_blank">documentation</a>
   on how to configure and enable the NFS Ganesha management functionality.</ng-container>
-</cd-info-panel>
+</cd-alert-panel>
index 097ea48c858dde6f28c200f2556ee744be842eb0..2d6c16b7f7def2d5a093791022d04dc2b70215d9 100644 (file)
@@ -9,5 +9,5 @@
   </ng-template>
 </cd-table>
 <ng-template #warning>
-  <cd-warning-panel i18n>Performance counters not available</cd-warning-panel>
+  <cd-alert-panel type="warning" i18n>Performance counters not available</cd-alert-panel>
 </ng-template>
index b9984b5cf2e8be050876e6c262f1d027988a1efa..88b93a22bf61192d16e019fdad5b844fe6d7baa5 100644 (file)
@@ -1,5 +1,5 @@
-<cd-info-panel>
+<cd-alert-panel type="info">
   {{ message }}<br>
   <ng-container i18n>Please consult the <a href="{{docsUrl}}" target="_blank">documentation</a>
   on how to configure and enable the Object Gateway management functionality.</ng-container>
-</cd-info-panel>
+</cd-alert-panel>
index 5508baff5fca3885c8c6dd3fd6e019737a9d2b5f..5b50b84200c9588b9facd3b14e43cee134c4d287 100644 (file)
@@ -1,8 +1,8 @@
-<cd-loading-panel *ngIf="editing && loading"
+<cd-loading-panel *ngIf="editing && loading && !error"
                   i18n>Loading bucket data...</cd-loading-panel>
 
 <div class="col-sm-12 col-lg-6"
-     *ngIf="!loading">
+     *ngIf="!loading && !error">
   <form name="bucketForm"
         #frm="ngForm"
         [formGroup]="bucketForm"
index 8d3231d14204269789551c9ebe9644331e94aeae..9aeba78fac730805ce343f2c923a9cc521d8a14b 100644 (file)
@@ -1,8 +1,9 @@
 <cd-loading-panel *ngIf="editing && loading && !error"
                   i18n>Loading user data...</cd-loading-panel>
-<cd-error-panel *ngIf="editing && error"
+<cd-alert-panel type="error"
+                *ngIf="editing && error"
                 (backAction)="goToListView()"
-                i18n>The user data could not be loaded.</cd-error-panel>
+                i18n>The user data could not be loaded.</cd-alert-panel>
 
 <div class="col-sm-12 col-lg-6"
      *ngIf="!loading && !error">
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.html
new file mode 100644 (file)
index 0000000..a4c2284
--- /dev/null
@@ -0,0 +1,25 @@
+<alert type="{{ bootstrapClass }}">
+  <table>
+    <tr>
+      <td rowspan="2" class="alert-panel-icon">
+        <i [ngClass]="[icons.large3x]" class="alert-{{ bootstrapClass }} {{ typeIcon }}"
+           aria-hidden="true"></i>
+      </td>
+      <td class="alert-panel-title">{{ title }}</td>
+    </tr>
+    <tr>
+      <td class="alert-panel-text">
+        <ng-content></ng-content>
+      </td>
+    </tr>
+  </table>
+</alert>
+
+<div class="button-group text-right"
+     *ngIf="backAction.observers.length > 0">
+  <button class="btn btn-light tc_backButton"
+          type="button"
+          (click)="backAction.emit()"
+          autofocus
+          i18n>Back</button>
+</div>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.scss
new file mode 100644 (file)
index 0000000..a663f92
--- /dev/null
@@ -0,0 +1,8 @@
+.alert-panel-icon {
+  vertical-align: top;
+  padding-right: 15px; // See @alert-padding in bootstrap/less/variables.less
+}
+
+.alert-panel-title {
+  font-weight: bold;
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.spec.ts
new file mode 100644 (file)
index 0000000..2692712
--- /dev/null
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { AlertComponent, AlertConfig } from 'ngx-bootstrap/alert';
+
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { AlertPanelComponent } from './alert-panel.component';
+
+describe('AlertPanelComponent', () => {
+  let component: AlertPanelComponent;
+  let fixture: ComponentFixture<AlertPanelComponent>;
+
+  configureTestBed({
+    declarations: [AlertPanelComponent, AlertComponent],
+    providers: [AlertConfig, i18nProviders]
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(AlertPanelComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/alert-panel/alert-panel.component.ts
new file mode 100644 (file)
index 0000000..48324e1
--- /dev/null
@@ -0,0 +1,46 @@
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+import { Icons } from '../../enum/icons.enum';
+
+@Component({
+  selector: 'cd-alert-panel',
+  templateUrl: './alert-panel.component.html',
+  styleUrls: ['./alert-panel.component.scss']
+})
+export class AlertPanelComponent implements OnInit {
+  @Input()
+  title = '';
+  @Input()
+  bootstrapClass = '';
+  @Output()
+  backAction = new EventEmitter();
+
+  @Input()
+  type: 'warning' | 'error' | 'info';
+  @Input()
+  typeIcon: Icons | string;
+
+  icons = Icons;
+
+  constructor(private i18n: I18n) {}
+
+  ngOnInit() {
+    switch (this.type) {
+      case 'warning':
+        this.title = this.title || this.i18n('Warning');
+        this.typeIcon = this.typeIcon || Icons.warning;
+        this.bootstrapClass = this.bootstrapClass || 'warning';
+        break;
+      case 'error':
+        this.title = this.title || this.i18n('Error');
+        this.typeIcon = this.typeIcon || Icons.destroyCircle;
+        this.bootstrapClass = this.bootstrapClass || 'danger';
+        break;
+      case 'info':
+        this.title = this.title || this.i18n('Information');
+        this.typeIcon = this.typeIcon || Icons.infoCircle;
+        this.bootstrapClass = this.bootstrapClass || 'info';
+        break;
+    }
+  }
+}
index 4a2b64af201aaf71c58a3622f9803c272fcdc2dc..841b39655e02b83e37484c209def7bb0683be340 100644 (file)
@@ -12,14 +12,13 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip';
 
 import { DirectivesModule } from '../directives/directives.module';
 import { PipesModule } from '../pipes/pipes.module';
+import { AlertPanelComponent } from './alert-panel/alert-panel.component';
 import { BackButtonComponent } from './back-button/back-button.component';
 import { ConfigOptionComponent } from './config-option/config-option.component';
 import { ConfirmationModalComponent } from './confirmation-modal/confirmation-modal.component';
 import { CriticalConfirmationModalComponent } from './critical-confirmation-modal/critical-confirmation-modal.component';
-import { ErrorPanelComponent } from './error-panel/error-panel.component';
 import { GrafanaComponent } from './grafana/grafana.component';
 import { HelperComponent } from './helper/helper.component';
-import { InfoPanelComponent } from './info-panel/info-panel.component';
 import { LanguageSelectorComponent } from './language-selector/language-selector.component';
 import { LoadingPanelComponent } from './loading-panel/loading-panel.component';
 import { ModalComponent } from './modal/modal.component';
@@ -30,7 +29,6 @@ import { SparklineComponent } from './sparkline/sparkline.component';
 import { SubmitButtonComponent } from './submit-button/submit-button.component';
 import { UsageBarComponent } from './usage-bar/usage-bar.component';
 import { ViewCacheComponent } from './view-cache/view-cache.component';
-import { WarningPanelComponent } from './warning-panel/warning-panel.component';
 
 @NgModule({
   imports: [
@@ -55,19 +53,17 @@ import { WarningPanelComponent } from './warning-panel/warning-panel.component';
     SelectBadgesComponent,
     SubmitButtonComponent,
     UsageBarComponent,
-    ErrorPanelComponent,
     LoadingPanelComponent,
-    InfoPanelComponent,
     ModalComponent,
     CriticalConfirmationModalComponent,
     ConfirmationModalComponent,
-    WarningPanelComponent,
     LanguageSelectorComponent,
     GrafanaComponent,
     SelectComponent,
     BackButtonComponent,
     RefreshSelectorComponent,
-    ConfigOptionComponent
+    ConfigOptionComponent,
+    AlertPanelComponent
   ],
   providers: [],
   exports: [
@@ -77,17 +73,15 @@ import { WarningPanelComponent } from './warning-panel/warning-panel.component';
     SelectBadgesComponent,
     SubmitButtonComponent,
     BackButtonComponent,
-    ErrorPanelComponent,
     LoadingPanelComponent,
-    InfoPanelComponent,
     UsageBarComponent,
     ModalComponent,
-    WarningPanelComponent,
     LanguageSelectorComponent,
     GrafanaComponent,
     SelectComponent,
     RefreshSelectorComponent,
-    ConfigOptionComponent
+    ConfigOptionComponent,
+    AlertPanelComponent
   ],
   entryComponents: [ModalComponent, CriticalConfirmationModalComponent, ConfirmationModalComponent]
 })
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.html
deleted file mode 100644 (file)
index b94fe85..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<alert type="danger">
-  <table>
-    <tr>
-      <td rowspan="2"
-          class="error-panel-alert-icon">
-        <i [ngClass]="[icons.destroyCircle, icons.large3x]" class="alert-danger"
-           aria-hidden="true"></i>
-      </td>
-      <td class="error-panel-alert-title">
-        {{ title }}
-      </td>
-    </tr>
-    <tr>
-      <td class="error-panel-alert-text">
-        <ng-content></ng-content>
-      </td>
-    </tr>
-  </table>
-</alert>
-
-<div class="button-group text-right"
-     *ngIf="backAction.observers.length > 0">
-  <button class="btn btn-light tc_backButton"
-          type="button"
-          (click)="backAction.emit()"
-          autofocus
-          i18n>Back</button>
-</div>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.scss
deleted file mode 100644 (file)
index 945fd6f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.error-panel-alert-icon {
-  vertical-align: top;
-  padding-right: 15px; // See @alert-padding in bootstrap/less/variables.less
-}
-.error-panel-alert-title {
-  font-weight: bold;
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.spec.ts
deleted file mode 100644 (file)
index f935583..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { AlertModule } from 'ngx-bootstrap/alert';
-
-import { configureTestBed } from '../../../../testing/unit-test-helper';
-import { ErrorPanelComponent } from './error-panel.component';
-
-describe('ErrorPanelComponent', () => {
-  let component: ErrorPanelComponent;
-  let fixture: ComponentFixture<ErrorPanelComponent>;
-
-  configureTestBed({
-    declarations: [ErrorPanelComponent],
-    imports: [AlertModule.forRoot()]
-  });
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(ErrorPanelComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.ts
deleted file mode 100644 (file)
index 56b3221..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
-import { Icons } from '../../../shared/enum/icons.enum';
-
-@Component({
-  selector: 'cd-error-panel',
-  templateUrl: './error-panel.component.html',
-  styleUrls: ['./error-panel.component.scss']
-})
-export class ErrorPanelComponent {
-  /**
-   * The title to be displayed. Defaults to 'Error'.
-   * @type {string}
-   */
-  @Input()
-  title = 'Error';
-
-  /**
-   * The event that is triggered when the 'Back' button is pressed.
-   * @type {EventEmitter<any>}
-   */
-  @Output()
-  backAction = new EventEmitter();
-
-  icons = Icons;
-}
index 777707327a5f7f4dbc0a9eb8df56e67e5d2a9833..d6ac94af42aa46bfde559bf338185de903c374e5 100644 (file)
@@ -2,17 +2,19 @@
 <cd-loading-panel *ngIf="loading && grafanaExist"
                   i18n>Loading panel data...</cd-loading-panel>
 
-<cd-info-panel *ngIf="!grafanaExist"
-               i18n>Please consult the
+<cd-alert-panel type="info"
+                *ngIf="!grafanaExist"
+                i18n>Please consult the
   <a href="{{ docsUrl }}"
      target="_blank">documentation</a> on how to
-  configure and enable the monitoring functionality.</cd-info-panel>
+  configure and enable the monitoring functionality.</cd-alert-panel>
 
-<cd-info-panel *ngIf="!dashboardExist"
-               i18n>Grafana Dashboard doesn't exist. Please refer to
+<cd-alert-panel type="info"
+                *ngIf="!dashboardExist"
+                i18n>Grafana Dashboard doesn't exist. Please refer to
   <a href="{{ docsUrl }}"
      target="_blank">documentation</a> on how to
-  add dashboards to Grafana.</cd-info-panel>
+  add dashboards to Grafana.</cd-alert-panel>
 
 <ng-container *ngIf="grafanaExist && dashboardExist">
   <div class="row">
index d063cd6b0a68774a0a0d78dbfe4ea98183ac1cbe..409f3b8a1a31242ce1e46c332411d39551c24ee3 100644 (file)
@@ -9,7 +9,7 @@ import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-h
 import { SummaryService } from '../../../shared/services/summary.service';
 import { SettingsService } from '../../api/settings.service';
 import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe';
-import { InfoPanelComponent } from '../info-panel/info-panel.component';
+import { AlertPanelComponent } from '../alert-panel/alert-panel.component';
 import { LoadingPanelComponent } from '../loading-panel/loading-panel.component';
 import { GrafanaComponent } from './grafana.component';
 
@@ -18,7 +18,7 @@ describe('GrafanaComponent', () => {
   let fixture: ComponentFixture<GrafanaComponent>;
 
   configureTestBed({
-    declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent],
+    declarations: [GrafanaComponent, AlertPanelComponent, LoadingPanelComponent],
     imports: [AlertModule.forRoot(), HttpClientTestingModule, RouterTestingModule, FormsModule],
     providers: [CephReleaseNamePipe, SettingsService, SummaryService, i18nProviders]
   });
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.html
deleted file mode 100644 (file)
index f5efe53..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<alert type="info">
-  <table>
-    <tr>
-      <td rowspan="2" class="info-panel-alert-icon">
-        <i [ngClass]="[icons.infoCircle, icons.large3x]" class="alert-info"
-           aria-hidden="true"></i>
-      </td>
-      <td class="info-panel-alert-title">
-        {{ title }}
-      </td>
-    </tr>
-    <tr>
-      <td class="info-panel-alert-text">
-        <ng-content></ng-content>
-      </td>
-    </tr>
-  </table>
-</alert>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.scss
deleted file mode 100644 (file)
index 27c0e32..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.info-panel-alert-icon {
-  vertical-align: top;
-  padding-right: 15px; // See @alert-padding in bootstrap/less/variables.less
-}
-.info-panel-alert-title {
-  font-weight: bold;
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.spec.ts
deleted file mode 100644 (file)
index 6a28aec..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { AlertModule } from 'ngx-bootstrap/alert';
-
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
-import { InfoPanelComponent } from './info-panel.component';
-
-describe('InfoPanelComponent', () => {
-  let component: InfoPanelComponent;
-  let fixture: ComponentFixture<InfoPanelComponent>;
-
-  configureTestBed({
-    declarations: [InfoPanelComponent],
-    imports: [AlertModule.forRoot()],
-    providers: i18nProviders
-  });
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(InfoPanelComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.ts
deleted file mode 100644 (file)
index a5427d9..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Component, Input } from '@angular/core';
-
-import { I18n } from '@ngx-translate/i18n-polyfill';
-import { Icons } from '../../../shared/enum/icons.enum';
-
-@Component({
-  selector: 'cd-info-panel',
-  templateUrl: './info-panel.component.html',
-  styleUrls: ['./info-panel.component.scss']
-})
-export class InfoPanelComponent {
-  /**
-   * The title to be displayed. Defaults to 'Information'.
-   * @type {string}
-   */
-  @Input()
-  title = this.i18n('Information');
-
-  icons = Icons;
-
-  constructor(private i18n: I18n) {}
-}
index 73e9ea6ad137878f00ee1849f0b77f500bfc1534..05afc42bcf2602e4290d00f6ec6c950cefa692fc 100644 (file)
@@ -1,15 +1,18 @@
-<cd-info-panel *ngIf="status === vcs.ValueNone">
+<cd-alert-panel type="info"
+                *ngIf="status === vcs.ValueNone">
   <ng-container i18n>Retrieving data<span *ngIf="statusFor"> for
   <span [innerHtml]="statusFor"></span></span>. Please wait...</ng-container>
-</cd-info-panel>
+</cd-alert-panel>
 
-<cd-warning-panel *ngIf="status === vcs.ValueStale">
+<cd-alert-panel *ngIf="status === vcs.ValueStale"
+                type="warning">
   <ng-container i18n>Displaying previously cached data<span *ngIf="statusFor">
   for <span [innerHtml]="statusFor"></span></span>.</ng-container>
-</cd-warning-panel>
+</cd-alert-panel>
 
-<cd-error-panel *ngIf="status === vcs.ValueException">
+<cd-alert-panel type="error"
+                *ngIf="status === vcs.ValueException">
   <ng-container i18n>Could not load data<span *ngIf="statusFor"> for
   <span [innerHtml]="statusFor"></span></span>.
   Please check the cluster health.</ng-container>
-</cd-error-panel>
+</cd-alert-panel>
index f55b8a62cb625d5431563c7619181b2dd8918a40..ba33678a77a4620d058d56c140fed4a572961f6f 100644 (file)
@@ -3,9 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { AlertModule } from 'ngx-bootstrap/alert';
 
 import { configureTestBed } from '../../../../testing/unit-test-helper';
-import { ErrorPanelComponent } from '../error-panel/error-panel.component';
-import { InfoPanelComponent } from '../info-panel/info-panel.component';
-import { WarningPanelComponent } from '../warning-panel/warning-panel.component';
+import { AlertPanelComponent } from '../alert-panel/alert-panel.component';
 import { ViewCacheComponent } from './view-cache.component';
 
 describe('ViewCacheComponent', () => {
@@ -13,12 +11,7 @@ describe('ViewCacheComponent', () => {
   let fixture: ComponentFixture<ViewCacheComponent>;
 
   configureTestBed({
-    declarations: [
-      ErrorPanelComponent,
-      InfoPanelComponent,
-      ViewCacheComponent,
-      WarningPanelComponent
-    ],
+    declarations: [ViewCacheComponent, AlertPanelComponent],
     imports: [AlertModule.forRoot()]
   });
 
index b0a806d0d47243013303b7cc80dba7a43e3aaff4..7370b07ae8b652a816aa254b0dc974fc5dee1043 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, Input, OnInit } from '@angular/core';
 
-import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
+import { ViewCacheStatus } from '../../enum/view-cache-status.enum';
 
 @Component({
   selector: 'cd-view-cache',
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.html
deleted file mode 100644 (file)
index 2592112..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<alert type="warning">
-  <table>
-    <tr>
-      <td rowspan="2" class="warning-panel-alert-icon">
-        <i [ngClass]="[icons.large3x, icons.warning]" class="alert-warning"
-           aria-hidden="true"></i>
-      </td>
-      <td class="warning-panel-alert-title">
-        {{ title }}
-      </td>
-    </tr>
-    <tr>
-      <td class="warning-panel-alert-text">
-        <ng-content></ng-content>
-      </td>
-    </tr>
-  </table>
-</alert>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.scss
deleted file mode 100644 (file)
index b47e386..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-.warning-panel-alert-icon {
-  vertical-align: top;
-  padding-right: 15px; // See @alert-padding in bootstrap/less/variables.less
-}
-.warning-panel-alert-title {
-  font-weight: bold;
-}
-.warning-panel-alert-text {
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.spec.ts
deleted file mode 100644 (file)
index 834aebe..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { AlertModule } from 'ngx-bootstrap/alert';
-
-import { configureTestBed } from '../../../../testing/unit-test-helper';
-import { WarningPanelComponent } from './warning-panel.component';
-
-describe('WarningPanelComponent', () => {
-  let component: WarningPanelComponent;
-  let fixture: ComponentFixture<WarningPanelComponent>;
-
-  configureTestBed({
-    declarations: [WarningPanelComponent],
-    imports: [AlertModule.forRoot()]
-  });
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(WarningPanelComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/warning-panel/warning-panel.component.ts
deleted file mode 100644 (file)
index e29e9fe..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Component, Input } from '@angular/core';
-import { Icons } from '../../../shared/enum/icons.enum';
-
-@Component({
-  selector: 'cd-warning-panel',
-  templateUrl: './warning-panel.component.html',
-  styleUrls: ['./warning-panel.component.scss']
-})
-export class WarningPanelComponent {
-  /**
-   * The title to be displayed. Defaults to 'Warning'.
-   * @type {string}
-   */
-  @Input()
-  title = 'Warning';
-
-  icons = Icons;
-}
index 1a74935ef9c043cdd177f358da99765117fae7fb..c7a8f894af06a2f6289f6e7e0c6d8e24f065145d 100644 (file)
@@ -1,5 +1,6 @@
-<cd-error-panel *ngIf="loadingError"
-                i18n>Failed to load data.</cd-error-panel>
+<cd-alert-panel type="error"
+                *ngIf="loadingError"
+                i18n>Failed to load data.</cd-alert-panel>
 
 <div class="dataTables_wrapper">
   <div class="dataTables_header clearfix"