From e71dc6c71bb42bd184c05f4f4b4d615fc7453c79 Mon Sep 17 00:00:00 2001 From: Andre Henn Date: Mon, 21 Oct 2024 14:00:40 +0200 Subject: [PATCH] feat: configurable layer import --- assets/formconfigs/layer.json | 1 + package-lock.json | 1 - .../GeneralEntityRoot/GeneralEntityRoot.tsx | 27 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/assets/formconfigs/layer.json b/assets/formconfigs/layer.json index f2089129..6c3cebea 100644 --- a/assets/formconfigs/layer.json +++ b/assets/formconfigs/layer.json @@ -38,6 +38,7 @@ "entityName": "#i18n.entityName", "navigationTitle": "#i18n.navigationTitle", "subTitle": "", + "importEnabled": true, "formConfig": { "name": "layer", "fields": [ diff --git a/package-lock.json b/package-lock.json index 98ca9667..1f2ad561 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@ant-design/pro-components": "^2.7.10", "@casualbot/jest-sonar-reporter": "2.4.0", "@monaco-editor/react": "4.6.0", - "@rollup/rollup-linux-x64-gnu": "4.24.0", "@terrestris/base-util": "2.0.0", "@terrestris/ol-util": "19.0.1", "@terrestris/shogun-util": "9.0.0", diff --git a/src/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.tsx b/src/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.tsx index b1f860b3..10c254f9 100644 --- a/src/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.tsx +++ b/src/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.tsx @@ -76,12 +76,11 @@ import { } from '../../../Controller/GenericEntityController'; import useSHOGunAPIClient from '../../../Hooks/useSHOGunAPIClient'; import TranslationUtil from '../../../Util/TranslationUtil'; -import GeneralEntityForm, { - FormConfig -} from '../GeneralEntityForm/GeneralEntityForm'; +import GeneralEntityForm from '../GeneralEntityForm/GeneralEntityForm'; import GeneralEntityTable, { TableConfig } from '../GeneralEntityTable/GeneralEntityTable'; +import {FormConfig} from "antd/es/config-provider/context"; type LayerUploadOptions = { baseUrl: string; @@ -109,17 +108,17 @@ type FeatureTypeAttributes = { }; export type GeneralEntityConfigType = { - i18n: FormTranslations; + defaultEntity?: T; endpoint: string; + entityName?: string; + formConfig?: FormConfig; entityType: string; defaultSortField?: string; - entityName?: string; + importEnabled?: boolean; navigationTitle?: string; + onEntitiesLoaded?: (entities: T[], entityType: string) => void; subTitle?: string; - formConfig: FormConfig; tableConfig: TableConfig; - onEntitiesLoaded?: (entities: T[], entityType: string) => void; - defaultEntity?: T; }; type OwnProps = GeneralEntityConfigType; @@ -127,17 +126,17 @@ type OwnProps = GeneralEntityConfigType; export type GeneralEntityRootProps = OwnProps & React.HTMLAttributes; export function GeneralEntityRoot({ - i18n, + importEnabled = true, + defaultEntity, endpoint, entityType, defaultSortField, entityName = 'Entität', + formConfig, navigationTitle = 'Entitäten', + onEntitiesLoaded = () => { }, subTitle = '… mit denen man Dinge tun kann (aus Gründen bspw.)', - formConfig, - tableConfig = {}, - defaultEntity, - onEntitiesLoaded = () => { } + tableConfig = {} }: GeneralEntityRootProps) { const location = useLocation(); @@ -824,7 +823,7 @@ export function GeneralEntityRoot({ {/* Upload only available for layer entities */} - {entityType === 'layer' && ( + {entityType === 'layer' && importEnabled && (