mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Plugin loading improvements (#6056)
* Add API endpoint to reload plugin registry * Tweak debug * Add elements for CUI * Update API version * Reload plugins from PUI
This commit is contained in:
@ -38,7 +38,13 @@
|
||||
{% admin_url user "plugin.pluginconfig" None as url %}
|
||||
{% include "admin_button.html" with url=url %}
|
||||
{% if plug %}
|
||||
<button class="btn btn-success" id="install-plugin" title="{% trans 'Install Plugin' %}"><span class='fas fa-plus-circle'></span> {% trans "Install Plugin" %}</button>
|
||||
<button class="btn btn-success" id="install-plugin" title="{% trans 'Install Plugin' %}">
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Install Plugin" %}
|
||||
</button>
|
||||
<button class='btn btn-success' id='reload-plugins' title='{% trans "Reload Plugins" %}'>
|
||||
<span class='fas fa-redo-alt'></span> {% trans "Reload Plugins" %}
|
||||
</button>
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -591,5 +591,10 @@ onPanelLoad('plugin', function() {
|
||||
installPlugin();
|
||||
});
|
||||
|
||||
// Callback to reload plugins
|
||||
$('#reload-plugins').click(function() {
|
||||
reloadPlugins();
|
||||
});
|
||||
|
||||
{% endif %}
|
||||
});
|
||||
|
@ -20,7 +20,8 @@
|
||||
activatePlugin,
|
||||
installPlugin,
|
||||
loadPluginTable,
|
||||
locateItemOrLocation
|
||||
locateItemOrLocation,
|
||||
reloadPlugins,
|
||||
*/
|
||||
|
||||
|
||||
@ -213,6 +214,37 @@ function activatePlugin(plugin_id, active=true) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reload the plugin registry
|
||||
*/
|
||||
function reloadPlugins() {
|
||||
let url = '{% url "api-plugin-reload" %}';
|
||||
|
||||
constructForm(url, {
|
||||
title: '{% trans "Reload Plugins" %}',
|
||||
method: 'POST',
|
||||
confirm: true,
|
||||
fields: {
|
||||
force_reload: {
|
||||
// hidden: true,
|
||||
value: true,
|
||||
},
|
||||
full_reload: {
|
||||
// hidden: true,
|
||||
value: true,
|
||||
},
|
||||
collect_plugins: {
|
||||
// hidden: true,
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
onSuccess: function() {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function locateItemOrLocation(options={}) {
|
||||
|
||||
if (!options.item && !options.location) {
|
||||
|
Reference in New Issue
Block a user