mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 08:40:03 +02:00
Merge pull request #58 from tiqi-group/37-update-task-status-in-frontend-when-restarting-the-service
Service data will be fetched as soon as the client connects to the websocket server
This commit is contained in:
commit
d2c0b6968e
@ -126,11 +126,6 @@ const App = () => {
|
|||||||
}, [state]);
|
}, [state]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Fetch data from the API when the component mounts
|
|
||||||
fetch(`http://${hostname}:${port}/service-properties`)
|
|
||||||
.then((response) => response.json())
|
|
||||||
.then((data: DataServiceJSON) => dispatch({ type: 'SET_DATA', data }));
|
|
||||||
|
|
||||||
// Allow the user to add a custom css file
|
// Allow the user to add a custom css file
|
||||||
fetch(`http://${hostname}:${port}/custom.css`)
|
fetch(`http://${hostname}:${port}/custom.css`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -145,7 +140,13 @@ const App = () => {
|
|||||||
})
|
})
|
||||||
.catch(console.error); // Handle the error appropriately
|
.catch(console.error); // Handle the error appropriately
|
||||||
|
|
||||||
socket.on('connect', () => setConnectionStatus('connected'));
|
socket.on('connect', () => {
|
||||||
|
// Fetch data from the API when the client connects
|
||||||
|
fetch(`http://${hostname}:${port}/service-properties`)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data: DataServiceJSON) => dispatch({ type: 'SET_DATA', data }));
|
||||||
|
setConnectionStatus('connected');
|
||||||
|
});
|
||||||
socket.on('disconnect', () => {
|
socket.on('disconnect', () => {
|
||||||
setConnectionStatus('disconnected');
|
setConnectionStatus('disconnected');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -222,7 +223,7 @@ const App = () => {
|
|||||||
|
|
||||||
// While the data is loading
|
// While the data is loading
|
||||||
if (!state) {
|
if (!state) {
|
||||||
return <p>Loading...</p>;
|
return <ConnectionToast connectionStatus={connectionStatus} />;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"files": {
|
"files": {
|
||||||
"main.css": "/static/css/main.c444b055.css",
|
"main.css": "/static/css/main.c444b055.css",
|
||||||
"main.js": "/static/js/main.9a4bacc5.js",
|
"main.js": "/static/js/main.964bc334.js",
|
||||||
"index.html": "/index.html",
|
"index.html": "/index.html",
|
||||||
"main.c444b055.css.map": "/static/css/main.c444b055.css.map",
|
"main.c444b055.css.map": "/static/css/main.c444b055.css.map",
|
||||||
"main.9a4bacc5.js.map": "/static/js/main.9a4bacc5.js.map"
|
"main.964bc334.js.map": "/static/js/main.964bc334.js.map"
|
||||||
},
|
},
|
||||||
"entrypoints": [
|
"entrypoints": [
|
||||||
"static/css/main.c444b055.css",
|
"static/css/main.c444b055.css",
|
||||||
"static/js/main.9a4bacc5.js"
|
"static/js/main.964bc334.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site displaying a pydase UI."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>pydase App</title><script defer="defer" src="/static/js/main.9a4bacc5.js"></script><link href="/static/css/main.c444b055.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site displaying a pydase UI."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>pydase App</title><script defer="defer" src="/static/js/main.964bc334.js"></script><link href="/static/css/main.c444b055.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
File diff suppressed because one or more lines are too long
1
src/pydase/frontend/static/js/main.964bc334.js.map
Normal file
1
src/pydase/frontend/static/js/main.964bc334.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user