@terrestris/shogun-admin 16.1.0-next.1 → 17.0.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/package.json +1 -2
- 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,368 +0,0 @@
|
|
|
1
|
-
import _get from 'lodash/get';
|
|
2
|
-
import _intersects from 'lodash/intersection';
|
|
3
|
-
import _isNil from 'lodash/isNil';
|
|
4
|
-
import _isNumber from 'lodash/isNumber';
|
|
5
|
-
import _isString from 'lodash/isString';
|
|
6
|
-
import _omit from 'lodash/omit';
|
|
7
|
-
import _set from 'lodash/set';
|
|
8
|
-
import Logger from '@terrestris/base-util/dist/Logger';
|
|
9
|
-
import Application from '@terrestris/shogun-util/dist/model/Application';
|
|
10
|
-
import BaseEntity from '@terrestris/shogun-util/dist/model/BaseEntity';
|
|
11
|
-
export class GenericEntityController {
|
|
12
|
-
entity;
|
|
13
|
-
initialValues;
|
|
14
|
-
service;
|
|
15
|
-
formConfig;
|
|
16
|
-
formUpdater; // maybe not required
|
|
17
|
-
nextUpdate;
|
|
18
|
-
constructor({ entity, initialValues, service, formConfig, formUpdater }) {
|
|
19
|
-
this.formUpdater = formUpdater;
|
|
20
|
-
this.service = service;
|
|
21
|
-
this.formConfig = formConfig;
|
|
22
|
-
if (!_isNil(entity)) {
|
|
23
|
-
this.entity = entity;
|
|
24
|
-
}
|
|
25
|
-
this.initialValues = initialValues;
|
|
26
|
-
}
|
|
27
|
-
getEntity() {
|
|
28
|
-
return this.entity;
|
|
29
|
-
}
|
|
30
|
-
setFormUpdater(formUpdater) {
|
|
31
|
-
this.formUpdater = formUpdater;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Load entity with given id using configured service and initialize the form values
|
|
35
|
-
* @param id The id of the entitiy
|
|
36
|
-
* @returns The entity
|
|
37
|
-
*/
|
|
38
|
-
async load(id) {
|
|
39
|
-
this.entity = await this.service?.findOne(id);
|
|
40
|
-
if (_isString(this.formConfig?.publicKey)) {
|
|
41
|
-
const isPublic = await this.service.isPublic(this.entity?.id);
|
|
42
|
-
const pubKey = this.formConfig.publicKey;
|
|
43
|
-
this.entity[pubKey] = isPublic;
|
|
44
|
-
}
|
|
45
|
-
// initialize form value
|
|
46
|
-
this.initializeFormValues();
|
|
47
|
-
return this.entity;
|
|
48
|
-
}
|
|
49
|
-
;
|
|
50
|
-
/**
|
|
51
|
-
* Create an empty instance and initialize form values
|
|
52
|
-
* @returns The plain instance
|
|
53
|
-
*/
|
|
54
|
-
createEntity() {
|
|
55
|
-
let entityCreated = this.create(BaseEntity);
|
|
56
|
-
if (this.formConfig?.name === 'application') {
|
|
57
|
-
entityCreated = this.create(Application);
|
|
58
|
-
}
|
|
59
|
-
this.entity = entityCreated;
|
|
60
|
-
this.initializeFormValues();
|
|
61
|
-
return this.entity;
|
|
62
|
-
}
|
|
63
|
-
;
|
|
64
|
-
async delete(entity) {
|
|
65
|
-
if (!_isNil(entity?.id)) {
|
|
66
|
-
await this.service.delete(entity?.id);
|
|
67
|
-
return Promise.resolve();
|
|
68
|
-
}
|
|
69
|
-
return Promise.reject();
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Fetch all entities
|
|
73
|
-
*/
|
|
74
|
-
async findAll(pageOpts) {
|
|
75
|
-
return await this.service?.findAll(pageOpts);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Update the entitiy from the form
|
|
79
|
-
*
|
|
80
|
-
* @param values the form values containing only changed values
|
|
81
|
-
*/
|
|
82
|
-
async updateEntity(values) {
|
|
83
|
-
for (const fieldConfig of this.formConfig.fields) {
|
|
84
|
-
if (values.hasOwnProperty(fieldConfig.dataField)) {
|
|
85
|
-
await this.setEntityValue(fieldConfig, values[fieldConfig.dataField]);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (this.nextUpdate) {
|
|
89
|
-
if (this.formUpdater) {
|
|
90
|
-
this.formUpdater(this.nextUpdate);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
Logger.warn('No formUpdater set for EntityController');
|
|
94
|
-
}
|
|
95
|
-
this.nextUpdate = undefined;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Save / Update (partial) the actual entity omitting read only fields (e.g. id)
|
|
100
|
-
* @returns The updated / saved entitiy
|
|
101
|
-
*/
|
|
102
|
-
async saveOrUpdate() {
|
|
103
|
-
const isUpdate = _isNumber(this.entity?.id);
|
|
104
|
-
const publicKey = this.formConfig?.publicKey;
|
|
105
|
-
const isPublic = publicKey ? this.entity?.[publicKey] : undefined;
|
|
106
|
-
// omit constant fields and read only fields
|
|
107
|
-
let entityUpdateObject = _omit(this.entity, [
|
|
108
|
-
'created',
|
|
109
|
-
'modified',
|
|
110
|
-
...this.formConfig?.fields
|
|
111
|
-
.filter(field => field.dataField === publicKey || field.readOnly)
|
|
112
|
-
.map(field => field.dataField)
|
|
113
|
-
]);
|
|
114
|
-
// re-add id for service methods
|
|
115
|
-
if (isUpdate) {
|
|
116
|
-
entityUpdateObject = {
|
|
117
|
-
...entityUpdateObject,
|
|
118
|
-
id: this.entity?.id
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
this.entity = isUpdate ?
|
|
122
|
-
await this.service.update(entityUpdateObject) :
|
|
123
|
-
await this.service.add(entityUpdateObject);
|
|
124
|
-
if (publicKey) {
|
|
125
|
-
if (isPublic) {
|
|
126
|
-
await this.service.setPublic(this.entity.id);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
await this.service.revokePublic(this.entity.id);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return this.entity;
|
|
133
|
-
}
|
|
134
|
-
getFormConfig() {
|
|
135
|
-
return this.formConfig;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Return the initial form values
|
|
139
|
-
*/
|
|
140
|
-
getInitialFormValues() {
|
|
141
|
-
return this.initialValues;
|
|
142
|
-
}
|
|
143
|
-
isFieldValid(fieldConfig, value) {
|
|
144
|
-
return {
|
|
145
|
-
validateStatus: 'success'
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Update passed entity
|
|
150
|
-
* @param e The entity of type T
|
|
151
|
-
* @returns The updated entity
|
|
152
|
-
*/
|
|
153
|
-
async update(e) {
|
|
154
|
-
return await this.service?.update(e);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Save passed entity
|
|
158
|
-
* @param e The entity of type T
|
|
159
|
-
* @returns The saved entity
|
|
160
|
-
*/
|
|
161
|
-
async add(e) {
|
|
162
|
-
return await this.service?.add(e);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* This function initiates a form change for all field configs that use one of the given dataFields.
|
|
166
|
-
* It only adds the given dataFields to the value change object.
|
|
167
|
-
* @param dataFields
|
|
168
|
-
* @protected
|
|
169
|
-
*/
|
|
170
|
-
updateFormForDataFields(dataFields) {
|
|
171
|
-
for (const fieldConfig of this.formConfig.fields) {
|
|
172
|
-
if (!Array.isArray(fieldConfig.dataField)) {
|
|
173
|
-
if (dataFields.includes(fieldConfig.dataField)) {
|
|
174
|
-
this.addFormChange(fieldConfig.dataField, _get(this.entity, fieldConfig.dataField));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
if (_intersects(fieldConfig.dataField, dataFields)) {
|
|
179
|
-
const values = {};
|
|
180
|
-
for (const dataField of fieldConfig.dataField) {
|
|
181
|
-
if (dataFields.includes(dataField)) {
|
|
182
|
-
_set(values, dataField, _get(this.entity, dataField));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
this.addFormChange(fieldConfig.dataField, values);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
*
|
|
192
|
-
* Currently not needed
|
|
193
|
-
*
|
|
194
|
-
* Update the form only for specific components
|
|
195
|
-
* @param components that are affected by the change
|
|
196
|
-
* @param values that should be given to the form
|
|
197
|
-
* @protected
|
|
198
|
-
*/
|
|
199
|
-
updateFormForComponents(components, values) {
|
|
200
|
-
for (const fieldConfig of this.formConfig.fields) {
|
|
201
|
-
if (!_isNil(fieldConfig.component) && components.includes(fieldConfig.component)) {
|
|
202
|
-
this.addFormChange(fieldConfig.dataField, values);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* this sets the entity values that are specified by the data fields in the field config to the values
|
|
208
|
-
* given by value.
|
|
209
|
-
* @param fieldConfig
|
|
210
|
-
* @param value
|
|
211
|
-
* @protected
|
|
212
|
-
*/
|
|
213
|
-
setEntityValueByFieldConfig(fieldConfig, value) {
|
|
214
|
-
if (_isNil(this.entity)) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (!Array.isArray(fieldConfig.dataField)) {
|
|
218
|
-
_set(this.entity, fieldConfig.dataField, value);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
for (const dataField of fieldConfig.dataField) {
|
|
222
|
-
_set(this.entity, dataField, _get(value, dataField));
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* create the form values object that is defined by the data fields in the field config from the entity.
|
|
228
|
-
* @param fieldConfig
|
|
229
|
-
* @protected
|
|
230
|
-
*/
|
|
231
|
-
getFormValueByFieldConfig(fieldConfig) {
|
|
232
|
-
if (!Array.isArray(fieldConfig.dataField)) {
|
|
233
|
-
return _get(this.entity, fieldConfig.dataField);
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
const result = {};
|
|
237
|
-
for (const dataField of fieldConfig.dataField) {
|
|
238
|
-
_set(result, dataField, _get(this.entity, dataField));
|
|
239
|
-
}
|
|
240
|
-
return result;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* create form values object to initialize the form
|
|
245
|
-
*/
|
|
246
|
-
initializeFormValues() {
|
|
247
|
-
const values = {};
|
|
248
|
-
for (const fieldConfig of this.formConfig.fields) {
|
|
249
|
-
values[fieldConfig.dataField] = this.getFormValue(fieldConfig);
|
|
250
|
-
}
|
|
251
|
-
this.initialValues = values;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* This gets the value of a given datafield if it is in the fieldconfig
|
|
255
|
-
* @param fieldConfig
|
|
256
|
-
* @param value
|
|
257
|
-
* @param dataField
|
|
258
|
-
* @protected
|
|
259
|
-
*/
|
|
260
|
-
getDataFieldValue(fieldConfig, value, dataField) {
|
|
261
|
-
if (Array.isArray(fieldConfig.dataField) && fieldConfig.dataField.includes(dataField)) {
|
|
262
|
-
return value[dataField];
|
|
263
|
-
}
|
|
264
|
-
else if (fieldConfig.dataField === dataField) {
|
|
265
|
-
return value;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* returns true if the current config contains the datafield
|
|
270
|
-
* @param fieldConfig
|
|
271
|
-
* @param dataField
|
|
272
|
-
* @protected
|
|
273
|
-
*/
|
|
274
|
-
hasDataFieldValue(fieldConfig, dataField) {
|
|
275
|
-
return (Array.isArray(fieldConfig.dataField) && fieldConfig.dataField.includes(dataField))
|
|
276
|
-
|| fieldConfig.dataField === dataField;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* This updates the given value and returns the new value. in case value is an object it is changed.
|
|
280
|
-
* @param fieldConfig
|
|
281
|
-
* @param value
|
|
282
|
-
* @param dataField
|
|
283
|
-
* @param newValue
|
|
284
|
-
* @protected
|
|
285
|
-
*/
|
|
286
|
-
updateDataFieldValue(fieldConfig, value, dataField, newValue) {
|
|
287
|
-
if (Array.isArray(fieldConfig.dataField) && fieldConfig.dataField.includes(dataField)) {
|
|
288
|
-
return Object.assign(value, { [dataField]: newValue });
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
return newValue;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* This function initiates a form change for all field configs that use one of the given dataFields.
|
|
296
|
-
* It only adds the given dataFields to the value change object.
|
|
297
|
-
* @param dataFields
|
|
298
|
-
* @protected
|
|
299
|
-
*/
|
|
300
|
-
addFormChangeForDataFields(dataFields) {
|
|
301
|
-
for (const fieldConfig of this.formConfig.fields) {
|
|
302
|
-
if (!Array.isArray(fieldConfig.dataField)) {
|
|
303
|
-
if (dataFields.includes(fieldConfig.dataField)) {
|
|
304
|
-
this.addFormChange(fieldConfig.dataField, _get(this.entity, fieldConfig.dataField));
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
if (_intersects(fieldConfig.dataField, dataFields)) {
|
|
309
|
-
const values = {};
|
|
310
|
-
for (const dataField of fieldConfig.dataField) {
|
|
311
|
-
if (dataFields.includes(dataField)) {
|
|
312
|
-
_set(values, dataField, _get(this.entity, dataField));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
this.addFormChange(fieldConfig.dataField, values);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Adds form change entry for given field name
|
|
322
|
-
* @param fieldName The field name
|
|
323
|
-
* @param value The value
|
|
324
|
-
*/
|
|
325
|
-
addFormChange(fieldName, value) {
|
|
326
|
-
if (!this.nextUpdate) {
|
|
327
|
-
this.nextUpdate = {};
|
|
328
|
-
}
|
|
329
|
-
if (!this.nextUpdate[fieldName]) {
|
|
330
|
-
this.nextUpdate[fieldName] = {};
|
|
331
|
-
}
|
|
332
|
-
if (!this.nextUpdate[fieldName]) {
|
|
333
|
-
this.nextUpdate[fieldName] = value;
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
Object.assign(this.nextUpdate[fieldName], value);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Set fields value of entity object given FieldConfig and FieldValue
|
|
341
|
-
* @param fieldConfig The FieldConfig holding cofiguration
|
|
342
|
-
* @param value The field value to set
|
|
343
|
-
*/
|
|
344
|
-
async setEntityValue(fieldConfig, value) {
|
|
345
|
-
this.setEntityValueByFieldConfig(fieldConfig, value);
|
|
346
|
-
this.addFormChangeForDataFields([fieldConfig.dataField]);
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Return the value of the form field given its field configuration
|
|
350
|
-
* @param fieldConfig The FieldConfig
|
|
351
|
-
* @returns The FieldValue
|
|
352
|
-
*/
|
|
353
|
-
getFormValue(fieldConfig) {
|
|
354
|
-
const value = this.getFormValueByFieldConfig(fieldConfig);
|
|
355
|
-
if (!value) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
return value;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Create new instance of class passed used in generics
|
|
362
|
-
* @param clz The Class
|
|
363
|
-
* @returns A corresponding instance
|
|
364
|
-
*/
|
|
365
|
-
create(clz) {
|
|
366
|
-
return new clz({});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useClientVersion: () => string;
|
package/dist/lib/Logger.d.ts
DELETED
package/dist/lib/Logger.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import jsLogger from 'js-logger';
|
|
2
|
-
let loglevel;
|
|
3
|
-
switch (process.env.NODE_ENV) {
|
|
4
|
-
case 'development':
|
|
5
|
-
loglevel = 'DEBUG';
|
|
6
|
-
break;
|
|
7
|
-
case 'test':
|
|
8
|
-
loglevel = 'DEBUG';
|
|
9
|
-
break;
|
|
10
|
-
case 'production':
|
|
11
|
-
loglevel = 'INFO';
|
|
12
|
-
break;
|
|
13
|
-
case 'CI':
|
|
14
|
-
loglevel = 'INFO';
|
|
15
|
-
break;
|
|
16
|
-
default:
|
|
17
|
-
loglevel = 'INFO';
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
jsLogger.useDefaults({
|
|
21
|
-
defaultLevel: jsLogger.get(loglevel).getLevel()
|
|
22
|
-
});
|
|
23
|
-
export default jsLogger;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import './Portal.less';
|
|
3
|
-
import { useCallback, useState } from 'react';
|
|
4
|
-
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
|
|
5
|
-
import { Button, message } from 'antd';
|
|
6
|
-
import _isEqual from 'lodash/isEqual';
|
|
7
|
-
import { Route, Routes } from 'react-router-dom';
|
|
8
|
-
import { useSetRecoilState } from 'recoil';
|
|
9
|
-
import config from 'shogunApplicationConfig';
|
|
10
|
-
import GeneralEntityRoot from '../../Component/GeneralEntity/GeneralEntityRoot/GeneralEntityRoot';
|
|
11
|
-
import GlobalSettingsRoot from '../../Component/GlobalSettings/GlobalSettingsRoot/GlobalSettingsRoot';
|
|
12
|
-
import ImageFileRoot from '../../Component/ImageFile/ImageFileRoot/ImageFileRoot';
|
|
13
|
-
import Logs from '../../Component/Logs/Logs';
|
|
14
|
-
import LogSettingsRoot from '../../Component/LogSettings/LogSettingsRoot/LogSettingsRoot';
|
|
15
|
-
import Navigation from '../../Component/Menu/Navigation/Navigation';
|
|
16
|
-
import MetricsRoot from '../../Component/Metrics/MetricsRoot/MetricsRoot';
|
|
17
|
-
import ApplicationInfo from '../../Component/Modal/ApplicationInfo/ApplicationInfo';
|
|
18
|
-
import WelcomeDashboard from '../../Component/WelcomeDashboard/WelcomeDashboard';
|
|
19
|
-
import usePlugins from '../../Hooks/usePlugins';
|
|
20
|
-
import { layerSuggestionListAtom } from '../../State/atoms';
|
|
21
|
-
export const Portal = () => {
|
|
22
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
23
|
-
const toggleCollapsed = () => setCollapsed(!collapsed);
|
|
24
|
-
const [entitiesToLoad, setEntitiesToLoad] = useState([]);
|
|
25
|
-
const [configsAreLoading, setConfigsAreLoading] = useState(false);
|
|
26
|
-
const plugins = usePlugins();
|
|
27
|
-
const setLayerSuggestionList = useSetRecoilState(layerSuggestionListAtom);
|
|
28
|
-
const fetchConfigForModel = async (modelName) => {
|
|
29
|
-
const reqOpts = {
|
|
30
|
-
method: 'GET',
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'application/json'
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const modelPath = `${config.path.modelConfigs}/${(modelName.toLowerCase())}.json`;
|
|
36
|
-
const response = await fetch(modelPath, reqOpts);
|
|
37
|
-
if (response.ok) {
|
|
38
|
-
if (response.status === 204) {
|
|
39
|
-
// No Data
|
|
40
|
-
return Promise.reject();
|
|
41
|
-
}
|
|
42
|
-
return await response.json();
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
message.error(`Could not load config for model: ${modelName}`);
|
|
46
|
-
throw new Error(response.statusText);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const fetchConfigsForModels = async () => {
|
|
50
|
-
setConfigsAreLoading(true);
|
|
51
|
-
const formConfigsPromises = config?.models?.map(fetchConfigForModel);
|
|
52
|
-
const formConfigs = await Promise.all(formConfigsPromises);
|
|
53
|
-
if (!_isEqual(formConfigs, entitiesToLoad)) {
|
|
54
|
-
setEntitiesToLoad(formConfigs);
|
|
55
|
-
}
|
|
56
|
-
setConfigsAreLoading(false);
|
|
57
|
-
};
|
|
58
|
-
const onEntitiesLoaded = useCallback((entities, entityType) => {
|
|
59
|
-
if (entityType === 'layer') {
|
|
60
|
-
const layers = entities;
|
|
61
|
-
setLayerSuggestionList(layers);
|
|
62
|
-
}
|
|
63
|
-
}, [setLayerSuggestionList]);
|
|
64
|
-
if (config?.models && config?.models?.length !== entitiesToLoad?.length && !configsAreLoading) {
|
|
65
|
-
fetchConfigsForModels();
|
|
66
|
-
}
|
|
67
|
-
let pluginRoutes = plugins.map(plugin => {
|
|
68
|
-
return (_jsx(Route, { path: plugin.key, element: _jsx(plugin.wrappedComponent, {}) }, plugin.key));
|
|
69
|
-
});
|
|
70
|
-
return (_jsxs("div", { className: "portal", children: [_jsxs("div", { className: "menu", children: [_jsx(Button, { className: "menu-toggle-button", type: "primary", onClick: toggleCollapsed, children: collapsed ? _jsx(MenuUnfoldOutlined, {}) : _jsx(MenuFoldOutlined, {}) }), _jsx(Navigation, { collapsed: collapsed, entityConfigs: entitiesToLoad })] }), _jsx("div", { className: "content", children: _jsxs(Routes, { children: [_jsx(Route, { path: '/', element: _jsx(WelcomeDashboard, {}) }), !configsAreLoading && entitiesToLoad?.map(entityConfig => {
|
|
71
|
-
return (_jsx(Route, { path: `${entityConfig?.entityType}/*`, element: _jsx(GeneralEntityRoot, { ...entityConfig, onEntitiesLoaded: onEntitiesLoaded }, entityConfig.entityType) }, entityConfig.entityType));
|
|
72
|
-
}), _jsx(Route, { path: 'imagefile/*', element: _jsx(ImageFileRoot, {}) }), _jsx(Route, { path: 'status/metrics/*', element: _jsx(MetricsRoot, {}) }), _jsx(Route, { path: 'status/logs/*', element: _jsx(Logs, {}) }), _jsx(Route, { path: 'settings/global/*', element: _jsx(GlobalSettingsRoot, {}) }), _jsx(Route, { path: 'settings/logs/*', element: _jsx(LogSettingsRoot, {}) }), pluginRoutes] }) }), _jsx(_Fragment, { children: _jsx(ApplicationInfo, {}) })] }));
|
|
73
|
-
};
|
|
74
|
-
export default Portal;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import BaseEntity from '@terrestris/shogun-util/dist/model/BaseEntity';
|
|
2
|
-
import GenericEntityService, { GenericEntityServiceOpts } from '@terrestris/shogun-util/dist/service/GenericEntityService';
|
|
3
|
-
export declare class GenericServiceImpl extends GenericEntityService<BaseEntity> {
|
|
4
|
-
constructor(opts: GenericEntityServiceOpts);
|
|
5
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Keycloak from 'keycloak-js';
|
|
2
|
-
export type LogLevel = 'OFF' | 'FATAL' | 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'TRACE';
|
|
3
|
-
export type LogLevels = {
|
|
4
|
-
configuredLevel: LogLevel;
|
|
5
|
-
effectiveLevel: LogLevel;
|
|
6
|
-
};
|
|
7
|
-
export type LogServiceOpts = {
|
|
8
|
-
keycloak?: Keycloak;
|
|
9
|
-
};
|
|
10
|
-
declare class LogService {
|
|
11
|
-
private readonly keycloak?;
|
|
12
|
-
constructor(opts?: LogServiceOpts);
|
|
13
|
-
getLoggers(): Promise<any>;
|
|
14
|
-
getLogger(loggerName: string): Promise<LogLevels>;
|
|
15
|
-
setLogger(loggerName: string, logLevel: LogLevel): Promise<boolean>;
|
|
16
|
-
getLogs(): Promise<string>;
|
|
17
|
-
}
|
|
18
|
-
export default LogService;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import config from 'shogunApplicationConfig';
|
|
2
|
-
import { getBearerTokenHeader } from '@terrestris/shogun-util/dist/security/getBearerTokenHeader';
|
|
3
|
-
import { getCsrfTokenHeader } from '@terrestris/shogun-util/dist/security/getCsrfTokenHeader';
|
|
4
|
-
import Logger from '../../Logger';
|
|
5
|
-
class LogService {
|
|
6
|
-
keycloak;
|
|
7
|
-
constructor(opts) {
|
|
8
|
-
this.keycloak = opts?.keycloak;
|
|
9
|
-
}
|
|
10
|
-
async getLoggers() {
|
|
11
|
-
try {
|
|
12
|
-
const loggerResponse = await fetch(`${config.path.shogunBase}actuator/loggers`, {
|
|
13
|
-
headers: {
|
|
14
|
-
...getBearerTokenHeader(this.keycloak)
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
const loggerJson = await loggerResponse.json();
|
|
18
|
-
return loggerJson.loggers;
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
Logger.error(`Error while reading the loggers: ${error}`);
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async getLogger(loggerName) {
|
|
26
|
-
try {
|
|
27
|
-
const loggerResponse = await fetch(`${config.path.shogunBase}actuator/loggers/${loggerName}`, {
|
|
28
|
-
headers: {
|
|
29
|
-
...getBearerTokenHeader(this.keycloak)
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return await loggerResponse.json();
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
Logger.error(`Error while reading the logger: ${error}`);
|
|
36
|
-
return Promise.reject();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async setLogger(loggerName, logLevel) {
|
|
40
|
-
try {
|
|
41
|
-
const loggerResponse = await fetch(`${config.path.shogunBase}actuator/loggers/${loggerName}`, {
|
|
42
|
-
method: 'POST',
|
|
43
|
-
headers: {
|
|
44
|
-
'Content-Type': 'application/json',
|
|
45
|
-
...getCsrfTokenHeader(),
|
|
46
|
-
...getBearerTokenHeader(this.keycloak)
|
|
47
|
-
},
|
|
48
|
-
body: JSON.stringify({
|
|
49
|
-
'configuredLevel': logLevel
|
|
50
|
-
})
|
|
51
|
-
});
|
|
52
|
-
return loggerResponse.status === 204;
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
Logger.error(`Error while setting the logger: ${error}`);
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
;
|
|
60
|
-
async getLogs() {
|
|
61
|
-
try {
|
|
62
|
-
const logResponse = await fetch(`${config.path.shogunBase}actuator/logfile`, {
|
|
63
|
-
headers: {
|
|
64
|
-
...getBearerTokenHeader(this.keycloak)
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
if (!logResponse.ok) {
|
|
68
|
-
throw new Error('No successful response while getting the logs');
|
|
69
|
-
}
|
|
70
|
-
return await logResponse.text();
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
Logger.error(`Error while reading the logs: ${error}`);
|
|
74
|
-
return Promise.reject();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
;
|
|
78
|
-
}
|
|
79
|
-
export default LogService;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Keycloak from 'keycloak-js';
|
|
2
|
-
export type Statistic = {
|
|
3
|
-
statistic: string;
|
|
4
|
-
value: number | string;
|
|
5
|
-
};
|
|
6
|
-
export type Tag = {
|
|
7
|
-
tag: string;
|
|
8
|
-
values: string[];
|
|
9
|
-
};
|
|
10
|
-
export type BaseUnit = 'seconds' | 'events' | 'threads' | 'bytes';
|
|
11
|
-
export type Metric = {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
baseUnit: BaseUnit;
|
|
15
|
-
measurements: Statistic[];
|
|
16
|
-
availableTags: Tag[];
|
|
17
|
-
};
|
|
18
|
-
export type MetricServiceOpts = {
|
|
19
|
-
keycloak?: Keycloak;
|
|
20
|
-
};
|
|
21
|
-
declare class MetricService {
|
|
22
|
-
private keycloak?;
|
|
23
|
-
constructor(opts?: MetricServiceOpts);
|
|
24
|
-
getMetric(type: string): Promise<Metric>;
|
|
25
|
-
}
|
|
26
|
-
export default MetricService;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import config from 'shogunApplicationConfig';
|
|
2
|
-
import { getBearerTokenHeader } from '@terrestris/shogun-util/dist/security/getBearerTokenHeader';
|
|
3
|
-
import Logger from '../../Logger';
|
|
4
|
-
class MetricService {
|
|
5
|
-
keycloak;
|
|
6
|
-
constructor(opts) {
|
|
7
|
-
this.keycloak = opts?.keycloak;
|
|
8
|
-
}
|
|
9
|
-
async getMetric(type) {
|
|
10
|
-
try {
|
|
11
|
-
const response = await fetch(`${config.path.shogunBase}actuator/metrics/${type}`, {
|
|
12
|
-
headers: {
|
|
13
|
-
...getBearerTokenHeader(this.keycloak)
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return await response.json();
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
Logger.error(`Error while reading the metric: ${error}`);
|
|
20
|
-
return Promise.reject();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
;
|
|
24
|
-
}
|
|
25
|
-
export default MetricService;
|