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.
- Loading branch information
1 parent
a96be3a
commit 9d5d4d5
Showing
31 changed files
with
279 additions
and
211 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
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
22 changes: 22 additions & 0 deletions
22
src/components/ClusterOverview/Compliance/ComplianceBody.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,22 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon } from 'patternfly-react'; | ||
|
||
const healtyIcon = <Icon type="fa" size="2x" name="check-circle" className="kubevirt-ocs-health__icon--ok" />; | ||
|
||
const errorIcon = <Icon type="fa" size="2x" name="exclamation-triangle" className="kubevirt-ocs-health__icon--error" />; | ||
|
||
const ComplianceBody = ({ data }) => ( | ||
<React.Fragment> | ||
<div className="kubevirt-ocs-health__icon"> | ||
{data.healthy ? healtyIcon : errorIcon} | ||
<span className="kubevirt-ocs-health__row-status-item-text">{data.message}</span> | ||
</div> | ||
</React.Fragment> | ||
); | ||
|
||
ComplianceBody.propTypes = { | ||
data: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default ComplianceBody; |
8 changes: 7 additions & 1 deletion
8
src/components/ClusterOverview/Compliance/fixtures/Compliance.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
10 changes: 10 additions & 0 deletions
10
src/components/ClusterOverview/Compliance/fixtures/ComplianceBody.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,10 @@ | ||
import { complianceData } from './Compliance.fixture'; | ||
|
||
import ComplianceBody from '../ComplianceBody'; | ||
|
||
export default [ | ||
{ | ||
component: ComplianceBody, | ||
props: { ...complianceData }, | ||
}, | ||
]; |
14 changes: 14 additions & 0 deletions
14
src/components/ClusterOverview/Compliance/tests/ComplianceBody.test.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,14 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
|
||
import { Compliance } from '../Compliance'; | ||
import { default as ComplianceFixtures } from '../fixtures/Compliance.fixture'; | ||
|
||
const testComplianceOverview = () => <Compliance {...ComplianceFixtures[0].props} />; | ||
|
||
describe('<Compliance />', () => { | ||
it('renders correctly', () => { | ||
const component = render(testComplianceOverview()); | ||
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
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
10 changes: 0 additions & 10 deletions
10
src/components/ClusterOverview/Health/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,3 @@ | ||
export const HEALTHY = 'Cluster is Healthy'; | ||
export const ERROR = 'Cluster health is in Error State'; | ||
export const UNKNOWN = 'Cannot get Cluster health'; |
14 changes: 0 additions & 14 deletions
14
src/components/ClusterOverview/Health/tests/HealthBody.test.js
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/components/ClusterOverview/Health/tests/__snapshots__/Health.test.js.snap
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/components/ClusterOverview/Health/tests/__snapshots__/HealthBody.test.js.snap
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
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 |
---|---|---|
@@ -1,12 +1,2 @@ | ||
export { ClusterOverview } from './ClusterOverview'; | ||
export { ClusterOverviewContext } from './ClusterOverviewContext'; | ||
|
||
// TODO move all these mocked data to component fixtures once they are not needed in web-ui | ||
// we do not include fixture files in build so we cannot reuse their mocked data | ||
export const complianceData = { | ||
data: { | ||
healthy: true, | ||
message: 'All nodes compliant', | ||
}, | ||
loaded: true, | ||
}; |
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-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,24 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon } from 'patternfly-react'; | ||
|
||
export const HealthItem = ({ icon, classname, message }) => ( | ||
<React.Fragment> | ||
<div className="kubevirt-ocs-health__icon"> | ||
<Icon type="fa" size="2x" name={icon} className={`kubevirt-ocs-health__icon--${classname}`} /> | ||
<span className="kubevirt-ocs-health__row-status-item-text">{message}</span> | ||
</div> | ||
</React.Fragment> | ||
); | ||
|
||
HealthItem.defaultProps = { | ||
message: 'Cant get health', | ||
icon: 'exclamation-triangle', | ||
classname: 'error', | ||
}; | ||
|
||
HealthItem.propTypes = { | ||
message: PropTypes.string, | ||
icon: PropTypes.string, | ||
classname: PropTypes.string, | ||
}; |
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', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.