mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
[PUI] Fix licensing dialog (#6993)
* make licensing dialog more failure tolerant * add error text if no info can be parsed * Update LicenseModal.tsx fix copy co-author: @SchrodingersGat
This commit is contained in:
parent
0d59f6e8a9
commit
1e0382c719
@ -20,7 +20,7 @@ export function LicenceView(entries: Readonly<any[]>) {
|
|||||||
return (
|
return (
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs">
|
||||||
<Divider />
|
<Divider />
|
||||||
{entries?.length > 0 && (
|
{entries?.length > 0 ? (
|
||||||
<Accordion variant="contained" defaultValue="-">
|
<Accordion variant="contained" defaultValue="-">
|
||||||
{entries?.map((entry: any, index: number) => (
|
{entries?.map((entry: any, index: number) => (
|
||||||
<Accordion.Item key={entry.name} value={`entry-${index}`}>
|
<Accordion.Item key={entry.name} value={`entry-${index}`}>
|
||||||
@ -38,6 +38,10 @@ export function LicenceView(entries: Readonly<any[]>) {
|
|||||||
</Accordion.Item>
|
</Accordion.Item>
|
||||||
))}
|
))}
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
) : (
|
||||||
|
<Text>
|
||||||
|
<Trans>No Information provided - this is likely a server issue</Trans>
|
||||||
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
@ -53,6 +57,8 @@ export function LicenseModal() {
|
|||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const rspdata = !data ? [] : Object.keys(data ?? {});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs">
|
||||||
<Divider />
|
<Divider />
|
||||||
@ -69,16 +75,16 @@ export function LicenseModal() {
|
|||||||
</Text>
|
</Text>
|
||||||
</Alert>
|
</Alert>
|
||||||
) : (
|
) : (
|
||||||
<Tabs defaultValue={Object.keys(data)[0] ?? ''}>
|
<Tabs defaultValue={rspdata[0] ?? ''}>
|
||||||
<Tabs.List>
|
<Tabs.List>
|
||||||
{Object.keys(data ?? {}).map((key) => (
|
{rspdata.map((key) => (
|
||||||
<Tabs.Tab key={key} value={key}>
|
<Tabs.Tab key={key} value={key}>
|
||||||
<Trans>{key} Packages</Trans>
|
<Trans>{key} Packages</Trans>
|
||||||
</Tabs.Tab>
|
</Tabs.Tab>
|
||||||
))}
|
))}
|
||||||
</Tabs.List>
|
</Tabs.List>
|
||||||
|
|
||||||
{Object.keys(data ?? {}).map((key) => (
|
{rspdata.map((key) => (
|
||||||
<Tabs.Panel key={key} value={key}>
|
<Tabs.Panel key={key} value={key}>
|
||||||
{LicenceView(data[key] ?? [])}
|
{LicenceView(data[key] ?? [])}
|
||||||
</Tabs.Panel>
|
</Tabs.Panel>
|
||||||
|
Loading…
Reference in New Issue
Block a user