Skip to content

Commit

Permalink
feat: profiling支持条件值自定义输入
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 29202
  • Loading branch information
liangling0628 committed Jan 14, 2025
1 parent 8f1c8c5 commit f31ae6b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/profiling/src/components/condition-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ const ConditionInput: React.FC<IProps> = ({ datasource, filterList, keyList, onC
onChange(param);
};

const handleValueConditionKeyDown = e => {
if (e.key === 'Enter') {
e.preventDefault();
const handleValueConditionKeyDown = (e, index: number, list: ICommonItem[]) => {
if (
e.key === 'Enter' &&
e.target.value &&
!list?.some(item => item.id === e.target.value || item.name === e.target.value)
) {
const dimension = e.target.value;
list.push({ id: dimension, name: dimension });
handleValueChange(e.target.value, index);
}
};

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

0 comments on commit f31ae6b

Please sign in to comment.