mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 02:16:03 +00:00
Add uninstall plugin dynamic
This commit is contained in:
parent
f8866e09f3
commit
8c9f9e496d
@ -20,7 +20,8 @@ export function* deletePlugin() {
|
||||
}
|
||||
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
yield put(deletePluginSucceeded());
|
||||
window.Strapi.notification.error('app.components.listPluginsPage.deletePlugin.error');
|
||||
}
|
||||
}
|
||||
// Individual exports for testing
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
"app.components.ListPluginsPage.helmet.title": "List plugins",
|
||||
"app.components.ListPluginsPage.title": "Plugins",
|
||||
"app.components.ListPluginsPage.description": "List of the installed plugins in the project.",
|
||||
"app.components.listPluginsPage.deletePlugin.error": "An error occurred during the plugin uninstallation",
|
||||
"app.components.listPlugins.title.singular": "{number} plugin is installed",
|
||||
"app.components.listPlugins.title.plural": "{number} plugins are installed",
|
||||
"app.components.listPlugins.title.none": "No plugin is installed",
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
"app.components.ListPluginsPage.helmet.title": "List plugins",
|
||||
"app.components.ListPluginsPage.title": "Plugins",
|
||||
"app.components.ListPluginsPage.description": "Liste des plugins installés dans le projet.",
|
||||
"app.components.listPluginsPage.deletePlugin.error": "Une erreur est survenue pendant la désintallation",
|
||||
"app.components.listPlugins.title.singular": "{number} est disponible",
|
||||
"app.components.listPlugins.title.plural": "{number} sont disponibles",
|
||||
"app.components.listPlugins.title.none": "Aucun plugin n'est installé",
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const exec = require('child_process').execSync;
|
||||
|
||||
/**
|
||||
* A set of functions called "actions" for `Admin`
|
||||
@ -45,9 +46,17 @@ module.exports = {
|
||||
uninstallPlugin: async ctx => {
|
||||
try {
|
||||
const { plugin } = ctx.params;
|
||||
console.log('plugin', plugin);
|
||||
|
||||
strapi.reload.isWatching = false;
|
||||
|
||||
strapi.log.info(`Uninstalling ${plugin}...`);
|
||||
exec(`strapi uninstall ${plugin}`);
|
||||
|
||||
ctx.send({ ok: true });
|
||||
|
||||
strapi.reload();
|
||||
} catch(err) {
|
||||
strapi.reload.isWatching = true;
|
||||
ctx.badRequest(null, [{ messages: [{ id: 'An error occured' }] }]);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user