From: Patrick Seidensal Date: Fri, 13 Sep 2019 10:10:05 +0000 (+0200) Subject: mgr/dashboard: add smart self report summary to details of osd-smart-list X-Git-Tag: v15.1.0~1350^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=87136e61b27ec82008c5144145a3043342edd614;p=ceph-ci.git mgr/dashboard: add smart self report summary to details of osd-smart-list Fixes: https://tracker.ceph.com/issues/41774 Signed-off-by: Patrick Seidensal --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.html index d5e3fe1688a..31a7bb8374c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.html @@ -9,6 +9,24 @@ {{ device.value.userMessage }} + + + {{ device.value.smart.data.self_test.status.string }} + + + + + {{ device.value.smart.data.self_test.status.string }} + + @@ -18,7 +36,7 @@ - diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.spec.ts index c003d68e67e..826728477c4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.spec.ts @@ -1,7 +1,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { SimpleChange, SimpleChanges } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabsModule } from 'ngx-bootstrap/tabs'; +import { By } from '@angular/platform-browser'; +import { TabsetComponent, TabsetConfig, TabsModule } from 'ngx-bootstrap/tabs'; import _ = require('lodash'); import { of } from 'rxjs'; @@ -62,7 +63,7 @@ describe('OsdSmartListComponent', () => { configureTestBed({ declarations: [OsdSmartListComponent], imports: [TabsModule, SharedModule, HttpClientTestingModule], - providers: [i18nProviders] + providers: [i18nProviders, TabsetComponent, TabsetConfig] }); beforeEach(() => { @@ -103,4 +104,26 @@ describe('OsdSmartListComponent', () => { expect(component.data).toEqual({}); expect(component.incompatible).toBeTruthy(); }); + + it('should display info panel for passed self test', () => { + initializeComponentWithData(); + fixture.detectChanges(); + const alertPanel = fixture.debugElement.query(By.css('cd-alert-panel')); + expect(component.incompatible).toBe(false); + expect(component.loading).toBe(false); + expect(alertPanel.attributes.size).toBe('slim'); + expect(alertPanel.attributes.title).toBe('SMART overall-health self-assessment test result'); + expect(alertPanel.attributes.type).toBe('info'); + }); + + it('should display warning panel for failed self test', () => { + initializeComponentWithData(patchData('ata_smart_data.self_test.status.passed', false)); + fixture.detectChanges(); + const alertPanel = fixture.debugElement.query(By.css('cd-alert-panel')); + expect(component.incompatible).toBe(false); + expect(component.loading).toBe(false); + expect(alertPanel.attributes.size).toBe('slim'); + expect(alertPanel.attributes.title).toBe('SMART overall-health self-assessment test result'); + expect(alertPanel.attributes.type).toBe('warning'); + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.ts index 26f0965ae98..24ae7a0436c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-smart-list/osd-smart-list.component.ts @@ -79,7 +79,10 @@ export class OsdSmartListComponent implements OnInit, OnChanges { // Build result result[deviceId] = { info: info, - smart: smartData.ata_smart_attributes, + smart: { + attributes: smartData.ata_smart_attributes, + data: smartData.ata_smart_data + }, device: info.device.name, identifier: info.serial_number }; 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 index a4c22848935..490164b22e1 100644 --- 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 @@ -1,20 +1,39 @@ - - - - - - - + + + + + + + + + + + + + + + +
- - {{ title }}
- -
+ + {{ title }}
+ +
+ + {{ title }} + +
+ + + +