-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HomeHealthSummary storybook (#1529)
* Add HomeHealthSummary storybook * Adapt HomeHealthSummary tests * Get back resultEnum as it does not have unknown value * Add unclustered story * Move render to default export * Add empty story
- Loading branch information
Showing
9 changed files
with
128 additions
and
48 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
72 changes: 72 additions & 0 deletions
72
assets/js/components/HealthSummary/HomeHealthSummary.stories.jsx
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,72 @@ | ||
import React from 'react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
|
||
import { healthSummaryFactory } from '@lib/test-utils/factories'; | ||
|
||
import HomeHealthSummary from './HomeHealthSummary'; | ||
|
||
const randomSummary = healthSummaryFactory.buildList(3); | ||
const healthySummary = healthSummaryFactory.buildList(3, { | ||
clustersHealth: 'passing', | ||
databaseHealth: 'passing', | ||
hostsHealth: 'passing', | ||
sapsystemHealth: 'passing', | ||
}); | ||
const unClusteredSummary = healthSummaryFactory.buildList(3, { | ||
clusterId: null, | ||
clustersHealth: 'unknown', | ||
databaseHealth: 'passing', | ||
hostsHealth: 'passing', | ||
sapsystemHealth: 'passing', | ||
}); | ||
|
||
function ContainerWrapper({ children }) { | ||
return ( | ||
<div className="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">{children}</div> | ||
); | ||
} | ||
|
||
export default { | ||
title: 'HomeHealthSummary', | ||
components: HomeHealthSummary, | ||
decorators: [ | ||
(Story) => ( | ||
<MemoryRouter> | ||
<Story /> | ||
</MemoryRouter> | ||
), | ||
], | ||
render: (args) => ( | ||
<ContainerWrapper> | ||
<HomeHealthSummary {...args} /> | ||
</ContainerWrapper> | ||
), | ||
}; | ||
|
||
export const Random = { | ||
args: { | ||
sapSystemsHealth: randomSummary, | ||
loading: false, | ||
}, | ||
}; | ||
|
||
export const Empty = { | ||
args: { | ||
...Random.args, | ||
sapSystemsHealth: [], | ||
}, | ||
}; | ||
|
||
export const Healthy = { | ||
args: { | ||
...Random.args, | ||
sapSystemsHealth: healthySummary, | ||
}, | ||
}; | ||
|
||
export const UnClustered = { | ||
args: { | ||
...Random.args, | ||
sapSystemsHealth: unClusteredSummary, | ||
}, | ||
}; |
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
13 changes: 13 additions & 0 deletions
13
assets/js/components/HealthSummary/HomeHealthSummaryPage.jsx
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,13 @@ | ||
import React from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
import HomeHealthSummary from './HomeHealthSummary'; | ||
|
||
export function HomeHealthSummaryPage() { | ||
const { loading, sapSystemsHealth } = useSelector( | ||
(state) => state.sapSystemsHealthSummary | ||
); | ||
|
||
return ( | ||
<HomeHealthSummary sapSystemsHealth={sapSystemsHealth} loading={loading} /> | ||
); | ||
} |
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,5 +1,5 @@ | ||
import HealthSummary from './HealthSummary'; | ||
|
||
export { HomeHealthSummary } from './HomeHealthSummary'; | ||
export { HomeHealthSummaryPage } from './HomeHealthSummaryPage'; | ||
|
||
export default HealthSummary; |
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,9 +1,9 @@ | ||
import React from 'react'; | ||
|
||
import { HomeHealthSummary } from '@components/HealthSummary'; | ||
import { HomeHealthSummaryPage } from '@components/HealthSummary'; | ||
|
||
function Home() { | ||
return <HomeHealthSummary />; | ||
return <HomeHealthSummaryPage />; | ||
} | ||
|
||
export default Home; |
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