From 0dbf4b0b077a1fcd354aa8e0531b67536a808be3 Mon Sep 17 00:00:00 2001 From: txix Date: Fri, 28 Jun 2024 14:11:04 +0300 Subject: [PATCH] 2024-06-28 14:11:04: merge [main:af3da2fbd0772f70ccd4b74936856548a018951d]; --- CHANGELOG.md | 4 ++++ package.json | 2 +- .../ConfigurationEditorJson/index.tsx | 24 +++++++++++-------- .../configuration-editor-page.scss | 5 +++- src/pages/ConfigurationEditorPage/index.tsx | 4 +++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c328c9a..402a860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.6 +- Добавлены кропки "удалить/добавть" в JsonView +- Добавлен скролл к JsonView +- Добавлена обработка ошибок к изменению конфига ## 0.12.5 - Исправлено неверное поведение показа меню - Добавлена страница NotFoundPage diff --git a/package.json b/package.json index ea09212..b95e561 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "isp-admin-ui", "private": true, - "version": "0.12.5", + "version": "0.12.6", "type": "module", "scripts": { "start": "vite", diff --git a/src/components/ConfigurationEditorJson/index.tsx b/src/components/ConfigurationEditorJson/index.tsx index 06974a3..4978dca 100644 --- a/src/components/ConfigurationEditorJson/index.tsx +++ b/src/components/ConfigurationEditorJson/index.tsx @@ -4,26 +4,30 @@ import { ReactJsonView } from 'isp-ui-kit' import {Spin} from 'antd' import { cleanEmptyParamsObject } from '@utils/objectUtils.ts' -const ConfigurationEditorJson: FC = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading, JsonSchema}) => { +const ConfigurationEditorJson: FC = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading}) => { if (isCurrentConfigLoading) { return } + const handleEdit = (updated_src: any) => { + const newData = { + ...bufConfig, + data: { ...updated_src } + } + setBufConfig(cleanEmptyParamsObject(newData)) + } + return ( handleEdit(updated_src)} + displayDataTypes={false} displayObjectSize={false} name={null} enableClipboard={true} iconStyle="square" - onEdit={({updated_src}: any) => { - const newData = { - ...bufConfig, - data: { ...updated_src } - } - setBufConfig(cleanEmptyParamsObject(newData)) - } - } + onEdit={({updated_src}: any) => handleEdit(updated_src)} src={bufConfig.data} sortKeys={true} collapsed={1} @@ -31,4 +35,4 @@ const ConfigurationEditorJson: FC = ({ bufConfig = ) } -export default ConfigurationEditorJson \ No newline at end of file +export default ConfigurationEditorJson diff --git a/src/pages/ConfigurationEditorPage/configuration-editor-page.scss b/src/pages/ConfigurationEditorPage/configuration-editor-page.scss index 7a9abec..f7f37ce 100644 --- a/src/pages/ConfigurationEditorPage/configuration-editor-page.scss +++ b/src/pages/ConfigurationEditorPage/configuration-editor-page.scss @@ -4,10 +4,12 @@ display: flex; flex-direction: column; background: white; - height: 100%; -ms-overflow-style: none; /* IE и Edge */ scrollbar-width: none; border-left: 1px solid $border-color; + height: 100vh; + overflow: scroll; + padding-bottom: 80px; &::-webkit-scrollbar { display: none; } @@ -17,6 +19,7 @@ &__header { display: flex; justify-content: space-between; + align-items: center; padding: $basic-padding *2 $basic-padding; border-bottom: 1px solid $border-color; } diff --git a/src/pages/ConfigurationEditorPage/index.tsx b/src/pages/ConfigurationEditorPage/index.tsx index ee48a6e..919db11 100644 --- a/src/pages/ConfigurationEditorPage/index.tsx +++ b/src/pages/ConfigurationEditorPage/index.tsx @@ -92,8 +92,8 @@ const ConfigurationEditorPage: FC = () => { createUpdateConfig(cleanEmptyParamsObject(newData)) .unwrap() .then(({ id }) => { - message.success('Конфигурация успешно сохранена') isNew && navigate(`/${moduleId}/configEditor/${id}`) + message.success('Конфигурация успешно сохранена') }) .catch((e) => { if (e.data.errorCode === 2004) { @@ -105,6 +105,7 @@ const ConfigurationEditorPage: FC = () => { if (e.data.errorCode === 400) { message.error('Невалидный JSON объект') } + message.error('Ошибка обновления элемента') }) } @@ -152,6 +153,7 @@ const ConfigurationEditorPage: FC = () => { Назад +

{bufConfig?.name}