Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SAP Instances status icon interactive #961

Merged
merged 3 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion assets/js/components/HealthSummary/HomeHealthSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ const healthSummaryTableConfig = {
title: 'SAP Instances',
key: 'sapsystemHealth',
className: 'text-center',
render: (content) => <HealthIcon health={content} centered={true} />,
render: (content, item) => (
<Link to={`/sap_systems/${item.id}`}>
{' '}
EMaksy marked this conversation as resolved.
Show resolved Hide resolved
<HealthIcon health={content} centered={true}>
{' '}
</HealthIcon>
</Link>
),
},
{
title: 'Database',
Expand Down
21 changes: 21 additions & 0 deletions assets/js/components/HealthSummary/HomeHealthSummary.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ const homeHealthSummaryActionPayload = [
}),
];

describe('HomeHealthSummary component', () => {
it('should have a clickable SAP INSTANCE icon with link to the belonging instance', () => {
const [StatefulHomeHealthSummary, store] = withState(<HomeHealthSummary />);
const { container } = renderWithRouter(StatefulHomeHealthSummary);
const [{ id }] = homeHealthSummaryActionPayload;

act(() => {
store.dispatch(
setHealthSummary(keysToCamel(homeHealthSummaryActionPayload))
);
store.dispatch(stopHealthSummaryLoading());
});

expect(
container
.querySelector(':nth-child(1) > :nth-child(1) > a')
.getAttribute('href')
).toContain(`/sap_systems/${id}`);
});
});

describe('HomeHealthSummary component', () => {
it('should have a working link to the passing checks in the overview component', () => {
const [StatefulHomeHealthSummary, store] = withState(<HomeHealthSummary />);
Expand Down
2 changes: 1 addition & 1 deletion assets/js/lib/test-utils/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const healthSummaryFactory = Factory.define(() => ({
hostsHealth: healthEnum,
id: faker.datatype.uuid(),
sapsystemHealth: healthEnum,
SID: faker.random.alphaNumeric({
sid: faker.random.alphaNumeric({
length: 3,
casing: 'upper',
}),
Expand Down
14 changes: 8 additions & 6 deletions assets/js/state/healthSummary.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createSlice } from '@reduxjs/toolkit';

// interface SapSystemHealthSummary {
// id: string,
// sid: string,
// sapsystemHealth: string,
// databaseHealth: string,
// clustersHealth: string,
// hostsHealth: string
// clusterId: string,
// clustersHealth: string,
// databaseHealth: string,
// databaseId: string,
// hostsHealth: string,
// id: string,
// sapsystemHealth: string,
// sid: string,
// }

const initialState = {
Expand Down