Skip to content

Commit b244e4b

Browse files
committed
Add errors and warning to discovery report
Signed-off-by: Montse Ortega <mortegag@redhat.com>
1 parent 0282c03 commit b244e4b

File tree

5 files changed

+151
-18
lines changed

5 files changed

+151
-18
lines changed

src/migration-wizard/steps/discovery/DiscoveryStep.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import React from 'react';
22
import Humanize from 'humanize-plus';
3+
4+
import type {
5+
Datastore,
6+
InfraNetworksInner,
7+
MigrationIssuesInner,
8+
Source,
9+
} from '@migration-planner-ui/api-client/models';
310
import {
11+
Badge,
12+
Flex,
13+
FlexItem,
14+
Icon,
15+
Progress,
416
Stack,
517
StackItem,
6-
Icon,
718
Text,
819
TextContent,
920
TreeView,
1021
TreeViewDataItem,
11-
Badge,
12-
Flex,
13-
FlexItem,
14-
Progress,
1522
} from '@patternfly/react-core';
1623
import {
1724
CogsIcon,
@@ -24,19 +31,15 @@ import {
2431
NetworkIcon,
2532
VirtualMachineIcon,
2633
} from '@patternfly/react-icons';
27-
import { global_warning_color_100 as globalWarningColor100 } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
2834
import { global_danger_color_100 as globalDangerColor100 } from '@patternfly/react-tokens/dist/js/global_danger_color_100';
29-
import type {
30-
Datastore,
31-
InfraNetworksInner,
32-
MigrationIssuesInner,
33-
Source,
34-
} from '@migration-planner-ui/api-client/models';
35+
import { global_warning_color_100 as globalWarningColor100 } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
36+
3537
import { useDiscoverySources } from '../../contexts/discovery-sources/Context';
36-
import { ReportTable } from './ReportTable';
37-
import { ReportPieChart } from './ReportPieChart';
38-
import EnhancedDownloadButton from './EnhancedDownloadButton';
38+
3939
import { Dashboard } from './assessment-report/Dashboard';
40+
import EnhancedDownloadButton from './EnhancedDownloadButton';
41+
import { ReportPieChart } from './ReportPieChart';
42+
import { ReportTable } from './ReportTable';
4043

4144
export const DiscoveryStep: React.FC = () => {
4245
const discoverSourcesContext = useDiscoverySources();

src/migration-wizard/steps/discovery/ReportTable.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,37 @@ export namespace ReportTable {
99
fields: Array<keyof DataList[0]>;
1010
style?: React.CSSProperties;
1111
withoutBorder?: boolean;
12+
caption?: string;
1213
};
1314
}
1415

1516
export function ReportTable<DataItem>(
1617
props: ReportTable.Props<DataItem[]>,
17-
withoutBorder = false
18+
withoutBorder = false,
1819
): React.ReactNode {
19-
const { columns, data, fields, style } = props;
20+
const { columns, data, fields, style, caption } = props;
2021

2122
return (
2223
<Table
2324
variant="compact"
2425
borders={true}
25-
style={{ border: withoutBorder ? 'none':'1px solid lightgray', borderRight: 'none', ...style }}
26+
style={{
27+
border: withoutBorder ? 'none' : '1px solid lightgray',
28+
borderRight: 'none',
29+
...style,
30+
}}
2631
>
32+
{caption && (
33+
<caption style={{
34+
fontWeight: 'bold',
35+
fontSize: '14px',
36+
textAlign: 'left',
37+
padding: '8px 16px',
38+
color: '#151515'
39+
}}>
40+
{caption}
41+
</caption>
42+
)}
2743
<Thead>
2844
<Tr style={{ border: withoutBorder ? 'none':'1px solid lightgray'}}>
2945
{columns.map((name, index) => (

src/migration-wizard/steps/discovery/assessment-report/Dashboard.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ import {
1515
} from '@patternfly/react-core';
1616

1717
import { Datastores } from './Datastores';
18+
import { ErrorTable } from './ErrorTable';
1819
import { InfrastructureOverview } from './InfastructureOverview';
1920
import { NetworkTopology } from './NetworkTopology';
2021
import { OSDistribution } from './OSDistribution';
2122
import { StorageOverview } from './StorageOverview';
2223
import { VMMigrationStatus } from './VMMigrationStatus';
24+
import { WarningsTable } from './WarningsTable';
2325

2426
import './Dashboard.css';
2527

@@ -109,6 +111,22 @@ export const Dashboard: React.FC<Props> = ({
109111
</GalleryItem>
110112
</Gallery>
111113
</GridItem>
114+
<GridItem span={12}>
115+
<Gallery hasGutter minWidths={{ default: '300px', md: '45%' }}>
116+
<GalleryItem>
117+
<ErrorTable
118+
errors={vms.notMigratableReasons}
119+
isExportMode={isExportMode}
120+
/>
121+
</GalleryItem>
122+
<GalleryItem>
123+
<WarningsTable
124+
warnings={vms.migrationWarnings}
125+
isExportMode={isExportMode}
126+
/>
127+
</GalleryItem>
128+
</Gallery>
129+
</GridItem>
112130
</Grid>
113131
</PageSection>
114132
);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from 'react';
2+
3+
import { MigrationIssue } from '@migration-planner-ui/api-client/models';
4+
import { Card, CardBody, CardTitle, Icon } from '@patternfly/react-core';
5+
import { ExclamationCircleIcon } from '@patternfly/react-icons';
6+
import { global_danger_color_100 as globalDangerColor100 } from '@patternfly/react-tokens/dist/js/global_danger_color_100';
7+
8+
import { ReportTable } from '../ReportTable';
9+
10+
interface ErrorTableProps {
11+
errors: MigrationIssue[];
12+
isExportMode?: boolean;
13+
}
14+
15+
export const ErrorTable: React.FC<ErrorTableProps> = ({
16+
errors,
17+
isExportMode = false,
18+
}) => {
19+
const tableHeight = isExportMode ? '100%' : '250px';
20+
return (
21+
<Card className={isExportMode ? 'dashboard-card-print' : 'dashboard-card'}>
22+
<CardTitle>
23+
<Icon style={{ color: globalDangerColor100.value }}>
24+
<ExclamationCircleIcon />
25+
</Icon>{' '}
26+
Errors
27+
</CardTitle>
28+
<CardBody style={{ padding: 0 }}>
29+
<div
30+
style={{
31+
maxHeight: tableHeight,
32+
overflowY: 'auto',
33+
overflowX: 'auto',
34+
padding: 2,
35+
}}
36+
>
37+
<ReportTable<MigrationIssue>
38+
data={errors}
39+
columns={['Description', 'Total']}
40+
fields={['assessment', 'count']}
41+
withoutBorder
42+
caption="Virtual machine validations"
43+
/>
44+
</div>
45+
</CardBody>
46+
</Card>
47+
);
48+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from 'react';
2+
3+
import { MigrationIssue } from '@migration-planner-ui/api-client/models';
4+
import { Card, CardBody, CardTitle, Icon } from '@patternfly/react-core';
5+
import { ExclamationTriangleIcon } from '@patternfly/react-icons';
6+
import { global_warning_color_100 as globalWarningColor100 } from '@patternfly/react-tokens/dist/js/global_warning_color_100';
7+
8+
import { ReportTable } from '../ReportTable';
9+
10+
interface WarningsTableProps {
11+
warnings: MigrationIssue[];
12+
isExportMode?: boolean;
13+
}
14+
15+
export const WarningsTable: React.FC<WarningsTableProps> = ({
16+
warnings,
17+
isExportMode = false,
18+
}) => {
19+
const tableHeight = isExportMode ? '100%' : '250px';
20+
return (
21+
<Card className={isExportMode ? 'dashboard-card-print' : 'dashboard-card'}>
22+
<CardTitle>
23+
<Icon style={{ color: globalWarningColor100.value }}>
24+
<ExclamationTriangleIcon />
25+
</Icon>{' '}
26+
Warnings
27+
</CardTitle>
28+
<CardBody style={{ padding: 0 }}>
29+
<div
30+
style={{
31+
maxHeight: tableHeight,
32+
overflowY: 'auto',
33+
overflowX: 'auto',
34+
padding: 2,
35+
}}
36+
>
37+
<ReportTable<MigrationIssue>
38+
data={warnings}
39+
columns={['Description', 'Total']}
40+
fields={['assessment', 'count']}
41+
withoutBorder
42+
caption="Virtual machine validations"
43+
/>
44+
</div>
45+
</CardBody>
46+
</Card>
47+
);
48+
};

0 commit comments

Comments
 (0)