React Interface v3

This commit is contained in:
DomySh
2022-06-12 16:44:54 +02:00
parent 98652b0fa9
commit 3139cbf288
10 changed files with 284 additions and 163 deletions

View File

@@ -1,50 +1,22 @@
import { Space, Title } from '@mantine/core';
import { showNotification } from '@mantine/notifications';
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import ServiceRow from '../components/ServiceRow';
import { notification_time, Service, update_freq } from '../js/models';
import { servicelist } from '../js/utils';
import { ImCross } from "react-icons/im"
import { Service, update_freq } from '../js/models';
import { errorNotify, servicelist } from '../js/utils';
function HomePage() {
const [services, setServices] = useState<Service[]>([
{
id:"ctfe",
internal_port:18080,
n_packets: 30,
n_regex: 40,
name:"CTFe",
public_port:80,
status:"pause"
},
{
id:"saas",
internal_port:18080,
n_packets: 30,
n_regex: 40,
name:"SaaS",
public_port:5000,
status:"active"
}
]);
const [services, setServices] = useState<Service[]>([]);
const navigator = useNavigate()
const updateInfo = () => {
servicelist().then(res => {
setServices(res)
}).catch(
err =>{
showNotification({
autoClose: notification_time,
title: "Home Page Auto-Update failed!",
message: "[ "+err+" ]",
color: 'red',
icon: <ImCross />,
});
})
err => errorNotify("Home Page Auto-Update failed!", err.toString())
)
}
useEffect(()=>{