mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
F: Implement dev helper features
Some checks failed
Frontend CI / build (22.x) (push) Has been cancelled
Some checks failed
Frontend CI / build (22.x) (push) Has been cancelled
This commit is contained in:
parent
0a1f9fe554
commit
9c5cb64156
|
@ -39,6 +39,7 @@ This readme file is used mostly to document project dependencies and conventions
|
||||||
- react-error-boundary
|
- react-error-boundary
|
||||||
- react-pdf
|
- react-pdf
|
||||||
- react-tooltip
|
- react-tooltip
|
||||||
|
- react-zoom-pan-pinch
|
||||||
- reactflow
|
- reactflow
|
||||||
- js-file-download
|
- js-file-download
|
||||||
- use-debounce
|
- use-debounce
|
||||||
|
|
15
rsconcept/frontend/package-lock.json
generated
15
rsconcept/frontend/package-lock.json
generated
|
@ -29,6 +29,7 @@
|
||||||
"react-tabs": "^6.0.2",
|
"react-tabs": "^6.0.2",
|
||||||
"react-toastify": "^10.0.5",
|
"react-toastify": "^10.0.5",
|
||||||
"react-tooltip": "^5.27.1",
|
"react-tooltip": "^5.27.1",
|
||||||
|
"react-zoom-pan-pinch": "^3.6.1",
|
||||||
"reactflow": "^11.11.4",
|
"reactflow": "^11.11.4",
|
||||||
"reagraph": "^4.19.2",
|
"reagraph": "^4.19.2",
|
||||||
"use-debounce": "^10.0.1"
|
"use-debounce": "^10.0.1"
|
||||||
|
@ -10542,6 +10543,20 @@
|
||||||
"react-dom": ">=16.13"
|
"react-dom": ">=16.13"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-zoom-pan-pinch": {
|
||||||
|
"version": "3.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.6.1.tgz",
|
||||||
|
"integrity": "sha512-SdPqdk7QDSV7u/WulkFOi+cnza8rEZ0XX4ZpeH7vx3UZEg7DoyuAy3MCmm+BWv/idPQL2Oe73VoC0EhfCN+sZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8",
|
||||||
|
"npm": ">=5"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "*",
|
||||||
|
"react-dom": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/reactflow": {
|
"node_modules/reactflow": {
|
||||||
"version": "11.11.4",
|
"version": "11.11.4",
|
||||||
"resolved": "https://registry.npmjs.org/reactflow/-/reactflow-11.11.4.tgz",
|
"resolved": "https://registry.npmjs.org/reactflow/-/reactflow-11.11.4.tgz",
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
"react-tabs": "^6.0.2",
|
"react-tabs": "^6.0.2",
|
||||||
"react-toastify": "^10.0.5",
|
"react-toastify": "^10.0.5",
|
||||||
"react-tooltip": "^5.27.1",
|
"react-tooltip": "^5.27.1",
|
||||||
|
"react-zoom-pan-pinch": "^3.6.1",
|
||||||
"reactflow": "^11.11.4",
|
"reactflow": "^11.11.4",
|
||||||
"reagraph": "^4.19.2",
|
"reagraph": "^4.19.2",
|
||||||
"use-debounce": "^10.0.1"
|
"use-debounce": "^10.0.1"
|
||||||
|
|
1134
rsconcept/frontend/public/db_schema.svg
Normal file
1134
rsconcept/frontend/public/db_schema.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 122 KiB |
|
@ -3,11 +3,13 @@ import {
|
||||||
IconAdminOff,
|
IconAdminOff,
|
||||||
IconDarkTheme,
|
IconDarkTheme,
|
||||||
IconDatabase,
|
IconDatabase,
|
||||||
|
IconDBStructure,
|
||||||
IconHelp,
|
IconHelp,
|
||||||
IconHelpOff,
|
IconHelpOff,
|
||||||
IconImage,
|
IconImage,
|
||||||
IconLightTheme,
|
IconLightTheme,
|
||||||
IconLogout,
|
IconLogout,
|
||||||
|
IconRESTapi,
|
||||||
IconUser
|
IconUser
|
||||||
} from '@/components/Icons';
|
} from '@/components/Icons';
|
||||||
import { CProps } from '@/components/props';
|
import { CProps } from '@/components/props';
|
||||||
|
@ -49,6 +51,16 @@ function UserDropdown({ isOpen, hideDropdown }: UserDropdownProps) {
|
||||||
router.push(urls.icons, event.ctrlKey || event.metaKey);
|
router.push(urls.icons, event.ctrlKey || event.metaKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gotoRestApi() {
|
||||||
|
hideDropdown();
|
||||||
|
router.push(urls.rest_api, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotoDatabaseSchema(event: CProps.EventMouse) {
|
||||||
|
hideDropdown();
|
||||||
|
router.push(urls.database_schema, event.ctrlKey || event.metaKey);
|
||||||
|
}
|
||||||
|
|
||||||
function handleToggleDarkMode() {
|
function handleToggleDarkMode() {
|
||||||
hideDropdown();
|
hideDropdown();
|
||||||
toggleDarkMode();
|
toggleDarkMode();
|
||||||
|
@ -82,6 +94,14 @@ function UserDropdown({ isOpen, hideDropdown }: UserDropdownProps) {
|
||||||
onClick={toggleAdminMode}
|
onClick={toggleAdminMode}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
{user?.is_staff ? (
|
||||||
|
<DropdownButton
|
||||||
|
text='REST API' // prettier: split-line
|
||||||
|
icon={<IconRESTapi size='1rem' />}
|
||||||
|
className='border-t'
|
||||||
|
onClick={gotoRestApi}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{user?.is_staff ? (
|
{user?.is_staff ? (
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
text='База данных' // prettier: split-line
|
text='База данных' // prettier: split-line
|
||||||
|
@ -96,6 +116,14 @@ function UserDropdown({ isOpen, hideDropdown }: UserDropdownProps) {
|
||||||
onClick={gotoIcons}
|
onClick={gotoIcons}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
{user?.is_staff ? (
|
||||||
|
<DropdownButton
|
||||||
|
text='Структура БД' // prettier: split-line
|
||||||
|
icon={<IconDBStructure size='1rem' />}
|
||||||
|
onClick={gotoDatabaseSchema}
|
||||||
|
className='border-b'
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
text='Выйти...'
|
text='Выйти...'
|
||||||
className='font-semibold'
|
className='font-semibold'
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { createBrowserRouter } from 'react-router-dom';
|
import { createBrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import CreateItemPage from '@/pages/CreateItemPage';
|
import CreateItemPage from '@/pages/CreateItemPage';
|
||||||
|
import DatabaseSchemaPage from '@/pages/DatabaseSchemaPage';
|
||||||
import HomePage from '@/pages/HomePage';
|
import HomePage from '@/pages/HomePage';
|
||||||
import IconsPage from '@/pages/IconsPage';
|
import IconsPage from '@/pages/IconsPage';
|
||||||
import LibraryPage from '@/pages/LibraryPage';
|
import LibraryPage from '@/pages/LibraryPage';
|
||||||
|
@ -63,13 +64,17 @@ export const Router = createBrowserRouter([
|
||||||
path: `${routes.oss}/:id`,
|
path: `${routes.oss}/:id`,
|
||||||
element: <OssPage />
|
element: <OssPage />
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: routes.manuals,
|
||||||
|
element: <ManualsPage />
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: `${routes.icons}`,
|
path: `${routes.icons}`,
|
||||||
element: <IconsPage />
|
element: <IconsPage />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: routes.manuals,
|
path: `${routes.database_schema}`,
|
||||||
element: <ManualsPage />
|
element: <DatabaseSchemaPage />
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ export const routes = {
|
||||||
help: 'manuals',
|
help: 'manuals',
|
||||||
rsforms: 'rsforms',
|
rsforms: 'rsforms',
|
||||||
oss: 'oss',
|
oss: 'oss',
|
||||||
icons: 'icons'
|
icons: 'icons',
|
||||||
|
database_schema: 'database-schema'
|
||||||
};
|
};
|
||||||
|
|
||||||
interface SchemaProps {
|
interface SchemaProps {
|
||||||
|
@ -39,11 +40,13 @@ interface OssProps {
|
||||||
*/
|
*/
|
||||||
export const urls = {
|
export const urls = {
|
||||||
admin: `${buildConstants.backend}/admin`,
|
admin: `${buildConstants.backend}/admin`,
|
||||||
|
rest_api: `${buildConstants.backend}/`,
|
||||||
home: '/',
|
home: '/',
|
||||||
login: `/${routes.login}`,
|
login: `/${routes.login}`,
|
||||||
login_hint: (userName: string) => `/login?username=${userName}`,
|
login_hint: (userName: string) => `/login?username=${userName}`,
|
||||||
profile: `/${routes.profile}`,
|
profile: `/${routes.profile}`,
|
||||||
icons: `/icons`,
|
icons: `/${routes.icons}`,
|
||||||
|
database_schema: `/${routes.database_schema}`,
|
||||||
signup: `/${routes.signup}`,
|
signup: `/${routes.signup}`,
|
||||||
library: `/${routes.library}`,
|
library: `/${routes.library}`,
|
||||||
library_filter: (strategy: string) => `/library?filter=${strategy}`,
|
library_filter: (strategy: string) => `/library?filter=${strategy}`,
|
||||||
|
|
|
@ -65,6 +65,8 @@ export { GiHoneycomb as IconOSS } from 'react-icons/gi';
|
||||||
export { RiHexagonLine as IconRSForm } from 'react-icons/ri';
|
export { RiHexagonLine as IconRSForm } from 'react-icons/ri';
|
||||||
export { LuArchive as IconArchive } from 'react-icons/lu';
|
export { LuArchive as IconArchive } from 'react-icons/lu';
|
||||||
export { LuDatabase as IconDatabase } from 'react-icons/lu';
|
export { LuDatabase as IconDatabase } from 'react-icons/lu';
|
||||||
|
export { LuView as IconDBStructure } from 'react-icons/lu';
|
||||||
|
export { LuPlaneTakeoff as IconRESTapi } from 'react-icons/lu';
|
||||||
export { LuImage as IconImage } from 'react-icons/lu';
|
export { LuImage as IconImage } from 'react-icons/lu';
|
||||||
export { TbColumns as IconList } from 'react-icons/tb';
|
export { TbColumns as IconList } from 'react-icons/tb';
|
||||||
export { ImStack as IconVersions } from 'react-icons/im';
|
export { ImStack as IconVersions } from 'react-icons/im';
|
||||||
|
|
31
rsconcept/frontend/src/pages/DatabaseSchemaPage.tsx
Normal file
31
rsconcept/frontend/src/pages/DatabaseSchemaPage.tsx
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useLayoutEffect, useMemo } from 'react';
|
||||||
|
import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch';
|
||||||
|
|
||||||
|
import AnimateFade from '@/components/wrap/AnimateFade';
|
||||||
|
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
||||||
|
import { resources } from '@/utils/constants';
|
||||||
|
|
||||||
|
function DatabaseSchemaPage() {
|
||||||
|
const { calculateHeight, setNoFooter } = useConceptOptions();
|
||||||
|
|
||||||
|
const panelHeight = useMemo(() => calculateHeight('0px'), [calculateHeight]);
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
setNoFooter(true);
|
||||||
|
return () => setNoFooter(false);
|
||||||
|
}, [setNoFooter]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnimateFade className='flex justify-center overflow-hidden' style={{ maxHeight: panelHeight }}>
|
||||||
|
<TransformWrapper>
|
||||||
|
<TransformComponent>
|
||||||
|
<img alt='Схема базы данных' src={resources.db_schema} className='w-fit h-fit' />
|
||||||
|
</TransformComponent>
|
||||||
|
</TransformWrapper>
|
||||||
|
</AnimateFade>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DatabaseSchemaPage;
|
|
@ -54,7 +54,8 @@ export const patterns = {
|
||||||
export const resources = {
|
export const resources = {
|
||||||
graph_font: '/DejaVu.ttf',
|
graph_font: '/DejaVu.ttf',
|
||||||
privacy_policy: '/privacy.pdf',
|
privacy_policy: '/privacy.pdf',
|
||||||
logo: '/logo_full.svg'
|
logo: '/logo_full.svg',
|
||||||
|
db_schema: '/db_schema.svg'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user