@terrestris/shogun-admin 16.1.0-next.1
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/LICENSE +201 -0
- package/README.md +42 -0
- package/dist/build/assets/App-BP74CNP_.js +1258 -0
- package/dist/build/assets/__federation_shared_react-CvClEUjg.js +9 -0
- package/dist/build/assets/__federation_shared_react-dom-BxqGBSTk.js +24 -0
- package/dist/build/assets/__federation_shared_react-i18next-MD_bYxcL.js +1 -0
- package/dist/build/assets/__federation_shared_react-router-dom-Vy7O6TNk.js +2 -0
- package/dist/build/assets/_commonjsHelpers-BosuxZz1.js +1 -0
- package/dist/build/assets/_virtual___federation_fn_import-PJHfB1tr.js +1 -0
- package/dist/build/assets/abap-DRC6TkPh.js +6 -0
- package/dist/build/assets/apex-BuapDI9Y.js +6 -0
- package/dist/build/assets/azcli-BypH-vXm.js +6 -0
- package/dist/build/assets/bat-BY6pwuIY.js +6 -0
- package/dist/build/assets/bicep-gRuQeaLk.js +7 -0
- package/dist/build/assets/cameligo-ul-Lp4lw.js +6 -0
- package/dist/build/assets/clojure-DeYg-96x.js +6 -0
- package/dist/build/assets/codicon-DCmgc-ay.ttf +0 -0
- package/dist/build/assets/coffee-CfnpWUYo.js +6 -0
- package/dist/build/assets/cpp-C9L3yaDO.js +6 -0
- package/dist/build/assets/csharp-DWGz5Zuj.js +6 -0
- package/dist/build/assets/csp-DrRCxMg5.js +6 -0
- package/dist/build/assets/css-BfLuTCmN.js +8 -0
- package/dist/build/assets/css.worker-BAJD-bzR.js +83 -0
- package/dist/build/assets/cssMode-Btzqpc23.js +4 -0
- package/dist/build/assets/cypher-DoFvH58O.js +6 -0
- package/dist/build/assets/dart-DIovg4uR.js +6 -0
- package/dist/build/assets/dockerfile-D2PfwrvU.js +6 -0
- package/dist/build/assets/ecl-C_scCXcs.js +6 -0
- package/dist/build/assets/editor.worker-MnaSPjGA.js +11 -0
- package/dist/build/assets/elixir-BRk-K-rg.js +6 -0
- package/dist/build/assets/favicon-CwZoocDV.ico +0 -0
- package/dist/build/assets/flow9-DLs3tTet.js +6 -0
- package/dist/build/assets/freemarker2-CoZuEXJi.js +3 -0
- package/dist/build/assets/fsharp-D0UiDa5C.js +6 -0
- package/dist/build/assets/go-CyVeKkvQ.js +6 -0
- package/dist/build/assets/graphql-BygKL3ZF.js +6 -0
- package/dist/build/assets/handlebars-BQ2vXFqT.js +1 -0
- package/dist/build/assets/hcl-D_OY6ada.js +6 -0
- package/dist/build/assets/html-S9BExIX4.js +1 -0
- package/dist/build/assets/html.worker-Bp7pNElH.js +460 -0
- package/dist/build/assets/htmlMode-D6oh_W-n.js +4 -0
- package/dist/build/assets/index-D5X_Cuhy.js +139 -0
- package/dist/build/assets/ini-BTpWsGps.js +6 -0
- package/dist/build/assets/java-3TATJI7h.js +6 -0
- package/dist/build/assets/javascript-C_BsKwTq.js +1 -0
- package/dist/build/assets/json.worker-BfIkrIax.js +48 -0
- package/dist/build/assets/jsonMode-CFQnTUoH.js +10 -0
- package/dist/build/assets/julia-DDpSJMW6.js +6 -0
- package/dist/build/assets/kotlin-DVYH6Lj_.js +6 -0
- package/dist/build/assets/less-CuFlys0T.js +7 -0
- package/dist/build/assets/lexon-m09vb5r-.js +6 -0
- package/dist/build/assets/liquid-CsJvQ-Gd.js +1 -0
- package/dist/build/assets/lua-D2Z7JJdl.js +6 -0
- package/dist/build/assets/m3-B2Cf9XSq.js +6 -0
- package/dist/build/assets/markdown-BXYnMxBe.js +6 -0
- package/dist/build/assets/mdx-CcsV6KQM.js +1 -0
- package/dist/build/assets/mips-Ckkbw-AO.js +6 -0
- package/dist/build/assets/msdax-B5uW3Zvf.js +6 -0
- package/dist/build/assets/mysql-B8ssZoUh.js +6 -0
- package/dist/build/assets/objective-c-CrrKwR0a.js +6 -0
- package/dist/build/assets/pascal-BWBTHuhh.js +6 -0
- package/dist/build/assets/pascaligo-BGLI1Hdo.js +6 -0
- package/dist/build/assets/perl-DDrv2Hr-.js +6 -0
- package/dist/build/assets/pgsql-DLPipH_Q.js +6 -0
- package/dist/build/assets/php-CTNlIIiR.js +6 -0
- package/dist/build/assets/pla-2oJWbEOo.js +6 -0
- package/dist/build/assets/postiats-DOk3G3cc.js +6 -0
- package/dist/build/assets/powerquery-Dgyr3wWZ.js +6 -0
- package/dist/build/assets/powershell-B_i9asfM.js +6 -0
- package/dist/build/assets/protobuf-CV9EbfTh.js +7 -0
- package/dist/build/assets/pug-CCBS_C5_.js +6 -0
- package/dist/build/assets/python-BNsLUA-F.js +1 -0
- package/dist/build/assets/qsharp-BLuZWbUW.js +6 -0
- package/dist/build/assets/r-CzF1MCbP.js +6 -0
- package/dist/build/assets/razor-CwLyy1uA.js +1 -0
- package/dist/build/assets/redis-C75U4IDy.js +6 -0
- package/dist/build/assets/redshift-Bc5xkKR1.js +6 -0
- package/dist/build/assets/restructuredtext-DmdQbaLT.js +6 -0
- package/dist/build/assets/ruby-DB0RB20n.js +6 -0
- package/dist/build/assets/rust-UMmp-gVE.js +6 -0
- package/dist/build/assets/sb-DVG02705.js +6 -0
- package/dist/build/assets/scala-DvSxYeG4.js +6 -0
- package/dist/build/assets/scheme-yf5bffbF.js +6 -0
- package/dist/build/assets/scss-Bzb7OGdO.js +8 -0
- package/dist/build/assets/shell-FNqbgIOG.js +6 -0
- 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 +6 -0
- package/dist/build/assets/sophia-B4VqtPa2.js +6 -0
- package/dist/build/assets/sparql-B7alP455.js +6 -0
- package/dist/build/assets/sql-D7lU1fdU.js +6 -0
- package/dist/build/assets/st-VuadG5SK.js +6 -0
- package/dist/build/assets/style-CJpWC7V3.css +1 -0
- package/dist/build/assets/swift-BYtUz8ZP.js +8 -0
- package/dist/build/assets/systemverilog-DOAuugfS.js +6 -0
- package/dist/build/assets/tcl-CXKOl_mN.js +6 -0
- package/dist/build/assets/ts.worker-BBBnYv8q.js +51333 -0
- package/dist/build/assets/tsMode-meseu6bK.js +11 -0
- package/dist/build/assets/twig-D9yiNO04.js +6 -0
- package/dist/build/assets/typescript-BuOvk1sq.js +1 -0
- package/dist/build/assets/typespec-BupSXVCO.js +6 -0
- package/dist/build/assets/vb-ZlaFEk-P.js +6 -0
- package/dist/build/assets/wgsl-DrbANKle.js +303 -0
- package/dist/build/assets/xml-BXx9C-xA.js +1 -0
- package/dist/build/assets/yaml-CuMedh6B.js +1 -0
- package/dist/build/index.html +24 -0
- package/dist/lib/App.d.ts +4 -0
- package/dist/lib/App.js +122 -0
- package/dist/lib/Component/Dashboard/Dashboard.d.ts +12 -0
- package/dist/lib/Component/Dashboard/Dashboard.js +10 -0
- package/dist/lib/Component/Dashboard/DashboardCard/DashboardCard.d.ts +13 -0
- package/dist/lib/Component/Dashboard/DashboardCard/DashboardCard.js +7 -0
- package/dist/lib/Component/Dashboard/DashboardStatistics/DashboardStatistics.d.ts +15 -0
- package/dist/lib/Component/Dashboard/DashboardStatistics/DashboardStatistics.js +30 -0
- package/dist/lib/Component/EvictCache/EvictCache.d.ts +6 -0
- package/dist/lib/Component/EvictCache/EvictCache.js +28 -0
- package/dist/lib/Component/FormField/DisplayField/DisplayField.d.ts +13 -0
- package/dist/lib/Component/FormField/DisplayField/DisplayField.js +32 -0
- package/dist/lib/Component/FormField/JSONEditor/JSONEditor.d.ts +13 -0
- package/dist/lib/Component/FormField/JSONEditor/JSONEditor.js +90 -0
- package/dist/lib/Component/FormField/JSONEditor/UserWorker.d.ts +1 -0
- package/dist/lib/Component/FormField/JSONEditor/UserWorker.js +26 -0
- package/dist/lib/Component/FormField/LinkField/LinkField.d.ts +11 -0
- package/dist/lib/Component/FormField/LinkField/LinkField.js +15 -0
- package/dist/lib/Component/FormField/MarkdownEditor/MarkdownEditor.d.ts +10 -0
- package/dist/lib/Component/FormField/MarkdownEditor/MarkdownEditor.js +23 -0
- package/dist/lib/Component/FormField/Permission/GroupPermissionGrid/GroupPermissionGrid.d.ts +7 -0
- package/dist/lib/Component/FormField/Permission/GroupPermissionGrid/GroupPermissionGrid.js +73 -0
- package/dist/lib/Component/FormField/Permission/InstancePermissionGrid/InstancePermissionGrid.d.ts +30 -0
- package/dist/lib/Component/FormField/Permission/InstancePermissionGrid/InstancePermissionGrid.js +151 -0
- package/dist/lib/Component/FormField/Permission/PermissionModal/PermissionModal.d.ts +28 -0
- package/dist/lib/Component/FormField/Permission/PermissionModal/PermissionModal.js +103 -0
- package/dist/lib/Component/FormField/Permission/PermissionSelect/PermissionSelect.d.ts +6 -0
- package/dist/lib/Component/FormField/Permission/PermissionSelect/PermissionSelect.js +21 -0
- package/dist/lib/Component/FormField/Permission/RolePermissionGrid/RolePermissionGrid.d.ts +7 -0
- package/dist/lib/Component/FormField/Permission/RolePermissionGrid/RolePermissionGrid.js +81 -0
- package/dist/lib/Component/FormField/Permission/UserPermissionGrid/UserPermissionGrid.d.ts +8 -0
- package/dist/lib/Component/FormField/Permission/UserPermissionGrid/UserPermissionGrid.js +87 -0
- package/dist/lib/Component/FormField/VerifyProviderDetailsField/VerifyProviderDetailsField.d.ts +13 -0
- package/dist/lib/Component/FormField/VerifyProviderDetailsField/VerifyProviderDetailsField.js +14 -0
- package/dist/lib/Component/FormField/YesOrNoField/YesOrNoField.d.ts +8 -0
- package/dist/lib/Component/FormField/YesOrNoField/YesOrNoField.js +10 -0
- package/dist/lib/Component/FullscreenWrapper/FullscreenWrapper.d.ts +4 -0
- package/dist/lib/Component/FullscreenWrapper/FullscreenWrapper.js +48 -0
- package/dist/lib/Component/GeneralEntity/GeneralEntityForm/GeneralEntityForm.d.ts +43 -0
- package/dist/lib/Component/GeneralEntity/GeneralEntityForm/GeneralEntityForm.js +145 -0
- package/dist/lib/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.d.ts +22 -0
- package/dist/lib/Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot.js +527 -0
- package/dist/lib/Component/GeneralEntity/GeneralEntityTable/GeneralEntityTable.d.ts +46 -0
- package/dist/lib/Component/GeneralEntity/GeneralEntityTable/GeneralEntityTable.js +179 -0
- package/dist/lib/Component/GlobalSettings/GlobalSettingsRoot/GlobalSettingsRoot.d.ts +5 -0
- package/dist/lib/Component/GlobalSettings/GlobalSettingsRoot/GlobalSettingsRoot.js +15 -0
- package/dist/lib/Component/Header/Header.d.ts +8 -0
- package/dist/lib/Component/Header/Header.js +16 -0
- package/dist/lib/Component/ImageFile/ImageFileForm/ImageFileForm.d.ts +7 -0
- package/dist/lib/Component/ImageFile/ImageFileForm/ImageFileForm.js +94 -0
- package/dist/lib/Component/ImageFile/ImageFileRoot/ImageFileRoot.d.ts +7 -0
- package/dist/lib/Component/ImageFile/ImageFileRoot/ImageFileRoot.js +44 -0
- package/dist/lib/Component/ImageFile/ImageFileTable/ImageFileTable.d.ts +9 -0
- package/dist/lib/Component/ImageFile/ImageFileTable/ImageFileTable.js +157 -0
- package/dist/lib/Component/LanguageSelector/index.d.ts +4 -0
- package/dist/lib/Component/LanguageSelector/index.js +15 -0
- package/dist/lib/Component/Layer/LayerTypeSelect/LayerTypeSelect.d.ts +11 -0
- package/dist/lib/Component/Layer/LayerTypeSelect/LayerTypeSelect.js +33 -0
- package/dist/lib/Component/LayerPreview/LayerPreview.d.ts +9 -0
- package/dist/lib/Component/LayerPreview/LayerPreview.js +159 -0
- package/dist/lib/Component/LayerPreview/MapComponent/MapComponent.d.ts +10 -0
- package/dist/lib/Component/LayerPreview/MapComponent/MapComponent.js +22 -0
- package/dist/lib/Component/LogSettings/LogLevelSelect/LogLevelSelect.d.ts +7 -0
- package/dist/lib/Component/LogSettings/LogLevelSelect/LogLevelSelect.js +20 -0
- package/dist/lib/Component/LogSettings/LogLevelTable/LogLevelTable.d.ts +12 -0
- package/dist/lib/Component/LogSettings/LogLevelTable/LogLevelTable.js +73 -0
- package/dist/lib/Component/LogSettings/LogSettingsRoot/LogSettingsRoot.d.ts +4 -0
- package/dist/lib/Component/LogSettings/LogSettingsRoot/LogSettingsRoot.js +11 -0
- package/dist/lib/Component/Logs/Logs.d.ts +5 -0
- package/dist/lib/Component/Logs/Logs.js +58 -0
- package/dist/lib/Component/Menu/Navigation/Navigation.d.ts +10 -0
- package/dist/lib/Component/Menu/Navigation/Navigation.js +96 -0
- package/dist/lib/Component/Menu/User/User.d.ts +7 -0
- package/dist/lib/Component/Menu/User/User.js +91 -0
- package/dist/lib/Component/Metrics/JdbcConnectionsActive/JdbcConnectionsActive.d.ts +6 -0
- package/dist/lib/Component/Metrics/JdbcConnectionsActive/JdbcConnectionsActive.js +7 -0
- package/dist/lib/Component/Metrics/JvmMemoryUsed/JvmMemoryUsed.d.ts +6 -0
- package/dist/lib/Component/Metrics/JvmMemoryUsed/JvmMemoryUsed.js +13 -0
- package/dist/lib/Component/Metrics/JvmThreadsLive/JvmThreadsLive.d.ts +6 -0
- package/dist/lib/Component/Metrics/JvmThreadsLive/JvmThreadsLive.js +7 -0
- package/dist/lib/Component/Metrics/MetricEntry/MetricEntry.d.ts +13 -0
- package/dist/lib/Component/Metrics/MetricEntry/MetricEntry.js +54 -0
- package/dist/lib/Component/Metrics/MetricsRoot/MetricsRoot.d.ts +12 -0
- package/dist/lib/Component/Metrics/MetricsRoot/MetricsRoot.js +28 -0
- package/dist/lib/Component/Metrics/ProcessCpuUsage/ProcessCpuUsage.d.ts +6 -0
- package/dist/lib/Component/Metrics/ProcessCpuUsage/ProcessCpuUsage.js +7 -0
- package/dist/lib/Component/Metrics/ProcessStartTime/ProcessStartTime.d.ts +6 -0
- package/dist/lib/Component/Metrics/ProcessStartTime/ProcessStartTime.js +12 -0
- package/dist/lib/Component/Metrics/ProcessUptime/ProcessUptime.d.ts +6 -0
- package/dist/lib/Component/Metrics/ProcessUptime/ProcessUptime.js +15 -0
- package/dist/lib/Component/Metrics/SystemCpuCount/SystemCpuCount.d.ts +6 -0
- package/dist/lib/Component/Metrics/SystemCpuCount/SystemCpuCount.js +7 -0
- package/dist/lib/Component/Metrics/SystemCpuUsage/SystemCpuUsage.d.ts +6 -0
- package/dist/lib/Component/Metrics/SystemCpuUsage/SystemCpuUsage.js +7 -0
- package/dist/lib/Component/Metrics/SystemLoadAverage/SystemLoadAverage.d.ts +6 -0
- package/dist/lib/Component/Metrics/SystemLoadAverage/SystemLoadAverage.js +7 -0
- package/dist/lib/Component/Modal/ApplicationInfo/ApplicationInfo.d.ts +7 -0
- package/dist/lib/Component/Modal/ApplicationInfo/ApplicationInfo.js +18 -0
- package/dist/lib/Component/ShogunSpinner/ShogunSpinner.d.ts +5 -0
- package/dist/lib/Component/ShogunSpinner/ShogunSpinner.js +7 -0
- package/dist/lib/Component/UserAvatar/UserAvatar.d.ts +9 -0
- package/dist/lib/Component/UserAvatar/UserAvatar.js +13 -0
- package/dist/lib/Component/WelcomeDashboard/WelcomeDashboard.d.ts +5 -0
- package/dist/lib/Component/WelcomeDashboard/WelcomeDashboard.js +35 -0
- package/dist/lib/Context/PluginContext.d.ts +9 -0
- package/dist/lib/Context/PluginContext.js +7 -0
- package/dist/lib/Context/SHOGunAPIClientContext.d.ts +9 -0
- package/dist/lib/Context/SHOGunAPIClientContext.js +7 -0
- package/dist/lib/Controller/ControllerUtil.d.ts +27 -0
- package/dist/lib/Controller/ControllerUtil.js +60 -0
- package/dist/lib/Controller/GenericEntityController.d.ts +169 -0
- package/dist/lib/Controller/GenericEntityController.js +368 -0
- package/dist/lib/Hooks/useClientVersion.d.ts +1 -0
- package/dist/lib/Hooks/useClientVersion.js +3 -0
- package/dist/lib/Hooks/usePlugins.d.ts +3 -0
- package/dist/lib/Hooks/usePlugins.js +6 -0
- package/dist/lib/Hooks/useSHOGunAPIClient.d.ts +3 -0
- package/dist/lib/Hooks/useSHOGunAPIClient.js +6 -0
- package/dist/lib/Logger.d.ts +2 -0
- package/dist/lib/Logger.js +23 -0
- package/dist/lib/Page/Portal/Portal.d.ts +7 -0
- package/dist/lib/Page/Portal/Portal.js +74 -0
- package/dist/lib/Service/GenericServiceImpl/GenericServiceImpl.d.ts +5 -0
- package/dist/lib/Service/GenericServiceImpl/GenericServiceImpl.js +7 -0
- package/dist/lib/Service/LogService/LogService.d.ts +18 -0
- package/dist/lib/Service/LogService/LogService.js +79 -0
- package/dist/lib/Service/MetricService/MetricService.d.ts +26 -0
- package/dist/lib/Service/MetricService/MetricService.js +25 -0
- package/dist/lib/State/atoms.d.ts +7 -0
- package/dist/lib/State/atoms.js +25 -0
- package/dist/lib/State/static.d.ts +3 -0
- package/dist/lib/State/static.js +10 -0
- package/dist/lib/Util/FileUtil.d.ts +3 -0
- package/dist/lib/Util/FileUtil.js +10 -0
- package/dist/lib/Util/JsonUtil.d.ts +11 -0
- package/dist/lib/Util/JsonUtil.js +22 -0
- package/dist/lib/Util/OpenAPIUtil.d.ts +25 -0
- package/dist/lib/Util/OpenAPIUtil.js +230 -0
- package/dist/lib/Util/TableUtil.d.ts +14 -0
- package/dist/lib/Util/TableUtil.js +71 -0
- package/dist/lib/Util/TranslationUtil.d.ts +3 -0
- package/dist/lib/Util/TranslationUtil.js +23 -0
- package/dist/lib/Util/UserUtil.d.ts +22 -0
- package/dist/lib/Util/UserUtil.js +32 -0
- package/dist/lib/i18n/index.d.ts +2 -0
- package/dist/lib/i18n/index.js +17 -0
- package/dist/lib/i18n/translations.d.ts +508 -0
- package/dist/lib/i18n/translations.js +512 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +172 -0
- package/dist/lib/plugin/index.d.ts +58 -0
- package/dist/lib/plugin/index.js +3 -0
- package/dist/lib/test-util.d.ts +6 -0
- package/dist/lib/test-util.js +16 -0
- package/package.json +137 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './Dashboard.less';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
interface OwnProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
|
+
actions?: ReactNode;
|
|
5
|
+
icon?: string;
|
|
6
|
+
columns?: number;
|
|
7
|
+
rows?: number;
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
type DashoardProps = OwnProps;
|
|
11
|
+
export declare const Dashboard: React.FC<DashoardProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './Dashboard.less';
|
|
3
|
+
export const Dashboard = (props) => {
|
|
4
|
+
const { actions, icon, className, children, columns = 2, rows, title, ...passThroughProps } = props;
|
|
5
|
+
const gridTemplateColumns = `repeat(${columns}, 1fr)`;
|
|
6
|
+
return (_jsxs("div", { className: `dashboard ${className ? className : ''}`, ...passThroughProps, children: [_jsxs("div", { className: "header", children: [icon &&
|
|
7
|
+
_jsx("img", { className: "icon", src: icon, alt: `${title} icon` }), _jsx("div", { className: "title", children: title }), _jsx("div", { className: "actions", children: actions })] }), _jsx("div", { className: "grid", style: {
|
|
8
|
+
gridTemplateColumns
|
|
9
|
+
}, children: children })] }));
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './DashboardCard.less';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import { CardProps } from 'antd/lib/card';
|
|
4
|
+
interface OwnProps extends CardProps {
|
|
5
|
+
actions?: ReactNode[];
|
|
6
|
+
avatar?: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
hoverable?: boolean;
|
|
10
|
+
}
|
|
11
|
+
type DashboardCardProps = OwnProps;
|
|
12
|
+
export declare const DashboardCard: React.FC<DashboardCardProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './DashboardCard.less';
|
|
3
|
+
import { Card } from 'antd';
|
|
4
|
+
export const DashboardCard = (props) => {
|
|
5
|
+
const { className, actions, avatar, children, description, hoverable = false, title, ...passThroughProps } = props;
|
|
6
|
+
return (_jsxs(Card, { ...passThroughProps, className: `dashboard-card ${hoverable ? 'hoverable' : ''} ${className ? className : ''}`, actions: actions, children: [_jsx(Card.Meta, { avatar: avatar, title: title, description: description }), _jsx("div", { className: "dashboard-card-body", children: children })] }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './DashboardStatistics.less';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Application from '@terrestris/shogun-util/dist/model/Application';
|
|
4
|
+
import Layer from '@terrestris/shogun-util/dist/model/Layer';
|
|
5
|
+
import User from '@terrestris/shogun-util/dist/model/User';
|
|
6
|
+
import GenericEntityService from '@terrestris/shogun-util/dist/service/GenericEntityService';
|
|
7
|
+
type DashboardStatisticsProps = {
|
|
8
|
+
service: GenericEntityService<Application | User | Layer>;
|
|
9
|
+
name: {
|
|
10
|
+
singular: string;
|
|
11
|
+
plural: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const DashboardStatistics: React.FC<DashboardStatisticsProps>;
|
|
15
|
+
export default DashboardStatistics;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './DashboardStatistics.less';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Statistic } from 'antd';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
export const DashboardStatistics = ({ service, name }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const [entitiesCount, setEntitiesCount] = useState(-1);
|
|
9
|
+
const [loadingState, setLoadingState] = useState();
|
|
10
|
+
const fetchEntities = async () => {
|
|
11
|
+
setLoadingState('loading');
|
|
12
|
+
try {
|
|
13
|
+
const fetchedEntities = await service?.findAll({
|
|
14
|
+
page: 0,
|
|
15
|
+
size: 1
|
|
16
|
+
});
|
|
17
|
+
const count = fetchedEntities.totalElements;
|
|
18
|
+
setEntitiesCount(count);
|
|
19
|
+
setLoadingState('done');
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
setLoadingState('failed');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (!loadingState && entitiesCount < 0) {
|
|
26
|
+
fetchEntities();
|
|
27
|
+
}
|
|
28
|
+
return (_jsx("div", { className: "statistics-card", children: _jsx(Statistic, { title: t('DashboardStatistics.statisticsTitle'), value: `${entitiesCount} ${entitiesCount > 0 ? name.plural : name.singular}` }) }));
|
|
29
|
+
};
|
|
30
|
+
export default DashboardStatistics;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ClearOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Button, message } from 'antd';
|
|
5
|
+
import _isNil from 'lodash/isNil';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import useSHOGunAPIClient from '../../Hooks/useSHOGunAPIClient';
|
|
8
|
+
export const EvictCache = ({ ...passThroughProps }) => {
|
|
9
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
10
|
+
const client = useSHOGunAPIClient();
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
const onClearCacheClick = async () => {
|
|
13
|
+
setIsLoading(true);
|
|
14
|
+
try {
|
|
15
|
+
await client?.cache().evictCache();
|
|
16
|
+
message.success('Successfully cleared the cache');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
message.error('Could not clear the cache');
|
|
20
|
+
}
|
|
21
|
+
setIsLoading(false);
|
|
22
|
+
};
|
|
23
|
+
if (_isNil(client)) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return (_jsx(Button, { onClick: onClearCacheClick, loading: isLoading, icon: _jsx(ClearOutlined, {}), ...passThroughProps, children: t('EvictCache.clear') }));
|
|
27
|
+
};
|
|
28
|
+
export default EvictCache;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DisplayFieldProps = {
|
|
3
|
+
dateFormat?: string;
|
|
4
|
+
format?: 'date' | 'text' | 'json';
|
|
5
|
+
formatFunction?: (val?: any) => string;
|
|
6
|
+
numberOfDigits?: number;
|
|
7
|
+
suffix?: string;
|
|
8
|
+
translationPrefix?: string;
|
|
9
|
+
value?: any;
|
|
10
|
+
valueKey?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const DisplayField: React.FC<DisplayFieldProps>;
|
|
13
|
+
export default DisplayField;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from 'antd';
|
|
3
|
+
import _get from 'lodash/get';
|
|
4
|
+
import _isEmpty from 'lodash/isEmpty';
|
|
5
|
+
import _isFinite from 'lodash/isFinite';
|
|
6
|
+
import _isFunction from 'lodash/isFunction';
|
|
7
|
+
import _isNil from 'lodash/isNil';
|
|
8
|
+
import moment from 'moment';
|
|
9
|
+
const DisplayField = ({ dateFormat = 'DD.MM.YYYY', format = 'text', formatFunction, numberOfDigits = 2, suffix, translationPrefix, value, valueKey, ...passThroughProps }) => {
|
|
10
|
+
if (_isFunction(formatFunction)) {
|
|
11
|
+
return _jsx(Typography.Text, { className: "displayfield", ...passThroughProps, children: formatFunction(value) });
|
|
12
|
+
}
|
|
13
|
+
if (valueKey !== undefined) {
|
|
14
|
+
value = _get(value, valueKey);
|
|
15
|
+
}
|
|
16
|
+
let displayText = value;
|
|
17
|
+
if (format === 'date' && value) {
|
|
18
|
+
displayText = moment(value).format(dateFormat);
|
|
19
|
+
}
|
|
20
|
+
if (format === 'json' && !_isEmpty(value)) {
|
|
21
|
+
displayText = JSON.stringify(value);
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(displayText)) {
|
|
24
|
+
displayText = displayText.join(', ');
|
|
25
|
+
}
|
|
26
|
+
const suffixText = !_isNil(displayText) && suffix ? ` ${suffix}` : '';
|
|
27
|
+
if (_isFinite(value)) {
|
|
28
|
+
return (_jsx(Typography.Text, { className: "displayfield", ...passThroughProps, children: `${new Intl.NumberFormat('de-DE').format(Number(value.toFixed(numberOfDigits)))}${suffixText}` }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsxs(Typography.Text, { className: "displayfield", ...passThroughProps, children: [displayText, suffixText] }));
|
|
31
|
+
};
|
|
32
|
+
export default DisplayField;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './JSONEditor.less';
|
|
2
|
+
import './UserWorker';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { EditorProps } from '@monaco-editor/react';
|
|
5
|
+
export type JSONEditorProps = {
|
|
6
|
+
value?: string;
|
|
7
|
+
onChange?: (value?: string) => void;
|
|
8
|
+
editorProps?: EditorProps;
|
|
9
|
+
entityType: string;
|
|
10
|
+
dataField: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const JSONEditor: React.FC<JSONEditorProps>;
|
|
13
|
+
export default JSONEditor;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './JSONEditor.less';
|
|
3
|
+
import './UserWorker';
|
|
4
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import Editor, { useMonaco } from '@monaco-editor/react';
|
|
6
|
+
import Logger from 'js-logger';
|
|
7
|
+
import { uniqueId } from 'lodash';
|
|
8
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
9
|
+
import _isNil from 'lodash/isNil';
|
|
10
|
+
import { swaggerDocs } from '../../../State/static';
|
|
11
|
+
import OpenAPIUtil from '../../../Util/OpenAPIUtil';
|
|
12
|
+
import FullscreenWrapper from '../../FullscreenWrapper/FullscreenWrapper';
|
|
13
|
+
export const JSONEditor = ({ value, onChange = () => undefined, editorProps, entityType, dataField }) => {
|
|
14
|
+
const [currentValue, setCurrentValue] = useState();
|
|
15
|
+
const monaco = useMonaco();
|
|
16
|
+
const openApiUtil = useMemo(() => new OpenAPIUtil({
|
|
17
|
+
document: swaggerDocs
|
|
18
|
+
}), []);
|
|
19
|
+
const registerSchemaValidation = useCallback(() => {
|
|
20
|
+
if (!monaco) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const propertyRefName = openApiUtil.getPropertyRefName(entityType, dataField);
|
|
24
|
+
if (_isNil(propertyRefName)) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const schema = openApiUtil.getJSONSchemaFromDocument(propertyRefName, entityType, dataField);
|
|
28
|
+
if (_isNil(monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const schemas = [
|
|
32
|
+
...cloneDeep(monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas),
|
|
33
|
+
{
|
|
34
|
+
uri: schema.$id ?? uniqueId('json-schema-id'),
|
|
35
|
+
fileMatch: [`${propertyRefName}.json`],
|
|
36
|
+
schema: schema
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
40
|
+
enableSchemaRequest: true,
|
|
41
|
+
validate: true,
|
|
42
|
+
trailingCommas: 'error',
|
|
43
|
+
schemaValidation: 'error',
|
|
44
|
+
comments: 'error',
|
|
45
|
+
schemas: schemas
|
|
46
|
+
});
|
|
47
|
+
}, [monaco, dataField, entityType, openApiUtil]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
registerSchemaValidation();
|
|
50
|
+
}, [registerSchemaValidation]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!value) {
|
|
53
|
+
setCurrentValue(undefined);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
try {
|
|
57
|
+
const jsonString = JSON.stringify(value, null, 2);
|
|
58
|
+
if (jsonString) {
|
|
59
|
+
setCurrentValue(jsonString);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
Logger.trace('JSON-Editor:', error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, [value]);
|
|
67
|
+
const changeHandler = (val) => {
|
|
68
|
+
if (_isNil(val)) {
|
|
69
|
+
onChange();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const jsonObject = JSON.parse(val);
|
|
74
|
+
onChange(jsonObject);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (val.length === 0) {
|
|
78
|
+
onChange();
|
|
79
|
+
}
|
|
80
|
+
Logger.trace('JSON-Editor:', error);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return (_jsx(FullscreenWrapper, { children: _jsx("div", { className: 'json-editor', children: _jsx(Editor, { value: currentValue, onChange: changeHandler, path: openApiUtil.getPropertyRefName(entityType, dataField) ?
|
|
84
|
+
`${openApiUtil.getPropertyRefName(entityType, dataField)}.json` :
|
|
85
|
+
undefined, language: "json", options: {
|
|
86
|
+
lineHeight: 20,
|
|
87
|
+
scrollBeyondLastLine: false
|
|
88
|
+
}, ...editorProps }) }) }));
|
|
89
|
+
};
|
|
90
|
+
export default JSONEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loader } from '@monaco-editor/react';
|
|
2
|
+
import * as monaco from 'monaco-editor';
|
|
3
|
+
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
4
|
+
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker';
|
|
5
|
+
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
|
|
6
|
+
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
|
7
|
+
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
8
|
+
self.MonacoEnvironment = {
|
|
9
|
+
getWorker(_, label) {
|
|
10
|
+
if (label === 'json') {
|
|
11
|
+
return new jsonWorker();
|
|
12
|
+
}
|
|
13
|
+
if (label === 'css' || label === 'scss' || label === 'less') {
|
|
14
|
+
return new cssWorker();
|
|
15
|
+
}
|
|
16
|
+
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
|
17
|
+
return new htmlWorker();
|
|
18
|
+
}
|
|
19
|
+
if (label === 'typescript' || label === 'javascript') {
|
|
20
|
+
return new tsWorker();
|
|
21
|
+
}
|
|
22
|
+
return new editorWorker();
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
loader.config({ monaco });
|
|
26
|
+
loader.init();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './LinkField.less';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TooltipProps } from 'antd';
|
|
4
|
+
export type LinkFieldProps = {
|
|
5
|
+
title?: string;
|
|
6
|
+
i18n?: FormTranslations;
|
|
7
|
+
value: string;
|
|
8
|
+
template?: string;
|
|
9
|
+
} & Partial<TooltipProps>;
|
|
10
|
+
export declare const LinkField: React.FC<LinkFieldProps>;
|
|
11
|
+
export default LinkField;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './LinkField.less';
|
|
3
|
+
import { LinkOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Tooltip } from 'antd';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import TranslationUtil from '../../../Util/TranslationUtil';
|
|
7
|
+
export const LinkField = ({ i18n, value, template = '{}', title = '', ...passThroughProps }) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const onClick = () => {
|
|
10
|
+
const link = template.replace(/{}/g, value);
|
|
11
|
+
window.open(link, '_blank');
|
|
12
|
+
};
|
|
13
|
+
return (_jsx(Tooltip, { title: title ? TranslationUtil.getTranslationFromConfig(title, i18n) : t('LinkField.title'), ...passThroughProps, children: _jsx("div", { className: "link-wrapper", children: _jsx(LinkOutlined, { onClick: onClick }) }) }));
|
|
14
|
+
};
|
|
15
|
+
export default LinkField;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './MarkdownEditor.less';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ICommand } from '@uiw/react-md-editor';
|
|
4
|
+
export type MarkdownEditorProps = {
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange?: (value?: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const commandsFilter: (command: ICommand) => false | ICommand;
|
|
9
|
+
export declare const MarkdownEditor: React.FC<MarkdownEditorProps>;
|
|
10
|
+
export default MarkdownEditor;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import './MarkdownEditor.less';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import MDEditor from '@uiw/react-md-editor';
|
|
5
|
+
import FullscreenWrapper from '../../FullscreenWrapper/FullscreenWrapper';
|
|
6
|
+
export const commandsFilter = (command) => {
|
|
7
|
+
if (command?.name === 'fullscreen') {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return command;
|
|
11
|
+
};
|
|
12
|
+
export const MarkdownEditor = ({ value, onChange = () => undefined }) => {
|
|
13
|
+
const [markdown, setMarkdown] = React.useState();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setMarkdown(value);
|
|
16
|
+
}, [value]);
|
|
17
|
+
const onMarkdownChange = (val) => {
|
|
18
|
+
setMarkdown(val);
|
|
19
|
+
onChange(val);
|
|
20
|
+
};
|
|
21
|
+
return (_jsx(FullscreenWrapper, { children: _jsx(MDEditor, { value: markdown, commandsFilter: commandsFilter, onChange: onMarkdownChange, highlightEnable: false }) }));
|
|
22
|
+
};
|
|
23
|
+
export default MarkdownEditor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import GroupInstancePermission from '@terrestris/shogun-util/dist/model/security/GroupInstancePermission';
|
|
3
|
+
import { InstancePermissionGridProps } from '../InstancePermissionGrid/InstancePermissionGrid';
|
|
4
|
+
export interface GroupPermissionGridProps extends Omit<InstancePermissionGridProps<GroupInstancePermission>, 'getInstancePermissions' | 'setInstancePermission' | 'deleteInstancePermission' | 'toDataType' | 'nameColumnDefinition' | 'getReferences' | 'toTag' | 'modalProps'> {
|
|
5
|
+
}
|
|
6
|
+
declare const GroupPermissionGrid: React.FC<GroupPermissionGridProps>;
|
|
7
|
+
export default GroupPermissionGrid;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import useSHOGunAPIClient from '../../../../Hooks/useSHOGunAPIClient';
|
|
5
|
+
import InstancePermissionGrid from '../InstancePermissionGrid/InstancePermissionGrid';
|
|
6
|
+
;
|
|
7
|
+
const GroupPermissionGrid = ({ entityType, ...passThroughProps }) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const client = useSHOGunAPIClient();
|
|
10
|
+
const service = useCallback(() => {
|
|
11
|
+
return (client?.[entityType])();
|
|
12
|
+
}, [client, entityType]);
|
|
13
|
+
const getGroupInstancePermissions = async (id) => {
|
|
14
|
+
return await service()?.getGroupInstancePermissions(id);
|
|
15
|
+
};
|
|
16
|
+
const setGroupInstancePermission = async (id, referenceId, permission) => {
|
|
17
|
+
await service()?.setGroupInstancePermission(id, referenceId, permission);
|
|
18
|
+
};
|
|
19
|
+
const deleteGroupInstancePermission = async (id, referenceId) => {
|
|
20
|
+
await service()?.deleteGroupInstancePermission(id, referenceId);
|
|
21
|
+
};
|
|
22
|
+
const getGroups = async (pageOpts) => {
|
|
23
|
+
return await client?.group().findAll(pageOpts);
|
|
24
|
+
};
|
|
25
|
+
const toGroupDataType = (permission) => {
|
|
26
|
+
return {
|
|
27
|
+
key: permission.group?.id,
|
|
28
|
+
reference: permission.group,
|
|
29
|
+
name: permission.group?.providerDetails?.name,
|
|
30
|
+
permission: permission.permission?.name
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const toTag = (group) => {
|
|
34
|
+
return {
|
|
35
|
+
value: group.id,
|
|
36
|
+
filterValues: [
|
|
37
|
+
group.id,
|
|
38
|
+
group.authProviderId,
|
|
39
|
+
group.providerDetails?.name
|
|
40
|
+
],
|
|
41
|
+
label: (_jsx("span", { children: group.providerDetails?.name }))
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const colDefinition = () => {
|
|
45
|
+
return {
|
|
46
|
+
sorter: (a, b) => {
|
|
47
|
+
const aName = a.reference?.providerDetails?.name;
|
|
48
|
+
const bName = b.reference?.providerDetails?.name;
|
|
49
|
+
if (!aName || !bName) {
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
return bName.localeCompare(aName);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
return (_jsx(InstancePermissionGrid, { entityType: entityType, getInstancePermissions: getGroupInstancePermissions, setInstancePermission: setGroupInstancePermission, deleteInstancePermission: deleteGroupInstancePermission, toDataType: toGroupDataType, nameColumnDefinition: colDefinition(), modalProps: {
|
|
57
|
+
toTag: toTag,
|
|
58
|
+
getReferences: getGroups,
|
|
59
|
+
setInstancePermission: setGroupInstancePermission,
|
|
60
|
+
descriptionText: t('GroupPermissionGrid.modal.description'),
|
|
61
|
+
referenceLabelText: t('GroupPermissionGrid.modal.referenceSelectLabel'),
|
|
62
|
+
referenceExtraText: t('GroupPermissionGrid.modal.referenceSelectExtra'),
|
|
63
|
+
referenceSelectPlaceholderText: t('GroupPermissionGrid.modal.referenceSelectPlaceholder'),
|
|
64
|
+
permissionSelectLabel: t('GroupPermissionGrid.modal.permissionSelectLabel'),
|
|
65
|
+
permissionSelectExtra: t('GroupPermissionGrid.modal.permissionSelectExtra'),
|
|
66
|
+
saveErrorMsg: (placeholder) => {
|
|
67
|
+
return t('GroupPermissionGrid.modal.saveErrorMsg', {
|
|
68
|
+
referenceIds: placeholder
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, ...passThroughProps }));
|
|
72
|
+
};
|
|
73
|
+
export default GroupPermissionGrid;
|
package/dist/lib/Component/FormField/Permission/InstancePermissionGrid/InstancePermissionGrid.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ColumnType, TableProps } from 'antd/es/table';
|
|
3
|
+
import PermissionCollectionType from '@terrestris/shogun-util/dist/model/enum/PermissionCollectionType';
|
|
4
|
+
import Group from '@terrestris/shogun-util/dist/model/Group';
|
|
5
|
+
import Role from '@terrestris/shogun-util/dist/model/Role';
|
|
6
|
+
import InstancePermission from '@terrestris/shogun-util/dist/model/security/InstancePermission';
|
|
7
|
+
import User from '@terrestris/shogun-util/dist/model/User';
|
|
8
|
+
import SHOGunAPIClient from '@terrestris/shogun-util/dist/service/SHOGunAPIClient';
|
|
9
|
+
import { PermissionModalProps } from '../PermissionModal/PermissionModal';
|
|
10
|
+
import './InstancePermissionGrid.less';
|
|
11
|
+
type NonBaseEntityCLientKeys = 'cache' | 'info' | 'auth' | 'graphql' | 'openapi' | 'getBasePath' | 'setBasePath' | 'getKeycloak' | 'setKeycloak';
|
|
12
|
+
export type EntityType = Exclude<keyof SHOGunAPIClient, NonBaseEntityCLientKeys>;
|
|
13
|
+
export interface DataType<T = Role | User | Group> {
|
|
14
|
+
key?: number;
|
|
15
|
+
reference: T;
|
|
16
|
+
name?: string;
|
|
17
|
+
permission: PermissionCollectionType;
|
|
18
|
+
}
|
|
19
|
+
export interface InstancePermissionGridProps<E extends InstancePermission> extends TableProps<DataType> {
|
|
20
|
+
entityId: number;
|
|
21
|
+
entityType: EntityType;
|
|
22
|
+
getInstancePermissions: (entityId: number) => Promise<E[] | undefined>;
|
|
23
|
+
setInstancePermission: (entityId: number, referenceId: number, permission: PermissionCollectionType) => Promise<void>;
|
|
24
|
+
deleteInstancePermission: (entityId: number, referenceId: number) => Promise<void>;
|
|
25
|
+
toDataType: (permission: E) => DataType;
|
|
26
|
+
nameColumnDefinition: ColumnType<DataType>;
|
|
27
|
+
modalProps: Omit<PermissionModalProps, 'entityId' | 'entityType'>;
|
|
28
|
+
}
|
|
29
|
+
export declare const InstancePermissionGrid: <T, E extends InstancePermission>({ entityId, getInstancePermissions, setInstancePermission, deleteInstancePermission, toDataType, modalProps, nameColumnDefinition, ...passThroughProps }: InstancePermissionGridProps<E>) => React.ReactElement | null;
|
|
30
|
+
export default InstancePermissionGrid;
|
package/dist/lib/Component/FormField/Permission/InstancePermissionGrid/InstancePermissionGrid.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef, useCallback } from 'react';
|
|
3
|
+
import { DeleteOutlined, SearchOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Button, Input, message, Space, Table, Tooltip } from 'antd';
|
|
5
|
+
import Logger from 'js-logger';
|
|
6
|
+
import _cloneDeep from 'lodash/cloneDeep';
|
|
7
|
+
import _get from 'lodash/get';
|
|
8
|
+
import _isFunction from 'lodash/isFunction';
|
|
9
|
+
import _isNil from 'lodash/isNil';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import useSHOGunAPIClient from '../../../../Hooks/useSHOGunAPIClient';
|
|
12
|
+
import PermissionModal from '../PermissionModal/PermissionModal';
|
|
13
|
+
import PermissionSelect from '../PermissionSelect/PermissionSelect';
|
|
14
|
+
import './InstancePermissionGrid.less';
|
|
15
|
+
;
|
|
16
|
+
export const InstancePermissionGrid = ({ entityId, getInstancePermissions, setInstancePermission, deleteInstancePermission, toDataType, modalProps, nameColumnDefinition, ...passThroughProps }) => {
|
|
17
|
+
const [permissionsLoading, setPermissionsLoading] = useState(false);
|
|
18
|
+
const [permissions, setPermissions] = useState([]);
|
|
19
|
+
const [data, setData] = useState([]);
|
|
20
|
+
const searchInput = useRef(null);
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const client = useSHOGunAPIClient();
|
|
23
|
+
const getPermissions = useCallback(async () => {
|
|
24
|
+
setPermissionsLoading(true);
|
|
25
|
+
if (!Number.isFinite(entityId)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
setPermissions(await getInstancePermissions(entityId));
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
message.error(t('InstancePermissionGrid.loadErrorMsg'));
|
|
33
|
+
Logger.error(error);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
setPermissionsLoading(false);
|
|
37
|
+
}
|
|
38
|
+
}, [entityId, getInstancePermissions, t]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
getPermissions();
|
|
41
|
+
}, [getPermissions]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (client && Array.isArray(permissions)) {
|
|
44
|
+
setData(permissions.map(toDataType));
|
|
45
|
+
}
|
|
46
|
+
}, [client, permissions, toDataType]);
|
|
47
|
+
const getColumnSearchProps = (dataIndex) => ({
|
|
48
|
+
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (_jsxs("div", { className: "column-search", children: [_jsx(Input, { ref: searchInput, placeholder: t('InstancePermissionGrid.filterInputPlaceholder'), value: selectedKeys[0], onChange: e => setSelectedKeys(e.target.value ? [e.target.value] : []), onPressEnter: () => confirm() }), _jsxs(Space, { children: [_jsx(Button, { type: "primary", onClick: () => confirm(), icon: _jsx(SearchOutlined, {}), size: "small", children: t('InstancePermissionGrid.filterSearchButtonText') }), _jsx(Button, { onClick: () => {
|
|
49
|
+
if (_isFunction(clearFilters)) {
|
|
50
|
+
clearFilters();
|
|
51
|
+
}
|
|
52
|
+
confirm();
|
|
53
|
+
}, size: "small", children: t('InstancePermissionGrid.filterResetButtonText') })] })] })),
|
|
54
|
+
filterIcon: (filtered) => (_jsx(SearchOutlined, { style: {
|
|
55
|
+
color: filtered ? '#1890ff' : undefined
|
|
56
|
+
} })),
|
|
57
|
+
onFilter: (value, record) => {
|
|
58
|
+
const val = _get(record, dataIndex);
|
|
59
|
+
if (_isNil(val)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return val
|
|
63
|
+
.toLowerCase()
|
|
64
|
+
.includes(value.toLowerCase());
|
|
65
|
+
},
|
|
66
|
+
onFilterDropdownOpenChange: visible => {
|
|
67
|
+
if (visible) {
|
|
68
|
+
setTimeout(() => searchInput.current?.select(), 100);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const onPermissionSelect = async (permission, record) => {
|
|
73
|
+
setPermissionsLoading(true);
|
|
74
|
+
if (!record.reference?.id) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
setInstancePermission(entityId, record.reference.id, permission);
|
|
79
|
+
let dataClone = _cloneDeep(data);
|
|
80
|
+
let match = dataClone.find(entry => entry.reference?.id === record.reference?.id);
|
|
81
|
+
if (match) {
|
|
82
|
+
match.permission = permission;
|
|
83
|
+
}
|
|
84
|
+
setData(dataClone);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
message.error(t('InstancePermissionGrid.updateErrorMsg'));
|
|
88
|
+
Logger.error(error);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
setPermissionsLoading(false);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const onDeleteClick = async (record) => {
|
|
95
|
+
setPermissionsLoading(true);
|
|
96
|
+
if (!record.reference?.id) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
deleteInstancePermission(entityId, record.reference.id);
|
|
101
|
+
let dataClone = data.filter(entry => entry.reference?.id !== record.reference?.id);
|
|
102
|
+
setData(dataClone);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
message.error(t('InstancePermissionGrid.deleteErrorMsg'));
|
|
106
|
+
Logger.error(error);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
setPermissionsLoading(false);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const getNameColumnDef = () => {
|
|
113
|
+
return {
|
|
114
|
+
...{
|
|
115
|
+
title: t('InstancePermissionGrid.nameColumnTitle'),
|
|
116
|
+
dataIndex: 'name',
|
|
117
|
+
key: 'name',
|
|
118
|
+
defaultSortOrder: 'ascend',
|
|
119
|
+
},
|
|
120
|
+
...getColumnSearchProps('name'),
|
|
121
|
+
...nameColumnDefinition,
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const columns = [getNameColumnDef(), {
|
|
125
|
+
title: t('InstancePermissionGrid.permissionColumnTitle'),
|
|
126
|
+
dataIndex: 'permission',
|
|
127
|
+
key: 'permission',
|
|
128
|
+
sorter: (a, b) => {
|
|
129
|
+
const aName = a.name;
|
|
130
|
+
const bName = b.name;
|
|
131
|
+
if (!aName || !bName) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
return bName?.localeCompare(aName);
|
|
135
|
+
},
|
|
136
|
+
render: (_, record) => (_jsx(PermissionSelect, { value: record.permission, onSelect: (val) => {
|
|
137
|
+
onPermissionSelect(val, record);
|
|
138
|
+
} }))
|
|
139
|
+
}, {
|
|
140
|
+
title: (_jsx(PermissionModal, { entityId: entityId, onSave: getPermissions, ...modalProps })),
|
|
141
|
+
key: 'operation',
|
|
142
|
+
className: 'operation-column',
|
|
143
|
+
width: 100,
|
|
144
|
+
fixed: 'right',
|
|
145
|
+
render: (_, record) => {
|
|
146
|
+
return (_jsx(Tooltip, { title: t('InstancePermissionGrid.deletePermissionButtonTooltip'), children: _jsx(DeleteOutlined, { onClick: () => onDeleteClick(record) }) }));
|
|
147
|
+
},
|
|
148
|
+
}];
|
|
149
|
+
return (_jsx(Table, { className: 'instance-permission-grid', loading: permissionsLoading, columns: columns, dataSource: data, size: 'small', ...passThroughProps }));
|
|
150
|
+
};
|
|
151
|
+
export default InstancePermissionGrid;
|