handle no report with void gridlayout

This commit is contained in:
Jordan Blasenhauer 2024-06-26 10:36:53 +02:00
parent ae2fe62cf3
commit d152ed903e
7 changed files with 29 additions and 1097 deletions

View file

@ -1082,6 +1082,9 @@ body {
@apply col-span-12 text-lg mb-0 font-bold dark:text-gray-300 break-word;
}
.text-void {
@apply col-span-12 text-lg mb-0 font-bold text-gray-300 break-word;
}
.text-table {
@apply col-span-12 mb-0 dark:text-gray-300 break-word;
@ -1162,6 +1165,10 @@ body {
@apply capitalize-first break-word w-full max-w-[80%] sm:max-w-[800px] col-span-12 font-bold dark:text-white/90 transition duration-300 ease-in-out text-[1.3rem] text-[#344767] tracking-normal;
}
.title-void {
@apply capitalize-first break-word w-full max-w-[80%] sm:max-w-[800px] col-span-12 font-bold dark:text-white/90 transition duration-300 ease-in-out text-[1.3rem] text-white tracking-normal;
}
.title-form {
@apply capitalize-first break-word w-full max-w-[80%] sm:max-w-[800px] col-span-12 font-bold dark:text-white/90 transition duration-300 ease-in-out text-xl text-[#344767] tracking-normal;
}
@ -1191,6 +1198,7 @@ body {
}
.no-subtitle.title-card,
.no-subtitle.title-void,
.no-subtitle.title-content,
.no-subtitle.title-min,
.no-subtitle.title-form {
@ -1204,6 +1212,7 @@ body {
.is-subtitle.title-form,
.is-subtitle.title-card,
.is-subtitle.title-void,
.is-subtitle.title-modal,
.is-subtitle.title-stat,
.is-subtitle.title-content,
@ -1217,6 +1226,10 @@ body {
@apply capitalize-first break-word dark:text-gray-300 col-span-12 break-words w-full max-w-[80%] sm:max-w-[800px] leading-normal text-[1.1rem] mb-0 lowercase;
}
.subtitle-void {
@apply capitalize-first break-word text-gray-300 col-span-12 break-words w-full max-w-[80%] sm:max-w-[800px] leading-normal text-[1.1rem] mb-0 lowercase;
}
.subtitle-form {
@apply capitalize-first break-word dark:text-gray-300 col-span-12 break-words w-full max-w-[80%] sm:max-w-[800px] leading-normal text-[1.05rem] mb-0 lowercase;
}

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@
import Grid from "@components/Widget/Grid.vue";
import GridLayout from "@components/Widget/GridLayout.vue";
import Title from "@components/Widget/Title.vue";
import Subtitle from "@components/Widget/Subtitle.vue";
import Table from "@components/Widget/Table.vue";
import MessageUnmatch from "@components/Message/Unmatch.vue";
@ -49,6 +50,7 @@ const props = defineProps({
v-bind="widget.data"
/>
<Title v-if="widget.type === 'Title'" v-bind="widget.data" />
<Subtitle v-if="widget.type === 'Subtitle'" v-bind="widget.data" />
<Table v-if="widget.type === 'Table'" v-bind="widget.data" />
</template>
</Grid>

View file

@ -68,10 +68,12 @@ const textIconEl = ref(null);
onMounted(() => {
// Check if next sibling is a
const renderEl = textEl.value || textIconEl.value || null;
const isVoid = renderEl.closest('[data-is="void"]') ? "void" : "";
text.class =
props.textClass || renderEl.closest("[data-is]")
? `text-${renderEl.closest("[data-is]").getAttribute("data-is")}`
? `text-${
isVoid || renderEl.closest("[data-is]").getAttribute("data-is")
}`
: "text-card";
});
</script>

View file

@ -33,542 +33,12 @@ onMounted(() => {
const builder = [
{
type: "card",
containerColumns: {
pc: 12,
tablet: 12,
mobile: 12,
},
type: "void",
widgets: [
{
type: "Title",
type: "MessageUnmatch",
data: {
title: "reports_title",
},
},
{
type: "Table",
data: {
title: "reports_table_title",
minWidth: "xl",
header: [
"reports_table_date",
"reports_table_ip",
"reports_table_country",
"reports_table_method",
"reports_table_url",
"reports_table_status_code",
"reports_table_cache_user_agent",
"reports_table_reason",
"reports_table_data",
],
positions: [1, 1, 1, 1, 2, 1, 2, 1, 2],
items: [
[
{
date: "25/06/2024 07:40:23",
type: "Text",
data: {
text: "25/06/2024 07:40:23",
},
},
{
ip: "172.21.0.1",
type: "Text",
data: {
text: "172.21.0.1",
},
},
{
country: "local",
type: "Text",
data: {
text: "local",
},
},
{
method: "GET",
type: "Text",
data: {
text: "GET",
},
},
{
url: "/admin/login?id=etc/passwd",
type: "Text",
data: {
text: "/admin/login?id=etc/passwd",
},
},
{
code: "403",
type: "Text",
data: {
text: "403",
},
},
{
user_agent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
type: "Text",
data: {
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
},
},
{
reason: "modsecurity",
type: "Text",
data: {
text: "modsecurity",
},
},
{
raw_data:
'{"fesfesfsefesfesfesfesfesfesfesfesfesfsefes": "fesfs"}',
type: "Text",
data: {
text: '{"fesfesfsefesfesfesfesfesfesfesfesfesfsefes": "fesfs"}',
},
},
],
[
{
date: "25/06/2024 07:40:23",
type: "Text",
data: {
text: "25/06/2024 07:40:23",
},
},
{
ip: "111111",
type: "Text",
data: {
text: "111111",
},
},
{
country: "fr",
type: "Text",
data: {
text: "fr",
},
},
{
method: "POST",
type: "Text",
data: {
text: "POST",
},
},
{
url: "/admin/login?id=e",
type: "Text",
data: {
text: "/admin/login?id=e",
},
},
{
code: "403",
type: "Text",
data: {
text: "403",
},
},
{
user_agent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
type: "Text",
data: {
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
},
},
{
reason: " antibot",
type: "Text",
data: {
text: " antibot",
},
},
{
raw_data: "{}",
type: "Text",
data: {
text: "{}",
},
},
],
[
{
date: "25/06/2024 07:40:23",
type: "Text",
data: {
text: "25/06/2024 07:40:23",
},
},
{
ip: "111111",
type: "Text",
data: {
text: "111111",
},
},
{
country: "fr",
type: "Text",
data: {
text: "fr",
},
},
{
method: "POST",
type: "Text",
data: {
text: "POST",
},
},
{
url: "/admin/login?id=e",
type: "Text",
data: {
text: "/admin/login?id=e",
},
},
{
code: "403",
type: "Text",
data: {
text: "403",
},
},
{
user_agent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
type: "Text",
data: {
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
},
},
{
reason: " antibot",
type: "Text",
data: {
text: " antibot",
},
},
{
raw_data: "{}",
type: "Text",
data: {
text: "{}",
},
},
],
[
{
date: "25/06/2024 07:40:23",
type: "Text",
data: {
text: "25/06/2024 07:40:23",
},
},
{
ip: "111111",
type: "Text",
data: {
text: "111111",
},
},
{
country: "fr",
type: "Text",
data: {
text: "fr",
},
},
{
method: "POST",
type: "Text",
data: {
text: "POST",
},
},
{
url: "/admin/login?id=e",
type: "Text",
data: {
text: "/admin/login?id=e",
},
},
{
code: "403",
type: "Text",
data: {
text: "403",
},
},
{
user_agent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
type: "Text",
data: {
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
},
},
{
reason: " antibot",
type: "Text",
data: {
text: " antibot",
},
},
{
raw_data: "{}",
type: "Text",
data: {
text: "{}",
},
},
],
[
{
date: "25/06/2024 07:40:23",
type: "Text",
data: {
text: "25/06/2024 07:40:23",
},
},
{
ip: "111111",
type: "Text",
data: {
text: "111111",
},
},
{
country: "fr",
type: "Text",
data: {
text: "fr",
},
},
{
method: "POST",
type: "Text",
data: {
text: "POST",
},
},
{
url: "/admin/login?id=e",
type: "Text",
data: {
text: "/admin/login?id=e",
},
},
{
code: "403",
type: "Text",
data: {
text: "403",
},
},
{
user_agent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
type: "Text",
data: {
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
},
},
{
reason: " antibot",
type: "Text",
data: {
text: " antibot",
},
},
{
raw_data: "{}",
type: "Text",
data: {
text: "{}",
},
},
],
[
{
date: "25/06/2024 07:40:23",
type: "Text",
data: {
text: "25/06/2024 07:40:23",
},
},
{
ip: "111111",
type: "Text",
data: {
text: "111111",
},
},
{
country: "fr",
type: "Text",
data: {
text: "fr",
},
},
{
method: "POST",
type: "Text",
data: {
text: "POST",
},
},
{
url: "/admin/login?id=e",
type: "Text",
data: {
text: "/admin/login?id=e",
},
},
{
code: "403",
type: "Text",
data: {
text: "403",
},
},
{
user_agent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
type: "Text",
data: {
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
},
},
{
reason: " antibot",
type: "Text",
data: {
text: " antibot",
},
},
{
raw_data: "{}",
type: "Text",
data: {
text: "{}",
},
},
],
],
filters: [
{
filter: "table",
filterName: "keyword",
type: "keyword",
value: "",
keys: ["url", "ip", "date", "user_agent", "raw_data"],
field: {
id: "reports-keyword",
value: "",
type: "text",
name: "reports-keyword",
label: "reports_search",
placeholder: "inp_keyword",
isClipboard: false,
popovers: [
{
text: "reports_search_desc",
iconName: "info",
},
],
columns: {
pc: 3,
tablet: 4,
mobile: 12,
},
},
},
{
filter: "table",
filterName: "country",
type: "select",
value: "all",
keys: ["country"],
field: {
id: "reports-country",
value: "all",
values: ["all", "local", "fr"],
name: "reports-country",
onlyDown: true,
label: "reports_country",
popovers: [
{
text: "reports_country_desc",
iconName: "info",
},
],
columns: {
pc: 3,
tablet: 4,
mobile: 12,
},
},
},
{
filter: "table",
filterName: "method",
type: "select",
value: "all",
keys: ["method"],
field: {
id: "reports-method",
value: "all",
values: ["all", "GET", "POST"],
name: "reports-method",
onlyDown: true,
label: "reports_method",
popovers: [
{
text: "reports_method_desc",
iconName: "info",
},
],
columns: {
pc: 3,
tablet: 4,
mobile: 12,
},
},
},
{
filter: "table",
filterName: "reason",
type: "select",
value: "all",
keys: ["reason"],
field: {
id: "reports-reason",
value: "all",
values: ["all", "modsecurity", " antibot"],
name: "reports-reason",
onlyDown: true,
label: "reports_reason",
popovers: [
{
text: "reports_reason_desc",
iconName: "info",
},
],
columns: {
pc: 3,
tablet: 4,
mobile: 12,
},
},
},
],
text: "reports_not_found",
},
},
],

View file

@ -1,568 +1,11 @@
[
{
"type": "card",
"containerColumns": {
"pc": 12,
"tablet": 12,
"mobile": 12
},
"type": "void",
"widgets": [
{
"type": "Title",
"type": "MessageUnmatch",
"data": {
"title": "reports_title"
}
},
{
"type": "Table",
"data": {
"title": "reports_table_title",
"minWidth": "xl",
"header": [
"reports_table_date",
"reports_table_ip",
"reports_table_country",
"reports_table_method",
"reports_table_url",
"reports_table_status_code",
"reports_table_cache_user_agent",
"reports_table_reason",
"reports_table_data"
],
"positions": [
1,
1,
1,
1,
2,
1,
2,
1,
2
],
"items": [
[
{
"date": "25/06/2024 07:40:23",
"type": "Text",
"data": {
"text": "25/06/2024 07:40:23"
}
},
{
"ip": "172.21.0.1",
"type": "Text",
"data": {
"text": "172.21.0.1"
}
},
{
"country": "local",
"type": "Text",
"data": {
"text": "local"
}
},
{
"method": "GET",
"type": "Text",
"data": {
"text": "GET"
}
},
{
"url": "/admin/login?id=etc/passwd",
"type": "Text",
"data": {
"text": "/admin/login?id=etc/passwd"
}
},
{
"code": "403",
"type": "Text",
"data": {
"text": "403"
}
},
{
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"type": "Text",
"data": {
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
},
{
"reason": "modsecurity",
"type": "Text",
"data": {
"text": "modsecurity"
}
},
{
"raw_data": "{\"fesfesfsefesfesfesfesfesfesfesfesfesfsefes\": \"fesfs\"}",
"type": "Text",
"data": {
"text": "{\"fesfesfsefesfesfesfesfesfesfesfesfesfsefes\": \"fesfs\"}"
}
}
],
[
{
"date": "25/06/2024 07:40:23",
"type": "Text",
"data": {
"text": "25/06/2024 07:40:23"
}
},
{
"ip": "111111",
"type": "Text",
"data": {
"text": "111111"
}
},
{
"country": "fr",
"type": "Text",
"data": {
"text": "fr"
}
},
{
"method": "POST",
"type": "Text",
"data": {
"text": "POST"
}
},
{
"url": "/admin/login?id=e",
"type": "Text",
"data": {
"text": "/admin/login?id=e"
}
},
{
"code": "403",
"type": "Text",
"data": {
"text": "403"
}
},
{
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"type": "Text",
"data": {
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
},
{
"reason": " antibot",
"type": "Text",
"data": {
"text": " antibot"
}
},
{
"raw_data": "{}",
"type": "Text",
"data": {
"text": "{}"
}
}
],
[
{
"date": "25/06/2024 07:40:23",
"type": "Text",
"data": {
"text": "25/06/2024 07:40:23"
}
},
{
"ip": "111111",
"type": "Text",
"data": {
"text": "111111"
}
},
{
"country": "fr",
"type": "Text",
"data": {
"text": "fr"
}
},
{
"method": "POST",
"type": "Text",
"data": {
"text": "POST"
}
},
{
"url": "/admin/login?id=e",
"type": "Text",
"data": {
"text": "/admin/login?id=e"
}
},
{
"code": "403",
"type": "Text",
"data": {
"text": "403"
}
},
{
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"type": "Text",
"data": {
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
},
{
"reason": " antibot",
"type": "Text",
"data": {
"text": " antibot"
}
},
{
"raw_data": "{}",
"type": "Text",
"data": {
"text": "{}"
}
}
],
[
{
"date": "25/06/2024 07:40:23",
"type": "Text",
"data": {
"text": "25/06/2024 07:40:23"
}
},
{
"ip": "111111",
"type": "Text",
"data": {
"text": "111111"
}
},
{
"country": "fr",
"type": "Text",
"data": {
"text": "fr"
}
},
{
"method": "POST",
"type": "Text",
"data": {
"text": "POST"
}
},
{
"url": "/admin/login?id=e",
"type": "Text",
"data": {
"text": "/admin/login?id=e"
}
},
{
"code": "403",
"type": "Text",
"data": {
"text": "403"
}
},
{
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"type": "Text",
"data": {
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
},
{
"reason": " antibot",
"type": "Text",
"data": {
"text": " antibot"
}
},
{
"raw_data": "{}",
"type": "Text",
"data": {
"text": "{}"
}
}
],
[
{
"date": "25/06/2024 07:40:23",
"type": "Text",
"data": {
"text": "25/06/2024 07:40:23"
}
},
{
"ip": "111111",
"type": "Text",
"data": {
"text": "111111"
}
},
{
"country": "fr",
"type": "Text",
"data": {
"text": "fr"
}
},
{
"method": "POST",
"type": "Text",
"data": {
"text": "POST"
}
},
{
"url": "/admin/login?id=e",
"type": "Text",
"data": {
"text": "/admin/login?id=e"
}
},
{
"code": "403",
"type": "Text",
"data": {
"text": "403"
}
},
{
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"type": "Text",
"data": {
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
},
{
"reason": " antibot",
"type": "Text",
"data": {
"text": " antibot"
}
},
{
"raw_data": "{}",
"type": "Text",
"data": {
"text": "{}"
}
}
],
[
{
"date": "25/06/2024 07:40:23",
"type": "Text",
"data": {
"text": "25/06/2024 07:40:23"
}
},
{
"ip": "111111",
"type": "Text",
"data": {
"text": "111111"
}
},
{
"country": "fr",
"type": "Text",
"data": {
"text": "fr"
}
},
{
"method": "POST",
"type": "Text",
"data": {
"text": "POST"
}
},
{
"url": "/admin/login?id=e",
"type": "Text",
"data": {
"text": "/admin/login?id=e"
}
},
{
"code": "403",
"type": "Text",
"data": {
"text": "403"
}
},
{
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"type": "Text",
"data": {
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
}
},
{
"reason": " antibot",
"type": "Text",
"data": {
"text": " antibot"
}
},
{
"raw_data": "{}",
"type": "Text",
"data": {
"text": "{}"
}
}
]
],
"filters": [
{
"filter": "table",
"filterName": "keyword",
"type": "keyword",
"value": "",
"keys": [
"url",
"ip",
"date",
"user_agent",
"raw_data"
],
"field": {
"id": "reports-keyword",
"value": "",
"type": "text",
"name": "reports-keyword",
"label": "reports_search",
"placeholder": "inp_keyword",
"isClipboard": false,
"popovers": [
{
"text": "reports_search_desc",
"iconName": "info"
}
],
"columns": {
"pc": 3,
"tablet": 4,
"mobile": 12
}
}
},
{
"filter": "table",
"filterName": "country",
"type": "select",
"value": "all",
"keys": [
"country"
],
"field": {
"id": "reports-country",
"value": "all",
"values": [
"all",
"local",
"fr"
],
"name": "reports-country",
"onlyDown": true,
"label": "reports_country",
"popovers": [
{
"text": "reports_country_desc",
"iconName": "info"
}
],
"columns": {
"pc": 3,
"tablet": 4,
"mobile": 12
}
}
},
{
"filter": "table",
"filterName": "method",
"type": "select",
"value": "all",
"keys": [
"method"
],
"field": {
"id": "reports-method",
"value": "all",
"values": [
"all",
"GET",
"POST"
],
"name": "reports-method",
"onlyDown": true,
"label": "reports_method",
"popovers": [
{
"text": "reports_method_desc",
"iconName": "info"
}
],
"columns": {
"pc": 3,
"tablet": 4,
"mobile": 12
}
}
},
{
"filter": "table",
"filterName": "reason",
"type": "select",
"value": "all",
"keys": [
"reason"
],
"field": {
"id": "reports-reason",
"value": "all",
"values": [
"all",
"modsecurity",
" antibot"
],
"name": "reports-reason",
"onlyDown": true,
"label": "reports_reason",
"popovers": [
{
"text": "reports_reason_desc",
"iconName": "info"
}
],
"columns": {
"pc": 3,
"tablet": 4,
"mobile": 12
}
}
}
]
"text": "reports_not_found"
}
}
]

View file

@ -1,5 +1,6 @@
import json
no_reports = []
reports = [
{
@ -314,7 +315,8 @@ def reports_builder(reports, data=None):
return builder
output = reports_builder(reports)
#output = reports_builder(reports)
output = reports_builder(no_reports)
# store on a file
with open("reports.json", "w") as f: