forked from I2P_Developers/i2p.i2p
* Console: Implement webapp state detection and stop button for webapps
on /configclients (Ticket #1025)
This commit is contained in:
@ -123,6 +123,8 @@ public class ConfigClientsHandler extends FormHandler {
|
|||||||
if (appnum >= 0) {
|
if (appnum >= 0) {
|
||||||
stopClient(appnum);
|
stopClient(appnum);
|
||||||
} else {
|
} else {
|
||||||
|
List<String> plugins = PluginStarter.getPlugins();
|
||||||
|
if (plugins.contains(app)) {
|
||||||
try {
|
try {
|
||||||
PluginStarter.stopPlugin(_context, app);
|
PluginStarter.stopPlugin(_context, app);
|
||||||
addFormNotice(_("Stopped plugin {0}", app));
|
addFormNotice(_("Stopped plugin {0}", app));
|
||||||
@ -130,6 +132,10 @@ public class ConfigClientsHandler extends FormHandler {
|
|||||||
addFormError(_("Error stopping plugin {0}", app) + ": " + e);
|
addFormError(_("Error stopping plugin {0}", app) + ": " + e);
|
||||||
_log.error("Error stopping plugin " + app, e);
|
_log.error("Error stopping plugin " + app, e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
WebAppStarter.stopWebApp(app);
|
||||||
|
addFormNotice(_("Stopped webapp {0}", app));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -145,9 +145,10 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
if (name.startsWith(RouterConsoleRunner.PREFIX) && name.endsWith(RouterConsoleRunner.ENABLED)) {
|
if (name.startsWith(RouterConsoleRunner.PREFIX) && name.endsWith(RouterConsoleRunner.ENABLED)) {
|
||||||
String app = name.substring(RouterConsoleRunner.PREFIX.length(), name.lastIndexOf(RouterConsoleRunner.ENABLED));
|
String app = name.substring(RouterConsoleRunner.PREFIX.length(), name.lastIndexOf(RouterConsoleRunner.ENABLED));
|
||||||
String val = props.getProperty(name);
|
String val = props.getProperty(name);
|
||||||
|
boolean isRunning = WebAppStarter.isWebAppRunning(app);
|
||||||
renderForm(buf, app, app, !"addressbook".equals(app),
|
renderForm(buf, app, app, !"addressbook".equals(app),
|
||||||
"true".equals(val), RouterConsoleRunner.ROUTERCONSOLE.equals(app), app + ".war",
|
"true".equals(val), RouterConsoleRunner.ROUTERCONSOLE.equals(app), app + ".war",
|
||||||
false, false, false, false, false, true);
|
false, false, false, isRunning, false, !isRunning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.append("</table>\n");
|
buf.append("</table>\n");
|
||||||
|
Reference in New Issue
Block a user