mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Admin section refactor (#6033)
* Remove plugin warning - No longer needed as plugins are automatically reloaded * Move ProjectCodeTable to admin interface * Move CustomUnits table * Transfer PartParameterTemplateTable * Tweak user menu * Fix unused imports
This commit is contained in:
parent
03a8190195
commit
8605832693
@ -34,15 +34,6 @@ export function MainMenu() {
|
||||
</UnstyledButton>
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
{userState.user?.is_staff && (
|
||||
<Menu.Item
|
||||
icon={<IconUserBolt />}
|
||||
component={Link}
|
||||
to="/settings/admin"
|
||||
>
|
||||
<Trans>Admin Center</Trans>
|
||||
</Menu.Item>
|
||||
)}
|
||||
<Menu.Label>
|
||||
<Trans>Settings</Trans>
|
||||
</Menu.Label>
|
||||
@ -58,8 +49,17 @@ export function MainMenu() {
|
||||
<Trans>System Settings</Trans>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{userState.user?.is_staff && <Menu.Divider />}
|
||||
{userState.user?.is_staff && (
|
||||
<Menu.Item
|
||||
icon={<IconUserBolt />}
|
||||
component={Link}
|
||||
to="/settings/admin"
|
||||
>
|
||||
<Trans>Admin Center</Trans>
|
||||
</Menu.Item>
|
||||
)}
|
||||
<Menu.Divider />
|
||||
|
||||
<Menu.Item
|
||||
icon={<IconLogout />}
|
||||
onClick={() => {
|
||||
|
@ -17,7 +17,7 @@ import { TableColumn } from '../Column';
|
||||
import { InvenTreeTable } from '../InvenTreeTable';
|
||||
import { RowDeleteAction, RowEditAction } from '../RowActions';
|
||||
|
||||
export function PartParameterTemplateTable() {
|
||||
export default function PartParameterTemplateTable() {
|
||||
const table = useTable('part-parameter-templates');
|
||||
|
||||
const user = useUserState();
|
||||
|
@ -19,7 +19,7 @@ import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
||||
/**
|
||||
* Table for displaying list of custom physical units
|
||||
*/
|
||||
export function CustomUnitsTable() {
|
||||
export default function CustomUnitsTable() {
|
||||
const table = useTable('custom-units');
|
||||
|
||||
const user = useUserState();
|
||||
|
@ -20,7 +20,7 @@ import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions';
|
||||
/**
|
||||
* Table for displaying list of project codes
|
||||
*/
|
||||
export function ProjectCodeTable() {
|
||||
export default function ProjectCodeTable() {
|
||||
const table = useTable('project-codes');
|
||||
|
||||
const user = useUserState();
|
||||
|
@ -1,20 +1,43 @@
|
||||
import { Trans, t } from '@lingui/macro';
|
||||
import { Paper, SimpleGrid, Stack, Text, Title } from '@mantine/core';
|
||||
import { IconPlugConnected, IconUsersGroup } from '@tabler/icons-react';
|
||||
import { Divider, Paper, SimpleGrid, Stack, Text, Title } from '@mantine/core';
|
||||
import {
|
||||
IconList,
|
||||
IconListDetails,
|
||||
IconPlugConnected,
|
||||
IconScale,
|
||||
IconUsersGroup
|
||||
} from '@tabler/icons-react';
|
||||
import { lazy, useMemo } from 'react';
|
||||
|
||||
import { PlaceholderPill } from '../../../../components/items/Placeholder';
|
||||
import { PanelGroup, PanelType } from '../../../../components/nav/PanelGroup';
|
||||
import { SettingsHeader } from '../../../../components/nav/SettingsHeader';
|
||||
import { GlobalSettingList } from '../../../../components/settings/SettingList';
|
||||
import { Loadable } from '../../../../functions/loading';
|
||||
|
||||
const UserManagementPanel = Loadable(
|
||||
lazy(() => import('./UserManagementPanel'))
|
||||
);
|
||||
|
||||
const PluginManagementPanel = Loadable(
|
||||
lazy(() => import('./PluginManagementPanel'))
|
||||
);
|
||||
|
||||
const ProjectCodeTable = Loadable(
|
||||
lazy(() => import('../../../../components/tables/settings/ProjectCodeTable'))
|
||||
);
|
||||
|
||||
const CustomUnitsTable = Loadable(
|
||||
lazy(() => import('../../../../components/tables/settings/CustomUnitsTable'))
|
||||
);
|
||||
|
||||
const PartParameterTemplateTable = Loadable(
|
||||
lazy(
|
||||
() =>
|
||||
import('../../../../components/tables/part/PartParameterTemplateTable')
|
||||
)
|
||||
);
|
||||
|
||||
export default function AdminCenter() {
|
||||
const adminCenterPanels: PanelType[] = useMemo(() => {
|
||||
return [
|
||||
@ -24,6 +47,30 @@ export default function AdminCenter() {
|
||||
icon: <IconUsersGroup />,
|
||||
content: <UserManagementPanel />
|
||||
},
|
||||
{
|
||||
name: 'projectcodes',
|
||||
label: t`Project Codes`,
|
||||
icon: <IconListDetails />,
|
||||
content: (
|
||||
<Stack spacing="xs">
|
||||
<GlobalSettingList keys={['PROJECT_CODES_ENABLED']} />
|
||||
<Divider />
|
||||
<ProjectCodeTable />
|
||||
</Stack>
|
||||
)
|
||||
},
|
||||
{
|
||||
name: 'customunits',
|
||||
label: t`Custom Units`,
|
||||
icon: <IconScale />,
|
||||
content: <CustomUnitsTable />
|
||||
},
|
||||
{
|
||||
name: 'parameters',
|
||||
label: t`Part Parameters`,
|
||||
icon: <IconList />,
|
||||
content: <PartParameterTemplateTable />
|
||||
},
|
||||
{
|
||||
name: 'plugin',
|
||||
label: t`Plugins`,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Trans } from '@lingui/macro';
|
||||
import { Alert, Stack, Title } from '@mantine/core';
|
||||
import { IconAlertTriangle, IconInfoCircle } from '@tabler/icons-react';
|
||||
import { IconInfoCircle } from '@tabler/icons-react';
|
||||
|
||||
import { GlobalSettingList } from '../../../../components/settings/SettingList';
|
||||
import { PluginErrorTable } from '../../../../components/tables/plugin/PluginErrorTable';
|
||||
@ -39,16 +39,6 @@ export default function PluginManagementPanel() {
|
||||
<Title order={5}>
|
||||
<Trans>Plugin Settings</Trans>
|
||||
</Title>
|
||||
<Alert
|
||||
icon={<IconAlertTriangle />}
|
||||
color="yellow"
|
||||
title={<Trans>Warning</Trans>}
|
||||
>
|
||||
<Trans>
|
||||
Changing the settings below require you to immediately restart the
|
||||
server. Do not change this while under active usage.
|
||||
</Trans>
|
||||
</Alert>
|
||||
<GlobalSettingList
|
||||
keys={[
|
||||
'ENABLE_PLUGINS_SCHEDULE',
|
||||
|
@ -7,11 +7,8 @@ import {
|
||||
IconCurrencyDollar,
|
||||
IconFileAnalytics,
|
||||
IconFingerprint,
|
||||
IconList,
|
||||
IconListDetails,
|
||||
IconPackages,
|
||||
IconQrcode,
|
||||
IconScale,
|
||||
IconServerCog,
|
||||
IconShoppingCart,
|
||||
IconSitemap,
|
||||
@ -25,10 +22,7 @@ import { StylishText } from '../../../components/items/StylishText';
|
||||
import { PanelGroup, PanelType } from '../../../components/nav/PanelGroup';
|
||||
import { SettingsHeader } from '../../../components/nav/SettingsHeader';
|
||||
import { GlobalSettingList } from '../../../components/settings/SettingList';
|
||||
import { PartParameterTemplateTable } from '../../../components/tables/part/PartParameterTemplateTable';
|
||||
import { CurrencyTable } from '../../../components/tables/settings/CurrencyTable';
|
||||
import { CustomUnitsTable } from '../../../components/tables/settings/CustomUnitsTable';
|
||||
import { ProjectCodeTable } from '../../../components/tables/settings/ProjectCodeTable';
|
||||
import { useServerApiState } from '../../../states/ApiState';
|
||||
|
||||
/**
|
||||
@ -101,24 +95,6 @@ export default function SystemSettings() {
|
||||
/>
|
||||
)
|
||||
},
|
||||
{
|
||||
name: 'projectcodes',
|
||||
label: t`Project Codes`,
|
||||
icon: <IconListDetails />,
|
||||
content: (
|
||||
<Stack spacing="xs">
|
||||
<GlobalSettingList keys={['PROJECT_CODES_ENABLED']} />
|
||||
<Divider />
|
||||
<ProjectCodeTable />
|
||||
</Stack>
|
||||
)
|
||||
},
|
||||
{
|
||||
name: 'physicalunits',
|
||||
label: t`Physical Units`,
|
||||
icon: <IconScale />,
|
||||
content: <CustomUnitsTable />
|
||||
},
|
||||
{
|
||||
name: 'notifications',
|
||||
label: t`Notifications`,
|
||||
@ -219,12 +195,6 @@ export default function SystemSettings() {
|
||||
/>
|
||||
)
|
||||
},
|
||||
{
|
||||
name: 'parameters',
|
||||
label: t`Part Parameters`,
|
||||
icon: <IconList />,
|
||||
content: <PartParameterTemplateTable />
|
||||
},
|
||||
{
|
||||
name: 'stock',
|
||||
label: t`Stock`,
|
||||
|
Loading…
Reference in New Issue
Block a user