Minor changes

This commit is contained in:
DomySh
2022-06-15 16:34:55 +02:00
parent b699eb4269
commit 0f912ce1b9
5 changed files with 3409 additions and 757 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -22,11 +22,13 @@
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"react-icons": "^4.4.0", "react-icons": "^4.4.0",
"react-router-dom": "^6.3.0", "react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"sass": "^1.52.3", "sass": "^1.52.3",
"typescript": "^4.7.3", "typescript": "^4.7.3",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"devDependencies": {
"react-scripts": "5.0.1"
},
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",

View File

@@ -21,12 +21,12 @@ function Header() {
const navigator = useNavigate() const navigator = useNavigate()
const updateInfo = () => { const updateInfo = () => {
generalstats().then(res => { generalstats().then(res => {
setGeneralStats(res) setGeneralStats(res)
}).catch( }).catch(
err => errorNotify("General Info Auto-Update failed!", err.toString()) err => errorNotify("General Info Auto-Update failed!", err.toString())
) )
} }
useEffect(()=>{ useEffect(()=>{

View File

@@ -38,6 +38,7 @@ function ServiceRow({ service, onClick, additional_buttons }:{ service:Service,
await stopservice(service.id).then(res => { await stopservice(service.id).then(res => {
if(!res){ if(!res){
okNotify(`Service ${service.id} stopped successfully!`,`The service ${service.name} has been stopped!`) okNotify(`Service ${service.id} stopped successfully!`,`The service ${service.name} has been stopped!`)
updateInfo();
}else{ }else{
errorNotify(`An error as occurred during the stopping of the service ${service.id}`,`Error: ${res}`) errorNotify(`An error as occurred during the stopping of the service ${service.id}`,`Error: ${res}`)
} }
@@ -45,7 +46,6 @@ function ServiceRow({ service, onClick, additional_buttons }:{ service:Service,
errorNotify(`An error as occurred during the stopping of the service ${service.id}`,`Error: ${err}`) errorNotify(`An error as occurred during the stopping of the service ${service.id}`,`Error: ${err}`)
}) })
setButtonLoading(false); setButtonLoading(false);
updateInfo();
} }
const startService = async () => { const startService = async () => {
@@ -53,6 +53,7 @@ function ServiceRow({ service, onClick, additional_buttons }:{ service:Service,
await startservice(service.id).then(res => { await startservice(service.id).then(res => {
if(!res){ if(!res){
okNotify(`Service ${service.id} started successfully!`,`The service ${service.name} has been started!`) okNotify(`Service ${service.id} started successfully!`,`The service ${service.name} has been started!`)
updateInfo();
}else{ }else{
errorNotify(`An error as occurred during the starting of the service ${service.id}`,`Error: ${res}`) errorNotify(`An error as occurred during the starting of the service ${service.id}`,`Error: ${res}`)
} }
@@ -60,7 +61,6 @@ function ServiceRow({ service, onClick, additional_buttons }:{ service:Service,
errorNotify(`An error as occurred during the starting of the service ${service.id}`,`Error: ${err}`) errorNotify(`An error as occurred during the starting of the service ${service.id}`,`Error: ${err}`)
}) })
setButtonLoading(false) setButtonLoading(false)
updateInfo();
} }
const pauseService = async () => { const pauseService = async () => {
@@ -68,6 +68,7 @@ function ServiceRow({ service, onClick, additional_buttons }:{ service:Service,
await pauseservice(service.id).then(res => { await pauseservice(service.id).then(res => {
if(!res){ if(!res){
okNotify(`Service ${service.id} paused successfully!`,`The service ${service.name} has been paused (Transparent mode)!`) okNotify(`Service ${service.id} paused successfully!`,`The service ${service.name} has been paused (Transparent mode)!`)
updateInfo();
}else{ }else{
errorNotify(`An error as occurred during the pausing of the service ${service.id}`,`Error: ${res}`) errorNotify(`An error as occurred during the pausing of the service ${service.id}`,`Error: ${res}`)
} }
@@ -75,7 +76,7 @@ function ServiceRow({ service, onClick, additional_buttons }:{ service:Service,
errorNotify(`An error as occurred during the pausing of the service ${service.id}`,`Error: ${err}`) errorNotify(`An error as occurred during the pausing of the service ${service.id}`,`Error: ${err}`)
}) })
setButtonLoading(false) setButtonLoading(false)
updateInfo();
} }
return <> return <>

View File

@@ -62,26 +62,27 @@ function ServiceDetails() {
const deleteService = () => { const deleteService = () => {
deleteservice(serviceInfo.id).then(res => { deleteservice(serviceInfo.id).then(res => {
if (!res) if (!res){
okNotify("Service delete complete!",`The service ${serviceInfo.id} has been deleted!`) okNotify("Service delete complete!",`The service ${serviceInfo.id} has been deleted!`)
else updateInfo();
}else
errorNotify("An error occurred while deleting a service",`Error: ${res}`) errorNotify("An error occurred while deleting a service",`Error: ${res}`)
}).catch(err => { }).catch(err => {
errorNotify("An error occurred while deleting a service",`Error: ${err}`) errorNotify("An error occurred while deleting a service",`Error: ${err}`)
}) })
updateInfo();
} }
const changePort = () => { const changePort = () => {
regenport(serviceInfo.id).then(res => { regenport(serviceInfo.id).then(res => {
if (!res) if (!res){
okNotify("Service port regeneration completed!",`The service ${serviceInfo.id} has changed the internal port!`) okNotify("Service port regeneration completed!",`The service ${serviceInfo.id} has changed the internal port!`)
else updateInfo();
}else
errorNotify("An error occurred while changing the internal service port",`Error: ${res}`) errorNotify("An error occurred while changing the internal service port",`Error: ${res}`)
}).catch(err => { }).catch(err => {
errorNotify("An error occurred while changing the internal service port",`Error: ${err}`) errorNotify("An error occurred while changing the internal service port",`Error: ${err}`)
}) })
updateInfo();
} }
return <div> return <div>