2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

[PUI] Part detail page (#5521)

* Very basic part detail page

- Simply displays the ID of the part (not any actual data)
- Navigate from the part table

* Implement generic PanelGroup component

- Used for displaying sets of panelized data
- Will be used a lot within the interface

* Reload part page after edit form

* Fix loading overlay for part page

* Fix search panel

* Add panels to part index page

* Fix icons

* Fix table row actions menu

* PanelGroup: allow active panel to be changed externally

* Fix SearchDrawer issue

- AbortController does not work as expected
- Might need to revisit this later

* Improve form loading indicator
This commit is contained in:
Oliver
2023-09-10 22:52:46 +10:00
committed by GitHub
parent 9a6c2d2953
commit a210e905dc
11 changed files with 393 additions and 57 deletions

View File

@ -2,6 +2,7 @@ import { t } from '@lingui/macro';
import { Text } from '@mantine/core';
import { IconEdit, IconTrash } from '@tabler/icons-react';
import { useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import { editPart } from '../../../functions/forms/PartForms';
import { notYetImplemented } from '../../../functions/notifications';
@ -190,13 +191,11 @@ function partTableParams(params: any): any {
* @returns
*/
export function PartListTable({ params = {} }: { params?: any }) {
let tableParams = useMemo(() => partTableParams(params), []);
let tableParams = useMemo(() => partTableParams(params), [params]);
let tableColumns = useMemo(() => partTableColumns(), []);
let tableFilters = useMemo(() => partTableFilters(), []);
// Add required query parameters
tableParams.category_detail = true;
// Callback function for generating set of row actions
function partTableRowActions(record: any): RowAction[] {
let actions: RowAction[] = [];
@ -213,16 +212,18 @@ export function PartListTable({ params = {} }: { params?: any }) {
}
});
if (record.IPN) {
actions.push({
title: t`View IPN`,
onClick: () => {}
});
}
actions.push({
title: t`Detail`,
onClick: () => {
navigate(`/part/${record.pk}/`);
}
});
return actions;
}
const navigate = useNavigate();
return (
<InvenTreeTable
url="part/"