@@ -3,19 +3,15 @@ import Paper from '@mui/material/Paper';
3
3
import Typography from '@mui/material/Typography' ;
4
4
import Alert from '@mui/material/Alert' ;
5
5
import Button from '@mui/material/Button' ;
6
-
7
- import {
8
- LoadtestServiceClient ,
9
- } from 'src/gen/orijtech/cosmosloadtester/v1/Loadtest_serviceServiceClientPb' ;
10
- import {
11
- RunLoadtestRequest ,
12
- RunLoadtestResponse ,
13
- } from 'src/gen/orijtech/cosmosloadtester/v1/loadtest_service_pb' ;
14
-
15
6
import * as timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb' ;
16
7
8
+
9
+ import { LoadtestServiceClient } from 'src/gen/orijtech/cosmosloadtester/v1/Loadtest_serviceServiceClientPb' ;
10
+ import { RunLoadtestRequest , RunLoadtestResponse } from 'src/gen/orijtech/cosmosloadtester/v1/loadtest_service_pb' ;
11
+ import { Spinner } from 'src/components/Spinner' ;
17
12
import Inputs from 'src/components/inputs/Inputs' ;
18
13
import Outputs from 'src/components/output/Outputs' ;
14
+
19
15
import { fields } from './Fields' ;
20
16
21
17
const service = new LoadtestServiceClient ( '' ) ;
@@ -52,7 +48,11 @@ export default function LoadTester() {
52
48
. setTransactionSizeBytes ( data . transactionSizeBytes )
53
49
. setTransactionsPerSecond ( data . transactionsPerSecond )
54
50
. setConnectionCount ( data . connectionCount ) ;
51
+
52
+ await ( new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ) ;
53
+
55
54
const result = await service . runLoadtest ( request , null ) ;
55
+
56
56
setData ( result . toObject ( ) ) ;
57
57
console . log ( result . toObject ( ) ) ;
58
58
} catch ( e : any ) {
@@ -64,42 +64,45 @@ export default function LoadTester() {
64
64
} ;
65
65
66
66
return (
67
- < Paper elevation = { 0 } sx = { { mt : 3 , p : 3 } } >
68
- < Alert severity = 'info' sx = { { mb : 3 } } variant = 'standard' >
69
- < Typography variant = "caption" >
70
- Enter TM Parameters
71
- </ Typography >
72
- </ Alert >
73
- < Inputs
74
- handleFormSubmission = { onFormSubmit }
75
- fields = { fields }
76
- submitRef = { submitRef }
77
- />
78
- < Button
79
- disableElevation = { true }
80
- disabled = { running }
81
- color = { running ? 'inherit' : 'info' }
82
- sx = { { textTransform : 'none' } }
83
- variant = 'contained'
84
- onClick = { ( ) => submitRef . current ?. click ( ) }
85
- >
86
- { running ? 'Running load testing...' : 'Run load testing' }
87
- </ Button >
67
+ < >
68
+ < Spinner loading = { running } />
69
+ < Paper elevation = { 0 } sx = { { mt : 3 , p : 3 } } >
70
+ < Alert severity = 'info' sx = { { mb : 3 } } variant = 'standard' >
71
+ < Typography variant = "caption" >
72
+ Enter TM Parameters
73
+ </ Typography >
74
+ </ Alert >
75
+ < Inputs
76
+ handleFormSubmission = { onFormSubmit }
77
+ fields = { fields }
78
+ submitRef = { submitRef }
79
+ />
80
+ < Button
81
+ disableElevation = { true }
82
+ disabled = { running }
83
+ color = { running ? 'inherit' : 'info' }
84
+ sx = { { textTransform : 'none' } }
85
+ variant = 'contained'
86
+ onClick = { ( ) => submitRef . current ?. click ( ) }
87
+ >
88
+ { running ? 'Running load testing...' : 'Run load testing' }
89
+ </ Button >
88
90
89
- { /* display errors if any occured */ }
90
- { error !== '' && < Typography component = 'h6' variant = 'caption' > { error } </ Typography > }
91
- { /* render data if it exists */ }
92
- {
93
- data !== undefined &&
94
- < >
95
- < Alert severity = 'success' sx = { { my : 3 } } >
96
- < Typography variant = 'caption' >
97
- Load Testing Results
98
- </ Typography >
99
- </ Alert >
100
- < Outputs data = { data } />
101
- </ >
102
- }
103
- </ Paper >
91
+ { /* display errors if any occured */ }
92
+ { error !== '' && < Typography component = 'h6' variant = 'caption' > { error } </ Typography > }
93
+ { /* render data if it exists */ }
94
+ {
95
+ data !== undefined &&
96
+ < >
97
+ < Alert severity = 'success' sx = { { my : 3 } } >
98
+ < Typography variant = 'caption' >
99
+ Load Testing Results
100
+ </ Typography >
101
+ </ Alert >
102
+ < Outputs data = { data } />
103
+ </ >
104
+ }
105
+ </ Paper >
106
+ </ >
104
107
) ;
105
108
}
0 commit comments