]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add info panel component
authorVolker Theile <vtheile@suse.com>
Mon, 14 May 2018 12:27:50 +0000 (14:27 +0200)
committerVolker Theile <vtheile@suse.com>
Mon, 14 May 2018 12:40:55 +0000 (14:40 +0200)
Signed-off-by: Volker Theile <vtheile@suse.com>
(cherry picked from commit d1b179d757aac258d3ce0abc162ed8f6550a535a)

src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.html [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.scss [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/info-panel/info-panel.component.ts [new file with mode: 0644]

index 97f82944fb160bafe241248894fb9cacae42d04f..0c5ba7337621a1fdd67d384e2a36c00bdde93e99 100644 (file)
@@ -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 (file)
index 0000000..27b5fd6
--- /dev/null
@@ -0,0 +1,18 @@
+<alert type="info">
+  <table>
+    <tr>
+      <td rowspan="2" class="info-panel-alert-icon">
+        <i class="fa fa-3x fa-info-circle 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
new file mode 100644 (file)
index 0000000..1d53f2f
--- /dev/null
@@ -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 (file)
index 0000000..319d431
--- /dev/null
@@ -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<InfoPanelComponent>;
+
+  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 (file)
index 0000000..9c72816
--- /dev/null
@@ -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';
+}