This is an automated email from the ASF dual-hosted git repository.
aloyszhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new b93aa368a4 [INLONG-10898][Dashboard] Data ranking increases according
to dt sorting (#10899)
b93aa368a4 is described below
commit b93aa368a41e33838aa7e5b4c29b454d0fabec86
Author: kamianlaida <[email protected]>
AuthorDate: Tue Aug 27 14:08:17 2024 +0800
[INLONG-10898][Dashboard] Data ranking increases according to dt sorting
(#10899)
---
.../src/ui/pages/GroupDetail/DataStream/PreviewModal.tsx | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/PreviewModal.tsx
b/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/PreviewModal.tsx
index a608dbcb7e..fa9edff445 100644
--- a/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/PreviewModal.tsx
+++ b/inlong-dashboard/src/ui/pages/GroupDetail/DataStream/PreviewModal.tsx
@@ -24,6 +24,7 @@ import { useRequest, useUpdateEffect } from '@/ui/hooks';
import i18n from '@/i18n';
import { ColumnsType } from 'antd/es/table';
import dayjs from 'dayjs';
+import { SortOrder } from 'antd/es/table/interface';
export interface Props extends ModalProps {
inlongGroupId: string;
@@ -87,6 +88,12 @@ const Comp: React.FC<Props> = ({ inlongGroupId,
inlongStreamId, ...modalProps })
}
return;
};
+ const timestampSorter = (a, b) => {
+ const dateA = dayjs(a.dt, 'YYYY-MM-DD HH:mm:ss');
+ const dateB = dayjs(b.dt, 'YYYY-MM-DD HH:mm:ss');
+ return dateA.isBefore(dateB) ? -1 : dateA.isAfter(dateB) ? 1 : 0;
+ };
+ const sortOrder: SortOrder = 'descend';
const detailColumns: ColumnsType<DataType> = [
{
@@ -94,11 +101,13 @@ const Comp: React.FC<Props> = ({ inlongGroupId,
inlongStreamId, ...modalProps })
key: 'dt',
width: 200,
dataIndex: 'dt',
+ sorter: timestampSorter,
+ defaultSortOrder: sortOrder,
},
].concat(
(getColumn() ? getColumn() : []).concat([
{
- title: 'operation',
+ title: i18n.t('basic.Operating'),
key: 'operation',
fixed: 'right',
width: 100,