Skip to content

Commit b91b7a0

Browse files
committed
display source config details
Signed-off-by: Colorado, Camilo <[email protected]>
1 parent 8e1b1b6 commit b91b7a0

File tree

14 files changed

+170
-81
lines changed

14 files changed

+170
-81
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ export { ReactComponent as Webcam } from './webcam.svg';
2020
export { ReactComponent as Webhook } from './webhook.svg';
2121
export { ReactComponent as Image } from './image.svg';
2222
export { ReactComponent as Fireworks } from './fire-works.svg';
23+
export { ReactComponent as PipelineLink } from './pipeline-link.svg';
Lines changed: 4 additions & 4 deletions
Loading

application/ui/src/features/inspect/toolbar/pipeline-configuration.component.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Copyright (C) 2025 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import { Suspense } from 'react';
4+
import { CSSProperties, Suspense } from 'react';
55

6+
import { PipelineLink } from '@geti-inspect/icons';
67
import {
78
Button,
89
Content,
@@ -18,17 +19,21 @@ import {
1819
View,
1920
} from '@geti/ui';
2021

21-
import { ReactComponent as Camera } from '../../../assets/icons/pipeline-link.svg';
2222
import { SourceFactory } from './sources/source-factory.component';
2323

24+
const paddingStyle = {
25+
'--spectrum-dialog-padding-x': dimensionValue('size-300'),
26+
'--spectrum-dialog-padding-y': dimensionValue('size-300'),
27+
} as CSSProperties;
28+
2429
export const InputOutputSetup = () => {
2530
return (
2631
<DialogTrigger type='popover'>
27-
<Button width={'size-3000'} variant={'secondary'} UNSAFE_style={{ gap: dimensionValue('size-125') }}>
28-
<Camera fill='white' />
32+
<Button variant={'secondary'} UNSAFE_style={{ gap: dimensionValue('size-125') }}>
33+
<PipelineLink fill='white' />
2934
<Text width={'auto'}>Pipeline configuration</Text>
3035
</Button>
31-
<Dialog minWidth={'size-6000'}>
36+
<Dialog minWidth={'size-6000'} UNSAFE_style={paddingStyle}>
3237
<Content>
3338
<Tabs aria-label='Dataset import tabs' height={'100%'}>
3439
<TabList>

application/ui/src/features/inspect/toolbar/sources/source-factory.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { isEmpty } from 'lodash-es';
77

88
import { $api } from '../../../../api/client';
99
import { EditSourceFactory } from './edit-source-factory.component';
10-
import { SourcesList } from './source-list.component';
10+
import { SourcesList } from './source-list/source-list.component';
1111
import { SourceOptions } from './source-options.component';
1212
import { SourceConfig } from './util';
1313

application/ui/src/features/inspect/toolbar/sources/source-list.component.tsx

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { SourceConfig } from '../../util';
2+
3+
import classes from './settings-list.module.scss';
4+
5+
interface SettingsListPops {
6+
source: SourceConfig;
7+
}
8+
9+
export const SettingsList = ({ source }: SettingsListPops) => {
10+
if (source.source_type === 'images_folder') {
11+
return (
12+
<ul className={classes.list}>
13+
<li>Folder path: {source.images_folder_path}</li>
14+
<li>Ignore existing images: {source.ignore_existing_images ? 'Yes' : 'No'}</li>
15+
</ul>
16+
);
17+
}
18+
19+
if (source.source_type === 'ip_camera') {
20+
return (
21+
<ul className={classes.list}>
22+
<li>Stream url: {source.stream_url}</li>
23+
<li>Auth required: {source.auth_required ? 'Yes' : 'No'}</li>
24+
</ul>
25+
);
26+
}
27+
28+
if (source.source_type === 'video_file') {
29+
console.log('source', source);
30+
return (
31+
<ul className={classes.list}>
32+
<li>Video path: {source.video_path}</li>
33+
</ul>
34+
);
35+
}
36+
37+
if (source.source_type === 'webcam') {
38+
return (
39+
<ul className={classes.list}>
40+
<li>Device id: {source.device_id}</li>
41+
</ul>
42+
);
43+
}
44+
45+
return <></>;
46+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.list {
2+
margin-left: var(--spectrum-global-dimension-font-size-200);
3+
list-style-type: disc;
4+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ImagesFolder, IpCamera, VideoFile, Webcam } from '@geti-inspect/icons';
2+
3+
interface SourceIconProps {
4+
type: string;
5+
}
6+
7+
export const SourceIcon = ({ type }: SourceIconProps) => {
8+
if (type === 'webcam') {
9+
return <Webcam />;
10+
}
11+
12+
if (type === 'ip_camera') {
13+
return <IpCamera />;
14+
}
15+
16+
if (type === 'video_file') {
17+
return <VideoFile />;
18+
}
19+
20+
if (type === 'images_folder') {
21+
return <ImagesFolder />;
22+
}
23+
24+
return <></>;
25+
};
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { Add as AddIcon } from '@geti/ui/icons';
2+
import { clsx } from 'clsx';
3+
import { isEqual } from 'lodash-es';
4+
import { Button, Flex, Text } from 'packages/ui';
5+
import { usePipeline } from 'src/hooks/use-pipeline.hook';
6+
7+
import { SourceMenu } from '../source-menu/source-menu.component';
8+
import { SourceConfig } from '../util';
9+
import { SettingsList } from './settings-list/settings-list.component';
10+
import { SourceIcon } from './source-icon/source-icon.component';
11+
import { StatusTag } from './status-tag/status-tag.component';
12+
import { removeUnderscore } from './utils';
13+
14+
import classes from './source-list.module.scss';
15+
16+
type SourcesListProps = {
17+
sources: SourceConfig[];
18+
onAddSource: () => void;
19+
onEditSourceFactory: (config: SourceConfig) => void;
20+
};
21+
22+
export const SourcesList = ({ sources, onAddSource, onEditSourceFactory }: SourcesListProps) => {
23+
const pipeline = usePipeline();
24+
const currentSource = pipeline.data.source?.id;
25+
26+
return (
27+
<Flex gap={'size-200'} direction={'column'}>
28+
<Button variant='secondary' UNSAFE_className={classes.addSource} onPress={onAddSource}>
29+
<AddIcon /> Add new source
30+
</Button>
31+
32+
{sources.map((source) => {
33+
const isConnected = isEqual(currentSource, source.id);
34+
35+
return (
36+
<Flex
37+
key={source.id}
38+
gap='size-200'
39+
direction='column'
40+
UNSAFE_className={clsx(classes.card, {
41+
[classes.activeCard]: isConnected,
42+
})}
43+
>
44+
<Flex alignItems={'center'} gap={'size-200'}>
45+
<SourceIcon type={source.source_type} />
46+
47+
<Flex direction={'column'} gap={'size-100'}>
48+
<Text UNSAFE_className={classes.title}>{source.name}</Text>
49+
<Flex gap={'size-100'} alignItems={'center'}>
50+
<Text UNSAFE_className={classes.type}>{removeUnderscore(source.source_type)}</Text>
51+
<StatusTag isConnected={isConnected} />
52+
</Flex>
53+
</Flex>
54+
</Flex>
55+
56+
<Flex justifyContent={'space-between'}>
57+
<SettingsList source={source} />
58+
59+
<SourceMenu
60+
id={String(source.id)}
61+
name={source.name}
62+
isConnected={isConnected}
63+
onEdit={() => onEditSourceFactory(source)}
64+
/>
65+
</Flex>
66+
</Flex>
67+
);
68+
})}
69+
</Flex>
70+
);
71+
};

application/ui/src/features/inspect/toolbar/sources/source-list.module.scss renamed to application/ui/src/features/inspect/toolbar/sources/source-list/source-list.module.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.card {
1111
padding: var(--spectrum-global-dimension-size-250);
1212
background: var(--spectrum-global-color-gray-200);
13-
border-radius: var(--spectrum-global-dimension-size-200);
13+
border-radius: var(--spectrum-global-dimension-size-65);
1414
}
1515

1616
.activeCard {
@@ -23,7 +23,6 @@
2323
font-size: var(--spectrum-global-dimension-font-size-200);
2424
}
2525

26-
.list {
27-
margin-left: var(--spectrum-global-dimension-font-size-200);
28-
list-style-type: disc;
26+
.type {
27+
text-transform: capitalize;
2928
}

0 commit comments

Comments
 (0)