@terrestris/shogun-admin 16.1.0-next.1 → 17.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +74 -74
- package/dist/build/assets/App-BP74CNP_.js +0 -1258
- package/dist/build/assets/__federation_shared_react-CvClEUjg.js +0 -9
- package/dist/build/assets/__federation_shared_react-dom-BxqGBSTk.js +0 -24
- package/dist/build/assets/__federation_shared_react-i18next-MD_bYxcL.js +0 -1
- package/dist/build/assets/__federation_shared_react-router-dom-Vy7O6TNk.js +0 -2
- package/dist/build/assets/_commonjsHelpers-BosuxZz1.js +0 -1
- package/dist/build/assets/_virtual___federation_fn_import-PJHfB1tr.js +0 -1
- package/dist/build/assets/abap-DRC6TkPh.js +0 -6
- package/dist/build/assets/apex-BuapDI9Y.js +0 -6
- package/dist/build/assets/azcli-BypH-vXm.js +0 -6
- package/dist/build/assets/bat-BY6pwuIY.js +0 -6
- package/dist/build/assets/bicep-gRuQeaLk.js +0 -7
- package/dist/build/assets/cameligo-ul-Lp4lw.js +0 -6
- package/dist/build/assets/clojure-DeYg-96x.js +0 -6
- package/dist/build/assets/codicon-DCmgc-ay.ttf +0 -0
- package/dist/build/assets/coffee-CfnpWUYo.js +0 -6
- package/dist/build/assets/cpp-C9L3yaDO.js +0 -6
- package/dist/build/assets/csharp-DWGz5Zuj.js +0 -6
- package/dist/build/assets/csp-DrRCxMg5.js +0 -6
- package/dist/build/assets/css-BfLuTCmN.js +0 -8
- package/dist/build/assets/css.worker-BAJD-bzR.js +0 -83
- package/dist/build/assets/cssMode-Btzqpc23.js +0 -4
- package/dist/build/assets/cypher-DoFvH58O.js +0 -6
- package/dist/build/assets/dart-DIovg4uR.js +0 -6
- package/dist/build/assets/dockerfile-D2PfwrvU.js +0 -6
- package/dist/build/assets/ecl-C_scCXcs.js +0 -6
- package/dist/build/assets/editor.worker-MnaSPjGA.js +0 -11
- package/dist/build/assets/elixir-BRk-K-rg.js +0 -6
- package/dist/build/assets/favicon-CwZoocDV.ico +0 -0
- package/dist/build/assets/flow9-DLs3tTet.js +0 -6
- package/dist/build/assets/freemarker2-CoZuEXJi.js +0 -3
- package/dist/build/assets/fsharp-D0UiDa5C.js +0 -6
- package/dist/build/assets/go-CyVeKkvQ.js +0 -6
- package/dist/build/assets/graphql-BygKL3ZF.js +0 -6
- package/dist/build/assets/handlebars-BQ2vXFqT.js +0 -1
- package/dist/build/assets/hcl-D_OY6ada.js +0 -6
- package/dist/build/assets/html-S9BExIX4.js +0 -1
- package/dist/build/assets/html.worker-Bp7pNElH.js +0 -460
- package/dist/build/assets/htmlMode-D6oh_W-n.js +0 -4
- package/dist/build/assets/index-D5X_Cuhy.js +0 -139
- package/dist/build/assets/ini-BTpWsGps.js +0 -6
- package/dist/build/assets/java-3TATJI7h.js +0 -6
- package/dist/build/assets/javascript-C_BsKwTq.js +0 -1
- package/dist/build/assets/json.worker-BfIkrIax.js +0 -48
- package/dist/build/assets/jsonMode-CFQnTUoH.js +0 -10
- package/dist/build/assets/julia-DDpSJMW6.js +0 -6
- package/dist/build/assets/kotlin-DVYH6Lj_.js +0 -6
- package/dist/build/assets/less-CuFlys0T.js +0 -7
- package/dist/build/assets/lexon-m09vb5r-.js +0 -6
- package/dist/build/assets/liquid-CsJvQ-Gd.js +0 -1
- package/dist/build/assets/lua-D2Z7JJdl.js +0 -6
- package/dist/build/assets/m3-B2Cf9XSq.js +0 -6
- package/dist/build/assets/markdown-BXYnMxBe.js +0 -6
- package/dist/build/assets/mdx-CcsV6KQM.js +0 -1
- package/dist/build/assets/mips-Ckkbw-AO.js +0 -6
- package/dist/build/assets/msdax-B5uW3Zvf.js +0 -6
- package/dist/build/assets/mysql-B8ssZoUh.js +0 -6
- package/dist/build/assets/objective-c-CrrKwR0a.js +0 -6
- package/dist/build/assets/pascal-BWBTHuhh.js +0 -6
- package/dist/build/assets/pascaligo-BGLI1Hdo.js +0 -6
- package/dist/build/assets/perl-DDrv2Hr-.js +0 -6
- package/dist/build/assets/pgsql-DLPipH_Q.js +0 -6
- package/dist/build/assets/php-CTNlIIiR.js +0 -6
- package/dist/build/assets/pla-2oJWbEOo.js +0 -6
- package/dist/build/assets/postiats-DOk3G3cc.js +0 -6
- package/dist/build/assets/powerquery-Dgyr3wWZ.js +0 -6
- package/dist/build/assets/powershell-B_i9asfM.js +0 -6
- package/dist/build/assets/protobuf-CV9EbfTh.js +0 -7
- package/dist/build/assets/pug-CCBS_C5_.js +0 -6
- package/dist/build/assets/python-BNsLUA-F.js +0 -1
- package/dist/build/assets/qsharp-BLuZWbUW.js +0 -6
- package/dist/build/assets/r-CzF1MCbP.js +0 -6
- package/dist/build/assets/razor-CwLyy1uA.js +0 -1
- package/dist/build/assets/redis-C75U4IDy.js +0 -6
- package/dist/build/assets/redshift-Bc5xkKR1.js +0 -6
- package/dist/build/assets/restructuredtext-DmdQbaLT.js +0 -6
- package/dist/build/assets/ruby-DB0RB20n.js +0 -6
- package/dist/build/assets/rust-UMmp-gVE.js +0 -6
- package/dist/build/assets/sb-DVG02705.js +0 -6
- package/dist/build/assets/scala-DvSxYeG4.js +0 -6
- package/dist/build/assets/scheme-yf5bffbF.js +0 -6
- package/dist/build/assets/scss-Bzb7OGdO.js +0 -8
- package/dist/build/assets/shell-FNqbgIOG.js +0 -6
- package/dist/build/assets/shogun-spinner-BmOUi9Ar.gif +0 -0
- package/dist/build/assets/shogun_logo-B9ohJOpL.png +0 -0
- package/dist/build/assets/solidity-DyKutqhl.js +0 -6
- package/dist/build/assets/sophia-B4VqtPa2.js +0 -6
- package/dist/build/assets/sparql-B7alP455.js +0 -6
- package/dist/build/assets/sql-D7lU1fdU.js +0 -6
- package/dist/build/assets/st-VuadG5SK.js +0 -6
- package/dist/build/assets/style-CJpWC7V3.css +0 -1
- package/dist/build/assets/swift-BYtUz8ZP.js +0 -8
- package/dist/build/assets/systemverilog-DOAuugfS.js +0 -6
- package/dist/build/assets/tcl-CXKOl_mN.js +0 -6
- package/dist/build/assets/ts.worker-BBBnYv8q.js +0 -51333
- package/dist/build/assets/tsMode-meseu6bK.js +0 -11
- package/dist/build/assets/twig-D9yiNO04.js +0 -6
- package/dist/build/assets/typescript-BuOvk1sq.js +0 -1
- package/dist/build/assets/typespec-BupSXVCO.js +0 -6
- package/dist/build/assets/vb-ZlaFEk-P.js +0 -6
- package/dist/build/assets/wgsl-DrbANKle.js +0 -303
- package/dist/build/assets/xml-BXx9C-xA.js +0 -1
- package/dist/build/assets/yaml-CuMedh6B.js +0 -1
- package/dist/build/index.html +0 -24
- package/dist/lib/App.d.ts +0 -4
- package/dist/lib/App.js +0 -122
- package/dist/lib/Component/Dashboard/Dashboard.d.ts +0 -12
- package/dist/lib/Component/Dashboard/Dashboard.js +0 -10
- package/dist/lib/Component/Dashboard/DashboardCard/DashboardCard.d.ts +0 -13
- package/dist/lib/Component/Dashboard/DashboardCard/DashboardCard.js +0 -7
- package/dist/lib/Component/Dashboard/DashboardStatistics/DashboardStatistics.d.ts +0 -15
- package/dist/lib/Component/Dashboard/DashboardStatistics/DashboardStatistics.js +0 -30
- package/dist/lib/Component/EvictCache/EvictCache.d.ts +0 -6
- package/dist/lib/Component/EvictCache/EvictCache.js +0 -28
- package/dist/lib/Component/FormField/DisplayField/DisplayField.d.ts +0 -13
- package/dist/lib/Component/FormField/DisplayField/DisplayField.js +0 -32
- package/dist/lib/Component/FormField/JSONEditor/JSONEditor.d.ts +0 -13
- package/dist/lib/Component/FormField/JSONEditor/JSONEditor.js +0 -90
- package/dist/lib/Component/FormField/JSONEditor/UserWorker.d.ts +0 -1
- package/dist/lib/Component/FormField/JSONEditor/UserWorker.js +0 -26
- package/dist/lib/Component/FormField/LinkField/LinkField.d.ts +0 -11
- package/dist/lib/Component/FormField/LinkField/LinkField.js +0 -15
- package/dist/lib/Component/FormField/MarkdownEditor/MarkdownEditor.d.ts +0 -10
- package/dist/lib/Component/FormField/MarkdownEditor/MarkdownEditor.js +0 -23
- package/dist/lib/Component/FormField/Permission/GroupPermissionGrid/GroupPermissionGrid.d.ts +0 -7
- package/dist/lib/Component/FormField/Permission/GroupPermissionGrid/GroupPermissionGrid.js +0 -73
- package/dist/lib/Component/FormField/Permission/InstancePermissionGrid/InstancePermissionGrid.d.ts +0 -30
- package/dist/lib/Component/FormField/Permission/InstancePermissionGrid/InstancePermissionGrid.js +0 -151
- package/dist/lib/Component/FormField/Permission/PermissionModal/PermissionModal.d.ts +0 -28
- package/dist/lib/Component/FormField/Permission/PermissionModal/PermissionModal.js +0 -103
- package/dist/lib/Component/FormField/Permission/PermissionSelect/PermissionSelect.d.ts +0 -6
- package/dist/lib/Component/FormField/Permission/PermissionSelect/PermissionSelect.js +0 -21
- package/dist/lib/Component/FormField/Permission/RolePermissionGrid/RolePermissionGrid.d.ts +0 -7
- package/dist/lib/Component/FormField/Permission/RolePermissionGrid/RolePermissionGrid.js +0 -81
- package/dist/lib/Component/FormField/Permission/UserPermissionGrid/UserPermissionGrid.d.ts +0 -8
- package/dist/lib/Component/FormField/Permission/UserPermissionGrid/UserPermissionGrid.js +0 -87
- package/dist/lib/Component/FormField/VerifyProviderDetailsField/VerifyProviderDetailsField.d.ts +0 -13
- package/dist/lib/Component/FormField/VerifyProviderDetailsField/VerifyProviderDetailsField.js +0 -14
- package/dist/lib/Component/FormField/YesOrNoField/YesOrNoField.d.ts +0 -8
- package/dist/lib/Component/FormField/YesOrNoField/YesOrNoField.js +0 -10
- package/dist/lib/Component/FullscreenWrapper/FullscreenWrapper.d.ts +0 -4
- package/dist/lib/Component/FullscreenWrapper/FullscreenWrapper.js +0 -48
- package/dist/lib/Component/GeneralEntity/GeneralEntityForm/GeneralEntityForm.d.ts +0 -43
- package/dist/lib/Component/GeneralEntity/GeneralEntityForm/GeneralEntityForm.js +0 -145
- package/dist/lib/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.d.ts +0 -22
- package/dist/lib/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.js +0 -527
- package/dist/lib/Component/GeneralEntity/GeneralEntityTable/GeneralEntityTable.d.ts +0 -46
- package/dist/lib/Component/GeneralEntity/GeneralEntityTable/GeneralEntityTable.js +0 -179
- package/dist/lib/Component/GlobalSettings/GlobalSettingsRoot/GlobalSettingsRoot.d.ts +0 -5
- package/dist/lib/Component/GlobalSettings/GlobalSettingsRoot/GlobalSettingsRoot.js +0 -15
- package/dist/lib/Component/Header/Header.d.ts +0 -8
- package/dist/lib/Component/Header/Header.js +0 -16
- package/dist/lib/Component/ImageFile/ImageFileForm/ImageFileForm.d.ts +0 -7
- package/dist/lib/Component/ImageFile/ImageFileForm/ImageFileForm.js +0 -94
- package/dist/lib/Component/ImageFile/ImageFileRoot/ImageFileRoot.d.ts +0 -7
- package/dist/lib/Component/ImageFile/ImageFileRoot/ImageFileRoot.js +0 -44
- package/dist/lib/Component/ImageFile/ImageFileTable/ImageFileTable.d.ts +0 -9
- package/dist/lib/Component/ImageFile/ImageFileTable/ImageFileTable.js +0 -157
- package/dist/lib/Component/LanguageSelector/index.d.ts +0 -4
- package/dist/lib/Component/LanguageSelector/index.js +0 -15
- package/dist/lib/Component/Layer/LayerTypeSelect/LayerTypeSelect.d.ts +0 -11
- package/dist/lib/Component/Layer/LayerTypeSelect/LayerTypeSelect.js +0 -33
- package/dist/lib/Component/LayerPreview/LayerPreview.d.ts +0 -9
- package/dist/lib/Component/LayerPreview/LayerPreview.js +0 -159
- package/dist/lib/Component/LayerPreview/MapComponent/MapComponent.d.ts +0 -10
- package/dist/lib/Component/LayerPreview/MapComponent/MapComponent.js +0 -22
- package/dist/lib/Component/LogSettings/LogLevelSelect/LogLevelSelect.d.ts +0 -7
- package/dist/lib/Component/LogSettings/LogLevelSelect/LogLevelSelect.js +0 -20
- package/dist/lib/Component/LogSettings/LogLevelTable/LogLevelTable.d.ts +0 -12
- package/dist/lib/Component/LogSettings/LogLevelTable/LogLevelTable.js +0 -73
- package/dist/lib/Component/LogSettings/LogSettingsRoot/LogSettingsRoot.d.ts +0 -4
- package/dist/lib/Component/LogSettings/LogSettingsRoot/LogSettingsRoot.js +0 -11
- package/dist/lib/Component/Logs/Logs.d.ts +0 -5
- package/dist/lib/Component/Logs/Logs.js +0 -58
- package/dist/lib/Component/Menu/Navigation/Navigation.d.ts +0 -10
- package/dist/lib/Component/Menu/Navigation/Navigation.js +0 -96
- package/dist/lib/Component/Menu/User/User.d.ts +0 -7
- package/dist/lib/Component/Menu/User/User.js +0 -91
- package/dist/lib/Component/Metrics/JdbcConnectionsActive/JdbcConnectionsActive.d.ts +0 -6
- package/dist/lib/Component/Metrics/JdbcConnectionsActive/JdbcConnectionsActive.js +0 -7
- package/dist/lib/Component/Metrics/JvmMemoryUsed/JvmMemoryUsed.d.ts +0 -6
- package/dist/lib/Component/Metrics/JvmMemoryUsed/JvmMemoryUsed.js +0 -13
- package/dist/lib/Component/Metrics/JvmThreadsLive/JvmThreadsLive.d.ts +0 -6
- package/dist/lib/Component/Metrics/JvmThreadsLive/JvmThreadsLive.js +0 -7
- package/dist/lib/Component/Metrics/MetricEntry/MetricEntry.d.ts +0 -13
- package/dist/lib/Component/Metrics/MetricEntry/MetricEntry.js +0 -54
- package/dist/lib/Component/Metrics/MetricsRoot/MetricsRoot.d.ts +0 -12
- package/dist/lib/Component/Metrics/MetricsRoot/MetricsRoot.js +0 -28
- package/dist/lib/Component/Metrics/ProcessCpuUsage/ProcessCpuUsage.d.ts +0 -6
- package/dist/lib/Component/Metrics/ProcessCpuUsage/ProcessCpuUsage.js +0 -7
- package/dist/lib/Component/Metrics/ProcessStartTime/ProcessStartTime.d.ts +0 -6
- package/dist/lib/Component/Metrics/ProcessStartTime/ProcessStartTime.js +0 -12
- package/dist/lib/Component/Metrics/ProcessUptime/ProcessUptime.d.ts +0 -6
- package/dist/lib/Component/Metrics/ProcessUptime/ProcessUptime.js +0 -15
- package/dist/lib/Component/Metrics/SystemCpuCount/SystemCpuCount.d.ts +0 -6
- package/dist/lib/Component/Metrics/SystemCpuCount/SystemCpuCount.js +0 -7
- package/dist/lib/Component/Metrics/SystemCpuUsage/SystemCpuUsage.d.ts +0 -6
- package/dist/lib/Component/Metrics/SystemCpuUsage/SystemCpuUsage.js +0 -7
- package/dist/lib/Component/Metrics/SystemLoadAverage/SystemLoadAverage.d.ts +0 -6
- package/dist/lib/Component/Metrics/SystemLoadAverage/SystemLoadAverage.js +0 -7
- package/dist/lib/Component/Modal/ApplicationInfo/ApplicationInfo.d.ts +0 -7
- package/dist/lib/Component/Modal/ApplicationInfo/ApplicationInfo.js +0 -18
- package/dist/lib/Component/ShogunSpinner/ShogunSpinner.d.ts +0 -5
- package/dist/lib/Component/ShogunSpinner/ShogunSpinner.js +0 -7
- package/dist/lib/Component/UserAvatar/UserAvatar.d.ts +0 -9
- package/dist/lib/Component/UserAvatar/UserAvatar.js +0 -13
- package/dist/lib/Component/WelcomeDashboard/WelcomeDashboard.d.ts +0 -5
- package/dist/lib/Component/WelcomeDashboard/WelcomeDashboard.js +0 -35
- package/dist/lib/Context/PluginContext.d.ts +0 -9
- package/dist/lib/Context/PluginContext.js +0 -7
- package/dist/lib/Context/SHOGunAPIClientContext.d.ts +0 -9
- package/dist/lib/Context/SHOGunAPIClientContext.js +0 -7
- package/dist/lib/Controller/ControllerUtil.d.ts +0 -27
- package/dist/lib/Controller/ControllerUtil.js +0 -60
- package/dist/lib/Controller/GenericEntityController.d.ts +0 -169
- package/dist/lib/Controller/GenericEntityController.js +0 -368
- package/dist/lib/Hooks/useClientVersion.d.ts +0 -1
- package/dist/lib/Hooks/useClientVersion.js +0 -3
- package/dist/lib/Hooks/usePlugins.d.ts +0 -3
- package/dist/lib/Hooks/usePlugins.js +0 -6
- package/dist/lib/Hooks/useSHOGunAPIClient.d.ts +0 -3
- package/dist/lib/Hooks/useSHOGunAPIClient.js +0 -6
- package/dist/lib/Logger.d.ts +0 -2
- package/dist/lib/Logger.js +0 -23
- package/dist/lib/Page/Portal/Portal.d.ts +0 -7
- package/dist/lib/Page/Portal/Portal.js +0 -74
- package/dist/lib/Service/GenericServiceImpl/GenericServiceImpl.d.ts +0 -5
- package/dist/lib/Service/GenericServiceImpl/GenericServiceImpl.js +0 -7
- package/dist/lib/Service/LogService/LogService.d.ts +0 -18
- package/dist/lib/Service/LogService/LogService.js +0 -79
- package/dist/lib/Service/MetricService/MetricService.d.ts +0 -26
- package/dist/lib/Service/MetricService/MetricService.js +0 -25
- package/dist/lib/State/atoms.d.ts +0 -7
- package/dist/lib/State/atoms.js +0 -25
- package/dist/lib/State/static.d.ts +0 -3
- package/dist/lib/State/static.js +0 -10
- package/dist/lib/Util/FileUtil.d.ts +0 -3
- package/dist/lib/Util/FileUtil.js +0 -10
- package/dist/lib/Util/JsonUtil.d.ts +0 -11
- package/dist/lib/Util/JsonUtil.js +0 -22
- package/dist/lib/Util/OpenAPIUtil.d.ts +0 -25
- package/dist/lib/Util/OpenAPIUtil.js +0 -230
- package/dist/lib/Util/TableUtil.d.ts +0 -14
- package/dist/lib/Util/TableUtil.js +0 -71
- package/dist/lib/Util/TranslationUtil.d.ts +0 -3
- package/dist/lib/Util/TranslationUtil.js +0 -23
- package/dist/lib/Util/UserUtil.d.ts +0 -22
- package/dist/lib/Util/UserUtil.js +0 -32
- package/dist/lib/i18n/index.d.ts +0 -2
- package/dist/lib/i18n/index.js +0 -17
- package/dist/lib/i18n/translations.d.ts +0 -508
- package/dist/lib/i18n/translations.js +0 -512
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +0 -172
- package/dist/lib/plugin/index.d.ts +0 -58
- package/dist/lib/plugin/index.js +0 -3
- package/dist/lib/test-util.d.ts +0 -6
- package/dist/lib/test-util.js +0 -16
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ModalProps } from 'antd';
|
|
3
|
-
import { DefaultOptionType } from 'antd/lib/select';
|
|
4
|
-
import { CustomTagProps } from 'rc-select/lib/BaseSelect';
|
|
5
|
-
import PermissionCollectionType from '@terrestris/shogun-util/dist/model/enum/PermissionCollectionType';
|
|
6
|
-
import Group from '@terrestris/shogun-util/dist/model/Group';
|
|
7
|
-
import { Page } from '@terrestris/shogun-util/dist/model/Page';
|
|
8
|
-
import Role from '@terrestris/shogun-util/dist/model/Role';
|
|
9
|
-
import User from '@terrestris/shogun-util/dist/model/User';
|
|
10
|
-
import { PageOpts } from '@terrestris/shogun-util/dist/service/GenericService';
|
|
11
|
-
import './PermissionModal.less';
|
|
12
|
-
export interface PermissionModalProps extends ModalProps {
|
|
13
|
-
entityId: number;
|
|
14
|
-
setInstancePermission: (entityId: number, referenceId: number, permission: PermissionCollectionType) => Promise<void>;
|
|
15
|
-
getReferences?: (pageOpts?: PageOpts) => Promise<Page<(User | Group | Role)> | undefined>;
|
|
16
|
-
toTag: (reference: User | Group | Role) => DefaultOptionType;
|
|
17
|
-
tagRenderer?: (props: CustomTagProps) => JSX.Element;
|
|
18
|
-
onSave?: () => void;
|
|
19
|
-
descriptionText?: string;
|
|
20
|
-
referenceLabelText?: string;
|
|
21
|
-
referenceExtraText?: string;
|
|
22
|
-
referenceSelectPlaceholderText?: string;
|
|
23
|
-
permissionSelectLabel?: string;
|
|
24
|
-
permissionSelectExtra?: string;
|
|
25
|
-
saveErrorMsg?: (placeholder: string) => string;
|
|
26
|
-
}
|
|
27
|
-
declare const PermissionModal: React.FC<PermissionModalProps>;
|
|
28
|
-
export default PermissionModal;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { PlusOutlined } from '@ant-design/icons';
|
|
4
|
-
import { Button, Modal, Select, Form, message, Tooltip, Divider, Pagination } from 'antd';
|
|
5
|
-
import Logger from 'js-logger';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import PermissionSelect from '../PermissionSelect/PermissionSelect';
|
|
8
|
-
import './PermissionModal.less';
|
|
9
|
-
;
|
|
10
|
-
const PermissionModal = ({ entityId, setInstancePermission, getReferences, toTag, tagRenderer, onSave = () => { }, descriptionText = '', referenceLabelText = '', referenceExtraText = '', referenceSelectPlaceholderText = '', permissionSelectLabel = '', permissionSelectExtra = '', saveErrorMsg = () => '', ...passThroughProps }) => {
|
|
11
|
-
const [loading, setLoading] = useState(false);
|
|
12
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
13
|
-
const [references, setReferences] = useState([]);
|
|
14
|
-
const [options, setOptions] = useState();
|
|
15
|
-
const [visible, setVisible] = useState(false);
|
|
16
|
-
const [referencePage, setReferencePage] = useState(1);
|
|
17
|
-
const [referenceTotal, setReferenceTotal] = useState();
|
|
18
|
-
const { t } = useTranslation();
|
|
19
|
-
const [form] = Form.useForm();
|
|
20
|
-
const referencePageSize = 20;
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!getReferences) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
(async () => {
|
|
26
|
-
setLoading(true);
|
|
27
|
-
try {
|
|
28
|
-
const refs = await getReferences({
|
|
29
|
-
page: referencePage - 1,
|
|
30
|
-
size: referencePageSize
|
|
31
|
-
});
|
|
32
|
-
if (!refs) {
|
|
33
|
-
throw new Error('Failed to load references');
|
|
34
|
-
}
|
|
35
|
-
setReferenceTotal(refs.totalElements);
|
|
36
|
-
setReferencePage(refs.number + 1);
|
|
37
|
-
setReferences(refs.content);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
message.error(t('PermissionModal.loadErrorMsg'));
|
|
41
|
-
Logger.error(error);
|
|
42
|
-
}
|
|
43
|
-
finally {
|
|
44
|
-
setLoading(false);
|
|
45
|
-
}
|
|
46
|
-
})();
|
|
47
|
-
}, [getReferences, t, referencePage]);
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (Array.isArray(references)) {
|
|
50
|
-
setOptions(references.map(toTag));
|
|
51
|
-
}
|
|
52
|
-
}, [references, toTag]);
|
|
53
|
-
const onClick = () => {
|
|
54
|
-
setVisible(!visible);
|
|
55
|
-
};
|
|
56
|
-
const onCancel = () => {
|
|
57
|
-
form.resetFields();
|
|
58
|
-
setVisible(false);
|
|
59
|
-
};
|
|
60
|
-
const onOk = async () => {
|
|
61
|
-
try {
|
|
62
|
-
await form.validateFields();
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const { referenceIds, permission } = form.getFieldsValue();
|
|
68
|
-
let erroneousRequestReferenceIds = [];
|
|
69
|
-
setIsSaving(true);
|
|
70
|
-
for (const referenceId of referenceIds) {
|
|
71
|
-
try {
|
|
72
|
-
await setInstancePermission(entityId, referenceId, permission);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
erroneousRequestReferenceIds.push(referenceId);
|
|
76
|
-
Logger.error(error);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (erroneousRequestReferenceIds.length > 0) {
|
|
80
|
-
message.error(saveErrorMsg(erroneousRequestReferenceIds.join(', ')));
|
|
81
|
-
}
|
|
82
|
-
form.resetFields();
|
|
83
|
-
setIsSaving(false);
|
|
84
|
-
setVisible(false);
|
|
85
|
-
onSave();
|
|
86
|
-
};
|
|
87
|
-
const onPaginationChange = (page) => {
|
|
88
|
-
setReferencePage(page);
|
|
89
|
-
};
|
|
90
|
-
return (_jsxs(_Fragment, { children: [_jsx(Tooltip, { title: t('PermissionModal.openModalButtonTooltipTitle'), children: _jsx(Button, { type: "primary", onClick: onClick, icon: _jsx(PlusOutlined, {}) }) }), _jsxs(Modal, { className: "permission-modal", title: t('PermissionModal.title'), open: visible, onCancel: onCancel, onOk: onOk, okButtonProps: {
|
|
91
|
-
loading: isSaving
|
|
92
|
-
}, width: 800, ...passThroughProps, children: [_jsx("div", { className: "description", children: descriptionText }), _jsxs(Form, { form: form, layout: "vertical", requiredMark: false, children: [_jsx(Form.Item, { name: "referenceIds", label: referenceLabelText, extra: referenceExtraText, rules: [{
|
|
93
|
-
required: true
|
|
94
|
-
}], children: _jsx(Select, { autoFocus: true, mode: "multiple", allowClear: true, optionFilterProp: 'filterValues', placeholder: referenceSelectPlaceholderText, loading: loading, options: options, tagRender: tagRenderer, dropdownRender: menu => (_jsxs("div", { className: "permission-modal-reference-dropdown", children: [menu, _jsx(Divider, {}), _jsx(Pagination, { total: referenceTotal, showTotal: total => `${t('PermissionModal.paginationTotal')}: ${total}`, locale: {
|
|
95
|
-
// eslint-disable-next-line camelcase
|
|
96
|
-
next_page: t('PermissionModal.paginationNextPage'),
|
|
97
|
-
// eslint-disable-next-line camelcase
|
|
98
|
-
prev_page: t('PermissionModal.paginationPrevPage')
|
|
99
|
-
}, onChange: onPaginationChange, current: referencePage, pageSize: referencePageSize, size: 'small' })] })) }) }), _jsx(Form.Item, { name: "permission", label: permissionSelectLabel, extra: permissionSelectExtra, rules: [{
|
|
100
|
-
required: true
|
|
101
|
-
}], children: _jsx(PermissionSelect, {}) })] })] })] }));
|
|
102
|
-
};
|
|
103
|
-
export default PermissionModal;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Select } from 'antd';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
;
|
|
5
|
-
const PermissionSelect = ({ ...passThroughProps }) => {
|
|
6
|
-
const { t } = useTranslation();
|
|
7
|
-
return (_jsx(Select, { placeholder: t('PermissionSelect.placeholder'), options: [{
|
|
8
|
-
label: t('PermissionSelect.readLabel'),
|
|
9
|
-
value: 'READ'
|
|
10
|
-
}, {
|
|
11
|
-
label: t('PermissionSelect.readUpdateLabel'),
|
|
12
|
-
value: 'READ_UPDATE'
|
|
13
|
-
}, {
|
|
14
|
-
label: t('PermissionSelect.readUpdateDeleteLabel'),
|
|
15
|
-
value: 'READ_UPDATE_DELETE'
|
|
16
|
-
}, {
|
|
17
|
-
label: t('PermissionSelect.adminLabel'),
|
|
18
|
-
value: 'ADMIN'
|
|
19
|
-
}], ...passThroughProps }));
|
|
20
|
-
};
|
|
21
|
-
export default PermissionSelect;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import RoleInstancePermission from '@terrestris/shogun-util/dist/model/security/RoleInstancePermission';
|
|
3
|
-
import { InstancePermissionGridProps } from '../InstancePermissionGrid/InstancePermissionGrid';
|
|
4
|
-
export interface RolePermissionGridProps extends Omit<InstancePermissionGridProps<RoleInstancePermission>, 'getInstancePermissions' | 'setInstancePermission' | 'deleteInstancePermission' | 'toDataType' | 'nameColumnDefinition' | 'getReferences' | 'toTag' | 'modalProps'> {
|
|
5
|
-
}
|
|
6
|
-
declare const RolePermissionGrid: React.FC<RolePermissionGridProps>;
|
|
7
|
-
export default RolePermissionGrid;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { Tag } from 'antd';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import useSHOGunAPIClient from '../../../../Hooks/useSHOGunAPIClient';
|
|
6
|
-
import InstancePermissionGrid from '../InstancePermissionGrid/InstancePermissionGrid';
|
|
7
|
-
;
|
|
8
|
-
const RolePermissionGrid = ({ entityType, ...passThroughProps }) => {
|
|
9
|
-
const { t } = useTranslation();
|
|
10
|
-
const client = useSHOGunAPIClient();
|
|
11
|
-
const service = useMemo(() => {
|
|
12
|
-
return (client?.[entityType])();
|
|
13
|
-
}, [client, entityType]);
|
|
14
|
-
const getRoleInstancePermissions = async (id) => {
|
|
15
|
-
return await service?.getRoleInstancePermissions(id);
|
|
16
|
-
};
|
|
17
|
-
const setRoleInstancePermission = async (id, referenceId, permission) => {
|
|
18
|
-
await service?.setRoleInstancePermission(id, referenceId, permission);
|
|
19
|
-
};
|
|
20
|
-
const deleteRoleInstancePermission = async (id, referenceId) => {
|
|
21
|
-
await service?.deleteRoleInstancePermission(id, referenceId);
|
|
22
|
-
};
|
|
23
|
-
const getRoles = async (pageOpts) => {
|
|
24
|
-
return await client?.role().findAll(pageOpts);
|
|
25
|
-
};
|
|
26
|
-
const toRoleDataType = (permission) => {
|
|
27
|
-
return {
|
|
28
|
-
key: permission.role?.id,
|
|
29
|
-
reference: permission.role,
|
|
30
|
-
name: permission.role?.providerDetails?.name,
|
|
31
|
-
permission: permission.permission?.name
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
const toTag = (role) => {
|
|
35
|
-
return {
|
|
36
|
-
value: role.id,
|
|
37
|
-
filterValues: [
|
|
38
|
-
role.providerDetails?.name
|
|
39
|
-
],
|
|
40
|
-
label: (_jsx("span", { children: role.providerDetails?.name }))
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const tagRenderer = (props) => {
|
|
44
|
-
const { label, ...passProps } = props;
|
|
45
|
-
const onPreventMouseDown = (event) => {
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
event.stopPropagation();
|
|
48
|
-
};
|
|
49
|
-
return (_jsx(Tag, { onMouseDown: onPreventMouseDown, className: "user-avatar-tag", ...passProps, children: label }));
|
|
50
|
-
};
|
|
51
|
-
const colDefinition = () => {
|
|
52
|
-
return {
|
|
53
|
-
sorter: (a, b) => {
|
|
54
|
-
const aName = a.reference?.providerDetails?.name;
|
|
55
|
-
const bName = b.reference?.providerDetails?.name;
|
|
56
|
-
if (!aName || !bName) {
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
return aName.localeCompare(bName);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
return (_jsx(InstancePermissionGrid, { entityType: entityType, getInstancePermissions: getRoleInstancePermissions, setInstancePermission: setRoleInstancePermission, deleteInstancePermission: deleteRoleInstancePermission, toDataType: toRoleDataType, nameColumnDefinition: colDefinition(), modalProps: {
|
|
64
|
-
toTag: toTag,
|
|
65
|
-
getReferences: getRoles,
|
|
66
|
-
tagRenderer: tagRenderer,
|
|
67
|
-
setInstancePermission: setRoleInstancePermission,
|
|
68
|
-
descriptionText: t('RolePermissionGrid.modal.description'),
|
|
69
|
-
referenceLabelText: t('RolePermissionGrid.modal.referenceSelectLabel'),
|
|
70
|
-
referenceExtraText: t('RolePermissionGrid.modal.referenceSelectExtra'),
|
|
71
|
-
referenceSelectPlaceholderText: t('RolePermissionGrid.modal.referenceSelectPlaceholder'),
|
|
72
|
-
permissionSelectLabel: t('RolePermissionGrid.modal.permissionSelectLabel'),
|
|
73
|
-
permissionSelectExtra: t('RolePermissionGrid.modal.permissionSelectExtra'),
|
|
74
|
-
saveErrorMsg: (placeholder) => {
|
|
75
|
-
return t('RolePermissionGrid.modal.saveErrorMsg', {
|
|
76
|
-
referenceIds: placeholder
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}, ...passThroughProps }));
|
|
80
|
-
};
|
|
81
|
-
export default RolePermissionGrid;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import UserInstancePermission from '@terrestris/shogun-util/dist/model/security/UserInstancePermission';
|
|
3
|
-
import { InstancePermissionGridProps } from '../InstancePermissionGrid/InstancePermissionGrid';
|
|
4
|
-
import './UserPermissionGrid.less';
|
|
5
|
-
export interface UserPermissionGridProps extends Omit<InstancePermissionGridProps<UserInstancePermission>, 'getInstancePermissions' | 'setInstancePermission' | 'deleteInstancePermission' | 'toDataType' | 'nameColumnDefinition' | 'getReferences' | 'toTag' | 'modalProps'> {
|
|
6
|
-
}
|
|
7
|
-
declare const UserPermissionGrid: React.FC<UserPermissionGridProps>;
|
|
8
|
-
export default UserPermissionGrid;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
import { Tag } from 'antd';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import useSHOGunAPIClient from '../../../../Hooks/useSHOGunAPIClient';
|
|
6
|
-
import UserAvatar from '../../../UserAvatar/UserAvatar';
|
|
7
|
-
import InstancePermissionGrid from '../InstancePermissionGrid/InstancePermissionGrid';
|
|
8
|
-
import './UserPermissionGrid.less';
|
|
9
|
-
;
|
|
10
|
-
const UserPermissionGrid = ({ entityType, ...passThroughProps }) => {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
const client = useSHOGunAPIClient();
|
|
13
|
-
const service = useCallback(() => {
|
|
14
|
-
return (client?.[entityType])();
|
|
15
|
-
}, [client, entityType]);
|
|
16
|
-
const getUserInstancePermissions = async (id) => {
|
|
17
|
-
return await service()?.getUserInstancePermissions(id);
|
|
18
|
-
};
|
|
19
|
-
const setUserInstancePermission = async (id, referenceId, permission) => {
|
|
20
|
-
await service()?.setUserInstancePermission(id, referenceId, permission);
|
|
21
|
-
};
|
|
22
|
-
const deleteUserInstancePermission = async (id, referenceId) => {
|
|
23
|
-
await service()?.deleteUserInstancePermission(id, referenceId);
|
|
24
|
-
};
|
|
25
|
-
const getUsers = async (pageOpts) => {
|
|
26
|
-
return await client?.user().findAll(pageOpts);
|
|
27
|
-
};
|
|
28
|
-
const toUserDataType = (permission) => {
|
|
29
|
-
return {
|
|
30
|
-
key: permission.user?.id,
|
|
31
|
-
reference: permission.user,
|
|
32
|
-
name: permission.user?.providerDetails?.username,
|
|
33
|
-
permission: permission.permission?.name
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const toTag = (user) => {
|
|
37
|
-
return {
|
|
38
|
-
value: user.id,
|
|
39
|
-
filterValues: [
|
|
40
|
-
user.providerDetails?.firstName,
|
|
41
|
-
user.providerDetails?.lastName,
|
|
42
|
-
user.providerDetails?.username,
|
|
43
|
-
user.providerDetails?.email
|
|
44
|
-
],
|
|
45
|
-
label: (_jsx(UserAvatar, { user: user }))
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const tagRenderer = (props) => {
|
|
49
|
-
const { label, ...passProps } = props;
|
|
50
|
-
const onPreventMouseDown = (event) => {
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
};
|
|
54
|
-
return (_jsx(Tag, { onMouseDown: onPreventMouseDown, className: "user-avatar-tag", ...passProps, children: label }));
|
|
55
|
-
};
|
|
56
|
-
const colDefinition = () => {
|
|
57
|
-
return {
|
|
58
|
-
sorter: (a, b) => {
|
|
59
|
-
const aName = a.reference?.providerDetails?.username;
|
|
60
|
-
const bName = b.reference?.providerDetails?.username;
|
|
61
|
-
if (!aName || !bName) {
|
|
62
|
-
return 0;
|
|
63
|
-
}
|
|
64
|
-
return aName.localeCompare(bName);
|
|
65
|
-
},
|
|
66
|
-
render: (_, record) => (_jsx(UserAvatar, { user: record.reference }))
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
return (_jsx(InstancePermissionGrid, { entityType: entityType, getInstancePermissions: getUserInstancePermissions, setInstancePermission: setUserInstancePermission, deleteInstancePermission: deleteUserInstancePermission, toDataType: toUserDataType, nameColumnDefinition: colDefinition(), modalProps: {
|
|
70
|
-
toTag: toTag,
|
|
71
|
-
getReferences: getUsers,
|
|
72
|
-
tagRenderer: tagRenderer,
|
|
73
|
-
setInstancePermission: setUserInstancePermission,
|
|
74
|
-
descriptionText: t('UserPermissionGrid.modal.description'),
|
|
75
|
-
referenceLabelText: t('UserPermissionGrid.modal.referenceSelectLabel'),
|
|
76
|
-
referenceExtraText: t('UserPermissionGrid.modal.referenceSelectExtra'),
|
|
77
|
-
referenceSelectPlaceholderText: t('UserPermissionGrid.modal.referenceSelectPlaceholder'),
|
|
78
|
-
permissionSelectLabel: t('UserPermissionGrid.modal.permissionSelectLabel'),
|
|
79
|
-
permissionSelectExtra: t('UserPermissionGrid.modal.permissionSelectExtra'),
|
|
80
|
-
saveErrorMsg: (placeholder) => {
|
|
81
|
-
return t('UserPermissionGrid.modal.saveErrorMsg', {
|
|
82
|
-
referenceIds: placeholder
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}, ...passThroughProps }));
|
|
86
|
-
};
|
|
87
|
-
export default UserPermissionGrid;
|
package/dist/lib/Component/FormField/VerifyProviderDetailsField/VerifyProviderDetailsField.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TooltipProps } from 'antd';
|
|
3
|
-
import Group from '@terrestris/shogun-util/dist/model/Group';
|
|
4
|
-
import User from '@terrestris/shogun-util/dist/model/User';
|
|
5
|
-
import './VerifyProviderDetailsField.less';
|
|
6
|
-
export type VerifyProviderDetailsFieldProps = {
|
|
7
|
-
record: User | Group;
|
|
8
|
-
value?: string;
|
|
9
|
-
i18n?: FormTranslations;
|
|
10
|
-
title?: string;
|
|
11
|
-
} & Partial<Omit<TooltipProps, 'title'>>;
|
|
12
|
-
export declare const VerifyProviderDetailsField: React.FC<VerifyProviderDetailsFieldProps>;
|
|
13
|
-
export default VerifyProviderDetailsField;
|
package/dist/lib/Component/FormField/VerifyProviderDetailsField/VerifyProviderDetailsField.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
3
|
-
import { Tooltip } from 'antd';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import TranslationUtil from '../../../Util/TranslationUtil';
|
|
6
|
-
import './VerifyProviderDetailsField.less';
|
|
7
|
-
export const VerifyProviderDetailsField = ({ record, value, i18n, title, ...passThroughProps }) => {
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
if (!record.providerDetails) {
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsx(_Fragment, { children: value }), _jsx(Tooltip, { title: title ? TranslationUtil.getTranslationFromConfig(title, i18n) : t('VerifyProviderDetailsField.title'), ...passThroughProps, children: _jsx(ExclamationCircleOutlined, { className: 'provider-details-warning' }) })] }));
|
|
11
|
-
}
|
|
12
|
-
return (_jsx(_Fragment, { children: value }));
|
|
13
|
-
};
|
|
14
|
-
export default VerifyProviderDetailsField;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './YesOrNoField.less';
|
|
3
|
-
import CheckOutlined from '@ant-design/icons/lib/icons/CheckOutlined';
|
|
4
|
-
import CloseOutlined from '@ant-design/icons/lib/icons/CloseOutlined';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
const YesOrNoField = ({ showIcons = true, value }) => {
|
|
7
|
-
const { t } = useTranslation();
|
|
8
|
-
return (value ? _jsxs("div", { className: "yes-no-field", children: [_jsx("span", { className: "yn-text", children: t('YesorNoField.yes') }), showIcons && _jsx(CheckOutlined, {})] }) : _jsxs("div", { className: "yes-no-field", children: [_jsx("span", { className: "yn-text", children: t('YesorNoField.no') }), showIcons && _jsx(CloseOutlined, {})] }));
|
|
9
|
-
};
|
|
10
|
-
export default YesOrNoField;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './FullscreenWrapper.less';
|
|
3
|
-
import { useRef, useState } from 'react';
|
|
4
|
-
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
|
|
5
|
-
import { Button, Tooltip } from 'antd';
|
|
6
|
-
import { useHotkeys } from 'react-hotkeys-hook';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
export const FullscreenWrapper = ({ children }) => {
|
|
9
|
-
const [fullscreen, setFullscreen] = useState(false);
|
|
10
|
-
const [minimizedHeight, setMinimizedHeight] = useState('10em');
|
|
11
|
-
const elementRef = useRef(null);
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const toggleFullscreen = () => {
|
|
14
|
-
const contentEl = document.querySelector('.content');
|
|
15
|
-
const leftContainerEl = document.querySelector('.content .left-container');
|
|
16
|
-
const shouldBeFullScreen = !fullscreen;
|
|
17
|
-
const element = elementRef.current;
|
|
18
|
-
if (!element) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (contentEl && leftContainerEl && shouldBeFullScreen) {
|
|
22
|
-
setMinimizedHeight(element.getBoundingClientRect().height + 'px');
|
|
23
|
-
const contentDimensions = contentEl.getBoundingClientRect();
|
|
24
|
-
const leftContainerDimensions = leftContainerEl.getBoundingClientRect();
|
|
25
|
-
element.style.left = `${contentDimensions.left}px`;
|
|
26
|
-
element.style.top = `${leftContainerDimensions.top}px`;
|
|
27
|
-
element.style.width = `${contentDimensions.width}px`;
|
|
28
|
-
element.style.height = `${leftContainerDimensions.height}px`;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
element.style.left = '';
|
|
32
|
-
element.style.top = '';
|
|
33
|
-
element.style.width = '';
|
|
34
|
-
element.style.height = minimizedHeight;
|
|
35
|
-
}
|
|
36
|
-
setFullscreen(shouldBeFullScreen);
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Exit fullscreen when Esc is pressed.
|
|
40
|
-
*/
|
|
41
|
-
useHotkeys('esc', toggleFullscreen, {
|
|
42
|
-
enabled: () => fullscreen,
|
|
43
|
-
enableOnFormTags: ['INPUT', 'TEXTAREA', 'SELECT']
|
|
44
|
-
});
|
|
45
|
-
const wrapperCls = `fs-wrapper${fullscreen ? ' fullscreen' : ''}`;
|
|
46
|
-
return (_jsxs("div", { className: wrapperCls, ref: elementRef, children: [_jsx(Tooltip, { title: fullscreen ? t('FullscreenWrapper.leaveFullscreen') : t('FullscreenWrapper.fullscreen'), placement: 'left', children: _jsx(Button, { icon: fullscreen ? _jsx(FullscreenExitOutlined, {}) : _jsx(FullscreenOutlined, {}), size: 'small', onClick: toggleFullscreen }) }), children] }));
|
|
47
|
-
};
|
|
48
|
-
export default FullscreenWrapper;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './GeneralEntityForm.less';
|
|
3
|
-
import { FormInstance, FormProps } from 'antd/lib/form';
|
|
4
|
-
export type FieldConfig = {
|
|
5
|
-
component?: string;
|
|
6
|
-
dataField: string;
|
|
7
|
-
dataType?: string;
|
|
8
|
-
fieldProps?: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
formItemProps?: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
label?: string;
|
|
15
|
-
noOptionValue?: {
|
|
16
|
-
value: string;
|
|
17
|
-
};
|
|
18
|
-
normalizer?: {
|
|
19
|
-
value: string;
|
|
20
|
-
};
|
|
21
|
-
required?: boolean;
|
|
22
|
-
requiredI18n?: string;
|
|
23
|
-
readOnly?: boolean;
|
|
24
|
-
};
|
|
25
|
-
export type FormMode = 'EDIT' | 'VIEW';
|
|
26
|
-
export type FormConfig = {
|
|
27
|
-
name: string;
|
|
28
|
-
publicKey?: string;
|
|
29
|
-
fields: FieldConfig[];
|
|
30
|
-
};
|
|
31
|
-
interface OwnProps {
|
|
32
|
-
loading?: boolean;
|
|
33
|
-
i18n: FormTranslations;
|
|
34
|
-
entityId?: number;
|
|
35
|
-
entityName: string;
|
|
36
|
-
entityType: string;
|
|
37
|
-
formConfig: FormConfig;
|
|
38
|
-
formProps?: Partial<FormProps>;
|
|
39
|
-
form: FormInstance;
|
|
40
|
-
}
|
|
41
|
-
export type GeneralEntityFormProps = OwnProps & React.HTMLAttributes<HTMLDivElement>;
|
|
42
|
-
export declare const GeneralEntityForm: React.FC<GeneralEntityFormProps>;
|
|
43
|
-
export default GeneralEntityForm;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PageHeader } from '@ant-design/pro-components';
|
|
3
|
-
import { DatePicker, Form, Input, InputNumber, Select, Spin, Statistic, Switch } from 'antd';
|
|
4
|
-
import './GeneralEntityForm.less';
|
|
5
|
-
import Logger from 'js-logger';
|
|
6
|
-
import _cloneDeep from 'lodash/cloneDeep';
|
|
7
|
-
import TranslationUtil from '../../../Util/TranslationUtil';
|
|
8
|
-
import DisplayField from '../../FormField/DisplayField/DisplayField';
|
|
9
|
-
import JSONEditor from '../../FormField/JSONEditor/JSONEditor';
|
|
10
|
-
import MarkdownEditor from '../../FormField/MarkdownEditor/MarkdownEditor';
|
|
11
|
-
import GroupPermissionGrid from '../../FormField/Permission/GroupPermissionGrid/GroupPermissionGrid';
|
|
12
|
-
import RolePermissionGrid from '../../FormField/Permission/RolePermissionGrid/RolePermissionGrid';
|
|
13
|
-
import UserPermissionGrid from '../../FormField/Permission/UserPermissionGrid/UserPermissionGrid';
|
|
14
|
-
import YesOrNoField from '../../FormField/YesOrNoField/YesOrNoField';
|
|
15
|
-
import LayerTypeSelect from '../../Layer/LayerTypeSelect/LayerTypeSelect';
|
|
16
|
-
const { TextArea } = Input;
|
|
17
|
-
const DEFAULT_DATE_FORMAT = 'DD.MM.YYYY';
|
|
18
|
-
export const GeneralEntityForm = ({ loading = false, i18n, entityId, entityName, entityType, formProps, form, formConfig }) => {
|
|
19
|
-
/**
|
|
20
|
-
* Create read-only components for certain form items
|
|
21
|
-
* @param fieldConfig
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
const createReadOnlyComponent = (fieldConfig) => {
|
|
25
|
-
switch (fieldConfig.component) {
|
|
26
|
-
case 'Switch':
|
|
27
|
-
return (_jsx(YesOrNoField, {}));
|
|
28
|
-
case 'Statistic':
|
|
29
|
-
return createFieldComponent(fieldConfig);
|
|
30
|
-
case 'DateField':
|
|
31
|
-
return _jsx(DisplayField, { format: "date", ...fieldConfig.fieldProps });
|
|
32
|
-
default:
|
|
33
|
-
return (_jsx(DisplayField, { ...fieldConfig.fieldProps }));
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Return a component given the "component" property in passed field configuration
|
|
38
|
-
* @param fieldCfg
|
|
39
|
-
*/
|
|
40
|
-
const createFieldComponent = (fieldCfg) => {
|
|
41
|
-
switch (fieldCfg?.component) {
|
|
42
|
-
case 'TextArea':
|
|
43
|
-
return (_jsx(TextArea, { ...fieldCfg?.fieldProps }));
|
|
44
|
-
case 'Input':
|
|
45
|
-
return (_jsx(Input, { ...fieldCfg?.fieldProps }));
|
|
46
|
-
case 'Number':
|
|
47
|
-
return (_jsx(InputNumber, { ...fieldCfg?.fieldProps }));
|
|
48
|
-
case 'Switch':
|
|
49
|
-
return (_jsx(Switch, { checkedChildren: "On", unCheckedChildren: "Off", ...fieldCfg?.fieldProps }));
|
|
50
|
-
case 'Select':
|
|
51
|
-
return (_jsx(Select, { ...fieldCfg?.fieldProps }));
|
|
52
|
-
case 'LayerTypeSelect':
|
|
53
|
-
return (_jsx(LayerTypeSelect, { ...fieldCfg?.fieldProps }));
|
|
54
|
-
case 'MarkdownEditor':
|
|
55
|
-
return (_jsx(MarkdownEditor, { ...fieldCfg?.fieldProps }));
|
|
56
|
-
case 'Statistic':
|
|
57
|
-
return (_jsx(Statistic, { ...fieldCfg?.fieldProps }));
|
|
58
|
-
case 'JSONEditor':
|
|
59
|
-
return (_jsx(JSONEditor, { entityType: entityType, dataField: fieldCfg.dataField, ...fieldCfg?.fieldProps }));
|
|
60
|
-
case 'DisplayField':
|
|
61
|
-
return (_jsx(DisplayField, { ...fieldCfg?.fieldProps }));
|
|
62
|
-
case 'DateField':
|
|
63
|
-
return (_jsx(DatePicker, { format: DEFAULT_DATE_FORMAT, ...fieldCfg?.fieldProps }));
|
|
64
|
-
case 'UserPermissionGrid':
|
|
65
|
-
if (entityId !== form.getFieldValue('id')) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
return (_jsx(UserPermissionGrid, { entityId: form.getFieldValue('id'), entityType: entityType.toLowerCase(), ...fieldCfg?.fieldProps }));
|
|
69
|
-
case 'GroupPermissionGrid':
|
|
70
|
-
if (entityId !== form.getFieldValue('id')) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
return (_jsx(GroupPermissionGrid, { entityId: form.getFieldValue('id'), entityType: entityType.toLowerCase(), ...fieldCfg?.fieldProps }));
|
|
74
|
-
case 'RolePermissionGrid':
|
|
75
|
-
if (entityId !== form.getFieldValue('id')) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
return (_jsx(RolePermissionGrid, { entityId: form.getFieldValue('id'), entityType: entityType.toLowerCase(), ...fieldCfg?.fieldProps }));
|
|
79
|
-
default:
|
|
80
|
-
Logger.error(`Cannot create component of type "${fieldCfg?.component}" with name "${fieldCfg?.dataField}"`);
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Return a component given the "datatype" property passed field configuration
|
|
86
|
-
* @param fieldConfig The field configuration
|
|
87
|
-
*/
|
|
88
|
-
const getFieldByDataType = (fieldConfig) => {
|
|
89
|
-
return (_jsx(Input, { ...fieldConfig?.fieldProps }));
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Generates an antd normalize function with the specified "no"-value.
|
|
93
|
-
*/
|
|
94
|
-
const getNormalizeFn = () => {
|
|
95
|
-
let noValue = '';
|
|
96
|
-
return (value, prevValue = []) => {
|
|
97
|
-
if (Array.isArray(value) &&
|
|
98
|
-
Array.isArray(prevValue) &&
|
|
99
|
-
value.indexOf(noValue) >= 0 &&
|
|
100
|
-
prevValue.indexOf(noValue) < 0) {
|
|
101
|
-
return [noValue];
|
|
102
|
-
}
|
|
103
|
-
return value;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Generate antd form item for given field config
|
|
108
|
-
* @param fieldCfg The FieldConfig
|
|
109
|
-
* @returns An antd FormItem
|
|
110
|
-
*/
|
|
111
|
-
const createFormItem = (fieldCfg) => {
|
|
112
|
-
let copyFieldCfg = _cloneDeep(fieldCfg);
|
|
113
|
-
copyFieldCfg.label = TranslationUtil.getTranslationFromConfig(fieldCfg.label, i18n);
|
|
114
|
-
let field;
|
|
115
|
-
if (copyFieldCfg.readOnly) {
|
|
116
|
-
field = createReadOnlyComponent(copyFieldCfg);
|
|
117
|
-
}
|
|
118
|
-
else if (copyFieldCfg.component) {
|
|
119
|
-
field = createFieldComponent(copyFieldCfg);
|
|
120
|
-
}
|
|
121
|
-
else if (copyFieldCfg.dataType) {
|
|
122
|
-
field = getFieldByDataType(copyFieldCfg);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
Logger.warn('FieldConfig is missing `readOnly`, `component` or `dataType` property.');
|
|
126
|
-
field = (_jsx(Input, { placeholder: "" }, copyFieldCfg?.dataField));
|
|
127
|
-
}
|
|
128
|
-
const formItemProps = {
|
|
129
|
-
rules: []
|
|
130
|
-
};
|
|
131
|
-
// when determining the status
|
|
132
|
-
formItemProps.rules = [{
|
|
133
|
-
required: copyFieldCfg.required
|
|
134
|
-
}];
|
|
135
|
-
if (copyFieldCfg.component === 'Switch') {
|
|
136
|
-
formItemProps.valuePropName = 'checked';
|
|
137
|
-
}
|
|
138
|
-
const { component, dataField } = copyFieldCfg;
|
|
139
|
-
return (_jsx(Form.Item, { name: dataField, className: `cls-${dataField}`, normalize: copyFieldCfg.component ? getNormalizeFn() : undefined, label: copyFieldCfg.label || `Field: ${copyFieldCfg.dataField}`, ...formItemProps, ...copyFieldCfg.formItemProps, children: field }, `${entityType}-${form.getFieldValue('id')}-${dataField || component?.toLocaleLowerCase()}`));
|
|
140
|
-
};
|
|
141
|
-
const initialValues = {};
|
|
142
|
-
const title = TranslationUtil.getTranslationFromConfig(entityName, i18n);
|
|
143
|
-
return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { title: title }), _jsx(Spin, { spinning: loading, children: _jsx(Form, { className: "general-entity-form", form: form, initialValues: initialValues, labelCol: { span: 5 }, wrapperCol: { span: 20 }, name: formConfig?.name, ...formProps, children: formConfig.fields?.map(createFormItem) }) })] }));
|
|
144
|
-
};
|
|
145
|
-
export default GeneralEntityForm;
|