This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HealthCard-Generic-Storage-Overview (#342)
- Loading branch information
1 parent
e59f281
commit 8534d65
Showing
18 changed files
with
238 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.kubevirt-dashboard-health__body { | ||
max-height: 100px; | ||
} | ||
|
||
.kubevirt-dashboard-health__icon { | ||
font-size: 1.333em; | ||
line-height: 1.333em; | ||
display: inline-flex; | ||
align-items: center; | ||
} | ||
|
||
.kubevirt-dashboard-health__icon--ok { | ||
color: yellowgreen; | ||
} | ||
|
||
.kubevirt-dashboard-health__icon--warning { | ||
color: goldenrod; | ||
} | ||
|
||
.kubevirt-dashboard-health__icon--error { | ||
color: red; | ||
} | ||
|
||
.kubevirt-dashboard-health__row-status-item-text { | ||
margin-left: 1em; | ||
font-size: 1em; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const HealthBody = ({ children }) => <div className="kubevirt-dashboard-health__items">{children}</div>; | ||
|
||
HealthBody.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon } from 'patternfly-react'; | ||
|
||
import { InlineLoading } from '../../Loading'; | ||
|
||
export const HealthItem = ({ icon, classname, message, isLoading, LoadingComponent }) => { | ||
const description = isLoading ? <LoadingComponent /> : message; | ||
return ( | ||
<div className="kubevirt-dashboard-health__icon"> | ||
<Icon type="fa" size="2x" name={icon} className={`kubevirt-dashboard-health__icon--${classname}`} /> | ||
<span className="kubevirt-dashboard-health__row-status-item-text">{description}</span> | ||
</div> | ||
); | ||
}; | ||
|
||
HealthItem.defaultProps = { | ||
LoadingComponent: InlineLoading, | ||
isLoading: false, | ||
}; | ||
|
||
HealthItem.propTypes = { | ||
message: PropTypes.string.isRequired, | ||
icon: PropTypes.string.isRequired, | ||
classname: PropTypes.string.isRequired, | ||
LoadingComponent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), | ||
isLoading: PropTypes.bool, | ||
}; |
12 changes: 12 additions & 0 deletions
12
src/components/Dashboard/Health/fixtures/HealthBody.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
import { HealthBody } from '../HealthBody'; | ||
import { HealthItem } from '../HealthItem'; | ||
import { default as HealthItemFixture } from './HealthItem.fixture'; | ||
|
||
export default { | ||
component: HealthBody, | ||
props: { | ||
children: <HealthItem {...HealthItemFixture[0].props} />, | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/components/Dashboard/Health/fixtures/HealthItem.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { HealthItem } from '../HealthItem'; | ||
|
||
export default [ | ||
{ | ||
component: HealthItem, | ||
props: { | ||
data: { | ||
healthy: { | ||
message: 'OCS is Healthy', | ||
iconname: 'check-circle', | ||
classname: 'ok', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { HealthBody } from '../HealthBody'; | ||
import { default as HealthItemFixture } from '../fixtures/HealthItem.fixture'; | ||
import { HealthItem } from '../HealthItem'; | ||
|
||
const testHealthBody = () => ( | ||
<HealthBody> | ||
<HealthItem {...HealthItemFixture[0].props} /> | ||
</HealthBody> | ||
); | ||
|
||
describe('<HealthBody />', () => { | ||
it('renders correctly', () => { | ||
const component = shallow(testHealthBody()); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { HealthItem } from '../HealthItem'; | ||
import { default as HealthItemFixtures } from '../fixtures/HealthItem.fixture'; | ||
|
||
// eslint-disable-next-line react/prop-types | ||
const testHealthItem = ({ props }) => <HealthItem {...props} />; | ||
|
||
describe('<HealthItem />', () => { | ||
it('renders correctly', () => { | ||
HealthItemFixtures.forEach(fixture => { | ||
const component = shallow(testHealthItem(fixture)); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
src/components/Dashboard/Health/tests/__snapshots__/HealthBody.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<HealthBody /> renders correctly 1`] = ` | ||
<div | ||
className="kubevirt-health__items" | ||
> | ||
<HealthItem | ||
classname="error" | ||
data={ | ||
Object { | ||
"healthy": Object { | ||
"classname": "ok", | ||
"iconname": "check-circle", | ||
"message": "OCS is Healthy", | ||
}, | ||
} | ||
} | ||
icon="exclamation-triangle" | ||
message="Cant get health" | ||
/> | ||
</div> | ||
`; |
21 changes: 21 additions & 0 deletions
21
src/components/Dashboard/Health/tests/__snapshots__/HealthItem.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<HealthItem /> renders correctly 1`] = ` | ||
<Fragment> | ||
<div | ||
className="kubevirt-ocs-health__icon" | ||
> | ||
<Icon | ||
className="kubevirt-ocs-health__icon--error" | ||
name="exclamation-triangle" | ||
size="2x" | ||
type="fa" | ||
/> | ||
<span | ||
className="kubevirt-ocs-health__row-status-item-text" | ||
> | ||
Cant get health | ||
</span> | ||
</div> | ||
</Fragment> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/components/StorageOverview/OCSHealth/fixtures/HealthBody.fixture.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const HEALTHY = 'OCS is Healthy'; | ||
export const DEGRADED = 'OCS health is Degraded'; | ||
export const ERROR = 'OCS health is in Error State'; | ||
export const UNKNOWN = 'Not available'; |
14 changes: 0 additions & 14 deletions
14
src/components/StorageOverview/OCSHealth/tests/HealthBody.test.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.