mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-29 09:27:52 +01:00
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:
1 parent
633b653f79
commit
900bb1e480
4 files changed
+52
-79
No files matched your search
@@ -81,14 +81,14 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
|
|||||||
setFormField(newRows);
|
setFormField(newRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAccessListChange = (idx: number, accessListId: number) => {
|
const handleAccessListChange = (id: number, accessListId: number) => {
|
||||||
const newValues = values.map((v: ProxyLocation, i: number) => (i === idx ? { ...v, accessListId } : v));
|
const newRows = rows.map((r: Row) => (r.id === id ? { ...r, value: { ...r.value, accessListId } } : r));
|
||||||
setValues(newValues);
|
setRows(newRows);
|
||||||
setFormField(newValues);
|
setFormField(newRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
const setFormField = (newValues: ProxyLocation[]) => {
|
const setFormField = (newRows: Row[]) => {
|
||||||
const filtered = newValues.filter((v: ProxyLocation) => v?.path?.trim() !== "");
|
const filtered = newRows.map((r: Row) => r.value).filter((v: ProxyLocation) => v?.path?.trim() !== "");
|
||||||
setFieldValue(name, filtered);
|
setFieldValue(name, filtered);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -307,6 +307,12 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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) && (
|
{advVisible.includes(row.id) && (
|
||||||
<div className="">
|
<div className="">
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
@@ -330,51 +336,9 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</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>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -254,9 +254,6 @@
|
|||||||
"column.access": {
|
"column.access": {
|
||||||
"defaultMessage": "Access"
|
"defaultMessage": "Access"
|
||||||
},
|
},
|
||||||
"column.error": {
|
|
||||||
"defaultMessage": "Error"
|
|
||||||
},
|
|
||||||
"column.authorization": {
|
"column.authorization": {
|
||||||
"defaultMessage": "Authorization"
|
"defaultMessage": "Authorization"
|
||||||
},
|
},
|
||||||
@@ -275,6 +272,9 @@
|
|||||||
"column.email": {
|
"column.email": {
|
||||||
"defaultMessage": "Email"
|
"defaultMessage": "Email"
|
||||||
},
|
},
|
||||||
|
"column.error": {
|
||||||
|
"defaultMessage": "Error"
|
||||||
|
},
|
||||||
"column.event": {
|
"column.event": {
|
||||||
"defaultMessage": "Event"
|
"defaultMessage": "Event"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -125,6 +125,9 @@
|
|||||||
"action.enable": {
|
"action.enable": {
|
||||||
"defaultMessage": "Lülita sisse"
|
"defaultMessage": "Lülita sisse"
|
||||||
},
|
},
|
||||||
|
"action.logs": {
|
||||||
|
"defaultMessage": "Logid"
|
||||||
|
},
|
||||||
"action.permissions": {
|
"action.permissions": {
|
||||||
"defaultMessage": "Õigused"
|
"defaultMessage": "Õigused"
|
||||||
},
|
},
|
||||||
@@ -269,6 +272,9 @@
|
|||||||
"column.email": {
|
"column.email": {
|
||||||
"defaultMessage": "E-post"
|
"defaultMessage": "E-post"
|
||||||
},
|
},
|
||||||
|
"column.error": {
|
||||||
|
"defaultMessage": "Viga"
|
||||||
|
},
|
||||||
"column.event": {
|
"column.event": {
|
||||||
"defaultMessage": "Sündmus"
|
"defaultMessage": "Sündmus"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconFileText, IconPower, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconFileText, IconPower, IconTrash } from "@tabler/icons-react";
|
||||||
import {
|
import { createColumnHelper, type SortingState, useTable } from "@tanstack/react-table";
|
||||||
createColumnHelper,
|
|
||||||
getCoreRowModel,
|
|
||||||
getSortedRowModel,
|
|
||||||
type SortingState,
|
|
||||||
useReactTable,
|
|
||||||
} from "@tanstack/react-table";
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import type { ProxyHost } from "src/api/backend";
|
import type { ProxyHost } from "src/api/backend";
|
||||||
import {
|
import {
|
||||||
@@ -32,8 +26,17 @@ interface Props {
|
|||||||
onLogs?: (id: number) => void;
|
onLogs?: (id: number) => void;
|
||||||
onNew?: () => void;
|
onNew?: () => void;
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, onEdit, onDelete, onDisableToggle, onLogs, onNew, isFiltered }: Props) {
|
export default function Table({
|
||||||
const columnHelper = createColumnHelper<ProxyHost>();
|
data,
|
||||||
|
isFetching,
|
||||||
|
onEdit,
|
||||||
|
onDelete,
|
||||||
|
onDisableToggle,
|
||||||
|
onLogs,
|
||||||
|
onNew,
|
||||||
|
isFiltered,
|
||||||
|
}: Props) {
|
||||||
|
const columnHelper = createColumnHelper<Features, ProxyHost>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
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 }}
|
data={{ id: info.row.original.id }}
|
||||||
/>
|
/>
|
||||||
</span>
|
</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
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
href="#"
|
href="#"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
onLogs?.(info.row.original.id);
|
onEdit?.(info.row.original.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconFileText size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.logs" />
|
<T id="action.edit" />
|
||||||
</a>
|
</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"
|
className="dropdown-item"
|
||||||
href="#"
|
href="#"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
|||||||
Reference in new issue
Block a user