fix(ui): co-browser (assist) list sorting

This commit is contained in:
Shekar Siri 2025-01-28 11:12:48 +01:00
parent 260ed8ac19
commit 93db47901d
3 changed files with 12 additions and 18 deletions

View file

@ -30,7 +30,7 @@ function LiveSessionList() {
let timeoutId: any;
const { filters } = filter;
const hasUserFilter = filters.map((i: any) => i.key).includes(KEYS.USERID);
const sortOptions = [{ label: 'Start Time', value: 'timestamp' }].concat(
const sortOptions = [{ label: 'Start Time', value: 'timestamp' }, { label: 'Duration', value: 'duration' }].concat(
metaList
.map(({ key }: any) => ({
label: capitalize(key),

View file

@ -6,28 +6,22 @@ interface Props {
sortOrder: string;
onChange?: (sortOrder: string) => void;
}
export default React.memo(function SortOrderButton(props: Props) {
const { sortOrder, onChange = () => null } = props;
const isAscending = sortOrder === 'asc';
return (
<div className="rounded-full">
<Segmented
size='small'
options={[
{ label: 'Ascending', value: 'Ascending', icon: <ArrowUpOutlined /> },
{ label: 'Descending', value: 'Descending', icon: <ArrowDownOutlined /> },
]}
defaultValue="Ascending"
onChange={(value) => {
if (value === 'Ascending') {
onChange('asc');
} else if (value === 'Descending') {
onChange('desc');
}
}}
/>
<Segmented
size="small"
options={[
{ label: 'Ascending', value: 'asc', icon: <ArrowUpOutlined /> },
{ label: 'Descending', value: 'desc', icon: <ArrowDownOutlined /> }
]}
defaultValue={sortOrder}
onChange={onChange}
/>
</div>
);
});

View file

@ -49,7 +49,7 @@ class SearchStoreLive {
latestRequestTime: number | null = null;
latestList = List();
alertMetricId: number | null = null;
instance = new Search();
instance = new Search({ sort: 'timestamp', order: 'desc' });
instanceLive = new Search();
savedSearch = new Search();
filterSearchList: any = {};