bug: Trace search bug is resolved (#741)

* bug: Trace search bug is resolved

* bug: Trace search bug is resolved

* chore: parseTagsToQuery is updated

* chore: parseTagsToQuery is updated

* chore: parseTagsToQuery is updated

* chore: parseTagsToQuery is updated
This commit is contained in:
palash-signoz 2022-03-03 19:10:51 +05:30 committed by GitHub
parent 9f7c60d2c1
commit 540a682bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -75,7 +75,7 @@ const SingleTags = (props: AllTagsProps): JSX.Element => {
value={AllMenu.find((e) => e.key === selectedOperator)?.value || ''} value={AllMenu.find((e) => e.key === selectedOperator)?.value || ''}
> >
{AllMenu.map((e) => ( {AllMenu.map((e) => (
<Option key={e.key} value={e.value}> <Option key={e.value} value={e.key}>
{e.value} {e.value}
</Option> </Option>
))} ))}

View File

@ -13,14 +13,14 @@ export const parseQueryToTags = (query: string): PayloadProps<Tags> => {
const noOfTags = query.split(' AND '); const noOfTags = query.split(' AND ');
const tags: Tags = noOfTags.map((filter) => { const tags: Tags = noOfTags.map((filter) => {
const isInPresent = filter.includes('IN'); const isInPresent = filter.includes('in');
const isNotInPresent = filter.includes('NOT_IN'); const isNotInPresent = filter.includes('not in');
if (!isNotInPresent || !isInPresent) { if (!isNotInPresent && !isInPresent) {
isError = true; isError = true;
} }
const splitBy = isNotInPresent ? 'NOT_IN' : isInPresent ? 'IN' : ''; const splitBy = isNotInPresent ? 'not in' : isInPresent ? 'in' : '';
if (splitBy.length === 0) { if (splitBy.length === 0) {
isError = true; isError = true;
@ -40,13 +40,15 @@ export const parseQueryToTags = (query: string): PayloadProps<Tags> => {
const removingFirstAndLastBrackets = `${filterForTags?.slice(1, -1)}`; const removingFirstAndLastBrackets = `${filterForTags?.slice(1, -1)}`;
const noofFilters = removingFirstAndLastBrackets.split(','); const noofFilters = removingFirstAndLastBrackets
.split(',')
.map((e) => e.replaceAll(/"/g, ''));
noofFilters.forEach((e) => { noofFilters.forEach((e) => {
const firstChar = e.charAt(0); const firstChar = e.charAt(0);
const lastChar = e.charAt(e.length - 1); const lastChar = e.charAt(e.length - 1);
if (!(firstChar === '"' && lastChar === '"')) { if (firstChar === '"' && lastChar === '"') {
isError = true; isError = true;
} }
}); });
@ -73,7 +75,9 @@ export const parseTagsToQuery = (tags: Tags): PayloadProps<string> => {
isError = true; isError = true;
} }
return `${Key[0]} ${Operator} (${Values.map((e) => `"${e}"`).join(',')})`; return `${Key[0]} ${Operator} (${Values.map((e) => {
return `"${e.replaceAll(/"/g, '')}"`;
}).join(',')})`;
}) })
.join(' AND '); .join(' AND ');