@@ -15,6 +15,7 @@ import Button from '@mui/material/Button';
1515import ConfirmDialog from '../common/ConfirmDialog' ;
1616import DefaultPage from '../common/DefaultPage' ;
1717import CopyableSecret from '../common/CopyableSecret' ;
18+ import LoadingSpinner from '../common/LoadingSpinner.tsx' ;
1819import { useAppDispatch , useAppSelector } from '../store' ;
1920import { fetchApps , uploadImage , deleteApp , updateApp , createApp } from './app-actions.ts' ;
2021import AddApplicationDialog from './AddApplicationDialog' ;
@@ -26,6 +27,7 @@ import {LastUsedCell} from '../common/LastUsedCell';
2627const Applications = ( ) => {
2728 const dispatch = useAppDispatch ( ) ;
2829 const apps = useAppSelector ( ( state ) => state . app . items ) ;
30+ const isLoading = useAppSelector ( ( state ) => state . app . isLoading ) ;
2931 const [ toDeleteApp , setToDeleteApp ] = useState < IApplication | null > ( ) ;
3032 const [ toUpdateApp , setToUpdateApp ] = useState < IApplication | null > ( ) ;
3133 const [ createDialog , setCreateDialog ] = useState < boolean > ( false ) ;
@@ -83,47 +85,51 @@ const Applications = () => {
8385 </ Button >
8486 }
8587 maxWidth = { 1000 } >
86- < Grid size = { 12 } >
88+ { isLoading ? (
89+ < LoadingSpinner />
90+ ) : (
91+ < Grid size = { 12 } >
8792 < 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+ ) }
127133 { createDialog && (
128134 < AddApplicationDialog
129135 fClose = { ( ) => setCreateDialog ( false ) }
0 commit comments