From 12b8a0b386b3097e72cf11503ce0e3e1890ffdfe Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 29 Mar 2024 14:06:27 +0100 Subject: [PATCH] small fixes --- Core/Objects/Router/DocumentRoute.class.php | 2 +- react/admin-panel/src/views/log-view.js | 8 +++-- .../admin-panel/src/views/route/route-edit.js | 8 ++++- .../admin-panel/src/views/route/route-form.js | 33 +++++++++++++++---- react/shared/hooks/pagination.js | 3 +- 5 files changed, 41 insertions(+), 13 deletions(-) diff --git a/Core/Objects/Router/DocumentRoute.class.php b/Core/Objects/Router/DocumentRoute.class.php index b00cdd8..5739a5f 100644 --- a/Core/Objects/Router/DocumentRoute.class.php +++ b/Core/Objects/Router/DocumentRoute.class.php @@ -35,7 +35,7 @@ class DocumentRoute extends Route { public function preInsert(array &$row) { parent::preInsert($row); - $this->extra = json_encode($this->args); + $this->extra = json_encode($this->args, JSON_UNESCAPED_SLASHES); } #[Pure] private function getClassName(): string { diff --git a/react/admin-panel/src/views/log-view.js b/react/admin-panel/src/views/log-view.js index 2b328b5..97dd80d 100644 --- a/react/admin-panel/src/views/log-view.js +++ b/react/admin-panel/src/views/log-view.js @@ -9,6 +9,7 @@ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import {API_DATETIME_FORMAT} from "shared/constants"; import {format, toDate} from "date-fns"; +import {Select} from "@material-ui/core"; export default function LogView(props) { @@ -59,6 +60,7 @@ export default function LogView(props) { const messageColumn = (() => { let column = new DataColumn(L("message"), "message"); + column.sortable = false; column.renderData = (L, entry) => { return
{entry.message}
} @@ -93,11 +95,11 @@ export default function LogView(props) {
- setLogLevel(parseInt(e.target.value))}> {LOG_LEVELS.map((value, index) => ) } - +
@@ -109,7 +111,7 @@ export default function LogView(props) { value={timestamp ? toDate(new Date()) : null} format={L("general.datefns_datetime_format_precise")} onChange={(newValue) => setTimestamp(newValue)} - slotProps={{ textField: { size: 'small' } }} + slotProps={{ textField: { } }} />
diff --git a/react/admin-panel/src/views/route/route-edit.js b/react/admin-panel/src/views/route/route-edit.js index df94b88..01dfdac 100644 --- a/react/admin-panel/src/views/route/route-edit.js +++ b/react/admin-panel/src/views/route/route-edit.js @@ -17,6 +17,12 @@ const ButtonBar = styled(Box)((props) => ({ } })); +const MonoSpaceTextField = styled(TextField)((props) => ({ + "& input": { + fontFamily: "monospace" + } +})); + export default function RouteEditView(props) { const {api, showDialog} = props; @@ -142,7 +148,7 @@ export default function RouteEditView(props) {
{L("Validate Route")}
- setRouteTest(e.target.value)} + setRouteTest(e.target.value)} variant={"outlined"} size={"small"} fullWidth={true} placeholder={L("Enter a path to test the route…")} />
diff --git a/react/admin-panel/src/views/route/route-form.js b/react/admin-panel/src/views/route/route-form.js
index 5187f2d..8c328a3 100644
--- a/react/admin-panel/src/views/route/route-form.js
+++ b/react/admin-panel/src/views/route/route-form.js
@@ -1,6 +1,6 @@
 import {Box, Checkbox, FormControl, FormControlLabel, FormGroup, Select, styled, TextField} from "@material-ui/core";
 import * as React from "react";
-import {useCallback, useContext} from "react";
+import {useCallback, useContext, useEffect, useRef} from "react";
 import {LocaleContext} from "shared/locale";
 
 const RouteFormControl = styled(FormControl)((props) => ({
@@ -16,6 +16,7 @@ export default function RouteForm(props) {
 
     const {route, setRoute} = props;
     const {translate: L} = useContext(LocaleContext);
+    const extraRef = useRef();
 
     const onChangeRouteType = useCallback((type) => {
         let newRoute = {...route, type: type };
@@ -28,6 +29,13 @@ export default function RouteForm(props) {
         setRoute(newRoute);
     }, [route]);
 
+    useEffect(() => {
+        if (extraRef.current) {
+            const scrollHeight = extraRef.current.scrollHeight + 5;
+            extraRef.current.style.height = scrollHeight + "px";
+        }
+    }, [extraRef?.current, route.extra]);
+
     const elements = [
         
             
@@ -48,7 +56,7 @@ export default function RouteForm(props) {