1
- import { Table , Button , notification , Typography } from 'antd'
1
+ import { Table , Button , notification , Typography , Tooltip , Spin } from 'antd'
2
2
import { usePollingEffect } from '../../utils/usePollingEffect'
3
3
import React , { useState } from 'react'
4
4
import { ColumnType } from 'antd/es/table'
@@ -8,8 +8,10 @@ const { Paragraph } = Typography
8
8
interface RunningQueryData {
9
9
query : string
10
10
read_rows : number
11
+ read_rows_readable : string
11
12
query_id : string
12
13
total_rows_approx : number
14
+ total_rows_approx_readable : string
13
15
elapsed : number
14
16
memory_usage : string
15
17
}
@@ -80,11 +82,16 @@ export default function RunningQueries() {
80
82
)
81
83
} ,
82
84
} ,
85
+ { title : 'User' , dataIndex : 'user' } ,
83
86
{ title : 'Elapsed time' , dataIndex : 'elapsed' } ,
84
87
{
85
88
title : 'Rows read' ,
86
89
dataIndex : 'read_rows' ,
87
- render : ( _ : any , item ) => `~${ item . read_rows } /${ item . total_rows_approx } ` ,
90
+ render : ( _ : any , item ) => (
91
+ < Tooltip title = { `~${ item . read_rows } /${ item . total_rows_approx } ` } >
92
+ ~{ item . read_rows_readable } /{ item . total_rows_approx_readable }
93
+ </ Tooltip >
94
+ ) ,
88
95
} ,
89
96
{ title : 'Memory Usage' , dataIndex : 'memory_usage' } ,
90
97
{
@@ -95,7 +102,6 @@ export default function RunningQueries() {
95
102
96
103
usePollingEffect (
97
104
async ( ) => {
98
- setRunningQueries ( [ ] )
99
105
setLoadingRunningQueries ( true )
100
106
const res = await fetch ( '/api/analyze/running_queries' )
101
107
const resJson = await res . json ( )
@@ -108,9 +114,13 @@ export default function RunningQueries() {
108
114
109
115
return (
110
116
< >
111
- < h1 style = { { textAlign : 'left' } } > Running queries</ h1 >
117
+ < h1 style = { { textAlign : 'left' } } > Running queries { loadingRunningQueries ? < Spin /> : null } </ h1 >
112
118
< br />
113
- < Table columns = { columns } dataSource = { runningQueries } loading = { loadingRunningQueries } />
119
+ < Table
120
+ columns = { columns }
121
+ dataSource = { runningQueries }
122
+ loading = { runningQueries . length == 0 && loadingRunningQueries }
123
+ />
114
124
</ >
115
125
)
116
126
}
0 commit comments