diff --git a/frontend/src/_vars.scss b/frontend/src/_vars.scss index 6cfc0eb..e65237e 100755 --- a/frontend/src/_vars.scss +++ b/frontend/src/_vars.scss @@ -1,2 +1,4 @@ $primary_color: #242a33; +$second_color: #1A1B1E; +$third_color:#25262b; diff --git a/frontend/src/components/RegexView/RegexView.module.scss b/frontend/src/components/RegexView/RegexView.module.scss index 26f5d90..6dd71be 100755 --- a/frontend/src/components/RegexView/RegexView.module.scss +++ b/frontend/src/components/RegexView/RegexView.module.scss @@ -1,6 +1,13 @@ +@use "../../vars" as *; .box{ padding:30px; margin:5px; +} + +.regex_text{ + padding: 10px; + background-color: $third_color; + border-radius: 15px; } \ No newline at end of file diff --git a/frontend/src/components/RegexView/index.tsx b/frontend/src/components/RegexView/index.tsx index c67dabc..afbe669 100755 --- a/frontend/src/components/RegexView/index.tsx +++ b/frontend/src/components/RegexView/index.tsx @@ -1,17 +1,85 @@ -import { TextInput } from '@mantine/core'; +import { Center, Grid, SegmentedControl, Text, Title, Box, Badge, Space, ActionIcon } from '@mantine/core'; import React from 'react'; import { RegexFilter } from '../../js/models'; import { getHumanReadableRegex } from '../../js/utils'; - import style from "./RegexView.module.scss"; +import { FaListAlt } from "react-icons/fa" +import { TiCancel } from "react-icons/ti" +import { BsTrashFill } from "react-icons/bs" function RegexView({ regexInfo }:{ regexInfo:RegexFilter }) { + + const mode_string = regexInfo.mode == "C"? "C -> S": + regexInfo.mode == "S"? "S -> C": + regexInfo.mode == "B"? "S <-> C": "🤔" + + let regex_expr = getHumanReadableRegex(regexInfo.regex); + let exact_regex = true; + + if (regex_expr.length>=4 && regex_expr.startsWith(".*") && regex_expr.endsWith(".*")){ + regex_expr = regex_expr.substring(2,regex_expr.length-2) + exact_regex = false; + } + return
- + + + Regex: + + + {regex_expr} + + + {}} size="xl" radius="md" variant="filled"> + + + + + + + Blacklist + + ), + }, + { + value: 'whitelist', + label: ( +
+ + Whitelist +
+ ), + }, + ]} + size="md" + color="gray" + disabled + /> + +
+ Service: {regexInfo.service_id} + + ID: {regexInfo.id} +
+
+ + +
+ Match: {exact_regex?"EXACT":"FIND"} + + Packets filtered: {regexInfo.n_packets} + + Mode: {mode_string} +
+
+ +
} diff --git a/frontend/src/components/ServiceRow/ServiceRow.module.scss b/frontend/src/components/ServiceRow/ServiceRow.module.scss index 62af116..5df816a 100755 --- a/frontend/src/components/ServiceRow/ServiceRow.module.scss +++ b/frontend/src/components/ServiceRow/ServiceRow.module.scss @@ -14,4 +14,5 @@ font-weight: bolder; margin-right: 10px; margin-bottom: 13px; + color:#FFF; } \ No newline at end of file diff --git a/frontend/src/components/ServiceRow/index.tsx b/frontend/src/components/ServiceRow/index.tsx index b265824..b284d6c 100755 --- a/frontend/src/components/ServiceRow/index.tsx +++ b/frontend/src/components/ServiceRow/index.tsx @@ -6,7 +6,7 @@ import { MdOutlineArrowForwardIos } from "react-icons/md" import style from "./ServiceRow.module.scss"; //"status":"stop"/"wait"/"active"/"pause", -function ServiceRow({ service, onClick }:{ service:Service, onClick?:()=>void }) { +function ServiceRow({ service, onClick, additional_buttons }:{ service:Service, onClick?:()=>void, additional_buttons?:any }) { let status_color = "gray"; switch(service.status){ @@ -32,6 +32,7 @@ function ServiceRow({ service, onClick }:{ service:Service, onClick?:()=>void })
+ {additional_buttons} {service.status === "pause"?:} diff --git a/frontend/src/js/models.ts b/frontend/src/js/models.ts index 6bfc8c9..fbd4dbd 100755 --- a/frontend/src/js/models.ts +++ b/frontend/src/js/models.ts @@ -34,5 +34,6 @@ export type RegexFilter = { service_id:string, regex:string is_blacklist:boolean, - mode:string // C->S S->C BOTH + mode:string //C S B => C->S S->C BOTH + n_packets:number } \ No newline at end of file diff --git a/frontend/src/pages/ServiceDetails.tsx b/frontend/src/pages/ServiceDetails.tsx index a5dfba0..e1493a0 100755 --- a/frontend/src/pages/ServiceDetails.tsx +++ b/frontend/src/pages/ServiceDetails.tsx @@ -1,6 +1,7 @@ -import { Grid, Space, Title } from '@mantine/core'; +import { ActionIcon, Grid, Space, Title } from '@mantine/core'; import { showNotification } from '@mantine/notifications'; import React, { useEffect, useState } from 'react'; +import { BsTrashFill } from 'react-icons/bs'; import { ImCross } from 'react-icons/im'; import { useParams } from 'react-router-dom'; import RegexView from '../components/RegexView'; @@ -26,22 +27,17 @@ function ServiceDetails() { id:3546, is_blacklist:true, mode:"B", - regex:"d2VkcmZoaXdlZGZoYnVp", - service_id:"ctfe" + regex:"LipmbGFnX2NoZWNrLio=", + service_id:"ctfe", + n_packets:5, }, { id:3546, is_blacklist:true, mode:"B", regex:"d2VkcmZoaXdlZGZoYnVp", - service_id:"ctfe" - }, - { - id:3546, - is_blacklist:true, - mode:"B", - regex:"d2VkcmZoaXdlZGZoYnVp", - service_id:"ctfe" + service_id:"ctfe", + n_packets: 54 } ]) @@ -84,7 +80,10 @@ function ServiceDetails() { }, []); return <> - + + {}} size="xl" radius="md" variant="filled"> + + }> {regexesList.length === 0? <> No regex found for this service! Add one clicking the add button above: