mirror of
https://github.com/inventree/InvenTree.git
synced 2026-04-15 15:58:48 +00:00
Selection lists updates (#11705)
* Add search capability to selection list entry endpoint * Use API lookup for selection entries * Add renderer func * Allow API filtering * Fetch selectionentry data related to the selected data item * remove now unneeded entry * add missing modelinfo * fix ref * add api bump * Provide optional single fetch function to API forms - Useful if we need to perform a custom API call for initial data * django-admin support for SelectionList * Docstring improvements * Apply 'active' filter * Tweak api version entry * Playwright tests * Tweak docs wording * Fix incorrect docstring * Adjust playwright tests --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@@ -64,7 +64,7 @@ export enum ApiEndpoints {
|
||||
content_type_list = 'contenttype/',
|
||||
icons = 'icons/',
|
||||
selectionlist_list = 'selection/',
|
||||
selectionlist_detail = 'selection/:id/',
|
||||
selectionentry_list = 'selection/:id/entry/',
|
||||
|
||||
// Barcode API endpoints
|
||||
barcode = 'barcode/',
|
||||
|
||||
@@ -287,6 +287,13 @@ export const ModelInformationDict: ModelDict = {
|
||||
api_endpoint: ApiEndpoints.selectionlist_list,
|
||||
icon: 'list_details'
|
||||
},
|
||||
selectionentry: {
|
||||
label: () => t`Selection Entry`,
|
||||
label_multiple: () => t`Selection Entries`,
|
||||
url_overview: '/settings/admin/part-parameters',
|
||||
api_endpoint: ApiEndpoints.selectionentry_list,
|
||||
icon: 'list_details'
|
||||
},
|
||||
error: {
|
||||
label: () => t`Error`,
|
||||
label_multiple: () => t`Errors`,
|
||||
|
||||
@@ -35,5 +35,6 @@ export enum ModelType {
|
||||
pluginconfig = 'pluginconfig',
|
||||
contenttype = 'contenttype',
|
||||
selectionlist = 'selectionlist',
|
||||
selectionentry = 'selectionentry',
|
||||
error = 'error'
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ export type ApiFormFieldHeader = {
|
||||
* @param adjustValue : Callback function to adjust the value of the field before it is sent to the API
|
||||
* @param addRow : Callback function to add a new row to a table field
|
||||
* @param onKeyDown : Callback function to get which key was pressed in the form to handle submission on enter
|
||||
* @param singleFetchFunction : Optional function to fetch a single value for this field (used for fetching the initial value when editing an existing object)
|
||||
*/
|
||||
export type ApiFormFieldType = {
|
||||
label?: string;
|
||||
@@ -126,6 +127,7 @@ export type ApiFormFieldType = {
|
||||
addRow?: () => any;
|
||||
headers?: ApiFormFieldHeader[];
|
||||
depends_on?: string[];
|
||||
singleFetchFunction?: (value: any) => Promise<any> | null;
|
||||
};
|
||||
|
||||
export type ApiFormFieldSet = Record<string, ApiFormFieldType>;
|
||||
|
||||
Reference in New Issue
Block a user