Skip to content

Commit 3489422

Browse files
dwesolowMarkRedeman
authored andcommitted
🚀 feat(inspect): Add dataset list (#2971)
* feat: Display placeholders for images * refactor: Fix scrollbar * chore: Remove learn more
1 parent e04ef66 commit 3489422

File tree

8 files changed

+102
-3
lines changed

8 files changed

+102
-3
lines changed

app/ui/src/assets/icons/image.svg

Lines changed: 5 additions & 0 deletions
Loading

app/ui/src/assets/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ export { ReactComponent as ThreeDotsCircle } from './three-dots-circle.svg';
1818
export { ReactComponent as VideoFile } from './video-file.svg';
1919
export { ReactComponent as Webcam } from './webcam.svg';
2020
export { ReactComponent as Webhook } from './webhook.svg';
21+
export { ReactComponent as Image } from './image.svg';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Image } from '@geti-inspect/icons';
2+
import { Flex, View } from '@geti/ui';
3+
4+
import styles from './dataset-item.module.scss';
5+
6+
const DatasetItemPlaceholder = () => {
7+
return (
8+
<Flex justifyContent={'center'} alignItems={'center'} UNSAFE_className={styles.datasetItemPlaceholder}>
9+
<Flex>
10+
<Image />
11+
</Flex>
12+
</Flex>
13+
);
14+
};
15+
16+
interface DatasetItemProps {
17+
mediaItem: string | undefined;
18+
}
19+
20+
export const DatasetItem = ({ mediaItem }: DatasetItemProps) => {
21+
if (mediaItem === undefined) {
22+
return <DatasetItemPlaceholder />;
23+
}
24+
25+
return <View>Item</View>;
26+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.datasetItemPlaceholder {
2+
border: 1px dashed var(--spectrum-global-color-gray-700);
3+
background-color: var(--spectrum-global-color-gray-200);
4+
aspect-ratio: 4/3;
5+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { Content, Divider, Flex, Grid, Heading, InlineAlert, minmax, repeat, View } from '@geti/ui';
2+
3+
import { DatasetItem } from './dataset-item/dataset-item.component';
4+
5+
const NotEnoughNormalImagesToTrain = () => {
6+
// TODO: This should change dynamically when user provides more normal images
7+
const requiredNumberOfNormalImages = 20;
8+
9+
return (
10+
<InlineAlert variant='info'>
11+
<Heading>{requiredNumberOfNormalImages} images required</Heading>
12+
<Content>
13+
Capture {requiredNumberOfNormalImages} images of normal cases. They help the model learn what is
14+
standard, so it can better detect anomalies.
15+
</Content>
16+
</InlineAlert>
17+
);
18+
};
19+
20+
const DatasetItemsList = () => {
21+
const mediaItems = Array.from({ length: 20 }).map((_, index) => ({
22+
id: index,
23+
mediaItem: undefined,
24+
}));
25+
26+
return (
27+
<Grid
28+
flex={1}
29+
columns={repeat('auto-fill', minmax('size-1600', '1fr'))}
30+
gap={'size-100'}
31+
alignContent={'start'}
32+
>
33+
{mediaItems.map(({ id, mediaItem }) => (
34+
<DatasetItem key={id} mediaItem={mediaItem} />
35+
))}
36+
</Grid>
37+
);
38+
};
39+
40+
export const Dataset = () => {
41+
return (
42+
<Flex direction={'column'} height={'100%'}>
43+
<Heading margin={0}>Dataset</Heading>
44+
<View flex={1} padding={'size-300'}>
45+
<Flex direction={'column'} height={'100%'} gap={'size-300'}>
46+
<NotEnoughNormalImagesToTrain />
47+
48+
<Divider size={'S'} />
49+
50+
<DatasetItemsList />
51+
</Flex>
52+
</View>
53+
</Flex>
54+
);
55+
};

app/ui/src/features/inspect/sidebar.component.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
import { useState } from 'react';
77

8-
import { Dataset, Models, Stats } from '@geti-inspect/icons';
8+
import { Dataset as DatasetIcon, Models, Stats } from '@geti-inspect/icons';
99
import { Flex, Grid, ToggleButton, View } from '@geti/ui';
1010

11+
import { Dataset } from './dataset/dataset.component';
12+
1113
import styles from './sidebar.module.scss';
1214

1315
const TABS = [
14-
{ label: 'Dataset', icon: <Dataset />, content: <>Dataset</> },
16+
{ label: 'Dataset', icon: <DatasetIcon />, content: <Dataset /> },
1517
{ label: 'Models', icon: <Models />, content: <>Models</> },
1618
{ label: 'Stats', icon: <Stats />, content: <>Stats</> },
1719
];
@@ -34,6 +36,7 @@ const SidebarTabs = ({ tabs, selectedTab }: TabProps) => {
3436
UNSAFE_className={styles.container}
3537
columns={gridTemplateColumns}
3638
data-expanded={tab !== null}
39+
minHeight={0}
3740
>
3841
<View
3942
gridColumn={'1/2'}

app/ui/src/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ html {
5353
background-color: var(--background);
5454
}
5555

56+
* {
57+
box-sizing: border-box;
58+
}
59+
5660
h1,
5761
h2,
5862
h3,

app/ui/src/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const Layout = () => {
2626
<Grid
2727
areas={['header', 'content']}
2828
UNSAFE_style={{
29-
gridTemplateRows: 'var(--spectrum-global-dimension-size-800, 4rem) auto',
29+
gridTemplateRows: 'var(--spectrum-global-dimension-size-800, 4rem) minmax(0, 1fr)',
3030
}}
3131
minHeight={'100vh'}
3232
maxHeight={'100vh'}

0 commit comments

Comments
 (0)