Fixes, and made firegex responsive
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { LoadingOverlay, Space, Title } from '@mantine/core';
|
||||
import { ActionIcon, LoadingOverlay, Modal, Space, Title, Tooltip } from '@mantine/core';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { BsPlusLg } from "react-icons/bs";
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import ServiceRow from '../components/ServiceRow';
|
||||
import { Service, update_freq } from '../js/models';
|
||||
import { errorNotify, servicelist } from '../js/utils';
|
||||
import AddNewService from '../components/AddNewService';
|
||||
|
||||
|
||||
function HomePage() {
|
||||
@@ -11,6 +13,8 @@ function HomePage() {
|
||||
const [services, setServices] = useState<Service[]>([]);
|
||||
const [loader, setLoader] = useState(true);
|
||||
const navigator = useNavigate()
|
||||
const [open, setOpen] = useState(false);
|
||||
const closeModal = () => {setOpen(false);}
|
||||
|
||||
const updateInfo = async () => {
|
||||
await servicelist().then(res => {
|
||||
@@ -33,7 +37,22 @@ function HomePage() {
|
||||
<LoadingOverlay visible={loader} />
|
||||
{services.length > 0?services.map( srv => <ServiceRow service={srv} key={srv.id} onClick={()=>{
|
||||
navigator("/"+srv.id)
|
||||
}} />):<><Space h="xl"/> <Title className='center-flex' order={3}>No services found! Add one clicking the "+" button above</Title></>}
|
||||
}} />):<><Space h="xl"/> <Title className='center-flex' order={3}>No services found! Add one clicking the "+" button above</Title>
|
||||
<Space h="xl" /> <Space h="xl" /> <Space h="xl" /> <Space h="xl" /> <Space h="xl" /> <Space h="xl" />
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<Tooltip label="Add a new service" transition="skew-down" transitionDuration={300} transitionTimingFunction="ease" color="blue">
|
||||
<ActionIcon color="blue" onClick={()=>setOpen(true)} size="xl" radius="md" variant="filled"><BsPlusLg size="20px" /></ActionIcon>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</>}
|
||||
|
||||
<Modal size="xl" title="Add a new service" opened={open} onClose={closeModal} closeOnClickOutside={false} centered>
|
||||
<AddNewService closePopup={closeModal} />
|
||||
</Modal>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -84,47 +84,32 @@ function ServiceDetails() {
|
||||
return <div>
|
||||
<LoadingOverlay visible={loader} />
|
||||
<ServiceRow service={serviceInfo} additional_buttons={<>
|
||||
<Tooltip label="Delete service" transition="skew-down" transitionDuration={300} transitionTimingFunction="ease" color="red">
|
||||
<Tooltip label="Delete service" transition="pop" transitionDuration={200} openDelay={500} transitionTimingFunction="ease" color="red">
|
||||
<ActionIcon color="red" onClick={()=>setDeleteModal(true)} size="xl" radius="md" variant="filled"><BsTrashFill size={22} /></ActionIcon>
|
||||
</Tooltip>
|
||||
<Space w="md"/>
|
||||
<Tooltip label="Change proxy port" transition="skew-down" transitionDuration={300} transitionTimingFunction="ease" color="blue">
|
||||
<Tooltip label="Change proxy port" transition="pop" transitionDuration={200} openDelay={500} transitionTimingFunction="ease" color="blue">
|
||||
<ActionIcon color="blue" onClick={()=>setChangePortModal(true)} size="xl" radius="md" variant="filled"><BsArrowRepeat size={28} /></ActionIcon>
|
||||
</Tooltip>
|
||||
<Space w="md"/>
|
||||
</>} add_new_regex={<>
|
||||
<Tooltip label="Add a new regex" transition="skew-down" transitionDuration={300} transitionTimingFunction="ease" color="blue">
|
||||
<ActionIcon color="blue" onClick={()=>setOpen(true)} size="xl" radius="md" variant="filled"><BsPlusLg size="20px" /></ActionIcon>
|
||||
</Tooltip>
|
||||
</>}></ServiceRow>
|
||||
|
||||
{regexesList.length === 0?
|
||||
<><Space h="xl" /> <Title className='center-flex' order={3}>No regex found for this service! Add one by clicking the "+" button</Title>
|
||||
<Space h="xl" /> <Space h="xl" /> <Space h="xl" /> <Space h="xl" />
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<Tooltip label="Add a new regex" transition="skew-down" transitionDuration={300} transitionTimingFunction="ease" color="blue">
|
||||
<ActionIcon color="blue" onClick={()=>setOpen(true)} size="xl" radius="md" variant="filled"><BsPlusLg size="20px" /></ActionIcon>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
</>
|
||||
|
||||
:
|
||||
{regexesList.length === 0?<>
|
||||
<Space h="xl" />
|
||||
<Title className='center-flex' align='center' order={3}>No regex found for this service! Add one by clicking the "+" button</Title>
|
||||
<Space h="xl" /> <Space h="xl" />
|
||||
<div className='center-flex'>
|
||||
<Tooltip label="Add a new regex" transition="pop" transitionDuration={200} openDelay={500} transitionTimingFunction="ease" color="blue">
|
||||
<ActionIcon color="blue" onClick={()=>setOpen(true)} size="xl" radius="md" variant="filled"><BsPlusLg size="20px" /></ActionIcon>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</>:
|
||||
<Grid>
|
||||
{regexesList.map( (regexInfo) => <Grid.Col key={regexInfo.id} span={6}><RegexView regexInfo={regexInfo}/></Grid.Col>)}
|
||||
{regexesList.map( (regexInfo) => <Grid.Col key={regexInfo.id} lg={6} xs={12}><RegexView regexInfo={regexInfo}/></Grid.Col>)}
|
||||
</Grid>
|
||||
}
|
||||
|
||||
{srv_id?
|
||||
<Modal size="xl" title="Add a new regex filter" opened={open} onClose={closeModal} closeOnClickOutside={false} centered>
|
||||
<AddNewRegex closePopup={closeModal} service={srv_id} />
|
||||
</Modal>:
|
||||
null
|
||||
}
|
||||
{srv_id?<AddNewRegex opened={open} onClose={closeModal} service={srv_id} />:null}
|
||||
|
||||
<YesNoModal
|
||||
title='Are you sure to delete this service?'
|
||||
|
||||
Reference in New Issue
Block a user