-
-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Visual tweaks for admin pages * Provide admin js file via API * Backend fixes * Tweak error detail drawer * Refactor plugin detail panel - Split out into separate files - Use <Accordion /> - Display custom configuration (if available) * Refactoring * Add custom configuration to sample UI plugin * Bump API version * Add separate API endpoint for admin integration details * Refactor plugin drawer * Null check * Add playwright tests for custom admin integration * Enable plugin panels in "settings" pages * Fix for unit test * Hide "Plugin Settings" for plugin without "settings" mixin * Fixes for playwright tests * Update playwright tests * Improved error message
- Loading branch information
1 parent
36e3159
commit 798e25a
Showing
26 changed files
with
540 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
src/backend/InvenTree/plugin/samples/static/plugins/sampleui/ui_settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
export function renderPluginSettings(target, data) { | ||
|
||
console.log("renderPluginSettings:", data); | ||
|
||
target.innerHTML = ` | ||
<h4>Custom Plugin Configuration Content</h4> | ||
<p>Custom plugin configuration UI elements can be rendered here.</p> | ||
<p>The following context data was provided by the server:</p> | ||
<ul> | ||
${Object.entries(data.context).map(([key, value]) => `<li>${key}: ${value}</li>`).join('')} | ||
</ul> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,58 @@ | ||
import { Anchor, Group, Stack, Text, Title } from '@mantine/core'; | ||
import { t } from '@lingui/macro'; | ||
import { | ||
Anchor, | ||
Group, | ||
SegmentedControl, | ||
Stack, | ||
Text, | ||
Title | ||
} from '@mantine/core'; | ||
import { IconSwitch } from '@tabler/icons-react'; | ||
import { ReactNode } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { Link, useNavigate } from 'react-router-dom'; | ||
|
||
import { useUserState } from '../../states/UserState'; | ||
import { StylishText } from '../items/StylishText'; | ||
|
||
interface SettingsHeaderInterface { | ||
title: string | ReactNode; | ||
label: string; | ||
title: string; | ||
shorthand?: string; | ||
subtitle?: string | ReactNode; | ||
switch_condition?: boolean; | ||
switch_text?: string | ReactNode; | ||
switch_link?: string; | ||
} | ||
|
||
/** | ||
* Construct a settings page header with interlinks to one other settings page | ||
*/ | ||
export function SettingsHeader({ | ||
label, | ||
title, | ||
shorthand, | ||
subtitle, | ||
switch_condition = true, | ||
switch_text, | ||
switch_link | ||
subtitle | ||
}: Readonly<SettingsHeaderInterface>) { | ||
const user = useUserState(); | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<Stack gap="0" ml={'sm'}> | ||
<Group> | ||
<Title order={3}>{title}</Title> | ||
{shorthand && <Text c="dimmed">({shorthand})</Text>} | ||
</Group> | ||
<Group> | ||
{subtitle ? <Text c="dimmed">{subtitle}</Text> : null} | ||
{switch_text && switch_link && switch_condition && ( | ||
<Anchor component={Link} to={switch_link}> | ||
<IconSwitch size={14} /> | ||
{switch_text} | ||
</Anchor> | ||
)} | ||
</Group> | ||
</Stack> | ||
<Group justify="space-between"> | ||
<Stack gap="0" ml={'sm'}> | ||
<Group> | ||
<StylishText size="xl">{title}</StylishText> | ||
{shorthand && <Text c="dimmed">({shorthand})</Text>} | ||
</Group> | ||
<Group>{subtitle ? <Text c="dimmed">{subtitle}</Text> : null}</Group> | ||
</Stack> | ||
{user.isStaff() && ( | ||
<SegmentedControl | ||
data={[ | ||
{ value: 'user', label: t`User Settings` }, | ||
{ value: 'system', label: t`System Settings` }, | ||
{ value: 'admin', label: t`Admin Center` } | ||
]} | ||
onChange={(value) => navigate(`/settings/${value}`)} | ||
value={label} | ||
/> | ||
)} | ||
</Group> | ||
); | ||
} |
Oops, something went wrong.