@orchestrator-ui/orchestrator-ui-components 7.5.1 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +7 -7
- package/CHANGELOG.md +26 -0
- package/dist/index.d.ts +542 -53
- package/dist/index.js +1297 -1101
- package/dist/index.js.map +1 -1
- package/jest.config.cjs +4 -1
- package/package.json +6 -6
- package/src/components/WfoAgent/ExportButton/ExportButton.tsx +5 -11
- package/src/components/WfoAgent/WfoAgent/WfoAgent.tsx +79 -31
- package/src/components/WfoAgent/WfoAgentChart/WfoAgentLineChart.tsx +2 -2
- package/src/components/WfoAgent/WfoAgentChart/WfoAgentPieChart.tsx +2 -2
- package/src/components/WfoAgent/WfoAgentTable/WfoAgentTable.tsx +9 -9
- package/src/components/WfoAgent/WfoAgentVisualization/WfoAgentVisualization.tsx +2 -2
- package/src/components/WfoAgent/WfoPlanProgress/WfoPlanProgress.tsx +107 -0
- package/src/components/WfoAgent/WfoPlanProgress/index.ts +1 -0
- package/src/components/WfoAgent/WfoPlanProgress/styles.ts +62 -0
- package/src/components/WfoAgent/WfoQueryArtifact/WfoQueryArtifact.tsx +40 -0
- package/src/components/WfoAgent/WfoQueryArtifact/index.ts +1 -0
- package/src/components/WfoAgent/index.ts +2 -0
- package/src/components/WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.tsx +3 -1
- package/src/components/WfoBadges/WfoVersionIncompatibleBadge/WfoVersionIncompatibleBadge.tsx +7 -6
- package/src/components/WfoBadges/WfoWebsocketStatusBadge/WfoWebsocketStatusBadge.tsx +9 -3
- package/src/components/WfoKeyValueTable/WfoValueCell.tsx +1 -1
- package/src/components/WfoPydanticForm/fields/WfoInteger.tsx +22 -3
- package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActions.tsx +3 -2
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +34 -3
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +9 -9
- package/src/components/WfoTable/WfoAdvancedTable/WfoAdvancedTable.tsx +1 -1
- package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +1 -1
- package/src/components/WfoTitleWithWebsocketBadge/WfoTitleWithWebsocketBadge.tsx +3 -2
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +57 -40
- package/src/components/WfoWorkflowSteps/WfoStep/useStepDetailOverride.ts +9 -0
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +0 -1
- package/src/configuration/constants.ts +3 -0
- package/src/configuration/version.ts +1 -1
- package/src/hooks/useAgentPlanEvents.ts +188 -0
- package/src/messages/en-GB.json +7 -0
- package/src/messages/nl-NL.json +2 -0
- package/src/pages/metadata/WfoScheduleTaskFormPage.tsx +153 -35
- package/src/rtk/endpoints/agentQueryResults.ts +19 -0
- package/src/rtk/endpoints/forms.ts +1 -1
- package/src/rtk/endpoints/index.ts +1 -0
- package/src/rtk/endpoints/metadata/scheduledTasks.ts +9 -17
- package/src/rtk/endpoints/streamMessages.ts +10 -23
- package/src/rtk/slices/orchestratorComponentOverride.ts +5 -1
- package/src/types/search.ts +19 -4
- package/src/utils/compareVersions.spec.ts +5 -0
- package/src/utils/compareVersions.ts +55 -23
- package/src/components/WfoAgent/ToolProgress/DiscoverFilterPathsDisplay.tsx +0 -99
- package/src/components/WfoAgent/ToolProgress/RunSearchDisplay.tsx +0 -34
- package/src/components/WfoAgent/ToolProgress/SetFilterTreeDisplay.styles.ts +0 -62
- package/src/components/WfoAgent/ToolProgress/SetFilterTreeDisplay.tsx +0 -107
- package/src/components/WfoAgent/ToolProgress/StartNewSearchDisplay.tsx +0 -60
- package/src/components/WfoAgent/ToolProgress/ToolProgress.tsx +0 -98
- package/src/components/WfoAgent/ToolProgress/index.ts +0 -1
- package/src/components/WfoAgent/ToolProgress/styles.ts +0 -52
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { EuiSpacer, EuiText } from '@elastic/eui';
|
|
4
|
-
|
|
5
|
-
import { WfoBadge } from '@/components/WfoBadges';
|
|
6
|
-
import { WfoPathBreadcrumb } from '@/components/WfoSearchPage/WfoSearchResults/WfoPathBreadcrumb';
|
|
7
|
-
|
|
8
|
-
interface DiscoverFilterPathsResult {
|
|
9
|
-
status?: string;
|
|
10
|
-
leaves?: Array<{
|
|
11
|
-
paths?: string[];
|
|
12
|
-
name?: string;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type DiscoverFilterPathsDisplayProps = {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
result?: any;
|
|
19
|
-
parameters: {
|
|
20
|
-
field_names?: string[];
|
|
21
|
-
entity_type?: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const DiscoverFilterPathsDisplay = ({ parameters, result }: DiscoverFilterPathsDisplayProps) => {
|
|
26
|
-
const { field_names = [] } = parameters;
|
|
27
|
-
|
|
28
|
-
const foundFields: [string, DiscoverFilterPathsResult][] =
|
|
29
|
-
result ?
|
|
30
|
-
Object.entries(result as Record<string, DiscoverFilterPathsResult>).filter(
|
|
31
|
-
([, fieldResult]) => fieldResult.status !== 'NOT_FOUND',
|
|
32
|
-
)
|
|
33
|
-
: [];
|
|
34
|
-
|
|
35
|
-
// Count total paths across all found fields
|
|
36
|
-
const totalPaths = foundFields.reduce((count, [, fieldResult]) => {
|
|
37
|
-
const pathCount =
|
|
38
|
-
fieldResult.leaves?.reduce((leafCount: number, leaf) => {
|
|
39
|
-
return leafCount + (leaf.paths?.length || 1);
|
|
40
|
-
}, 0) || 0;
|
|
41
|
-
return count + pathCount;
|
|
42
|
-
}, 0);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div>
|
|
46
|
-
{field_names.length > 0 && (
|
|
47
|
-
<>
|
|
48
|
-
<EuiText size="xs" color="subdued">
|
|
49
|
-
Looking for{' '}
|
|
50
|
-
{field_names.map((name, idx) => (
|
|
51
|
-
<React.Fragment key={name}>
|
|
52
|
-
{idx > 0 && ', '}
|
|
53
|
-
<WfoBadge color="hollow" textColor="default">
|
|
54
|
-
{name}
|
|
55
|
-
</WfoBadge>
|
|
56
|
-
</React.Fragment>
|
|
57
|
-
))}
|
|
58
|
-
</EuiText>
|
|
59
|
-
<EuiSpacer size="s" />
|
|
60
|
-
</>
|
|
61
|
-
)}
|
|
62
|
-
|
|
63
|
-
{result && totalPaths > 0 && (
|
|
64
|
-
<div>
|
|
65
|
-
<EuiText size="xs" color="subdued">
|
|
66
|
-
<strong>
|
|
67
|
-
Found {totalPaths} path
|
|
68
|
-
{totalPaths > 1 ? 's' : ''}:
|
|
69
|
-
</strong>
|
|
70
|
-
</EuiText>
|
|
71
|
-
<EuiSpacer size="xs" />
|
|
72
|
-
{foundFields.map(([fieldName, fieldResult]) => (
|
|
73
|
-
<div key={fieldName} style={{ marginBottom: '8px' }}>
|
|
74
|
-
{fieldResult.leaves
|
|
75
|
-
&& fieldResult.leaves.length > 0
|
|
76
|
-
&& fieldResult.leaves.map((leaf, leafIdx: number) => {
|
|
77
|
-
const paths = leaf.paths || (leaf.name ? [leaf.name] : []);
|
|
78
|
-
return (
|
|
79
|
-
<React.Fragment key={leafIdx}>
|
|
80
|
-
{paths.map((path: string, pathIdx: number) => (
|
|
81
|
-
<div
|
|
82
|
-
key={pathIdx}
|
|
83
|
-
style={{
|
|
84
|
-
marginBottom: '4px',
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
<WfoPathBreadcrumb path={path} size="s" />
|
|
88
|
-
</div>
|
|
89
|
-
))}
|
|
90
|
-
</React.Fragment>
|
|
91
|
-
);
|
|
92
|
-
})}
|
|
93
|
-
</div>
|
|
94
|
-
))}
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
|
|
4
|
-
|
|
5
|
-
import { WfoBadge } from '@/components/WfoBadges';
|
|
6
|
-
|
|
7
|
-
type RunSearchDisplayProps = {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
result?: any;
|
|
10
|
-
parameters: {
|
|
11
|
-
limit?: number;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const RunSearchDisplay = ({ parameters }: RunSearchDisplayProps) => {
|
|
16
|
-
const { limit = 10 } = parameters;
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<EuiFlexGroup gutterSize="s" alignItems="center">
|
|
21
|
-
<EuiFlexItem grow={false}>
|
|
22
|
-
<EuiText size="xs" color="subdued">
|
|
23
|
-
<strong>Results Limit</strong>
|
|
24
|
-
</EuiText>
|
|
25
|
-
</EuiFlexItem>
|
|
26
|
-
<EuiFlexItem grow={false}>
|
|
27
|
-
<WfoBadge textColor="default" color="hollow">
|
|
28
|
-
{limit}
|
|
29
|
-
</WfoBadge>
|
|
30
|
-
</EuiFlexItem>
|
|
31
|
-
</EuiFlexGroup>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
|
-
|
|
3
|
-
import { WfoThemeHelpers } from '@/hooks';
|
|
4
|
-
|
|
5
|
-
export const getFilterDisplayStyles = ({ theme }: WfoThemeHelpers) => {
|
|
6
|
-
const wrapStyle = css({
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexWrap: 'wrap',
|
|
9
|
-
gap: theme.size.s,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const columnGroupWrapStyle = css({
|
|
13
|
-
display: 'flex',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
gap: theme.size.s,
|
|
16
|
-
alignItems: 'flex-start',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const chipStyle = css({
|
|
20
|
-
display: 'inline-flex',
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
borderRadius: theme.size.xl,
|
|
23
|
-
border: `1px solid ${theme.border.color}`,
|
|
24
|
-
backgroundColor: theme.colors.backgroundBasePlain,
|
|
25
|
-
padding: `${theme.size.s} ${theme.size.m}`,
|
|
26
|
-
lineHeight: 1.1,
|
|
27
|
-
gap: theme.size.s,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const groupStyle = css({
|
|
31
|
-
border: `1px solid ${theme.colors.borderBaseSubdued}`,
|
|
32
|
-
borderRadius: theme.border.radius.medium,
|
|
33
|
-
padding: theme.size.s,
|
|
34
|
-
margin: theme.size.xs,
|
|
35
|
-
backgroundColor: theme.colors.backgroundBasePlain,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const operatorStyle = css({
|
|
39
|
-
fontFamily: theme.font.familyCode,
|
|
40
|
-
padding: `${theme.size.xs}px ${theme.size.s}px`,
|
|
41
|
-
borderRadius: theme.size.s,
|
|
42
|
-
backgroundColor: theme.colors.primary,
|
|
43
|
-
color: theme.colors.textGhost,
|
|
44
|
-
fontSize: theme.size.m,
|
|
45
|
-
fontWeight: theme.font.weight.bold,
|
|
46
|
-
margin: `${theme.size.xs} 0`,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const valueStyle = css({
|
|
50
|
-
fontWeight: theme.font.weight.semiBold,
|
|
51
|
-
color: theme.colors.warning,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
wrapStyle,
|
|
56
|
-
columnGroupWrapStyle,
|
|
57
|
-
chipStyle,
|
|
58
|
-
groupStyle,
|
|
59
|
-
operatorStyle,
|
|
60
|
-
valueStyle,
|
|
61
|
-
};
|
|
62
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { useTranslations } from 'next-intl';
|
|
4
|
-
|
|
5
|
-
import { EuiText } from '@elastic/eui';
|
|
6
|
-
|
|
7
|
-
import { WfoBadge } from '@/components/WfoBadges';
|
|
8
|
-
import { WfoPathBreadcrumb } from '@/components/WfoSearchPage/WfoSearchResults/WfoPathBreadcrumb';
|
|
9
|
-
import { getOperatorDisplay, isCondition } from '@/components/WfoSearchPage/utils';
|
|
10
|
-
import { useWithOrchestratorTheme } from '@/hooks';
|
|
11
|
-
import { Condition, Group, PathDataType } from '@/types';
|
|
12
|
-
|
|
13
|
-
import { getFilterDisplayStyles } from './SetFilterTreeDisplay.styles';
|
|
14
|
-
|
|
15
|
-
const DEPTH_INDENT = 16;
|
|
16
|
-
|
|
17
|
-
interface BetweenValue {
|
|
18
|
-
start?: string | number;
|
|
19
|
-
end?: string | number;
|
|
20
|
-
from?: string | number;
|
|
21
|
-
to?: string | number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type SetFilterTreeDisplayProps = {
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
result?: any;
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
parameters: any;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const SetFilterTreeDisplay = ({ parameters }: SetFilterTreeDisplayProps) => {
|
|
32
|
-
const t = useTranslations('agent.page');
|
|
33
|
-
const { wrapStyle, columnGroupWrapStyle, chipStyle, groupStyle, operatorStyle, valueStyle } =
|
|
34
|
-
useWithOrchestratorTheme(getFilterDisplayStyles);
|
|
35
|
-
|
|
36
|
-
// Parameters might be the Group directly, or wrapped in a filters property
|
|
37
|
-
const filters = (parameters?.filters || parameters) as Group;
|
|
38
|
-
|
|
39
|
-
const formatFilterValue = (condition: Condition['condition']): string => {
|
|
40
|
-
if ('value' in condition && condition.value !== undefined) {
|
|
41
|
-
if (condition.op === 'between' && condition.value && typeof condition.value === 'object') {
|
|
42
|
-
const { start, end, from, to } = condition.value as BetweenValue;
|
|
43
|
-
const fromVal = start || from;
|
|
44
|
-
const toVal = end || to;
|
|
45
|
-
return `${fromVal} … ${toVal}`;
|
|
46
|
-
}
|
|
47
|
-
return String(condition.value);
|
|
48
|
-
}
|
|
49
|
-
return '—';
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const renderFilterGroup = (group: Group, depth = 0): React.ReactNode => {
|
|
53
|
-
if (!group.children || group.children.length === 0) {
|
|
54
|
-
return (
|
|
55
|
-
<EuiText size="s" color="subdued">
|
|
56
|
-
<em>{t('emptyGroup')}</em>
|
|
57
|
-
</EuiText>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const areChildrenGroups = group.children.length > 0 && !isCondition(group.children[0]);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div css={groupStyle} style={{ marginLeft: depth * DEPTH_INDENT }}>
|
|
65
|
-
<div css={operatorStyle}>{group.op}</div>
|
|
66
|
-
<div css={areChildrenGroups ? columnGroupWrapStyle : wrapStyle}>
|
|
67
|
-
{group.children.map((child, i) => (
|
|
68
|
-
<div key={i}>
|
|
69
|
-
{isCondition(child) ?
|
|
70
|
-
<div css={chipStyle}>
|
|
71
|
-
<WfoPathBreadcrumb path={child.path} size="s" showArrows={true} />
|
|
72
|
-
<WfoBadge textColor="default" color="hollow">
|
|
73
|
-
{
|
|
74
|
-
getOperatorDisplay(
|
|
75
|
-
child.condition.op,
|
|
76
|
-
child.value_kind ?
|
|
77
|
-
{
|
|
78
|
-
path: child.path,
|
|
79
|
-
type: child.value_kind as PathDataType,
|
|
80
|
-
operators: [],
|
|
81
|
-
value_schema: {},
|
|
82
|
-
group: 'leaf' as const,
|
|
83
|
-
}
|
|
84
|
-
: undefined,
|
|
85
|
-
).symbol
|
|
86
|
-
}
|
|
87
|
-
</WfoBadge>
|
|
88
|
-
<span css={valueStyle}>{formatFilterValue(child.condition)}</span>
|
|
89
|
-
</div>
|
|
90
|
-
: renderFilterGroup(child, depth + 1)}
|
|
91
|
-
</div>
|
|
92
|
-
))}
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
if (!filters || !filters.children || filters.children.length === 0) {
|
|
99
|
-
return (
|
|
100
|
-
<EuiText size="s" color="subdued">
|
|
101
|
-
<em>{t('noFiltersApplied')}</em>
|
|
102
|
-
</EuiText>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return <div>{renderFilterGroup(filters)}</div>;
|
|
107
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui';
|
|
4
|
-
|
|
5
|
-
import { WfoBadge } from '@/components/WfoBadges';
|
|
6
|
-
|
|
7
|
-
type StartNewSearchDisplayProps = {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
result?: any;
|
|
10
|
-
parameters: {
|
|
11
|
-
entity_type?: string;
|
|
12
|
-
action?: string;
|
|
13
|
-
query?: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const StartNewSearchDisplay = ({ parameters }: StartNewSearchDisplayProps) => {
|
|
18
|
-
const { entity_type, action, query } = parameters;
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<EuiFlexGroup gutterSize="s" wrap>
|
|
23
|
-
{entity_type && (
|
|
24
|
-
<EuiFlexItem grow={false}>
|
|
25
|
-
<EuiText size="xs" color="subdued">
|
|
26
|
-
<strong>Entity Type</strong>
|
|
27
|
-
</EuiText>
|
|
28
|
-
<EuiSpacer size="xs" />
|
|
29
|
-
<WfoBadge textColor="default" color="hollow">
|
|
30
|
-
{entity_type}
|
|
31
|
-
</WfoBadge>
|
|
32
|
-
</EuiFlexItem>
|
|
33
|
-
)}
|
|
34
|
-
{action && (
|
|
35
|
-
<EuiFlexItem grow={false}>
|
|
36
|
-
<EuiText size="xs" color="subdued">
|
|
37
|
-
<strong>Action</strong>
|
|
38
|
-
</EuiText>
|
|
39
|
-
<EuiSpacer size="xs" />
|
|
40
|
-
<WfoBadge textColor="default" color="hollow">
|
|
41
|
-
{action}
|
|
42
|
-
</WfoBadge>
|
|
43
|
-
</EuiFlexItem>
|
|
44
|
-
)}
|
|
45
|
-
</EuiFlexGroup>
|
|
46
|
-
{query && (
|
|
47
|
-
<>
|
|
48
|
-
<EuiSpacer size="s" />
|
|
49
|
-
<EuiText size="xs" color="subdued">
|
|
50
|
-
<strong>Query</strong>
|
|
51
|
-
</EuiText>
|
|
52
|
-
<EuiSpacer size="xs" />
|
|
53
|
-
<EuiText size="s">
|
|
54
|
-
<em>"{query}"</em>
|
|
55
|
-
</EuiText>
|
|
56
|
-
</>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useTranslations } from 'next-intl';
|
|
4
|
-
|
|
5
|
-
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
|
|
6
|
-
|
|
7
|
-
import { useWithOrchestratorTheme } from '@/hooks';
|
|
8
|
-
import { useOrchestratorTheme } from '@/hooks/useOrchestratorTheme';
|
|
9
|
-
import { WfoCheckmarkCircleFill, WfoChevronDown, WfoChevronUp, WfoXCircleFill } from '@/icons';
|
|
10
|
-
import { WfoWrench } from '@/icons/heroicons';
|
|
11
|
-
|
|
12
|
-
import { DiscoverFilterPathsDisplay } from './DiscoverFilterPathsDisplay';
|
|
13
|
-
import { RunSearchDisplay } from './RunSearchDisplay';
|
|
14
|
-
import { SetFilterTreeDisplay } from './SetFilterTreeDisplay';
|
|
15
|
-
import { StartNewSearchDisplay } from './StartNewSearchDisplay';
|
|
16
|
-
import { getToolProgressStyles } from './styles';
|
|
17
|
-
|
|
18
|
-
type ToolProgressProps = {
|
|
19
|
-
name: string;
|
|
20
|
-
status: 'executing' | 'inProgress' | 'complete' | 'failed';
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
args?: any;
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
result?: any;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// Mapping of tool names to their display components
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
const TOOL_DISPLAY_COMPONENTS: Record<string, React.ComponentType<any>> = {
|
|
30
|
-
set_filter_tree: SetFilterTreeDisplay,
|
|
31
|
-
start_new_search: StartNewSearchDisplay,
|
|
32
|
-
run_search: RunSearchDisplay,
|
|
33
|
-
discover_filter_paths: DiscoverFilterPathsDisplay,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const ToolProgress = ({ name, status, args, result }: ToolProgressProps) => {
|
|
37
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
38
|
-
const tPage = useTranslations('agent.page');
|
|
39
|
-
|
|
40
|
-
const { containerStyle, containerClickableStyle, headerStyle, nameStyle, expandedContentStyle, iconSize, iconStyle } =
|
|
41
|
-
useWithOrchestratorTheme(getToolProgressStyles);
|
|
42
|
-
|
|
43
|
-
const { theme } = useOrchestratorTheme();
|
|
44
|
-
|
|
45
|
-
const getToolLabel = (toolName: string) => {
|
|
46
|
-
const toolKey = `tools.${toolName}`;
|
|
47
|
-
const translated = tPage(toolKey);
|
|
48
|
-
const fullKey = `agent.page.${toolKey}`;
|
|
49
|
-
return translated === fullKey ? toolName : translated;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const renderStatus = () => {
|
|
53
|
-
if (status === 'complete') {
|
|
54
|
-
return <WfoCheckmarkCircleFill color={theme.colors.success} width={iconSize} height={iconSize} />;
|
|
55
|
-
}
|
|
56
|
-
if (status === 'inProgress' || status === 'executing') {
|
|
57
|
-
return <EuiLoadingSpinner size="s" />;
|
|
58
|
-
}
|
|
59
|
-
if (status === 'failed') {
|
|
60
|
-
return <WfoXCircleFill color={theme.colors.danger} width={iconSize} height={iconSize} />;
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const DisplayComponent = TOOL_DISPLAY_COMPONENTS[name];
|
|
66
|
-
const hasContent = DisplayComponent && (args || result);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div css={containerStyle}>
|
|
70
|
-
<div css={hasContent && containerClickableStyle} onClick={() => hasContent && setIsExpanded(!isExpanded)}>
|
|
71
|
-
<EuiFlexGroup gutterSize="m" alignItems="center" css={headerStyle}>
|
|
72
|
-
<EuiFlexItem grow={false}>
|
|
73
|
-
<div css={iconStyle}>
|
|
74
|
-
<WfoWrench width={iconSize} height={iconSize} />
|
|
75
|
-
</div>
|
|
76
|
-
</EuiFlexItem>
|
|
77
|
-
<EuiFlexItem grow={true}>
|
|
78
|
-
<span css={nameStyle}>{getToolLabel(name)}</span>
|
|
79
|
-
</EuiFlexItem>
|
|
80
|
-
<EuiFlexItem grow={false} style={{ minWidth: `${iconSize}px` }}>
|
|
81
|
-
{renderStatus()}
|
|
82
|
-
</EuiFlexItem>
|
|
83
|
-
<EuiFlexItem grow={false} style={{ minWidth: `${iconSize}px` }}>
|
|
84
|
-
{hasContent
|
|
85
|
-
&& (isExpanded ?
|
|
86
|
-
<WfoChevronUp width={iconSize} height={iconSize} />
|
|
87
|
-
: <WfoChevronDown width={iconSize} height={iconSize} />)}
|
|
88
|
-
</EuiFlexItem>
|
|
89
|
-
</EuiFlexGroup>
|
|
90
|
-
</div>
|
|
91
|
-
{hasContent && isExpanded && (
|
|
92
|
-
<div css={expandedContentStyle}>
|
|
93
|
-
<DisplayComponent parameters={args} result={result} />
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
</div>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ToolProgress } from './ToolProgress';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
|
-
|
|
3
|
-
import { WfoThemeHelpers } from '@/hooks';
|
|
4
|
-
|
|
5
|
-
export const getToolProgressStyles = ({ theme }: WfoThemeHelpers) => {
|
|
6
|
-
const containerStyle = css({
|
|
7
|
-
border: `${theme.border.width.thin} solid ${theme.colors.borderBaseSubdued}`,
|
|
8
|
-
borderRadius: theme.border.radius.medium,
|
|
9
|
-
backgroundColor: theme.colors.backgroundBaseNeutral,
|
|
10
|
-
transition: `all ${theme.animation.normal} ease`,
|
|
11
|
-
maxWidth: '50%',
|
|
12
|
-
marginRight: 'auto',
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const containerClickableStyle = css({
|
|
16
|
-
cursor: 'pointer',
|
|
17
|
-
'&:hover': {
|
|
18
|
-
borderColor: theme.colors.primary,
|
|
19
|
-
backgroundColor: theme.colors.backgroundBasePlain,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const headerStyle = css({
|
|
24
|
-
padding: `${theme.size.base} ${theme.size.l}`,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const nameStyle = css({
|
|
28
|
-
fontSize: theme.size.m,
|
|
29
|
-
fontWeight: theme.font.weight.medium,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const expandedContentStyle = css({
|
|
33
|
-
borderTop: `${theme.border.width.thin} solid ${theme.colors.borderBaseSubdued}`,
|
|
34
|
-
padding: `${theme.size.base} ${theme.size.l}`,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const iconSize = 18;
|
|
38
|
-
|
|
39
|
-
const iconStyle = css({
|
|
40
|
-
color: theme.colors.textSubdued,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
containerStyle,
|
|
45
|
-
containerClickableStyle,
|
|
46
|
-
headerStyle,
|
|
47
|
-
nameStyle,
|
|
48
|
-
expandedContentStyle,
|
|
49
|
-
iconSize,
|
|
50
|
-
iconStyle,
|
|
51
|
-
};
|
|
52
|
-
};
|