2
0
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:
Oliver
2024-05-19 18:00:26 +10:00
committed by GitHub
parent 2431fc6d58
commit e4dedb63f4
7 changed files with 39 additions and 25 deletions

View File

@ -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 ?? '',