Merge branch 'MSP-3487_configuration-editor_page_edits' into 'main'
Resolve MSP-3487 "Configuration editor page edits" Closes MSP-3487 See merge request isp/isp-admin-ui!36
This commit is contained in:
commit
af3da2fbd0
5 files changed
+26
-13
No files matched your search
@@ -1,3 +1,7 @@
|
||||
## 0.12.6
|
||||
- Добавлены кропки "удалить/добавть" в JsonView
|
||||
- Добавлен скролл к JsonView
|
||||
- Добавлена обработка ошибок к изменению конфига
|
||||
## 0.12.5
|
||||
- Исправлено неверное поведение показа меню
|
||||
- Добавлена страница NotFoundPage
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"private": true,
|
||||
"version": "0.12.5",
|
||||
"version": "0.12.6",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
||||
@@ -4,26 +4,30 @@ import { ReactJsonView } from 'isp-ui-kit'
|
||||
import {Spin} from 'antd'
|
||||
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
|
||||
|
||||
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading, JsonSchema}) => {
|
||||
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading}) => {
|
||||
if (isCurrentConfigLoading) {
|
||||
return <Spin className="spin" />
|
||||
}
|
||||
|
||||
const handleEdit = (updated_src: any) => {
|
||||
const newData = {
|
||||
...bufConfig,
|
||||
data: { ...updated_src }
|
||||
}
|
||||
setBufConfig(cleanEmptyParamsObject(newData))
|
||||
}
|
||||
|
||||
return (
|
||||
<ReactJsonView
|
||||
onAdd={true}
|
||||
onDelete={({updated_src}: any) => 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<ConfigurationEditorPropsType> = ({ bufConfig =
|
||||
)
|
||||
}
|
||||
|
||||
export default ConfigurationEditorJson
|
||||
export default ConfigurationEditorJson
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 = () => {
|
||||
<RollbackOutlined />
|
||||
Назад
|
||||
</Button>
|
||||
<h1>{bufConfig?.name}</h1>
|
||||
<div className="configuration-editor-page__controll">
|
||||
<Button
|
||||
disabled={!JsonSchema}
|
||||
|
||||
Reference in new issue
Block a user