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

[UI] Data Insight Layout looks broken in case of large number of assets #13803 #13921

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('Data Insight feature', () => {
interceptURL('GET', '/api/v1/apps?limit=*', 'apps');
interceptURL(
'GET',
'/api/v1/apps/name/DataInsightsApplication?fields=owner,pipelines',
'/api/v1/apps/name/DataInsightsApplication?*',
'dataInsightsApplication'
);
interceptURL(
Expand All @@ -128,7 +128,7 @@ describe('Data Insight feature', () => {
cy.get('[data-menu-id*="integrations.apps"]').scrollIntoView().click();
verifyResponseStatusCode('@apps', 200);
cy.get(
'[data-testid="data-insights-card"] [data-testid="config-btn"]'
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@dataInsightsApplication', 200);
cy.get('[data-testid="deploy-button"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Data Insight settings page should work properly', () => {
'triggerPipeline'
);
cy.get(
'[data-testid="data-insights-card"] [data-testid="config-btn"]'
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@getDataInsightDetails', 200);
cy.get('[data-testid="deploy-button"]').click();
Expand All @@ -67,7 +67,7 @@ describe('Data Insight settings page should work properly', () => {
);
interceptURL('PATCH', '/api/v1/apps/*', 'updateApplication');
cy.get(
'[data-testid="data-insights-card"] [data-testid="config-btn"]'
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@getDataInsightDetails', 200);
cy.get('[data-testid="edit-button"]').click();
Expand All @@ -93,24 +93,26 @@ describe('Data Insight settings page should work properly', () => {
'deleteApplication'
);
cy.get(
'[data-testid="data-insights-card"] [data-testid="config-btn"]'
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@getDataInsightDetails', 200);
cy.get('[data-testid="manage-button"]').click();
cy.get('[data-testid="uninstall-button-title"]').click();
cy.get('[data-testid="save-button"]').click();
verifyResponseStatusCode('@deleteApplication', 200);
verifyResponseStatusCode('@getApplications', 200);
cy.get('[data-testid="data-insights-card"]').should('not.exist');
cy.get('[data-testid="data-insights-application-card"]').should(
'not.exist'
);
});

it('Install application', () => {
interceptURL('GET', '/api/v1/apps/marketplace?limit=*', 'getMarketPlace');
interceptURL('POST', '/api/v1/apps/install', 'installApplication');
interceptURL('POST', '/api/v1/apps', 'installApplication');
cy.get('[data-testid="add-application"]').click();
verifyResponseStatusCode('@getMarketPlace', 200);
cy.get(
'[data-testid="data-insights-card"] [data-testid="config-btn"]'
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
).click();
cy.get('[data-testid="install-application"]').click();
cy.get('[data-testid="save-button"]').click();
Expand All @@ -119,6 +121,8 @@ describe('Data Insight settings page should work properly', () => {
cy.get('[data-testid="deploy-button"]').click();
verifyResponseStatusCode('@installApplication', 201);
verifyResponseStatusCode('@getApplications', 200);
cy.get('[data-testid="data-insights-card"]').should('be.visible');
cy.get('[data-testid="data-insights-application-card"]').should(
'be.visible'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ApplicationCard = ({
className,
'application-card card-body-border-none'
)}
data-testid={`${kebabCase(title)}-card`}>
data-testid={`${kebabCase(appName)}-card`}>
<div className="d-flex items-center gap-3">
<div className="application-logo">
<AppLogo appName={appName} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
BAR_CHART_MARGIN,
DATA_INSIGHT_GRAPH_COLORS,
DI_STRUCTURE,
GRAPH_HEIGHT,
} from '../../constants/DataInsight.constants';
import { DataReportIndex } from '../../generated/dataInsight/dataInsightChart';
import { DataInsightChartType } from '../../generated/dataInsight/dataInsightChartResult';
Expand Down Expand Up @@ -106,7 +107,7 @@ const DailyActiveUsersChart: FC<Props> = ({ chartFilter, selectedDays }) => {
{dailyActiveUsers.length ? (
<Row gutter={DI_STRUCTURE.rowContainerGutter}>
<Col span={DI_STRUCTURE.leftContainerSpan}>
<ResponsiveContainer debounce={1} minHeight={400}>
<ResponsiveContainer debounce={1} height={GRAPH_HEIGHT}>
<LineChart data={data} margin={BAR_CHART_MARGIN}>
<CartesianGrid
stroke={GRAPH_BACKGROUND_COLOR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
.ant-card-head {
border-bottom: 1px solid @border-color;
}
.custom-data-insight-tooltip-container {
max-height: 250px;
overflow-y: auto;
}
}
.ant-card-body {
padding: 16px 16px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jest.mock('../../utils/DataInsightUtils', () => ({
getGraphDataByEntityType: jest
.fn()
.mockImplementation(() => DUMMY_GRAPH_DATA),
sortEntityByValue: jest.fn().mockImplementation((entities) => entities),
}));
jest.mock('./EntitySummaryProgressBar.component', () => {
return jest.fn().mockImplementation(({ label, entity }) => (
Expand All @@ -58,40 +59,44 @@ jest.mock('react-i18next', () => ({
describe('Test DescriptionInsight Component', () => {
it('Should render the graph', async () => {
await act(async () => {
const { container } = render(<DescriptionInsight {...mockProps} />);
const card = screen.getByTestId('entity-description-percentage-card');
render(<DescriptionInsight {...mockProps} />);
});
const card = await screen.findByTestId(
'entity-description-percentage-card'
);

const graph = queryByAttribute(
'id',
container,
`${mockProps.dataInsightChartName}-graph`
);
const graph = queryByAttribute(
'id',
card,
`${mockProps.dataInsightChartName}-graph`
);

expect(card).toBeInTheDocument();
expect(graph).toBeInTheDocument();
});
expect(card).toBeInTheDocument();
expect(graph).toBeInTheDocument();
});

it('Should render the graph and progress bar even if one entity dont have values', async () => {
(getGraphDataByEntityType as jest.Mock).mockImplementationOnce(
() => DUMMY_GRAPH_DATA_WITH_MISSING_ENTITY
);
await act(async () => {
const { container } = render(<DescriptionInsight {...mockProps} />);
const card = screen.getByTestId('entity-description-percentage-card');
render(<DescriptionInsight {...mockProps} />);
});
const card = await screen.findByTestId(
'entity-description-percentage-card'
);

const graph = queryByAttribute(
'id',
container,
`${mockProps.dataInsightChartName}-graph`
);
const missingEntityValue = await screen.findByTestId('Table');
const graph = queryByAttribute(
'id',
card,
`${mockProps.dataInsightChartName}-graph`
);
const missingEntityValue = await screen.findByTestId('Table');

expect(card).toBeInTheDocument();
expect(graph).toBeInTheDocument();
expect(missingEntityValue).toBeInTheDocument();
expect(missingEntityValue.textContent).toBe('0');
});
expect(card).toBeInTheDocument();
expect(graph).toBeInTheDocument();
expect(missingEntityValue).toBeInTheDocument();
expect(missingEntityValue.textContent).toBe('0');
});

it('Should fetch data based on dataInsightChartName props', async () => {
Expand Down
Loading
Loading