2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Plugin missing fix (#5653)

* Add 'is_installed' property to PluginConfig model

- Allow us to show users which plugins are "outdated"

* Cleanup plugin table

- Display clearly if a plugin is no longer installed

* Fixes for plugin table

* Revert change due to failing CI
This commit is contained in:
Oliver
2023-10-03 19:44:10 +11:00
committed by GitHub
parent 88314da7b3
commit 78905a45c7
5 changed files with 50 additions and 24 deletions

View File

@ -45,34 +45,24 @@ function loadPluginTable(table, options={}) {
return '{% trans "No plugins found" %}';
},
columns: [
{
field: 'active',
title: '',
sortable: true,
formatter: function(value, row) {
if (row.active) {
return `<span class='fa fa-check-circle icon-green' title='{% trans "This plugin is active" %}'></span>`;
} else {
return `<span class='fa fa-times-circle icon-red' title ='{% trans "This plugin is not active" %}'></span>`;
}
}
},
{
field: 'name',
title: '{% trans "Plugin Description" %}',
title: '{% trans "Plugin" %}',
sortable: true,
switchable: false,
formatter: function(value, row) {
let html = '';
if (row.active) {
html += `<strong>${value}</strong>`;
if (row.meta && row.meta.description) {
html += ` - <small>${row.meta.description}</small>`;
}
if (!row.is_installed) {
html += `<span class='fa fa-question-circle' title='{% trans "This plugin is no longer installed" %}'></span>`;
} else if (row.active) {
html += `<span class='fa fa-check-circle icon-green' title='{% trans "This plugin is active" %}'></span>`;
} else {
html += `<em>${value}</em>`;
html += `<span class='fa fa-times-circle icon-red' title ='{% trans "This plugin is installed but not active" %}'></span>`;
}
html += `&nbsp;<span>${value}</span>`;
if (row.is_builtin) {
html += `<span class='badge bg-success rounded-pill badge-right'>{% trans "Builtin" %}</span>`;
}
@ -84,6 +74,12 @@ function loadPluginTable(table, options={}) {
return html;
}
},
{
field: 'meta.description',
title: '{% trans "Description" %}',
sortable: false,
switchable: true,
},
{
field: 'meta.version',
title: '{% trans "Version" %}',
@ -104,15 +100,18 @@ function loadPluginTable(table, options={}) {
{
field: 'meta.author',
title: '{% trans "Author" %}',
sortable: false,
},
{
field: 'actions',
title: '',
switchable: false,
sortable: false,
formatter: function(value, row) {
let buttons = '';
// Check if custom plugins are enabled for this instance
if (options.custom && !row.is_builtin) {
if (options.custom && !row.is_builtin && row.is_installed) {
if (row.active) {
buttons += makeIconButton('fa-stop-circle icon-red', 'btn-plugin-disable', row.pk, '{% trans "Disable Plugin" %}');
} else {

View File

@ -471,6 +471,10 @@ function getPluginTableFilters() {
type: 'bool',
title: '{% trans "Sample" %}',
},
installed: {
type: 'bool',
title: '{% trans "Installed" %}'
},
};
}