Console: Better status feedback on manual reseed from URL

Reseed: Better status feedback and cleanup in summary bar
This commit is contained in:
zzz
2015-03-22 10:08:48 +00:00
parent 44c75187f5
commit 2c45378c6d
7 changed files with 79 additions and 24 deletions

View File

@ -450,13 +450,13 @@ public class ConfigClientsHandler extends FormHandler {
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
if (mgr == null)
return;
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 20; i++) {
if (!mgr.isUpdateInProgress(PLUGIN)) {
tmp.delete();
break;
}
try {
Thread.sleep(1000);
Thread.sleep(500);
} catch (InterruptedException ie) {}
}
String status = mgr.getStatus();

View File

@ -49,25 +49,23 @@ public class ConfigReseedHandler extends FormHandler {
addFormError(_("Reseeding is already in progress"));
} else {
// wait a while for completion but not forever
for (int i = 0; i < 20; i++) {
for (int i = 0; i < 40; i++) {
try {
Thread.sleep(1000);
Thread.sleep(500);
} catch (InterruptedException ie) {}
if (!_context.netDb().reseedChecker().inProgress()) {
String status = _context.netDb().reseedChecker().getStatus();
if (status.length() > 0)
addFormNotice(status);
else
addFormNotice(_("Ressed complete, check summary bar for status"));
return;
}
if (!_context.netDb().reseedChecker().inProgress())
break;
}
if (_context.netDb().reseedChecker().inProgress()) {
String status = _context.netDb().reseedChecker().getStatus();
if (status.length() > 0)
addFormNotice(status);
else
addFormNotice(_("Ressed in progress, check summary bar for status"));
String status = _context.netDb().reseedChecker().getStatus();
String error = _context.netDb().reseedChecker().getError();
if (error.length() > 0) {
addFormErrorNoEscape(error);
} else if (status.length() > 0) {
addFormNoticeNoEscape(status);
} else if (_context.netDb().reseedChecker().inProgress()) {
addFormNotice(_("Reseed in progress, check summary bar for status"));
} else {
addFormNotice(_("Reseed complete, check summary bar for status"));
}
}
} catch (IllegalArgumentException iae) {

View File

@ -152,6 +152,17 @@ public abstract class FormHandler {
_notices.add(msg);
}
/**
* Add an error message to display
* Use if it includes a link or other formatting.
* Does not escape '<' and '>' before queueing
* @since 0.9.19
*/
protected void addFormErrorNoEscape(String msg) {
if (msg == null) return;
_errors.add(msg);
}
/**
* Display everything, wrap it in a div for consistent presentation
*