From: Volker Theile Date: Fri, 20 Apr 2018 10:13:40 +0000 (+0200) Subject: mgr/dashboard: Add cd-error-panel component to display error messages. X-Git-Tag: v13.1.0~93^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3fc274867a1033fd4307d35b99bfcb1d07dfdb1c;p=ceph.git mgr/dashboard: Add cd-error-panel component to display error messages. Signed-off-by: Volker Theile --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts index 1c0c10ffcb3e..97f82944fb16 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts @@ -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 index 000000000000..392a5b598715 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.html @@ -0,0 +1,23 @@ +
+
+

+ {{ title }} +

+
+
+ +
+ +
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 index 000000000000..e69de29bb2d1 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 index 000000000000..563bf529eca3 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.spec.ts @@ -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; + + 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 index 000000000000..497de0397efb --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/error-panel/error-panel.component.ts @@ -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} + */ + @Output() backAction = new EventEmitter(); +}