@@ -31,10 +31,9 @@ import {
3131 getTableColumns ,
3232 timeStaticsDimList ,
3333} from './config' ;
34- import { Table , Radio , Tabs , TabsProps } from 'antd' ;
34+ import { Table , Radio , Spin } from 'antd' ;
3535import i18n from '@/i18n' ;
3636import './index.less' ;
37- import { startCase } from 'lodash' ;
3837type Props = CommonInterface ;
3938const initialQuery = {
4039 inlongStreamId : null ,
@@ -43,6 +42,7 @@ const initialQuery = {
4342 timeStaticsDim : timeStaticsDimList [ 0 ] . value ,
4443 sinkId : null ,
4544 sinkType : null ,
45+ auditIds : [ ] ,
4646} ;
4747const Comp : React . FC < Props > = ( { inlongGroupId } ) => {
4848 const [ form ] = useForm ( ) ;
@@ -81,7 +81,11 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
8181 } ,
8282 ) ;
8383
84- const { data : sourceData = [ ] , run } = useRequest (
84+ const {
85+ data : sourceData = [ ] ,
86+ loading,
87+ run,
88+ } = useRequest (
8589 {
8690 url : '/audit/list' ,
8791 method : 'POST' ,
@@ -90,7 +94,7 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
9094 startDate : timestampFormat ( query . startDate , 'yyyy-MM-dd' ) ,
9195 endDate : timestampFormat ( query . endDate , 'yyyy-MM-dd' ) ,
9296 inlongGroupId,
93- inlongStreamId : inlongStreamID ,
97+ ... ( subTab === 'stream' && { inlongStreamId : inlongStreamID } ) ,
9498 } ,
9599 } ,
96100 {
@@ -101,7 +105,9 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
101105 query . endDate ,
102106 query . startDate ,
103107 query . timeStaticsDim ,
108+ query . auditIds ,
104109 inlongStreamID ,
110+ subTab ,
105111 ] ,
106112 formatResult : result => result . sort ( ( a , b ) => ( a . auditId - b . auditId > 0 ? 1 : - 1 ) ) ,
107113 } ,
@@ -149,12 +155,16 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
149155 } , { } ) ;
150156 }
151157 return output ;
152- } , [ sourceData , query . timeStaticsDim , type ] ) ;
158+ } , [ sourceData , type ] ) ;
153159
154160 const onSearch = async ( ) => {
155161 let values = await form . validateFields ( ) ;
156162 if ( values . timeStaticsDim == 'MINUTE' ) {
157- setQuery ( prev => ( { ...prev , endDate : prev . startDate } ) ) ;
163+ if ( subTab === 'group' ) {
164+ setQuery ( prev => ( { ...prev , endDate : prev . startDate , inlongStreamId : null } ) ) ;
165+ } else {
166+ setQuery ( prev => ( { ...prev , endDate : prev . startDate } ) ) ;
167+ }
158168 } else {
159169 setQuery ( values ) ;
160170 }
@@ -202,20 +212,21 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
202212 } , [ inlongGroupId , inlongStreamID ] ) ;
203213
204214 const onChange = e => {
215+ const newTab = e . target . value ;
205216 const tmp = { ...query } ;
206- if ( e . target . value === 'group' ) {
217+ if ( newTab === 'group' ) {
207218 tmp . inlongStreamId = null ;
208219 tmp . sinkId = null ;
209- setInlongStreamID ( undefined ) ;
220+ tmp . sinkType = null ;
221+ setInlongStreamID ( null ) ;
210222 } else {
211223 tmp . sinkType = null ;
212224 tmp . inlongStreamId = streamList ?. [ 0 ] ?. value ;
213225 setInlongStreamID ( streamList ?. [ 0 ] ?. value ) ;
214226 }
215227 setQuery ( tmp ) ;
216- setSubTab ( e . target . value ) ;
228+ setSubTab ( newTab ) ;
217229 } ;
218-
219230 return (
220231 < >
221232 < div style = { { marginBottom : 20 } } >
@@ -241,13 +252,14 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
241252 subTab ,
242253 ) }
243254 style = { { marginBottom : 30 , gap : 10 } }
244- onFilter = { allValues =>
255+ onFilter = { allValues => {
256+ console . log ( 'onFilter:' , allValues ) ;
245257 setQuery ( {
246258 ...allValues ,
247259 startDate : + allValues . startDate . $d ,
248260 endDate : + allValues . endDate . $d ,
249- } )
250- }
261+ } ) ;
262+ } }
251263 />
252264 </ div >
253265 < div className = "audit-container" >
@@ -262,7 +274,24 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
262274 </ Radio . Group >
263275 </ div >
264276 < div className = "chart-container" >
265- < Charts height = { 400 } option = { toChartData ( sourceData , sourceDataMap ) } forceUpdate = { true } />
277+ { loading ? (
278+ < div
279+ style = { {
280+ height : 400 ,
281+ display : 'flex' ,
282+ alignContent : 'center' ,
283+ justifyContent : 'center' ,
284+ } }
285+ >
286+ < Spin />
287+ </ div >
288+ ) : (
289+ < Charts
290+ height = { 400 }
291+ option = { toChartData ( sourceData , sourceDataMap ) }
292+ forceUpdate = { true }
293+ />
294+ ) }
266295 </ div >
267296 < div className = "table-container" >
268297 < HighTable
@@ -273,6 +302,7 @@ const Comp: React.FC<Props> = ({ inlongGroupId }) => {
273302 pagination : {
274303 pageSizeOptions : [ '10' , '20' , '50' , '60' , '100' , '120' ] ,
275304 } ,
305+ loading,
276306 summary : ( ) => (
277307 < Table . Summary fixed >
278308 < Table . Summary . Row >
0 commit comments