fix: resolve merge conflicts breaking frontend CI

- LocationsFields: remove duplicated conflict block, integrate AccessField
  into the Row-based layout (fixes JSX parse error)
- ProxyHosts/Table: migrate to updated @tanstack/react-table API (useTable,
  createColumnHelper<Features, ProxyHost>)
- Add missing Estonian translations (action.logs, column.error)
- Re-sort en.json locale keys
This commit is contained in:
Dimas R. Wisnu
2026-09-23 19:18:51 +07:00
parent 633b653f79
commit 900bb1e480
4 changed files with 52 additions and 79 deletions
@@ -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) {
</div>
</div>
</div>
<AccessField
name={`locations[${row.id}].accessListId`}
label="access-list"
id={`locations-access-list-${row.id}`}
onFormChange={(value) => handleAccessListChange(row.id, value)}
/>
{advVisible.includes(row.id) && (
<div className="">
<CodeEditor
@@ -330,51 +336,9 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
</div>
)}
</div>
<AccessField
name={`locations[${idx}].accessListId`}
label="access-list"
id={`locations-access-list-${idx}`}
onFormChange={(value) => handleAccessListChange(idx, value)}
/>
{advVisible.includes(idx) && (
<div className="">
<CodeEditor
language="nginx"
placeholder={intl.formatMessage({ id: "nginx-config.placeholder" })}
padding={15}
data-color-mode="dark"
minHeight={170}
indentWidth={2}
value={item.advancedConfig}
onChange={(e) => handleChange(idx, "advancedConfig", e.target.value)}
style={{
fontFamily:
"ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace",
borderRadius: "0.3rem",
minHeight: "170px",
}}
/>
</div>
)}
<div className="mt-1">
<a
href="#"
onClick={(e) => {
e.preventDefault();
handleRemove(idx);
}}
>
<T id="action.delete" />
</a>
</div>
</div>
</div>
))}
<div>
<button type="button" className="btn btn-sm" onClick={handleAdd}>
<T id="action.add-location" />
</button>
</div>
);
})
)}
</>
);
}
+3 -3
View File
@@ -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"
},
+6
View File
@@ -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"
},
+28 -25
View File
@@ -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<ProxyHost>();
export default function Table({
data,
isFetching,
onEdit,
onDelete,
onDisableToggle,
onLogs,
onNew,
isFiltered,
}: Props) {
const columnHelper = createColumnHelper<Features, ProxyHost>();
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 }}
/>
</span>
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
onEdit?.(info.row.original.id);
}}
>
<IconEdit size={16} />
<T id="action.edit" />
</a>
<HasPermission section={PROXY_HOSTS} permission={MANAGE} hideError>
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
onLogs?.(info.row.original.id);
onEdit?.(info.row.original.id);
}}
>
<IconFileText size={16} />
<T id="action.logs" />
<IconEdit size={16} />
<T id="action.edit" />
</a>
<a
<HasPermission section={PROXY_HOSTS} permission={MANAGE} hideError>
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
onLogs?.(info.row.original.id);
}}
>
<IconFileText size={16} />
<T id="action.logs" />
</a>
<a
className="dropdown-item"
href="#"
onClick={(e) => {