diff --git a/frontend/src/components/Form/LocationsFields.tsx b/frontend/src/components/Form/LocationsFields.tsx index 7138bdd7a..9c4d8b3a8 100644 --- a/frontend/src/components/Form/LocationsFields.tsx +++ b/frontend/src/components/Form/LocationsFields.tsx @@ -81,14 +81,14 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) { setFormField(newRows); }; - const handleAccessListChange = (idx: number, accessListId: number) => { - const newValues = values.map((v: ProxyLocation, i: number) => (i === idx ? { ...v, accessListId } : v)); - setValues(newValues); - setFormField(newValues); + const handleAccessListChange = (id: number, accessListId: number) => { + const newRows = rows.map((r: Row) => (r.id === id ? { ...r, value: { ...r.value, accessListId } } : r)); + setRows(newRows); + setFormField(newRows); }; - const setFormField = (newValues: ProxyLocation[]) => { - const filtered = newValues.filter((v: ProxyLocation) => v?.path?.trim() !== ""); + const setFormField = (newRows: Row[]) => { + const filtered = newRows.map((r: Row) => r.value).filter((v: ProxyLocation) => v?.path?.trim() !== ""); setFieldValue(name, filtered); }; @@ -307,6 +307,12 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) { + handleAccessListChange(row.id, value)} + /> {advVisible.includes(row.id) && (
)}
- handleAccessListChange(idx, value)} - /> - {advVisible.includes(idx) && ( -
- handleChange(idx, "advancedConfig", e.target.value)} - style={{ - fontFamily: - "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", - borderRadius: "0.3rem", - minHeight: "170px", - }} - /> -
- )} -
- { - e.preventDefault(); - handleRemove(idx); - }} - > - - -
- - - ))} -
- -
+ ); + }) + )} ); } diff --git a/frontend/src/locale/src/en.json b/frontend/src/locale/src/en.json index aa0b47f5e..da8765a5e 100644 --- a/frontend/src/locale/src/en.json +++ b/frontend/src/locale/src/en.json @@ -254,9 +254,6 @@ "column.access": { "defaultMessage": "Access" }, - "column.error": { - "defaultMessage": "Error" - }, "column.authorization": { "defaultMessage": "Authorization" }, @@ -275,6 +272,9 @@ "column.email": { "defaultMessage": "Email" }, + "column.error": { + "defaultMessage": "Error" + }, "column.event": { "defaultMessage": "Event" }, diff --git a/frontend/src/locale/src/et.json b/frontend/src/locale/src/et.json index 9fd0f74d1..989a153aa 100644 --- a/frontend/src/locale/src/et.json +++ b/frontend/src/locale/src/et.json @@ -125,6 +125,9 @@ "action.enable": { "defaultMessage": "Lülita sisse" }, + "action.logs": { + "defaultMessage": "Logid" + }, "action.permissions": { "defaultMessage": "Õigused" }, @@ -269,6 +272,9 @@ "column.email": { "defaultMessage": "E-post" }, + "column.error": { + "defaultMessage": "Viga" + }, "column.event": { "defaultMessage": "Sündmus" }, diff --git a/frontend/src/pages/Nginx/ProxyHosts/Table.tsx b/frontend/src/pages/Nginx/ProxyHosts/Table.tsx index cc4fc603e..7a9b4cd6b 100644 --- a/frontend/src/pages/Nginx/ProxyHosts/Table.tsx +++ b/frontend/src/pages/Nginx/ProxyHosts/Table.tsx @@ -1,11 +1,5 @@ import { IconDotsVertical, IconEdit, IconFileText, IconPower, IconTrash } from "@tabler/icons-react"; -import { - createColumnHelper, - getCoreRowModel, - getSortedRowModel, - type SortingState, - useReactTable, -} from "@tanstack/react-table"; +import { createColumnHelper, type SortingState, useTable } from "@tanstack/react-table"; import { useMemo, useState } from "react"; import type { ProxyHost } from "src/api/backend"; import { @@ -32,8 +26,17 @@ interface Props { onLogs?: (id: number) => void; onNew?: () => void; } -export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onLogs, onNew, isFiltered }: Props) { - const columnHelper = createColumnHelper(); +export default function Table({ + data, + isFetching, + onEdit, + onDelete, + onDisableToggle, + onLogs, + onNew, + isFiltered, +}: Props) { + const columnHelper = createColumnHelper(); const columns = useMemo( () => [ columnHelper.accessor((row: any) => row.owner, { @@ -117,30 +120,30 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog data={{ id: info.row.original.id }} /> - { - e.preventDefault(); - onEdit?.(info.row.original.id); - }} - > - - - - { e.preventDefault(); - onLogs?.(info.row.original.id); + onEdit?.(info.row.original.id); }} > - - + + - + { + e.preventDefault(); + onLogs?.(info.row.original.id); + }} + > + + + + {