diff --git a/app/dashboard/applications/Applications.tsx b/app/dashboard/applications/Applications.tsx index f3defbb..ec4b8d7 100644 --- a/app/dashboard/applications/Applications.tsx +++ b/app/dashboard/applications/Applications.tsx @@ -72,6 +72,7 @@ export default function Dashboard() { const [applications, setApplications] = useState([]); const [servers, setServers] = useState([]); const [isGridLayout, setIsGridLayout] = useState(false); + const [loading, setLoading] = useState(true); useEffect(() => { const savedLayout = Cookies.get('layoutPreference'); @@ -109,10 +110,12 @@ export default function Dashboard() { const getApplications = async () => { try { + setLoading(true) const response = await axios.post('/api/applications/get', { page: currentPage, ITEMS_PER_PAGE: itemsPerPage }); setApplications(response.data.applications); setServers(response.data.servers); setMaxPage(response.data.maxPage); + setLoading(false) } catch (error: any) { console.log(error.response); } @@ -235,77 +238,95 @@ export default function Dashboard() {
-
- {applications.map((app) => ( - - -
-
-
-
-
-
-
-
- {app.icon ? ( - {app.name} - ) : ( - Image - )} -
-
- {app.name} - - {app.description}
- Server: {app.server || 'No server'} -
+ {!loading ? +
+ {applications.map((app) => ( + + +
+
+
-
-
-
- - {app.localURL && ( +
+
+
+ {app.icon ? ( + {app.name} + ) : ( + Image + )} +
+
+ {app.name} + + {app.description}
+ Server: {app.server || 'No server'} +
+
+
+
+
+
- )} + {app.localURL && ( + + )} +
+
-
+ + + ))} +
+ : +
+
+ + + + + + + + + + + Loading...
- - - ))} -
+
+ }
diff --git a/app/dashboard/servers/Servers.tsx b/app/dashboard/servers/Servers.tsx index e31f844..bf82b38 100644 --- a/app/dashboard/servers/Servers.tsx +++ b/app/dashboard/servers/Servers.tsx @@ -73,6 +73,7 @@ export default function Dashboard() { const [maxPage, setMaxPage] = useState(1); const [servers, setServers] = useState([]); const [isGridLayout, setIsGridLayout] = useState(false); + const [loading, setLoading] = useState(true); useEffect(() => { const savedLayout = Cookies.get('layoutPreference'); @@ -100,9 +101,11 @@ export default function Dashboard() { const getServers = async () => { try { + setLoading(true); const response = await axios.post('/api/servers/get', { page: currentPage }); setServers(response.data.servers); setMaxPage(response.data.maxPage); + setLoading(false); } catch (error: any) { console.log(error.response); } @@ -237,62 +240,80 @@ export default function Dashboard() {

-
- {servers.map((server) => ( - - -
-
-
- {server.name} - -
- - OS: {server.os || '-'} -
-
- - IP: {server.ip || 'Nicht angegeben'} -
-
-
-
-
-
-
- {server.url && ( - - )} -
- + {!loading ? +
+ {servers.map((server) => ( + + +
+
+
+ {server.name} + +
+ + OS: {server.os || '-'} +
+
+ + IP: {server.ip || 'Nicht angegeben'} +
+
+
+
+
+
+
+ {server.url && ( + + )} +
+ +
+
+
+ ))} +
+ : +
+
+ + + + + + + + + + + Loading...
- - - ))} -
+
+ }