mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Plugin setting fix (#7258)
* Fix CUI URLs * Fix for plugin setting API - Fix conflict between "key" for PluginConfig and "key" for setting - Needs to be "plugin" for plugin lookup, which accesses the "key" field in the PluginConfig model * Fix for editing setting in PUI * Add 'r' back in * Remove debug code * Update unit tests * Bump API version * Another unit test fix
This commit is contained in:
@ -47,6 +47,19 @@ export function SettingList({
|
||||
|
||||
const [setting, setSetting] = useState<Setting | undefined>(undefined);
|
||||
|
||||
// Determine the field type of the setting
|
||||
const fieldType = useMemo(() => {
|
||||
if (setting?.type != undefined) {
|
||||
return setting.type;
|
||||
}
|
||||
|
||||
if (setting?.choices != undefined && setting.choices.length > 0) {
|
||||
return 'choice';
|
||||
}
|
||||
|
||||
return 'string';
|
||||
}, [setting]);
|
||||
|
||||
const editSettingModal = useEditApiFormModal({
|
||||
url: settingsState.endpoint,
|
||||
pk: setting?.key,
|
||||
@ -54,11 +67,7 @@ export function SettingList({
|
||||
title: t`Edit Setting`,
|
||||
fields: {
|
||||
value: {
|
||||
value: setting?.value ?? '',
|
||||
field_type:
|
||||
setting?.type ?? (setting?.choices?.length ?? 0) > 0
|
||||
? 'choice'
|
||||
: 'string',
|
||||
field_type: fieldType,
|
||||
label: setting?.name,
|
||||
description: setting?.description,
|
||||
api_url: setting?.api_url ?? '',
|
||||
|
Reference in New Issue
Block a user