-
-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[React] Settings interface #5679
[React] Settings interface #5679
Conversation
- Allow use without a pk
- User information available globally - Add placeholder page for plugin settings
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
- Allows list of settings to be drilled down through props - Also provides a way of reloading the settings list
- No longer case sensitive
- Still some work to be done here - Need to pass the base URL down through useContext
- Required some adjustment to existing forms interface
# Conflicts: # InvenTree/InvenTree/api_version.py
…ttings # Conflicts: # InvenTree/InvenTree/api_version.py # InvenTree/InvenTree/serializers.py # src/frontend/src/components/forms/ApiForm.tsx # src/frontend/src/components/forms/fields/ApiFormField.tsx # src/frontend/src/components/nav/MainMenu.tsx # src/frontend/src/functions/forms.tsx # src/frontend/src/hooks/UseInstance.tsx # src/frontend/src/pages/build/BuildDetail.tsx # src/frontend/src/pages/part/CategoryDetail.tsx # src/frontend/src/pages/part/PartDetail.tsx # src/frontend/src/pages/stock/LocationDetail.tsx # src/frontend/src/pages/stock/StockDetail.tsx # src/frontend/src/states/ApiState.tsx # src/frontend/src/states/states.tsx
…ttings # Conflicts: # src/frontend/src/components/nav/MainMenu.tsx
- Replace with global state manager - Does not currently refresh properly
…ttings # Conflicts: # src/frontend/src/components/nav/PanelGroup.tsx # src/frontend/src/functions/forms.tsx
- Integrated many improvements from current master
- Now integrates nicely with userSettingsState and globalSettingsState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start for building out all required management options via the API; Great work
openModalApiForm({ | ||
name: 'setting-edit', | ||
url: settingsState.endpoint, | ||
pk: setting.key, | ||
method: 'PATCH', | ||
title: t`Edit Setting`, | ||
ignorePermissionCheck: true, | ||
fields: { | ||
value: { | ||
value: setting?.value ?? '', | ||
field_type: field_type, | ||
choices: setting?.choices || [], | ||
label: setting?.name, | ||
description: setting?.description | ||
} | ||
}, | ||
onFormSuccess() { | ||
showNotification({ | ||
title: t`Setting updated`, | ||
message: t`${setting?.name} updated successfully`, | ||
color: 'green' | ||
}); | ||
settingsState.fetchSettings(); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment: I played with inline editing - which gave a really snappy feel. Maybe that can be done in a follow up PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the idea, a modal requires way more clicks which is bad ux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main drivers for a modal here is that the modal framework is already in place which handles API transactions, error handling, etc
I'd happily review an inline editor solution - potentially the forms components I have already implemented could be reused. The only requirement would be that we add provision for an in-line error message which is displayed when the value is marked as invalid by the server.
@matmair I am going to merge this in now as I think it is sufficiently advanced that we can leverage it. Thanks for your good points and improvements, I think it is pretty clean now! Note that this does not address all the points in #5326 - perhaps the task-list over there can be moved to a new issue so we can continue to tick off the other items? |
Implementing a settings interface for the new UI
TODO
useContext
useInstance
hook to use proper API URLs - not raw strings