Compare commits

..
2 Commits
33 changed files with 115 additions and 73 deletions

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
## 0.13.0
- Добавлена темная тема
## 0.12.6
- Добавлены кропки "удалить/добавть" в JsonView
- Добавлен скролл к JsonView
+2 -1
View File
@@ -6,7 +6,8 @@ RUN npm install
RUN npm run build
FROM nginx:1.25-alpine-slim
EXPOSE 80
EXPOSE 8001
RUN rm -f /etc/nginx/conf.d/default.conf
COPY cfg/80_isp-admin-ui.conf /etc/nginx/conf.d/80_isp-admin-ui.conf
COPY --from=build-deps /usr/src/app/build /opt/msp/isp-admin-ui
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "isp-admin-ui",
"version": "0.12.5",
"version": "0.13.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "isp-admin-ui",
"version": "0.12.5",
"version": "0.13.0",
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.6",
"@codemirror/lang-json": "^6.0.1",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "isp-admin-ui",
"private": true,
"version": "0.12.6",
"version": "0.13.0",
"type": "module",
"scripts": {
"start": "vite",
@@ -10,11 +10,13 @@
&__table {
&__name-field {
input {
color: #606060;
border: none;
background-color: transparent;
width: 100%;
&:focus-visible {
color: var(--ant-color-text);
padding: $basic-padding;
border-radius: 4px;
outline: 1px solid $blue-color;
@@ -34,7 +36,7 @@
.active-config {
tr {
background: $blue-light;
background: var(--ant-color-info-bg);
}
}
+12 -3
View File
@@ -1,8 +1,8 @@
import { ConfigProvider } from 'antd'
import ruRu from 'antd/locale/ru_RU'
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { lightTheme } from '@constants/theme.ts'
import { darkTheme, lightTheme } from '@constants/theme.ts'
import { Context } from '@stores/index.tsx'
@@ -12,10 +12,19 @@ import './app.scss'
const App = () => {
const [themes, setTheme] = useState(lightTheme)
const [changeTheme, setChangeTheme] = useState(
localStorage.getItem('theme')
? JSON.parse(localStorage.getItem('theme') || '')
: true
)
useEffect(() => {
setTheme(() => (changeTheme ? darkTheme : lightTheme))
}, [changeTheme])
return (
<div className="app">
<Context.Provider value={{ setTheme }}>
<Context.Provider value={{ setTheme, setChangeTheme, changeTheme }}>
<ConfigProvider theme={themes} locale={ruRu}>
<Routers />
</ConfigProvider>
@@ -31,11 +31,6 @@
&__row {
cursor: pointer;
&.ant-table-row {
&:hover td {
background-color: white !important;
}
}
}
}
}
+7 -3
View File
@@ -1,7 +1,7 @@
import { EditorState, EditorView } from '@uiw/react-codemirror'
import { Button, Spin, Table } from 'antd'
import { ColumnsType } from 'antd/es/table'
import { FC, memo, useState } from 'react'
import { FC, memo, useContext, useState } from 'react'
import CodeMirrorMerge from 'react-codemirror-merge'
import Modal from '@widgets/Modal'
@@ -20,6 +20,7 @@ import { VersionType } from '@type/version.type'
import './compare-version-modal.scss'
import dayjs from 'dayjs'
import { dateFormats } from '@constants/date.ts'
import { Context } from '@stores/index.tsx'
const Original = CodeMirrorMerge.Original
@@ -37,6 +38,7 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
const { data: allUsers = [], isLoading: isUsersLoading } =
userServiceApi.useGetAllUsersQuery()
const { profile } = useAppSelector((state) => state.profileReducer)
const { changeTheme } = useContext(Context)
const isLoading = isVersionLoading || isUsersLoading
if (isLoading) {
return <Spin />
@@ -79,7 +81,10 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
<span> Версия: {selectedItem.configVersion}</span>
<span>{config?.version ? `Текущая версия : ${config?.version}` : `Версия: ${config?.configVersion}`}</span>
</div>
<CodeMirrorMerge orientation="a-b">
<CodeMirrorMerge
orientation="a-b"
theme={changeTheme ? 'dark' : 'light'}
>
<Original
value={JSON.stringify(sortObject(selectedItem.data), null, 2)}
/>
@@ -95,7 +100,6 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
) : (
<div className="compare-version-modal__content__table">
<Table
rowClassName="compare-version-modal__content__table__row"
size="small"
columns={columns}
pagination={{ pageSize: 30 }}
@@ -1,10 +1,12 @@
import { FC } from 'react'
import { FC, useContext } from 'react'
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage'
import Editor from '@monaco-editor/react'
import { ConfigType } from '@pages/ModulesPage/module.type.ts'
import { message } from 'antd'
import { Context } from '@stores/index.tsx'
const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBtn= () => {}, bufConfig, setBufConfig }) => {
const { changeTheme } = useContext(Context)
const debounce = (func: (...args: any[]) => void, wait: number) => {
let timeout: NodeJS.Timeout
return (...args: []) => {
@@ -44,7 +46,7 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({setDisableBt
width="auto"
height="100vh"
language="json"
theme="vs-white"
theme={changeTheme ? 'vs-dark' : 'vs-white'}
value={editorValue}
onChange={handleChange}
options={{
@@ -1,10 +1,12 @@
import { FC } from 'react'
import { FC, useContext } from 'react'
import {ConfigurationEditorPropsType} from '@pages/ConfigurationEditorPage'
import { ReactJsonView } from 'isp-ui-kit'
import {Spin} from 'antd'
import { cleanEmptyParamsObject } from '@utils/objectUtils.ts'
import { Context } from '@stores/index.tsx'
const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig = {}, setBufConfig, isCurrentConfigLoading}) => {
const { changeTheme } = useContext(Context)
if (isCurrentConfigLoading) {
return <Spin className="spin" />
}
@@ -19,9 +21,9 @@ const ConfigurationEditorJson: FC<ConfigurationEditorPropsType> = ({ bufConfig =
return (
<ReactJsonView
theme={ changeTheme ? 'twilight' : ''}
onAdd={true}
onDelete={({updated_src}: any) => handleEdit(updated_src)}
displayDataTypes={false}
displayObjectSize={false}
name={null}
@@ -1,11 +1,12 @@
import { ReactJsonView } from 'isp-ui-kit'
import { FC, memo } from 'react'
import { FC, memo, useContext } from 'react'
import Modal from '@widgets/Modal'
import { ConfigurationPreviewModalPropsType } from '@components/ConfigurationPreviewModal/configuration-preview-modal.type.ts'
import './configuration-preview-modal.scss'
import { Context } from '@stores/index.tsx'
const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
@@ -14,6 +15,7 @@ const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
open,
onClose
}) => {
const { changeTheme } = useContext(Context)
const data = JSON.parse(JSON.stringify(config.data || {}))
const configName = versionCompare
? `Версия: ${config.configVersion}`
@@ -22,6 +24,7 @@ const ConfigurationPreviewModal: FC<ConfigurationPreviewModalPropsType> = ({
<div className="configuration-preview-modal">
<Modal title={configName || ''} open={open} onClose={onClose}>
<ReactJsonView
theme={ changeTheme ? 'twilight' : ''}
src={data}
name={false}
sortKeys={true}
+1 -2
View File
@@ -19,7 +19,6 @@
}
.ant-menu-title-content {
color: #1B1B1B;
padding-left: 10px
}
}
@@ -30,7 +29,7 @@
display: none !important;
}
border-bottom: 1px solid lightgray;
border-bottom: 1px solid var(--ant-color-border);
border-radius: 0 !important;
& .ant-menu-submenu-title {
+1 -1
View File
@@ -8,7 +8,7 @@ $text-size-header2: 1.25rem;
$text-color-gray: var(--ant-primary-color);
$background-color: #F0F2F5;
$grey: #606060;
$border-color: #d9d9d9;
$border-color: var(--ant-color-border);
$error-red: #cf1322;
$blue-color: #40A9FF;
+14 -2
View File
@@ -1,5 +1,17 @@
import { theme } from 'antd'
export const darkTheme = { algorithm: theme.darkAlgorithm }
export const darkTheme = {
algorithm: theme.darkAlgorithm,
cssVar: true,
token: {
colorBgLayout: '#000000'
}
}
export const lightTheme = { algorithm: theme.defaultAlgorithm }
export const lightTheme = {
algorithm: theme.defaultAlgorithm,
cssVar: true,
token: {
colorBgLayout: '#FFFFFF'
}
}
@@ -3,7 +3,6 @@
.app-access-page {
display: flex;
height: 100%;
background: #fff;
.ant-tree {
background: none;
@@ -3,7 +3,6 @@
.applications-page {
height: 100%;
display: flex;
background: #fff;
&__list {
.ant-list-item {
@@ -21,14 +20,7 @@
max-height: 100vh;
}
.three-columns {
display: flex;
background: #fff;
box-shadow: inset -1px 0px 0px $border-color;
height: 100%;
}
.modal__wrap{
min-width: 350px;
min-width: 380px;
}
}
+1 -1
View File
@@ -172,7 +172,7 @@ const ApplicationsPage = () => {
}
return (
<main className="applications-page three-columns">
<main className="applications-page">
<Column
title="Группы приложений"
onUpdateItem={updateApplicationModal}
@@ -3,7 +3,6 @@
.configuration-editor-page {
display: flex;
flex-direction: column;
background: white;
-ms-overflow-style: none; /* IE и Edge */
scrollbar-width: none;
border-left: 1px solid $border-color;
+1 -1
View File
@@ -18,7 +18,7 @@
&__inner-marker {
font-size: 11px;
border: 1px solid #15D1E6;
border: 1px solid var(--ant-color-border);
border-radius: 12px;
padding: 0 4px;
margin: 4px
+1 -1
View File
@@ -188,7 +188,7 @@ const ModulesPage = () => {
}
return (
<section className="modules-page three-columns">
<section className="modules-page">
<Column
items={filterFirstColumnItems(ModulesList, searchValue)}
showAddBtn={false}
+2 -7
View File
@@ -2,9 +2,11 @@
.modules-page {
height: 100%;
display: flex;
&__tabs {
padding: 0 $basic-padding*2;
width: 100%;
overflow-x: scroll;
}
.ant-tag {
@@ -43,10 +45,3 @@
width: fit-content !important;
}
}
.three-columns {
display: flex;
background: #fff;
box-shadow: inset -1px 0px 0px $border-color;
height: 100%;
}
+16 -3
View File
@@ -1,5 +1,5 @@
import { Button, Descriptions, Popconfirm } from 'antd'
import { useState } from 'react'
import { useContext, useEffect, useState } from 'react'
import PermissionList from '@widgets/PermissionList'
@@ -9,13 +9,23 @@ import RoleList from '@components/RoleList'
import { useAppSelector } from '@hooks/redux.ts'
import useLogout from '@hooks/useLogout.tsx'
import './profile-page.scss'
import { Context } from '@stores/index.tsx'
import './profile-page.scss'
const ProfilePage = () => {
const [isModalOpen, setIsModalOpen] = useState<boolean>(false)
const { profile } = useAppSelector((state) => state.profileReducer)
const { logoutUser, isLoading } = useLogout()
const { changeTheme, setChangeTheme } = useContext(Context)
const onChangeTheme = () => {
setChangeTheme((prev: any) => !prev)
}
useEffect(() => {
localStorage.setItem('theme', JSON.stringify(changeTheme))
}, [changeTheme])
return (
<section className="profile-page">
@@ -23,7 +33,10 @@ const ProfilePage = () => {
onClose={() => setIsModalOpen(false)}
open={isModalOpen}
/>
<h1 className="profile-page__title">{`${profile.lastName} ${profile.firstName}`}</h1>
<header className="profile-page__header">
<h1 className="profile-page__title">{`${profile.lastName} ${profile.firstName}`}</h1>
<Button onClick={onChangeTheme}>Сменить тему</Button>
</header>
<div className="profile-page__user-info">
<div className="profile-page__user-info__email-wrapper">
<Descriptions>
+7 -2
View File
@@ -3,13 +3,18 @@
.profile-page {
height: 100vh;
overflow: auto;
border: 1px solid #F0F0F0;
border: 1px solid var(--ant-color-border);
padding: $basic-padding * 2;
background: #fff;
display: flex;
flex-direction: column;
align-items: start;
&__header {
display: flex;
justify-content: space-between;
width: 100%;
}
&__title {
font-size: $text-size-header1;
}
+1 -2
View File
@@ -25,7 +25,6 @@ import { NewRoleType, PermissionKeysType, RoleType } from '@type/roles.type.ts'
import './roles-page.scss'
const { Column, EmptyData, NoData } = Layout
const RolesPage = () => {
@@ -191,7 +190,7 @@ const RolesPage = () => {
}
return (
<section className="roles-page three-columns">
<section className="roles-page">
<Column
showUpdateBtn={false}
items={filterFirstColumnItems(data, searchValue)}
+1 -7
View File
@@ -2,6 +2,7 @@
.roles-page {
height: 100%;
display: flex;
.role-item {
&__id {
@@ -14,10 +15,3 @@
width: 100%
}
}
.three-columns {
display: flex;
background: #fff;
box-shadow: inset -1px 0px 0px $border-color;
height: 100%;
}
@@ -2,7 +2,6 @@
.security-log-page {
height: 100%;
background: #fff;
border: 1px solid $border-color;
&__header {
@@ -2,7 +2,6 @@
.sessions-page {
height: 100%;
background: #fff;
border: 1px solid $border-color;
&__header {
-1
View File
@@ -1,7 +1,6 @@
@import "../../constants/style/styleConst";
.user-editor {
background: #fff;
height: 100%;
border: 1px solid $border-color;
-1
View File
@@ -2,7 +2,6 @@
.users-page {
height: 100%;
background: #fff;
border: 1px solid $border-color;
.ant-btn-group >.ant-btn:first-child {
z-index: 2;
+9 -1
View File
@@ -21,11 +21,19 @@ import UIReducer from './redusers/UISlice.ts'
export interface ContextProps {
setTheme: Dispatch<
SetStateAction<{ algorithm: (token: SeedToken) => MapToken }>
SetStateAction<{
algorithm: (token: SeedToken) => MapToken
cssVar: boolean
token: { colorBgLayout: string }
}>
>
changeTheme: boolean
setChangeTheme: Dispatch<SetStateAction<boolean>>
}
export const Context = createContext<ContextProps>({
changeTheme: false,
setChangeTheme: () => false,
setTheme: () => theme.defaultAlgorithm
})
+7 -1
View File
@@ -5,4 +5,10 @@
position: absolute;
top: 8px;
right: 8px;
}
svg {
path {
fill: var(--ant-color-text) !important;
}
}
}
+8 -3
View File
@@ -1,7 +1,9 @@
import RefParser from '@apidevtools/json-schema-ref-parser'
import JSONSchemaView from 'json-schema-view-js'
import cloneDeep from 'lodash.clonedeep'
import React, { useEffect, useRef } from 'react'
import { FC, useContext, useEffect, useRef } from 'react'
import { Context } from '@stores/index.tsx'
import 'json-schema-view-js/dist/style.min.css'
@@ -9,7 +11,8 @@ interface JsonSchemaViewerProps {
schema: object
}
const JsonSchemaViewer: React.FC<JsonSchemaViewerProps> = ({ schema }) => {
const JsonSchemaViewer: FC<JsonSchemaViewerProps> = ({ schema }) => {
const { changeTheme } = useContext(Context)
const myRef = useRef<HTMLDivElement>(null)
useEffect(() => {
@@ -28,7 +31,9 @@ const JsonSchemaViewer: React.FC<JsonSchemaViewerProps> = ({ schema }) => {
if (err) {
console.log(err)
} else {
const view = new JSONSchemaView(dereferencedSchema, 3)
const view = new JSONSchemaView(dereferencedSchema, 3, {
theme: changeTheme ? 'dark' : ''
})
if (myRef.current) {
myRef.current.appendChild(view.render())
}
+3 -3
View File
@@ -5,7 +5,7 @@
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(211, 211, 211, 0.8);
background-color: var(--ant-color-bg-mask);
width: 100%;
height: 100%;
display: flex;
@@ -17,7 +17,7 @@
min-height: 170px;
max-height: 90vh;
max-width: 90%;
background: white;
background: var(--ant-layout-light-sider-bg);
color: white;
z-index: 10;
border-radius: 16px;
@@ -32,7 +32,7 @@
&__header {
height: 50px;
background: white;
background: var(--ant-layout-light-sider-bg);
overflow: hidden;
border-top-left-radius: 16px;
border-top-right-radius: 16px;