Skip to content

Commit f31ae6b

Browse files
committed
feat: profiling支持条件值自定义输入
# Reviewed, transaction id: 29202
1 parent 8f1c8c5 commit f31ae6b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/profiling/src/components/condition-input.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,15 @@ const ConditionInput: React.FC<IProps> = ({ datasource, filterList, keyList, onC
155155
onChange(param);
156156
};
157157

158-
const handleValueConditionKeyDown = e => {
159-
if (e.key === 'Enter') {
160-
e.preventDefault();
158+
const handleValueConditionKeyDown = (e, index: number, list: ICommonItem[]) => {
159+
if (
160+
e.key === 'Enter' &&
161+
e.target.value &&
162+
!list?.some(item => item.id === e.target.value || item.name === e.target.value)
163+
) {
164+
const dimension = e.target.value;
165+
list.push({ id: dimension, name: dimension });
166+
handleValueChange(e.target.value, index);
161167
}
162168
};
163169

@@ -295,7 +301,7 @@ const ConditionInput: React.FC<IProps> = ({ datasource, filterList, keyList, onC
295301
showArrow={false}
296302
tokenSeparators={[',', '|', '\n', ' ', '\r\n', '\r']}
297303
onChange={v => handleValueChange(v, index)}
298-
onInputKeyDown={v => handleValueConditionKeyDown(v)}
304+
onInputKeyDown={v => handleValueConditionKeyDown(v, index, dimensionValueMap[item.key!] || [])}
299305
showSearch={true}
300306
>
301307
{/* {needNUll(item.key) && (

0 commit comments

Comments
 (0)