Skip to content

Commit 12b3273

Browse files
committed
fix: fixes
1 parent b2f786e commit 12b3273

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/containers/Tenant/Diagnostics/TopQueries/RunningQueriesData.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {ResizeableDataTable} from '../../../../components/ResizeableDataTable/Re
66
import {TableWithControlsLayout} from '../../../../components/TableWithControlsLayout/TableWithControlsLayout';
77
import {TruncatedQuery} from '../../../../components/TruncatedQuery/TruncatedQuery';
88
import {topQueriesApi} from '../../../../store/reducers/executeTopQueries/executeTopQueries';
9-
import type {CellValue, KeyValueRow} from '../../../../types/api/query';
9+
import type {KeyValueRow} from '../../../../types/api/query';
1010
import {cn} from '../../../../utils/cn';
1111
import {formatDateTime} from '../../../../utils/dataFormatters/dataFormatters';
1212
import {useAutoRefreshInterval, useTypedSelector} from '../../../../utils/hooks';
@@ -22,26 +22,20 @@ interface Props {
2222

2323
const RUNNING_QUERIES_COLUMNS_WIDTH_LS_KEY = 'runningQueriesColumnsWidth';
2424

25-
const parseDate = (date: CellValue) => (date ? new Date(date.toString()).getTime() : '');
26-
2725
const columns: Column<KeyValueRow>[] = [
2826
{
2927
name: 'UserSID',
3028
header: i18n('col_user'),
3129
render: ({row}) => <div className={b('user-sid')}>{row.UserSID || '–'}</div>,
32-
sortAccessor: (row) => String(row.UserSID),
3330
sortable: true,
3431
},
3532
{
3633
name: 'QueryStartAt',
3734
header: i18n('col_start-time'),
38-
render: ({row}) => formatDateTime(parseDate(row.QueryStartAt)),
35+
render: ({row}) => formatDateTime(new Date(row.QueryStartAt as string).getTime()),
3936
sortable: true,
4037
resizeable: false,
4138
defaultOrder: DataTable.DESCENDING,
42-
sortAccessor: (row) => {
43-
return parseDate(row.QueryStartAt);
44-
},
4539
},
4640
{
4741
name: 'Query',
@@ -57,7 +51,7 @@ const columns: Column<KeyValueRow>[] = [
5751
{
5852
name: 'ApplicationName',
5953
header: i18n('col_app'),
60-
render: ({row}) => row.ApplicationName || '-',
54+
render: ({row}) => <div className={b('user-sid')}>{row.ApplicationName || '–'}</div>,
6155
sortable: true,
6256
},
6357
];
@@ -78,7 +72,7 @@ export const RunningQueriesData = ({database}: Props) => {
7872
);
7973

8074
return (
81-
<TableWithControlsLayout.Table loading={isFetching}>
75+
<TableWithControlsLayout.Table loading={isFetching && data === undefined}>
8276
{error ? (
8377
<ResponseError error={error} />
8478
) : (

src/store/reducers/executeTopQueries/executeTopQueries.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const topQueriesApi = api.injectEndpoints({
8787

8888
return false;
8989
},
90+
providesTags: ['All'],
9091
}),
9192
getRunningQueries: build.query({
9293
queryFn: async (
@@ -118,6 +119,7 @@ export const topQueriesApi = api.injectEndpoints({
118119
forceRefetch() {
119120
return true;
120121
},
122+
providesTags: ['All'],
121123
}),
122124
}),
123125
overrideExisting: 'throw',

0 commit comments

Comments
 (0)