@@ -11,50 +11,50 @@ export interface SqlMetadataRendererProps {
1111 } ;
1212}
1313
14- export const SqlMetadataRenderer = memo ( function SqlMetadataRenderer ( { data } : SqlMetadataRendererProps ) {
15- const getStatusMessage = ( ) => {
16- switch ( data . status ) {
17- case 'read_from_cache_success' :
18- return {
19- icon : '✓' ,
20- text : 'Query result loaded from cache' ,
21- color : 'var(--vscode-testing-iconPassed)'
22- } ;
23- case 'success_no_cache' :
24- return {
25- icon : 'ℹ' ,
26- text : 'Query executed successfully' ,
27- color : 'var(--vscode-notificationsInfoIcon-foreground)'
28- } ;
29- case 'cache_not_supported_for_query' :
30- return {
31- icon : 'ℹ' ,
32- text : 'Caching not supported for this query type' ,
33- color : 'var(--vscode-notificationsInfoIcon-foreground)'
34- } ;
35- default :
36- return {
37- icon : 'ℹ' ,
38- text : `Status: ${ data . status } ` ,
39- color : 'var(--vscode-foreground)'
40- } ;
41- }
42- } ;
14+ const getStatusMessage = ( status : string ) => {
15+ switch ( status ) {
16+ case 'read_from_cache_success' :
17+ return {
18+ icon : '✓' ,
19+ text : 'Query result loaded from cache' ,
20+ color : 'var(--vscode-testing-iconPassed)'
21+ } ;
22+ case 'success_no_cache' :
23+ return {
24+ icon : 'ℹ' ,
25+ text : 'Query executed successfully' ,
26+ color : 'var(--vscode-notificationsInfoIcon-foreground)'
27+ } ;
28+ case 'cache_not_supported_for_query' :
29+ return {
30+ icon : 'ℹ' ,
31+ text : 'Caching not supported for this query type' ,
32+ color : 'var(--vscode-notificationsInfoIcon-foreground)'
33+ } ;
34+ default :
35+ return {
36+ icon : 'ℹ' ,
37+ text : `Status: ${ status } ` ,
38+ color : 'var(--vscode-foreground)'
39+ } ;
40+ }
41+ } ;
4342
44- const statusInfo = getStatusMessage ( ) ;
43+ const formatBytes = ( bytes : number ) => {
44+ if ( bytes < 1024 ) {
45+ return `${ bytes } B` ;
46+ }
47+ if ( bytes < 1024 * 1024 ) {
48+ return `${ ( bytes / 1024 ) . toFixed ( 2 ) } KB` ;
49+ }
50+ if ( bytes < 1024 * 1024 * 1024 ) {
51+ return `${ ( bytes / ( 1024 * 1024 ) ) . toFixed ( 2 ) } MB` ;
52+ }
53+ return `${ ( bytes / ( 1024 * 1024 * 1024 ) ) . toFixed ( 2 ) } GB` ;
54+ } ;
4555
46- const formatBytes = ( bytes : number ) => {
47- if ( bytes < 1024 ) {
48- return `${ bytes } B` ;
49- }
50- if ( bytes < 1024 * 1024 ) {
51- return `${ ( bytes / 1024 ) . toFixed ( 2 ) } KB` ;
52- }
53- if ( bytes < 1024 * 1024 * 1024 ) {
54- return `${ ( bytes / ( 1024 * 1024 ) ) . toFixed ( 2 ) } MB` ;
55- }
56- return `${ ( bytes / ( 1024 * 1024 * 1024 ) ) . toFixed ( 2 ) } GB` ;
57- } ;
56+ export const SqlMetadataRenderer = memo ( function SqlMetadataRenderer ( { data } : SqlMetadataRendererProps ) {
57+ const statusInfo = getStatusMessage ( data . status ) ;
5858
5959 return (
6060 < div
0 commit comments