@autobe/ui 0.30.0-dev.20260315 → 0.30.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/LICENSE +661 -661
- package/lib/components/AutoBeChatMain.js +5 -5
- package/lib/components/AutoBeConfigModal.js +9 -9
- package/package.json +2 -2
- package/src/components/AutoBeAssistantMessageMovie.tsx +22 -22
- package/src/components/AutoBeChatMain.tsx +376 -376
- package/src/components/AutoBeChatSidebar.tsx +414 -414
- package/src/components/AutoBeConfigButton.tsx +83 -83
- package/src/components/AutoBeConfigModal.tsx +443 -443
- package/src/components/AutoBeStatusButton.tsx +75 -75
- package/src/components/AutoBeStatusModal.tsx +486 -486
- package/src/components/AutoBeUserMessageMovie.tsx +27 -27
- package/src/components/common/ActionButton.tsx +205 -205
- package/src/components/common/ActionButtonGroup.tsx +80 -80
- package/src/components/common/AutoBeConfigInput.tsx +185 -185
- package/src/components/common/ChatBubble.tsx +119 -119
- package/src/components/common/Collapsible.tsx +95 -95
- package/src/components/common/CompactSessionIndicator.tsx +73 -73
- package/src/components/common/CompactSessionList.tsx +82 -82
- package/src/components/common/index.ts +8 -8
- package/src/components/common/openai/OpenAIContent.tsx +53 -53
- package/src/components/common/openai/OpenAIUserAudioContent.tsx +70 -70
- package/src/components/common/openai/OpenAIUserFileContent.tsx +76 -76
- package/src/components/common/openai/OpenAIUserImageContent.tsx +34 -34
- package/src/components/common/openai/OpenAIUserTextContent.tsx +15 -15
- package/src/components/common/openai/index.ts +5 -5
- package/src/components/events/AutoBeCompleteEventMovie.tsx +402 -402
- package/src/components/events/AutoBeCorrectEventMovie.tsx +354 -354
- package/src/components/events/AutoBeEventGroupMovie.tsx +18 -18
- package/src/components/events/AutoBeEventMovie.tsx +158 -158
- package/src/components/events/AutoBeProgressEventMovie.tsx +217 -217
- package/src/components/events/AutoBeScenarioEventMovie.tsx +135 -135
- package/src/components/events/AutoBeStartEventMovie.tsx +82 -82
- package/src/components/events/AutoBeValidateEventMovie.tsx +249 -249
- package/src/components/events/README.md +300 -300
- package/src/components/events/common/CollapsibleEventGroup.tsx +211 -211
- package/src/components/events/common/EventCard.tsx +61 -61
- package/src/components/events/common/EventContent.tsx +31 -31
- package/src/components/events/common/EventHeader.tsx +85 -85
- package/src/components/events/common/EventIcon.tsx +82 -82
- package/src/components/events/common/ProgressBar.tsx +64 -64
- package/src/components/events/common/index.ts +13 -13
- package/src/components/events/groups/CorrectEventGroup.tsx +183 -183
- package/src/components/events/groups/ValidateEventGroup.tsx +143 -143
- package/src/components/events/groups/index.ts +8 -8
- package/src/components/events/index.ts +16 -16
- package/src/components/events/utils/eventGrouper.tsx +116 -116
- package/src/components/events/utils/index.ts +1 -1
- package/src/components/index.ts +13 -13
- package/src/components/upload/AutoBeChatUploadBox.tsx +425 -425
- package/src/components/upload/AutoBeChatUploadSendButton.tsx +66 -66
- package/src/components/upload/AutoBeFileUploadBox.tsx +123 -123
- package/src/components/upload/AutoBeUploadConfig.ts +5 -5
- package/src/components/upload/AutoBeVoiceRecoderButton.tsx +100 -100
- package/src/components/upload/index.ts +5 -5
- package/src/constant/color.ts +28 -28
- package/src/context/AutoBeAgentContext.tsx +245 -245
- package/src/context/AutoBeAgentSessionList.tsx +58 -58
- package/src/context/SearchParamsContext.tsx +49 -49
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useEscapeKey.ts +24 -24
- package/src/hooks/useIsomorphicLayoutEffect.ts +8 -8
- package/src/hooks/useMediaQuery.ts +73 -73
- package/src/hooks/useSessionStorage.ts +10 -10
- package/src/icons/Receipt.tsx +74 -74
- package/src/index.ts +9 -9
- package/src/strategy/AutoBeAgentSessionStorageStrategy.ts +127 -127
- package/src/structure/AutoBeListener.ts +373 -373
- package/src/structure/AutoBeListenerState.ts +53 -53
- package/src/structure/IAutoBeAgentSessionStorageStrategy.ts +87 -87
- package/src/structure/IAutoBeEventGroup.ts +6 -6
- package/src/structure/index.ts +4 -4
- package/src/types/config.ts +44 -44
- package/src/types/index.ts +1 -1
- package/src/utils/AutoBeFileUploader.ts +279 -279
- package/src/utils/AutoBeVoiceRecorder.ts +95 -95
- package/src/utils/__tests__/crypto.test.ts +286 -286
- package/src/utils/__tests__/storage.test.ts +229 -229
- package/src/utils/crypto.ts +95 -95
- package/src/utils/index.ts +6 -6
- package/src/utils/number.ts +17 -17
- package/src/utils/storage.ts +96 -96
- package/src/utils/time.ts +14 -14
- package/tsconfig.json +9 -9
- package/vitest.config.ts +15 -15
- package/README.md +0 -261
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutoBeDatabaseCorrectEvent,
|
|
3
|
-
AutoBeRealizeAuthorizationCorrectEvent,
|
|
4
|
-
AutoBeRealizeCorrectEvent,
|
|
5
|
-
AutoBeTestCorrectEvent,
|
|
6
|
-
} from "@autobe/interface";
|
|
7
|
-
|
|
8
|
-
import { AutoBeCorrectEventMovie } from "../AutoBeCorrectEventMovie";
|
|
9
|
-
import { CollapsibleEventGroup } from "../common/CollapsibleEventGroup";
|
|
10
|
-
|
|
11
|
-
type CorrectEvent =
|
|
12
|
-
| AutoBeDatabaseCorrectEvent
|
|
13
|
-
| AutoBeTestCorrectEvent
|
|
14
|
-
| AutoBeRealizeCorrectEvent
|
|
15
|
-
| AutoBeRealizeAuthorizationCorrectEvent;
|
|
16
|
-
|
|
17
|
-
export interface ICorrectEventGroupProps {
|
|
18
|
-
events: CorrectEvent[];
|
|
19
|
-
defaultCollapsed?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Specialized group component for correction events Shows correction summary
|
|
24
|
-
* and statistics
|
|
25
|
-
*/
|
|
26
|
-
export const CorrectEventGroup = (props: ICorrectEventGroupProps) => {
|
|
27
|
-
const { events, defaultCollapsed = true } = props;
|
|
28
|
-
|
|
29
|
-
if (events.length === 0) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Calculate correction statistics
|
|
34
|
-
const eventTypes = Array.from(new Set(events.map((e) => e.type)));
|
|
35
|
-
const eventTypeCounts = eventTypes.reduce(
|
|
36
|
-
(acc, type) => {
|
|
37
|
-
acc[type] = events.filter((e) => e.type === type).length;
|
|
38
|
-
return acc;
|
|
39
|
-
},
|
|
40
|
-
{} as Record<string, number>,
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// Get latest step numbers for each event type
|
|
44
|
-
const latestSteps = eventTypes.reduce(
|
|
45
|
-
(acc, type) => {
|
|
46
|
-
const eventsOfType = events.filter((e) => e.type === type);
|
|
47
|
-
acc[type] = Math.max(...eventsOfType.map((e) => e.step));
|
|
48
|
-
return acc;
|
|
49
|
-
},
|
|
50
|
-
{} as Record<string, number>,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const renderSummary = (events: CorrectEvent[]) => (
|
|
54
|
-
<>
|
|
55
|
-
Correction events showing AI self-improvement feedback loop
|
|
56
|
-
<br />
|
|
57
|
-
<br />
|
|
58
|
-
<strong>Success Rate:</strong> 100% (All corrections applied successfully)
|
|
59
|
-
<br />
|
|
60
|
-
<strong>Total Corrections:</strong> {events.length} events
|
|
61
|
-
<br />
|
|
62
|
-
<strong>Event Types:</strong> {eventTypes.join(", ")}
|
|
63
|
-
<br />
|
|
64
|
-
<br />
|
|
65
|
-
<div
|
|
66
|
-
style={{
|
|
67
|
-
display: "flex",
|
|
68
|
-
flexDirection: "column",
|
|
69
|
-
gap: "0.5rem",
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
{eventTypes.map((type) => {
|
|
73
|
-
const typeDisplayNames = {
|
|
74
|
-
databaseCorrect: "🗄️ Database Schema",
|
|
75
|
-
testCorrect: "🧪 Test Suite",
|
|
76
|
-
realizeCorrect: "⚙️ Implementation",
|
|
77
|
-
realizeAuthorizationCorrect: "🔐 Authorization",
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<div
|
|
82
|
-
key={type}
|
|
83
|
-
style={{
|
|
84
|
-
display: "flex",
|
|
85
|
-
justifyContent: "space-between",
|
|
86
|
-
alignItems: "center",
|
|
87
|
-
padding: "0.5rem",
|
|
88
|
-
backgroundColor: "#f0fdf4",
|
|
89
|
-
borderRadius: "0.25rem",
|
|
90
|
-
border: "1px solid #bbf7d0",
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
<span style={{ fontSize: "0.75rem", fontWeight: "500" }}>
|
|
94
|
-
{typeDisplayNames[type as keyof typeof typeDisplayNames] ||
|
|
95
|
-
type}
|
|
96
|
-
</span>
|
|
97
|
-
<div
|
|
98
|
-
style={{ display: "flex", gap: "1rem", alignItems: "center" }}
|
|
99
|
-
>
|
|
100
|
-
<span style={{ fontSize: "0.75rem", color: "#16a34a" }}>
|
|
101
|
-
{eventTypeCounts[type]} corrections
|
|
102
|
-
</span>
|
|
103
|
-
<span
|
|
104
|
-
style={{
|
|
105
|
-
fontSize: "0.625rem",
|
|
106
|
-
color: "#64748b",
|
|
107
|
-
fontFamily: "monospace",
|
|
108
|
-
backgroundColor: "#e2e8f0",
|
|
109
|
-
padding: "0.125rem 0.375rem",
|
|
110
|
-
borderRadius: "0.25rem",
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
Step {latestSteps[type]}
|
|
114
|
-
</span>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
})}
|
|
119
|
-
</div>
|
|
120
|
-
<br />
|
|
121
|
-
<div
|
|
122
|
-
style={{
|
|
123
|
-
display: "flex",
|
|
124
|
-
gap: "0.5rem",
|
|
125
|
-
alignItems: "center",
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
<div
|
|
129
|
-
style={{
|
|
130
|
-
display: "flex",
|
|
131
|
-
alignItems: "center",
|
|
132
|
-
gap: "0.25rem",
|
|
133
|
-
}}
|
|
134
|
-
>
|
|
135
|
-
<div
|
|
136
|
-
style={{
|
|
137
|
-
width: "12px",
|
|
138
|
-
height: "12px",
|
|
139
|
-
backgroundColor: "#16a34a",
|
|
140
|
-
borderRadius: "2px",
|
|
141
|
-
}}
|
|
142
|
-
/>
|
|
143
|
-
<span style={{ fontSize: "0.75rem" }}>
|
|
144
|
-
Corrected: {events.length}
|
|
145
|
-
</span>
|
|
146
|
-
</div>
|
|
147
|
-
<div
|
|
148
|
-
style={{
|
|
149
|
-
display: "flex",
|
|
150
|
-
alignItems: "center",
|
|
151
|
-
gap: "0.25rem",
|
|
152
|
-
}}
|
|
153
|
-
>
|
|
154
|
-
<div
|
|
155
|
-
style={{
|
|
156
|
-
width: "12px",
|
|
157
|
-
height: "12px",
|
|
158
|
-
backgroundColor: "#10b981",
|
|
159
|
-
borderRadius: "2px",
|
|
160
|
-
}}
|
|
161
|
-
/>
|
|
162
|
-
<span style={{ fontSize: "0.75rem" }}>Self-Improvement Active</span>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
</>
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<CollapsibleEventGroup
|
|
170
|
-
events={events}
|
|
171
|
-
title="Correction Events"
|
|
172
|
-
iconType="success"
|
|
173
|
-
variant="success"
|
|
174
|
-
getTimestamp={(event) => event.created_at}
|
|
175
|
-
renderEvent={(event) => <AutoBeCorrectEventMovie event={event} />}
|
|
176
|
-
renderSummary={renderSummary}
|
|
177
|
-
defaultCollapsed={defaultCollapsed}
|
|
178
|
-
description="AI self-correction and improvement events"
|
|
179
|
-
/>
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export default CorrectEventGroup;
|
|
1
|
+
import {
|
|
2
|
+
AutoBeDatabaseCorrectEvent,
|
|
3
|
+
AutoBeRealizeAuthorizationCorrectEvent,
|
|
4
|
+
AutoBeRealizeCorrectEvent,
|
|
5
|
+
AutoBeTestCorrectEvent,
|
|
6
|
+
} from "@autobe/interface";
|
|
7
|
+
|
|
8
|
+
import { AutoBeCorrectEventMovie } from "../AutoBeCorrectEventMovie";
|
|
9
|
+
import { CollapsibleEventGroup } from "../common/CollapsibleEventGroup";
|
|
10
|
+
|
|
11
|
+
type CorrectEvent =
|
|
12
|
+
| AutoBeDatabaseCorrectEvent
|
|
13
|
+
| AutoBeTestCorrectEvent
|
|
14
|
+
| AutoBeRealizeCorrectEvent
|
|
15
|
+
| AutoBeRealizeAuthorizationCorrectEvent;
|
|
16
|
+
|
|
17
|
+
export interface ICorrectEventGroupProps {
|
|
18
|
+
events: CorrectEvent[];
|
|
19
|
+
defaultCollapsed?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Specialized group component for correction events Shows correction summary
|
|
24
|
+
* and statistics
|
|
25
|
+
*/
|
|
26
|
+
export const CorrectEventGroup = (props: ICorrectEventGroupProps) => {
|
|
27
|
+
const { events, defaultCollapsed = true } = props;
|
|
28
|
+
|
|
29
|
+
if (events.length === 0) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Calculate correction statistics
|
|
34
|
+
const eventTypes = Array.from(new Set(events.map((e) => e.type)));
|
|
35
|
+
const eventTypeCounts = eventTypes.reduce(
|
|
36
|
+
(acc, type) => {
|
|
37
|
+
acc[type] = events.filter((e) => e.type === type).length;
|
|
38
|
+
return acc;
|
|
39
|
+
},
|
|
40
|
+
{} as Record<string, number>,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Get latest step numbers for each event type
|
|
44
|
+
const latestSteps = eventTypes.reduce(
|
|
45
|
+
(acc, type) => {
|
|
46
|
+
const eventsOfType = events.filter((e) => e.type === type);
|
|
47
|
+
acc[type] = Math.max(...eventsOfType.map((e) => e.step));
|
|
48
|
+
return acc;
|
|
49
|
+
},
|
|
50
|
+
{} as Record<string, number>,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const renderSummary = (events: CorrectEvent[]) => (
|
|
54
|
+
<>
|
|
55
|
+
Correction events showing AI self-improvement feedback loop
|
|
56
|
+
<br />
|
|
57
|
+
<br />
|
|
58
|
+
<strong>Success Rate:</strong> 100% (All corrections applied successfully)
|
|
59
|
+
<br />
|
|
60
|
+
<strong>Total Corrections:</strong> {events.length} events
|
|
61
|
+
<br />
|
|
62
|
+
<strong>Event Types:</strong> {eventTypes.join(", ")}
|
|
63
|
+
<br />
|
|
64
|
+
<br />
|
|
65
|
+
<div
|
|
66
|
+
style={{
|
|
67
|
+
display: "flex",
|
|
68
|
+
flexDirection: "column",
|
|
69
|
+
gap: "0.5rem",
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{eventTypes.map((type) => {
|
|
73
|
+
const typeDisplayNames = {
|
|
74
|
+
databaseCorrect: "🗄️ Database Schema",
|
|
75
|
+
testCorrect: "🧪 Test Suite",
|
|
76
|
+
realizeCorrect: "⚙️ Implementation",
|
|
77
|
+
realizeAuthorizationCorrect: "🔐 Authorization",
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div
|
|
82
|
+
key={type}
|
|
83
|
+
style={{
|
|
84
|
+
display: "flex",
|
|
85
|
+
justifyContent: "space-between",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
padding: "0.5rem",
|
|
88
|
+
backgroundColor: "#f0fdf4",
|
|
89
|
+
borderRadius: "0.25rem",
|
|
90
|
+
border: "1px solid #bbf7d0",
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<span style={{ fontSize: "0.75rem", fontWeight: "500" }}>
|
|
94
|
+
{typeDisplayNames[type as keyof typeof typeDisplayNames] ||
|
|
95
|
+
type}
|
|
96
|
+
</span>
|
|
97
|
+
<div
|
|
98
|
+
style={{ display: "flex", gap: "1rem", alignItems: "center" }}
|
|
99
|
+
>
|
|
100
|
+
<span style={{ fontSize: "0.75rem", color: "#16a34a" }}>
|
|
101
|
+
{eventTypeCounts[type]} corrections
|
|
102
|
+
</span>
|
|
103
|
+
<span
|
|
104
|
+
style={{
|
|
105
|
+
fontSize: "0.625rem",
|
|
106
|
+
color: "#64748b",
|
|
107
|
+
fontFamily: "monospace",
|
|
108
|
+
backgroundColor: "#e2e8f0",
|
|
109
|
+
padding: "0.125rem 0.375rem",
|
|
110
|
+
borderRadius: "0.25rem",
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
Step {latestSteps[type]}
|
|
114
|
+
</span>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
})}
|
|
119
|
+
</div>
|
|
120
|
+
<br />
|
|
121
|
+
<div
|
|
122
|
+
style={{
|
|
123
|
+
display: "flex",
|
|
124
|
+
gap: "0.5rem",
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<div
|
|
129
|
+
style={{
|
|
130
|
+
display: "flex",
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
gap: "0.25rem",
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<div
|
|
136
|
+
style={{
|
|
137
|
+
width: "12px",
|
|
138
|
+
height: "12px",
|
|
139
|
+
backgroundColor: "#16a34a",
|
|
140
|
+
borderRadius: "2px",
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
<span style={{ fontSize: "0.75rem" }}>
|
|
144
|
+
Corrected: {events.length}
|
|
145
|
+
</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div
|
|
148
|
+
style={{
|
|
149
|
+
display: "flex",
|
|
150
|
+
alignItems: "center",
|
|
151
|
+
gap: "0.25rem",
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<div
|
|
155
|
+
style={{
|
|
156
|
+
width: "12px",
|
|
157
|
+
height: "12px",
|
|
158
|
+
backgroundColor: "#10b981",
|
|
159
|
+
borderRadius: "2px",
|
|
160
|
+
}}
|
|
161
|
+
/>
|
|
162
|
+
<span style={{ fontSize: "0.75rem" }}>Self-Improvement Active</span>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</>
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<CollapsibleEventGroup
|
|
170
|
+
events={events}
|
|
171
|
+
title="Correction Events"
|
|
172
|
+
iconType="success"
|
|
173
|
+
variant="success"
|
|
174
|
+
getTimestamp={(event) => event.created_at}
|
|
175
|
+
renderEvent={(event) => <AutoBeCorrectEventMovie event={event} />}
|
|
176
|
+
renderSummary={renderSummary}
|
|
177
|
+
defaultCollapsed={defaultCollapsed}
|
|
178
|
+
description="AI self-correction and improvement events"
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export default CorrectEventGroup;
|
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutoBeDatabaseValidateEvent,
|
|
3
|
-
AutoBeInterfaceOperationReviewEvent,
|
|
4
|
-
AutoBeRealizeAuthorizationValidateEvent,
|
|
5
|
-
AutoBeRealizeValidateEvent,
|
|
6
|
-
AutoBeTestValidateEvent,
|
|
7
|
-
} from "@autobe/interface";
|
|
8
|
-
|
|
9
|
-
import { AutoBeValidateEventMovie } from "../AutoBeValidateEventMovie";
|
|
10
|
-
import { CollapsibleEventGroup } from "../common/CollapsibleEventGroup";
|
|
11
|
-
|
|
12
|
-
export type ValidateEvent =
|
|
13
|
-
| AutoBeDatabaseValidateEvent
|
|
14
|
-
| AutoBeInterfaceOperationReviewEvent
|
|
15
|
-
| AutoBeTestValidateEvent
|
|
16
|
-
| AutoBeRealizeValidateEvent
|
|
17
|
-
| AutoBeRealizeAuthorizationValidateEvent;
|
|
18
|
-
|
|
19
|
-
export interface IValidateEventGroupProps {
|
|
20
|
-
events: ValidateEvent[];
|
|
21
|
-
defaultCollapsed?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Specialized group component for validation events Shows validation summary
|
|
26
|
-
* and error statistics
|
|
27
|
-
*/
|
|
28
|
-
export const ValidateEventGroup = (props: IValidateEventGroupProps) => {
|
|
29
|
-
const { events, defaultCollapsed = true } = props;
|
|
30
|
-
|
|
31
|
-
if (events.length === 0) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Calculate validation statistics
|
|
36
|
-
const errorEvents = events.filter((event) => {
|
|
37
|
-
switch (event.type) {
|
|
38
|
-
case "databaseValidate":
|
|
39
|
-
case "realizeValidate":
|
|
40
|
-
return true;
|
|
41
|
-
case "testValidate":
|
|
42
|
-
case "realizeAuthorizationValidate":
|
|
43
|
-
return event.result.type !== "success";
|
|
44
|
-
case "interfaceOperationReview":
|
|
45
|
-
default:
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}).length;
|
|
49
|
-
|
|
50
|
-
const successEvents = events.length - errorEvents;
|
|
51
|
-
const eventTypes = Array.from(new Set(events.map((e) => e.type)));
|
|
52
|
-
|
|
53
|
-
const renderSummary = (events: ValidateEvent[]) => (
|
|
54
|
-
<>
|
|
55
|
-
Validation and review events from various components
|
|
56
|
-
<br />
|
|
57
|
-
<br />
|
|
58
|
-
<strong>Success Rate:</strong>{" "}
|
|
59
|
-
{events.length > 0
|
|
60
|
-
? Math.round((successEvents / events.length) * 100)
|
|
61
|
-
: 0}
|
|
62
|
-
%
|
|
63
|
-
<br />
|
|
64
|
-
<strong>Successful:</strong> {successEvents} events
|
|
65
|
-
<br />
|
|
66
|
-
<strong>Failed/Issues:</strong> {errorEvents} events
|
|
67
|
-
<br />
|
|
68
|
-
<strong>Event Types:</strong> {eventTypes.join(", ")}
|
|
69
|
-
<br />
|
|
70
|
-
<br />
|
|
71
|
-
<div
|
|
72
|
-
style={{
|
|
73
|
-
display: "flex",
|
|
74
|
-
gap: "0.5rem",
|
|
75
|
-
alignItems: "center",
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
<div
|
|
79
|
-
style={{
|
|
80
|
-
display: "flex",
|
|
81
|
-
alignItems: "center",
|
|
82
|
-
gap: "0.25rem",
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
<div
|
|
86
|
-
style={{
|
|
87
|
-
width: "12px",
|
|
88
|
-
height: "12px",
|
|
89
|
-
backgroundColor: "#4caf50",
|
|
90
|
-
borderRadius: "2px",
|
|
91
|
-
}}
|
|
92
|
-
/>
|
|
93
|
-
<span style={{ fontSize: "0.75rem" }}>Success: {successEvents}</span>
|
|
94
|
-
</div>
|
|
95
|
-
<div
|
|
96
|
-
style={{
|
|
97
|
-
display: "flex",
|
|
98
|
-
alignItems: "center",
|
|
99
|
-
gap: "0.25rem",
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
<div
|
|
103
|
-
style={{
|
|
104
|
-
width: "12px",
|
|
105
|
-
height: "12px",
|
|
106
|
-
backgroundColor: "#f59e0b",
|
|
107
|
-
borderRadius: "2px",
|
|
108
|
-
}}
|
|
109
|
-
/>
|
|
110
|
-
<span style={{ fontSize: "0.75rem" }}>Issues: {errorEvents}</span>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</>
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const getGroupIconType = () => {
|
|
117
|
-
if (errorEvents === 0) return "success"; // All successful
|
|
118
|
-
if (successEvents === 0) return "warning"; // All failed
|
|
119
|
-
return "warning"; // Mixed results
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const getGroupVariant = () => {
|
|
123
|
-
if (errorEvents === 0) return "success"; // All successful
|
|
124
|
-
if (successEvents === 0) return "warning"; // All failed
|
|
125
|
-
return "warning"; // Mixed results
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<CollapsibleEventGroup
|
|
130
|
-
events={events}
|
|
131
|
-
title="Validation Events"
|
|
132
|
-
iconType={getGroupIconType()}
|
|
133
|
-
variant={getGroupVariant()}
|
|
134
|
-
getTimestamp={(event) => event.created_at}
|
|
135
|
-
renderEvent={(event) => <AutoBeValidateEventMovie event={event} />}
|
|
136
|
-
renderSummary={renderSummary}
|
|
137
|
-
defaultCollapsed={defaultCollapsed}
|
|
138
|
-
description="Validation and review events"
|
|
139
|
-
/>
|
|
140
|
-
);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export default ValidateEventGroup;
|
|
1
|
+
import {
|
|
2
|
+
AutoBeDatabaseValidateEvent,
|
|
3
|
+
AutoBeInterfaceOperationReviewEvent,
|
|
4
|
+
AutoBeRealizeAuthorizationValidateEvent,
|
|
5
|
+
AutoBeRealizeValidateEvent,
|
|
6
|
+
AutoBeTestValidateEvent,
|
|
7
|
+
} from "@autobe/interface";
|
|
8
|
+
|
|
9
|
+
import { AutoBeValidateEventMovie } from "../AutoBeValidateEventMovie";
|
|
10
|
+
import { CollapsibleEventGroup } from "../common/CollapsibleEventGroup";
|
|
11
|
+
|
|
12
|
+
export type ValidateEvent =
|
|
13
|
+
| AutoBeDatabaseValidateEvent
|
|
14
|
+
| AutoBeInterfaceOperationReviewEvent
|
|
15
|
+
| AutoBeTestValidateEvent
|
|
16
|
+
| AutoBeRealizeValidateEvent
|
|
17
|
+
| AutoBeRealizeAuthorizationValidateEvent;
|
|
18
|
+
|
|
19
|
+
export interface IValidateEventGroupProps {
|
|
20
|
+
events: ValidateEvent[];
|
|
21
|
+
defaultCollapsed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Specialized group component for validation events Shows validation summary
|
|
26
|
+
* and error statistics
|
|
27
|
+
*/
|
|
28
|
+
export const ValidateEventGroup = (props: IValidateEventGroupProps) => {
|
|
29
|
+
const { events, defaultCollapsed = true } = props;
|
|
30
|
+
|
|
31
|
+
if (events.length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Calculate validation statistics
|
|
36
|
+
const errorEvents = events.filter((event) => {
|
|
37
|
+
switch (event.type) {
|
|
38
|
+
case "databaseValidate":
|
|
39
|
+
case "realizeValidate":
|
|
40
|
+
return true;
|
|
41
|
+
case "testValidate":
|
|
42
|
+
case "realizeAuthorizationValidate":
|
|
43
|
+
return event.result.type !== "success";
|
|
44
|
+
case "interfaceOperationReview":
|
|
45
|
+
default:
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}).length;
|
|
49
|
+
|
|
50
|
+
const successEvents = events.length - errorEvents;
|
|
51
|
+
const eventTypes = Array.from(new Set(events.map((e) => e.type)));
|
|
52
|
+
|
|
53
|
+
const renderSummary = (events: ValidateEvent[]) => (
|
|
54
|
+
<>
|
|
55
|
+
Validation and review events from various components
|
|
56
|
+
<br />
|
|
57
|
+
<br />
|
|
58
|
+
<strong>Success Rate:</strong>{" "}
|
|
59
|
+
{events.length > 0
|
|
60
|
+
? Math.round((successEvents / events.length) * 100)
|
|
61
|
+
: 0}
|
|
62
|
+
%
|
|
63
|
+
<br />
|
|
64
|
+
<strong>Successful:</strong> {successEvents} events
|
|
65
|
+
<br />
|
|
66
|
+
<strong>Failed/Issues:</strong> {errorEvents} events
|
|
67
|
+
<br />
|
|
68
|
+
<strong>Event Types:</strong> {eventTypes.join(", ")}
|
|
69
|
+
<br />
|
|
70
|
+
<br />
|
|
71
|
+
<div
|
|
72
|
+
style={{
|
|
73
|
+
display: "flex",
|
|
74
|
+
gap: "0.5rem",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<div
|
|
79
|
+
style={{
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
gap: "0.25rem",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
style={{
|
|
87
|
+
width: "12px",
|
|
88
|
+
height: "12px",
|
|
89
|
+
backgroundColor: "#4caf50",
|
|
90
|
+
borderRadius: "2px",
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
<span style={{ fontSize: "0.75rem" }}>Success: {successEvents}</span>
|
|
94
|
+
</div>
|
|
95
|
+
<div
|
|
96
|
+
style={{
|
|
97
|
+
display: "flex",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
gap: "0.25rem",
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
<div
|
|
103
|
+
style={{
|
|
104
|
+
width: "12px",
|
|
105
|
+
height: "12px",
|
|
106
|
+
backgroundColor: "#f59e0b",
|
|
107
|
+
borderRadius: "2px",
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
<span style={{ fontSize: "0.75rem" }}>Issues: {errorEvents}</span>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</>
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const getGroupIconType = () => {
|
|
117
|
+
if (errorEvents === 0) return "success"; // All successful
|
|
118
|
+
if (successEvents === 0) return "warning"; // All failed
|
|
119
|
+
return "warning"; // Mixed results
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const getGroupVariant = () => {
|
|
123
|
+
if (errorEvents === 0) return "success"; // All successful
|
|
124
|
+
if (successEvents === 0) return "warning"; // All failed
|
|
125
|
+
return "warning"; // Mixed results
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<CollapsibleEventGroup
|
|
130
|
+
events={events}
|
|
131
|
+
title="Validation Events"
|
|
132
|
+
iconType={getGroupIconType()}
|
|
133
|
+
variant={getGroupVariant()}
|
|
134
|
+
getTimestamp={(event) => event.created_at}
|
|
135
|
+
renderEvent={(event) => <AutoBeValidateEventMovie event={event} />}
|
|
136
|
+
renderSummary={renderSummary}
|
|
137
|
+
defaultCollapsed={defaultCollapsed}
|
|
138
|
+
description="Validation and review events"
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export default ValidateEventGroup;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
CorrectEventGroup,
|
|
3
|
-
type ICorrectEventGroupProps,
|
|
4
|
-
} from "./CorrectEventGroup";
|
|
5
|
-
export {
|
|
6
|
-
ValidateEventGroup,
|
|
7
|
-
type IValidateEventGroupProps,
|
|
8
|
-
} from "./ValidateEventGroup";
|
|
1
|
+
export {
|
|
2
|
+
CorrectEventGroup,
|
|
3
|
+
type ICorrectEventGroupProps,
|
|
4
|
+
} from "./CorrectEventGroup";
|
|
5
|
+
export {
|
|
6
|
+
ValidateEventGroup,
|
|
7
|
+
type IValidateEventGroupProps,
|
|
8
|
+
} from "./ValidateEventGroup";
|