dnazarenkoo 8363dadd8d
fix: resolve the list view issues (#3020)
* feat: add dynamic table based on query

* feat: add the list view for the traces explorer

* fix: fix the options menu

* feat: update the list view columns config for the traces explorer

* feat: fix columns for the list view for the traces explorer page

* feat: update customization columns for the list view from the traces explorer

* feat: add error msg for the list view, fix creating data for the table

* fix: resolve the list view issues

* fix: update the date column for the list view

* fix: remove additional filter title for the list view

* fix: add initial orderBy filter for the list view

---------

Co-authored-by: Yevhen Shevchenko <y.shevchenko@seedium.io>
Co-authored-by: Nazarenko19 <danil.nazarenko2000@gmail.com>
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
2023-07-05 16:20:20 +05:30

29 lines
795 B
TypeScript

import { SelectProps } from 'antd';
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
export const getOptionsFromKeys = (
keys: BaseAutocompleteData[],
selectedKeys: (string | undefined)[],
): SelectProps['options'] => {
const options = keys.map(({ id, key }) => ({
label: key,
value: id,
}));
return options.filter(
({ value }) => !selectedKeys.find((key) => key === value),
);
};
export const getInitialColumns = (
initialColumnTitles: string[],
attributeKeys: BaseAutocompleteData[],
): BaseAutocompleteData[] =>
initialColumnTitles.reduce((acc, title) => {
const initialColumn = attributeKeys.find(({ key }) => title === key);
if (!initialColumn) return acc;
return [...acc, initialColumn];
}, [] as BaseAutocompleteData[]);