mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-20 15:05:12 +00:00
[UI] Launch forms directly from plugin (#13174)
* [UI] Launch forms directly from plugin Provide ability for plugins to dynamically launch modal forms, without specifying the underlying react components. This allows (for example) a primary action on a detail page to launch a new native API form * Add CHANGELOG entry
This commit is contained in:
1 parent
ad723c15e4
commit
461186bee9
9 files changed
+231
-1
No files matched your search
@@ -57,7 +57,22 @@ export function renderPartPanel(target, data) {
|
||||
<h4>Part Detail Panel</h4>
|
||||
<hr>
|
||||
<p>This is a custom panel for a Part detail page</p>
|
||||
<button type="button" id="sample-plugin-edit-part">Edit Part</button>
|
||||
`;
|
||||
|
||||
// Launch an API form from the plugin, without rendering the modal within the plugin itself
|
||||
target.querySelector('#sample-plugin-edit-part').onclick = () => {
|
||||
data.forms?.openEdit?.({
|
||||
url: 'part/',
|
||||
pk: data.id,
|
||||
title: 'Edit Part from Plugin',
|
||||
fields: {
|
||||
name: {},
|
||||
description: {},
|
||||
},
|
||||
successMessage: 'Part updated from plugin',
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user