Table settings: Show collection name in Copy columns from existing table dropdown

This commit is contained in:
Sidney Alcantara
2021-10-14 13:47:17 +11:00
parent 1e48d5fb31
commit f0a25f1c0e
3 changed files with 21 additions and 7 deletions

View File

@@ -35,7 +35,6 @@ export default function FieldSettings(props: IMenuModalProps) {
) {
setShowRebuildPrompt(true);
}
console.log(key, update);
const updatedConfig = _set({ ...newConfig }, key, update);
setNewConfig(updatedConfig);
};
@@ -48,7 +47,6 @@ export default function FieldSettings(props: IMenuModalProps) {
[newConfig.renderFieldType, type]
);
if (!open) return null;
console.log(newConfig);
return (
<Modal

View File

@@ -13,7 +13,9 @@ export const tableSettings = (
mode: TableSettingsDialogModes | null,
roles: string[] | undefined,
sections: string[] | undefined,
tables: { label: string; value: any }[] | undefined,
tables:
| { label: string; value: any; section: string; collection: string }[]
| undefined,
collections: string[]
): Field[] =>
[
@@ -271,10 +273,15 @@ export const tableSettings = (
options: tables,
clearable: true,
freeText: false,
itemRenderer: (option: { value: string; label: string }) => (
itemRenderer: (option: {
value: string;
label: string;
section: string;
collection: string;
}) => (
<>
{option.label}{" "}
<code style={{ marginLeft: "auto" }}>{option.value}</code>
{option.section} &gt; {option.label}{" "}
<code style={{ marginLeft: "auto" }}>{option.collection}</code>
</>
),
}

View File

@@ -1,5 +1,6 @@
import useSWR from "swr";
import _find from "lodash/find";
import _sortBy from "lodash/sortBy";
import { Stack, Button, DialogContentText } from "@mui/material";
@@ -120,7 +121,15 @@ export default function TableSettingsDialog({
mode,
roles,
sectionNames,
tables?.map((table) => ({ label: table.name, value: table.id })),
_sortBy(
tables?.map((table) => ({
label: table.name,
value: table.id,
section: table.section,
collection: table.collection,
})),
["section", "label"]
),
collections
)}
customComponents={{