Skip to content

Commit

Permalink
change query
Browse files Browse the repository at this point in the history
Signed-off-by: shanghaikid <jiangruiyi@gmail.com>
  • Loading branch information
shanghaikid committed Jun 15, 2023
1 parent f7dfedd commit 6d2cf82
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions client/src/pages/query/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,27 @@ const Query: FC<{
// Iterate resultItem keys, then format vector(array) items.
const tmp = Object.keys(resultItem).reduce(
(prev: { [key: string]: any }, item: string) => {
if (Array.isArray(resultItem[item])) {
const list2Str = JSON.stringify(resultItem[item]);
prev[item] = (
<div className={classes.vectorTableCell}>
<div>{list2Str}</div>
<CopyButton
label={copyTrans.label}
value={list2Str}
className={classes.copyBtn}
/>
</div>
);
} else {
prev[item] = `${resultItem[item]}`;
switch (item) {
case 'json':
prev[item] = <div>{JSON.stringify(resultItem[item])}</div>;
break;
case 'vector':
const list2Str = JSON.stringify(resultItem[item]);
prev[item] = (
<div className={classes.vectorTableCell}>
<div>{list2Str}</div>
<CopyButton
label={copyTrans.label}
value={list2Str}
className={classes.copyBtn}
/>
</div>
);
break;
default:
prev[item] = `${resultItem[item]}`;
}

return prev;
},
{}
Expand Down

0 comments on commit 6d2cf82

Please sign in to comment.