@@ -15,6 +15,7 @@ import Button from '@mui/material/Button';
15
15
import ConfirmDialog from '../common/ConfirmDialog' ;
16
16
import DefaultPage from '../common/DefaultPage' ;
17
17
import CopyableSecret from '../common/CopyableSecret' ;
18
+ import LoadingSpinner from '../common/LoadingSpinner.tsx' ;
18
19
import { useAppDispatch , useAppSelector } from '../store' ;
19
20
import { fetchApps , uploadImage , deleteApp , updateApp , createApp } from './app-actions.ts' ;
20
21
import AddApplicationDialog from './AddApplicationDialog' ;
@@ -26,6 +27,7 @@ import {LastUsedCell} from '../common/LastUsedCell';
26
27
const Applications = ( ) => {
27
28
const dispatch = useAppDispatch ( ) ;
28
29
const apps = useAppSelector ( ( state ) => state . app . items ) ;
30
+ const isLoading = useAppSelector ( ( state ) => state . app . isLoading ) ;
29
31
const [ toDeleteApp , setToDeleteApp ] = useState < IApplication | null > ( ) ;
30
32
const [ toUpdateApp , setToUpdateApp ] = useState < IApplication | null > ( ) ;
31
33
const [ createDialog , setCreateDialog ] = useState < boolean > ( false ) ;
@@ -83,47 +85,51 @@ const Applications = () => {
83
85
</ Button >
84
86
}
85
87
maxWidth = { 1000 } >
86
- < Grid size = { 12 } >
88
+ { isLoading ? (
89
+ < LoadingSpinner />
90
+ ) : (
91
+ < Grid size = { 12 } >
87
92
< Paper elevation = { 6 } style = { { overflowX : 'auto' } } >
88
- < Table id = "app-table" >
89
- < TableHead >
90
- < TableRow >
91
- < TableCell padding = "checkbox" style = { { width : 80 } } />
92
- < TableCell > Name</ TableCell >
93
- < TableCell > Token</ TableCell >
94
- < TableCell > Description</ TableCell >
95
- < TableCell > Priority</ TableCell >
96
- < TableCell > Last Used</ TableCell >
97
- < TableCell />
98
- < TableCell />
99
- </ TableRow >
100
- </ TableHead >
101
- < TableBody >
102
- { apps . map ( ( app : IApplication ) => (
103
- < Row
104
- key = { app . id }
105
- description = { app . description }
106
- defaultPriority = { app . defaultPriority }
107
- image = { app . image }
108
- name = { app . name }
109
- value = { app . token }
110
- lastUsed = { app . lastUsed }
111
- fUpload = { ( ) => handleImageUploadClick ( app . id ) }
112
- fDelete = { ( ) => setToDeleteApp ( app ) }
113
- fEdit = { ( ) => setToUpdateApp ( app ) }
114
- noDelete = { app . internal }
115
- />
116
- ) ) }
117
- </ TableBody >
118
- </ Table >
119
- < input
120
- ref = { fileInputRef }
121
- type = "file"
122
- style = { { display : 'none' } }
123
- onChange = { onUploadImage }
124
- />
125
- </ Paper >
126
- </ Grid >
93
+ < Table id = "app-table" >
94
+ < TableHead >
95
+ < TableRow >
96
+ < TableCell padding = "checkbox" style = { { width : 80 } } />
97
+ < TableCell > Name</ TableCell >
98
+ < TableCell > Token</ TableCell >
99
+ < TableCell > Description</ TableCell >
100
+ < TableCell > Priority</ TableCell >
101
+ < TableCell > Last Used</ TableCell >
102
+ < TableCell />
103
+ < TableCell />
104
+ </ TableRow >
105
+ </ TableHead >
106
+ < TableBody >
107
+ { apps . map ( ( app : IApplication ) => (
108
+ < Row
109
+ key = { app . id }
110
+ description = { app . description }
111
+ defaultPriority = { app . defaultPriority }
112
+ image = { app . image }
113
+ name = { app . name }
114
+ value = { app . token }
115
+ lastUsed = { app . lastUsed }
116
+ fUpload = { ( ) => handleImageUploadClick ( app . id ) }
117
+ fDelete = { ( ) => setToDeleteApp ( app ) }
118
+ fEdit = { ( ) => setToUpdateApp ( app ) }
119
+ noDelete = { app . internal }
120
+ />
121
+ ) ) }
122
+ </ TableBody >
123
+ </ Table >
124
+ < input
125
+ ref = { fileInputRef }
126
+ type = "file"
127
+ style = { { display : 'none' } }
128
+ onChange = { onUploadImage }
129
+ />
130
+ </ Paper >
131
+ </ Grid >
132
+ ) }
127
133
{ createDialog && (
128
134
< AddApplicationDialog
129
135
fClose = { ( ) => setCreateDialog ( false ) }
0 commit comments