From e65ad8bff3a76e9a4518096edf3a6859ce8f25f0 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Mon, 14 May 2018 14:27:50 +0200 Subject: [PATCH] mgr/dashboard: Add info panel component Signed-off-by: Volker Theile (cherry picked from commit d1b179d757aac258d3ce0abc162ed8f6550a535a) --- .../shared/components/components.module.ts | 3 ++ .../info-panel/info-panel.component.html | 18 ++++++++++++ .../info-panel/info-panel.component.scss | 9 ++++++ .../info-panel/info-panel.component.spec.ts | 28 +++++++++++++++++++ .../info-panel/info-panel.component.ts | 14 ++++++++++ 5 files changed, 72 insertions(+) create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.html create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.scss create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.spec.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.ts 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 97f82944fb160..0c5ba7337621a 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 @@ -9,6 +9,7 @@ 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 { InfoPanelComponent } from './info-panel/info-panel.component'; import { LoadingPanelComponent } from './loading-panel/loading-panel.component'; import { ModalComponent } from './modal/modal.component'; import { SparklineComponent } from './sparkline/sparkline.component'; @@ -37,6 +38,7 @@ import { ViewCacheComponent } from './view-cache/view-cache.component'; UsageBarComponent, ErrorPanelComponent, LoadingPanelComponent, + InfoPanelComponent, ModalComponent, DeletionModalComponent ], @@ -48,6 +50,7 @@ import { ViewCacheComponent } from './view-cache/view-cache.component'; SubmitButtonComponent, ErrorPanelComponent, LoadingPanelComponent, + InfoPanelComponent, UsageBarComponent ], entryComponents: [ 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 new file mode 100644 index 0000000000000..27b5fd676b813 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.html @@ -0,0 +1,18 @@ + + + + + + + + + +
+ + + {{ title }} +
+ +
+
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 new file mode 100644 index 0000000000000..1d53f2f34e92d --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.scss @@ -0,0 +1,9 @@ +.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; +} +.info-panel-alert-text { +} 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 new file mode 100644 index 0000000000000..319d431945964 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.spec.ts @@ -0,0 +1,28 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AlertModule } from 'ngx-bootstrap'; + +import { InfoPanelComponent } from './info-panel.component'; + +describe('InfoPanelComponent', () => { + let component: InfoPanelComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InfoPanelComponent ], + imports: [ AlertModule.forRoot() ] + }) + .compileComponents(); + })); + + 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 new file mode 100644 index 0000000000000..9c728164d1f25 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.ts @@ -0,0 +1,14 @@ +import { Component, Input } from '@angular/core'; + +@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 = 'Information'; +} -- 2.39.5