-
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.
- Loading branch information
Showing
7 changed files
with
83 additions
and
19 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
56 changes: 56 additions & 0 deletions
56
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,56 @@ | ||
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', | ||
}); | ||
|
||
export default { | ||
title: 'HomeHealthSummary', | ||
components: HomeHealthSummary, | ||
decorators: [ | ||
(Story) => ( | ||
<MemoryRouter> | ||
<Story /> | ||
</MemoryRouter> | ||
), | ||
], | ||
}; | ||
|
||
function ContainerWrapper({ children }) { | ||
return ( | ||
<div className="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">{children}</div> | ||
); | ||
} | ||
|
||
export const Random = { | ||
args: { | ||
sapSystemsHealth: randomSummary, | ||
loading: false, | ||
}, | ||
render: (args) => ( | ||
<ContainerWrapper> | ||
<HomeHealthSummary {...args} /> | ||
</ContainerWrapper> | ||
), | ||
}; | ||
|
||
export const Healthy = { | ||
args: { | ||
...Random.args, | ||
sapSystemsHealth: healthySummary, | ||
}, | ||
render: (args) => ( | ||
<ContainerWrapper> | ||
<HomeHealthSummary {...args} /> | ||
</ContainerWrapper> | ||
), | ||
}; |
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