Skip to content

Commit fc8a5e8

Browse files
committed
404 hosts search
1 parent da68fe2 commit fc8a5e8

File tree

4 files changed

+11
-146
lines changed

4 files changed

+11
-146
lines changed

frontend/src/pages/AuditLog/AuditTable.tsx

Lines changed: 0 additions & 128 deletions
This file was deleted.

frontend/src/pages/AuditLog/TableWrapper.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { IconSearch } from "@tabler/icons-react";
21
import { useState } from "react";
32
import Alert from "react-bootstrap/Alert";
43
import { LoadingPage } from "src/components";
@@ -28,21 +27,6 @@ export default function TableWrapper() {
2827
<div className="col">
2928
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "auditlog.title" })}</h2>
3029
</div>
31-
<div className="col-md-auto col-sm-12">
32-
<div className="ms-auto d-flex flex-wrap btn-list">
33-
<div className="input-group input-group-flat w-auto">
34-
<span className="input-group-text input-group-text-sm">
35-
<IconSearch size={16} />
36-
</span>
37-
<input
38-
id="advanced-table-search"
39-
type="text"
40-
className="form-control form-control-sm"
41-
autoComplete="off"
42-
/>
43-
</div>
44-
</div>
45-
</div>
4630
</div>
4731
</div>
4832
<Table data={data ?? []} isFetching={isFetching} onSelectItem={setEventId} />

frontend/src/pages/Nginx/DeadHosts/TableWrapper.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Table from "./Table";
1212

1313
export default function TableWrapper() {
1414
const queryClient = useQueryClient();
15+
const [search, setSearch] = useState("");
1516
const [deleteId, setDeleteId] = useState(0);
1617
const [editId, setEditId] = useState(0 as number | "new");
1718
const { isFetching, isLoading, isError, error, data } = useDeadHosts(["owner", "certificate"]);
@@ -36,6 +37,13 @@ export default function TableWrapper() {
3637
showSuccess(intl.formatMessage({ id: enabled ? "notification.host-enabled" : "notification.host-disabled" }));
3738
};
3839

40+
let filtered = null;
41+
if (search && data) {
42+
filtered = data?.filter((item) => {
43+
return item.domainNames.some((domain: string) => domain.toLowerCase().includes(search));
44+
});
45+
}
46+
3947
return (
4048
<div className="card mt-4">
4149
<div className="card-status-top bg-red" />
@@ -56,6 +64,7 @@ export default function TableWrapper() {
5664
type="text"
5765
className="form-control form-control-sm"
5866
autoComplete="off"
67+
onChange={(e: any) => setSearch(e.target.value.toLowerCase())}
5968
/>
6069
</div>
6170
<Button size="sm" className="btn-red" onClick={() => setEditId("new")}>
@@ -66,7 +75,7 @@ export default function TableWrapper() {
6675
</div>
6776
</div>
6877
<Table
69-
data={data ?? []}
78+
data={filtered ?? data ?? []}
7079
isFetching={isFetching}
7180
onEdit={(id: number) => setEditId(id)}
7281
onDelete={(id: number) => setDeleteId(id)}

frontend/src/pages/Settings/SettingTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
22
import { intl } from "src/locale";
33

4-
export default function AuditTable() {
4+
export default function SettingTable() {
55
return (
66
<div className="card mt-4">
77
<div className="card-status-top bg-teal" />

0 commit comments

Comments
 (0)