]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Add cd-error-panel component to display error messages.
authorVolker Theile <vtheile@suse.com>
Fri, 20 Apr 2018 10:13:40 +0000 (12:13 +0200)
committerVolker Theile <vtheile@suse.com>
Wed, 25 Apr 2018 11:02:32 +0000 (13:02 +0200)
Signed-off-by: Volker Theile <vtheile@suse.com>
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 [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.scss [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.ts [new file with mode: 0644]

index 1c0c10ffcb3e20aeef11c6553a78ab4f32139cbd..97f82944fb160bafe241248894fb9cacae42d04f 100644 (file)
@@ -7,6 +7,7 @@ import { AlertModule, ModalModule, PopoverModule, TooltipModule } from 'ngx-boot
 
 import { PipesModule } from '../pipes/pipes.module';
 import { DeletionModalComponent } from './deletion-modal/deletion-modal.component';
+import { ErrorPanelComponent } from './error-panel/error-panel.component';
 import { HelperComponent } from './helper/helper.component';
 import { LoadingPanelComponent } from './loading-panel/loading-panel.component';
 import { ModalComponent } from './modal/modal.component';
@@ -34,6 +35,7 @@ import { ViewCacheComponent } from './view-cache/view-cache.component';
     HelperComponent,
     SubmitButtonComponent,
     UsageBarComponent,
+    ErrorPanelComponent,
     LoadingPanelComponent,
     ModalComponent,
     DeletionModalComponent
@@ -44,6 +46,7 @@ import { ViewCacheComponent } from './view-cache/view-cache.component';
     SparklineComponent,
     HelperComponent,
     SubmitButtonComponent,
+    ErrorPanelComponent,
     LoadingPanelComponent,
     UsageBarComponent
   ],
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
new file mode 100644 (file)
index 0000000..392a5b5
--- /dev/null
@@ -0,0 +1,23 @@
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <h3 class="panel-title">
+      <i class="fa fa-exclamation-triangle fa-fw icon-danger"
+         aria-hidden="true"></i> {{ title }}
+    </h3>
+  </div>
+  <div class="panel-body">
+    <ng-content></ng-content>
+  </div>
+  <div class="panel-footer"
+       *ngIf="backAction.observers.length > 0">
+    <div class="button-group text-right">
+      <button class="btn btn-sm btn-default tc_backButton"
+              type="button"
+              (click)="backAction.emit()"
+              autofocus
+              i18n>
+        Back
+      </button>
+    </div>
+  </div>
+</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
new file mode 100644 (file)
index 0000000..e69de29
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
new file mode 100644 (file)
index 0000000..563bf52
--- /dev/null
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ErrorPanelComponent } from './error-panel.component';
+
+describe('ErrorPanelComponent', () => {
+  let component: ErrorPanelComponent;
+  let fixture: ComponentFixture<ErrorPanelComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ ErrorPanelComponent ]
+    })
+    .compileComponents();
+  }));
+
+  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
new file mode 100644 (file)
index 0000000..497de03
--- /dev/null
@@ -0,0 +1,21 @@
+import { Component, EventEmitter, Input, Output } from '@angular/core';
+
+@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();
+}