Skip to content

Commit

Permalink
admin/plugins: Fix UI in case of missed finished:uninstall event
Browse files Browse the repository at this point in the history
  • Loading branch information
webzwo0i committed Jul 30, 2023
1 parent 49d673b commit 05eddd0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/static/js/admin/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,26 @@ $(document).ready(() => {
// filter out epl
installed.list = installed.list.filter((plugin) => plugin.name !== 'ep_etherpad-lite');

// remove all installed plugins (leave plugins that are still being installed)
// Remove plugins from the list - they will be added later.
// Installed.list contains a list of plugins the server has successfully installed
// At this point plugins are ignored if:
// - they are being installed (as installed.list does not contain them yet)
// - they have been uninstalled (as installed.list does not contain them anymore)
installed.list.forEach((plugin) => {
$(`#installed-plugins .${plugin.name}`).remove();
});

// Remove outdated entries
const installedItems = $('#installed-plugins tr');
installedItems.each(function () {
const pluginName = $(this).attr('class');
const message = $(this).find('.progress .message').text();
// In case the finished:uninstall msg was missed, remove the plugin from the list
if (message === 'Uninstalling') {
$(`#installed-plugins .${pluginName}`).remove();
}
});

if (installed.list.length > 0) {
displayPluginList(installed.list, $('#installed-plugins'), $('#installed-plugin-template'));
window.console.log('before emit checkUpdates', new Date())
Expand Down

0 comments on commit 05eddd0

Please sign in to comment.