From ffc2d2fdbe1aa2fb6f4a6fdafb82af819bc74a03 Mon Sep 17 00:00:00 2001
From: aceberg <1502200+aceberg@users.noreply.github.com>
Date: Sun, 23 Mar 2025 13:42:38 +0700
Subject: [PATCH] History Page
---
frontend/Makefile | 2 ++
frontend/src/App.css | 23 ++++++++++++++
frontend/src/components/Body/TableHead.tsx | 2 +-
frontend/src/components/Body/TableRow.tsx | 2 +-
frontend/src/components/HostPage/HistCard.tsx | 18 +++++++++++
frontend/src/components/HostPage/HostCard.tsx | 31 +++++++++----------
frontend/src/components/HostPage/Ping.tsx | 8 ++---
frontend/src/components/MacHistory.tsx | 29 +++++++++++++++++
frontend/src/functions/api.ts | 7 +++++
frontend/src/functions/exports.ts | 4 +--
frontend/src/pages/History.tsx | 30 +++++++++++++++---
frontend/src/pages/HostPage.tsx | 18 ++++++++---
internal/models/models.go | 8 -----
...{Config-BbCoAEkY.js => Config-B-Lp_aW1.js} | 0
.../web/public/assets/History-Be3nB-kA.js | 1 -
.../web/public/assets/History-DlXapsnh.js | 1 +
.../web/public/assets/HostPage-BWCN9Byb.js | 1 -
.../web/public/assets/HostPage-CWNBClYI.js | 1 +
.../web/public/assets/MacHistory-CwNdmW4v.js | 4 +++
internal/web/public/assets/index.css | 2 +-
internal/web/public/assets/index.js | 3 +-
internal/web/webgui.go | 6 ++--
22 files changed, 153 insertions(+), 48 deletions(-)
create mode 100644 frontend/src/components/HostPage/HistCard.tsx
create mode 100644 frontend/src/components/MacHistory.tsx
rename internal/web/public/assets/{Config-BbCoAEkY.js => Config-B-Lp_aW1.js} (100%)
delete mode 100644 internal/web/public/assets/History-Be3nB-kA.js
create mode 100644 internal/web/public/assets/History-DlXapsnh.js
delete mode 100644 internal/web/public/assets/HostPage-BWCN9Byb.js
create mode 100644 internal/web/public/assets/HostPage-CWNBClYI.js
create mode 100644 internal/web/public/assets/MacHistory-CwNdmW4v.js
diff --git a/frontend/Makefile b/frontend/Makefile
index 7c003d6..b54a7b8 100644
--- a/frontend/Makefile
+++ b/frontend/Makefile
@@ -16,6 +16,8 @@ replace:
cp tmp History-*.js && \
cat HostPage-*.js | sed 's/index-.*\.js/index.js/g' > tmp && \
cp tmp HostPage-*.js && \
+ cat MacHistory-*.js | sed 's/index-.*\.js/index.js/g' > tmp && \
+ cp tmp MacHistory-*.js && \
rm tmp index-*
all: build replace
\ No newline at end of file
diff --git a/frontend/src/App.css b/frontend/src/App.css
index 8707468..dae3db3 100644
--- a/frontend/src/App.css
+++ b/frontend/src/App.css
@@ -1,10 +1,33 @@
+/* VARS */
+:root {
+ --transparent-light: #ffffff15;
+}
+
/* Sort button */
.my-btn {
height: 100%;
background-color: #00000000;
color: var(--bs-primary);
text-align: center;
+ cursor: pointer;
+ padding: 1px;
+ border-radius: 15%;
}
.my-btn:hover {
+ background-color: var(--transparent-light);
+}
+
+/* History box */
+.my-box-on::before, .my-box-off::before {
+ content: url("data:image/svg+xml;utf8,");
+ border-left: thin solid black;
+}
+.my-box-on {
+ background-color: var(--bs-success);
+}
+.my-box-off {
+ background-color: var(--bs-gray-500);
+}
+.my-box-on:hover, .my-box-off:hover {
background-color: #0000001a;
}
\ No newline at end of file
diff --git a/frontend/src/components/Body/TableHead.tsx b/frontend/src/components/Body/TableHead.tsx
index 4b91d44..384a66e 100644
--- a/frontend/src/components/Body/TableHead.tsx
+++ b/frontend/src/components/Body/TableHead.tsx
@@ -10,7 +10,7 @@ function TableHead() {
return (
-
)
diff --git a/frontend/src/components/HostPage/HistCard.tsx b/frontend/src/components/HostPage/HistCard.tsx
new file mode 100644
index 0000000..3f0553f
--- /dev/null
+++ b/frontend/src/components/HostPage/HistCard.tsx
@@ -0,0 +1,18 @@
+import MacHistory from "../MacHistory"
+
+function HistCard(_props: any) {
+
+ return (
+
+
Name
Iface
IP
diff --git a/frontend/src/components/Body/TableRow.tsx b/frontend/src/components/Body/TableRow.tsx
index 2959734..64aba53 100644
--- a/frontend/src/components/Body/TableRow.tsx
+++ b/frontend/src/components/Body/TableRow.tsx
@@ -53,7 +53,7 @@ function TableRow(_props: any) {
{now}
-
+
| {index()}. | +
+ {host.Name} + {host.IP} + |
+
+ |
+