Cleanup about and version dialogs (#6235)

This commit is contained in:
Oliver 2024-01-14 10:10:34 +11:00 committed by GitHub
parent 9070eaad60
commit f27503b1af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 19 deletions

View File

@ -52,7 +52,7 @@ class VersionView(APIView):
'code': InvenTree.version.inventreeGithubUrl(), 'code': InvenTree.version.inventreeGithubUrl(),
'credit': InvenTree.version.inventreeCreditsUrl(), 'credit': InvenTree.version.inventreeCreditsUrl(),
'app': InvenTree.version.inventreeAppUrl(), 'app': InvenTree.version.inventreeAppUrl(),
'bug': f'{InvenTree.version.inventreeGithubUrl()}/issues', 'bug': f'{InvenTree.version.inventreeGithubUrl()}issues',
}, },
}) })

View File

@ -20,6 +20,7 @@ export function CopyButton({
compact compact
> >
<IconCopy size={10} /> <IconCopy size={10} />
{label && <div>&nbsp;</div>}
{label && label} {label && label}
</Button> </Button>
)} )}

View File

@ -1,5 +1,16 @@
import { Trans } from '@lingui/macro'; import { Trans } from '@lingui/macro';
import { Anchor, Badge, Group, Stack, Table, Text, Title } from '@mantine/core'; import {
Anchor,
Badge,
Button,
Divider,
Group,
Space,
Stack,
Table,
Text,
Title
} from '@mantine/core';
import { ContextModalProps } from '@mantine/modals'; import { ContextModalProps } from '@mantine/modals';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
@ -17,7 +28,10 @@ type AboutLookupRef = {
copy?: boolean; copy?: boolean;
}; };
export function AboutInvenTreeModal({}: ContextModalProps<{ export function AboutInvenTreeModal({
context,
id
}: ContextModalProps<{
modalBody: string; modalBody: string;
}>) { }>) {
const [user] = useUserState((state) => [state.user]); const [user] = useUserState((state) => [state.user]);
@ -80,6 +94,10 @@ export function AboutInvenTreeModal({}: ContextModalProps<{
}Active plugins: ${JSON.stringify(server.active_plugins)}`; }Active plugins: ${JSON.stringify(server.active_plugins)}`;
return ( return (
<Stack> <Stack>
<Divider />
<Title order={5}>
<Trans>Version Information</Trans>
</Title>
<Group> <Group>
<Text> <Text>
<Trans>Your InvenTree version status is</Trans> <Trans>Your InvenTree version status is</Trans>
@ -98,9 +116,6 @@ export function AboutInvenTreeModal({}: ContextModalProps<{
</Badge> </Badge>
)} )}
</Group> </Group>
<Title order={5}>
<Trans>Version Information</Trans>
</Title>
<Table> <Table>
<tbody> <tbody>
{fillTable( {fillTable(
@ -161,11 +176,21 @@ export function AboutInvenTreeModal({}: ContextModalProps<{
)} )}
</tbody> </tbody>
</Table> </Table>
<Group> <Divider />
<Group position="apart">
<CopyButton <CopyButton
value={copyval} value={copyval}
label={<Trans>Copy version information</Trans>} label={<Trans>Copy version information</Trans>}
/> />
<Space />
<Button
color="red"
onClick={() => {
context.closeModal(id);
}}
>
<Trans>Dismiss</Trans>
</Button>
</Group> </Group>
</Stack> </Stack>
); );

View File

@ -1,5 +1,13 @@
import { Trans } from '@lingui/macro'; import { Trans } from '@lingui/macro';
import { Badge, Button, Stack, Table, Title } from '@mantine/core'; import {
Badge,
Button,
Divider,
Group,
Stack,
Table,
Title
} from '@mantine/core';
import { ContextModalProps } from '@mantine/modals'; import { ContextModalProps } from '@mantine/modals';
import { useServerApiState } from '../../states/ApiState'; import { useServerApiState } from '../../states/ApiState';
@ -13,6 +21,7 @@ export function ServerInfoModal({
return ( return (
<Stack> <Stack>
<Divider />
<Title order={5}> <Title order={5}>
<Trans>Server</Trans> <Trans>Server</Trans>
</Title> </Title>
@ -127,15 +136,17 @@ export function ServerInfoModal({
</tr> </tr>
</tbody> </tbody>
</Table> </Table>
<Button <Divider />
color="red" <Group position="right">
variant="outline" <Button
onClick={() => { color="red"
context.closeModal(id); onClick={() => {
}} context.closeModal(id);
> }}
<Trans>Close modal</Trans> >
</Button> <Trans>Dismiss</Trans>
</Button>
</Group>
</Stack> </Stack>
); );
} }

View File

@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro';
import { openContextModal } from '@mantine/modals'; import { openContextModal } from '@mantine/modals';
import { DocumentationLinkItem } from '../components/items/DocumentationLinks'; import { DocumentationLinkItem } from '../components/items/DocumentationLinks';
import { StylishText } from '../components/items/StylishText';
import { IS_DEV_OR_DEMO } from '../main'; import { IS_DEV_OR_DEMO } from '../main';
export const footerLinks = [ export const footerLinks = [
@ -73,7 +74,11 @@ export const navDocLinks: DocumentationLinkItem[] = [
function serverInfo() { function serverInfo() {
return openContextModal({ return openContextModal({
modal: 'info', modal: 'info',
title: <Trans>System Information</Trans>, title: (
<StylishText size="xl">
<Trans>System Information</Trans>
</StylishText>
),
size: 'xl', size: 'xl',
innerProps: {} innerProps: {}
}); });
@ -82,7 +87,11 @@ function serverInfo() {
function aboutInvenTree() { function aboutInvenTree() {
return openContextModal({ return openContextModal({
modal: 'about', modal: 'about',
title: <Trans>About InvenTree</Trans>, title: (
<StylishText size="xl">
<Trans>About InvenTree</Trans>
</StylishText>
),
size: 'xl', size: 'xl',
innerProps: {} innerProps: {}
}); });