feat: tag value suggestion is updated

This commit is contained in:
Palash gupta 2022-03-29 09:59:50 +05:30
parent d4d1104a53
commit 5556d1d6fc
No known key found for this signature in database
GPG Key ID: 8FD05AE6F9150AD6
4 changed files with 20 additions and 21 deletions

View File

@ -51,7 +51,7 @@ function DebounceSelect<
filterOption={false}
onSearch={debounceFetcher}
notFoundContent={fetching ? <Spin size="small" /> : null}
style={{ minWidth: '170px' }}
style={{ width: '170px' }}
// as all other props are from SelectProps only
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}

View File

@ -21,12 +21,8 @@ export async function fetchTag(
return [];
}
console.log(response.payload);
return [
{
label: 'asd',
value: 'asd',
},
];
return response.payload.map((e) => ({
label: e.tagValues,
value: e.tagValues,
}));
}

View File

@ -83,27 +83,22 @@ function SingleTags(props: AllTagsProps): JSX.Element {
<DebounceSelect
fetchOptions={(): Promise<TagValue[]> =>
fetchTag(globalReducer.minTime, globalReducer.maxTime, selectedKey[0])
fetchTag(globalReducer.minTime, globalReducer.maxTime, selectedKey[index])
}
debounceTimeout={300}
mode="tags"
/>
{/* <ValueSelect
value={selectedValues}
onChange={(value): void => {
onSelect={(value: Value): void => {
setLocalSelectedTags((tags) => [
...tags.slice(0, index),
{
Key: selectedKey,
Operator: selectedOperator,
Values: value as string[],
Values: [...selectedValues, value.value],
},
...tags.slice(index + 1, tags.length),
]);
}}
mode="tags"
/> */}
mode="multiple"
/>
<IconContainer role="button" onClick={(): void => onDeleteTagHandler(index)}>
<CloseOutlined />
@ -121,4 +116,10 @@ interface AllTagsProps {
>;
}
interface Value {
key: string;
label: string;
value: string;
}
export default SingleTags;

View File

@ -6,6 +6,8 @@ export interface Props {
tagKey: string;
}
export interface PayloadProps {
key: string;
interface Value {
tagValues: string;
}
export type PayloadProps = Value[];