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 (
|
||||
<Stack spacing="xs">
|
||||
<Divider />
|
||||
{entries?.length > 0 && (
|
||||
{entries?.length > 0 ? (
|
||||
<Accordion variant="contained" defaultValue="-">
|
||||
{entries?.map((entry: any, index: number) => (
|
||||
<Accordion.Item key={entry.name} value={`entry-${index}`}>
|
||||
@ -38,6 +38,10 @@ export function LicenceView(entries: Readonly<any[]>) {
|
||||
</Accordion.Item>
|
||||
))}
|
||||
</Accordion>
|
||||
) : (
|
||||
<Text>
|
||||
<Trans>No Information provided - this is likely a server issue</Trans>
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
@ -53,6 +57,8 @@ export function LicenseModal() {
|
||||
.catch(() => {})
|
||||
});
|
||||
|
||||
const rspdata = !data ? [] : Object.keys(data ?? {});
|
||||
|
||||
return (
|
||||
<Stack spacing="xs">
|
||||
<Divider />
|
||||
@ -69,16 +75,16 @@ export function LicenseModal() {
|
||||
</Text>
|
||||
</Alert>
|
||||
) : (
|
||||
<Tabs defaultValue={Object.keys(data)[0] ?? ''}>
|
||||
<Tabs defaultValue={rspdata[0] ?? ''}>
|
||||
<Tabs.List>
|
||||
{Object.keys(data ?? {}).map((key) => (
|
||||
{rspdata.map((key) => (
|
||||
<Tabs.Tab key={key} value={key}>
|
||||
<Trans>{key} Packages</Trans>
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
|
||||
{Object.keys(data ?? {}).map((key) => (
|
||||
{rspdata.map((key) => (
|
||||
<Tabs.Panel key={key} value={key}>
|
||||
{LicenceView(data[key] ?? [])}
|
||||
</Tabs.Panel>
|
||||
|
Loading…
Reference in New Issue
Block a user