use of org.jboss.hal.resources.Messages in project console by hal.
the class TopologyTasks method reloadBlocking.
// ------------------------------------------------------ topology
/**
* Show a blocking verification dialog and executes the specified operation.
*/
public static void reloadBlocking(Dispatcher dispatcher, EventBus eventBus, Operation operation, String type, String name, String urlConsole, Resources resources) {
Messages messages = resources.messages();
String title = messages.restart(name);
dispatcher.execute(operation, result -> DialogFactory.buildBlocking(title, Dialog.Size.MEDIUM, messages.reloadConsoleRedirect(urlConsole)).show(), (operation1, failure) -> MessageEvent.fire(eventBus, Message.error(messages.reloadErrorCause(type, name, failure))), (operation1, exception) -> MessageEvent.fire(eventBus, Message.error(messages.reloadErrorCause(type, name, exception.getMessage()))));
}
use of org.jboss.hal.resources.Messages in project console by hal.
the class ApplyPatchWizard method show.
public void show() {
Messages messages = resources.messages();
Wizard.Builder<PatchContext, PatchState> wb = new Wizard.Builder<>(messages.addResourceTitle(Names.PATCH), new PatchContext());
checkServersState(servers -> {
if (servers != null) {
wb.addStep(CHECK_SERVERS, new CheckRunningServersStep(resources, servers, statementContext.selectedHost()));
}
wb.addStep(UPLOAD, new UploadPatchStep(resources)).addStep(CONFIGURE, new ConfigurationStep(metadata, resources)).onBack((context, currentState) -> {
PatchState previous = null;
switch(currentState) {
case CHECK_SERVERS:
break;
case UPLOAD:
previous = CHECK_SERVERS;
break;
case CONFIGURE:
previous = UPLOAD;
break;
default:
break;
}
return previous;
}).onNext((context, currentState) -> {
PatchState next = null;
switch(currentState) {
case CHECK_SERVERS:
next = UPLOAD;
break;
case UPLOAD:
next = CONFIGURE;
break;
case CONFIGURE:
break;
default:
break;
}
return next;
}).stayOpenAfterFinish().onFinish((wzd, context) -> {
String name = context.file.name;
wzd.showProgress(resources.constants().patchInProgress(), messages.patchInProgress(name));
series(new FlowContext(progress.get()), new UploadPatch(statementContext, dispatcher, serverActions, context)).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext flowContext, Throwable error) {
wzd.showError(resources.constants().patchError(), messages.patchAddError(name, error.getMessage()), error.getMessage());
}
@Override
public void onSuccess(FlowContext context) {
callback.execute();
wzd.showSuccess(resources.constants().patchSuccessful(), messages.patchSucessfullyApplied(name), messages.view(Names.PATCH), cxt -> {
/* nothing to do, content is already selected */
});
}
});
});
Wizard<PatchContext, PatchState> wizard = wb.build();
wizard.show();
});
}
use of org.jboss.hal.resources.Messages in project console by hal.
the class PatchesColumn method checkHostState.
/**
* Checks if the host or standalone server is in restart mode, if yes then asks user to restart host/server, as it must be
* restarted before a patch can be installed or to call a rollback on an installed patch.
*/
private void checkHostState(Callback callback) {
Messages messages = resources.messages();
if (environment.isStandalone()) {
Operation operation = new Operation.Builder(ResourceAddress.root(), READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).param(ATTRIBUTES_ONLY, true).build();
dispatcher.execute(operation, result -> {
Server.STANDALONE.addServerAttributes(result);
if (Server.STANDALONE.needsRestart()) {
serverActions.restartStandalone(Server.STANDALONE, messages.patchRestartStandaloneQuestion());
} else {
callback.execute();
}
});
} else {
ResourceAddress address = new ResourceAddress().add(HOST, statementContext.selectedHost());
Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).param(ATTRIBUTES_ONLY, true).build();
dispatcher.execute(operation, result -> {
Property prop = new Property(statementContext.selectedHost(), result);
Host host = new Host(prop);
if (host.needsRestart()) {
SafeHtml question = host.isDomainController() ? messages.patchRestartDomainControllerQuestion(host.getName()) : messages.patchRestartHostControllerQuestion(host.getName());
hostActions.restart(host, question);
} else {
callback.execute();
}
});
}
}
use of org.jboss.hal.resources.Messages in project console by hal.
the class RollbackWizard method show.
public void show() {
Messages messages = resources.messages();
Wizard.Builder<PatchContext, PatchState> wb = new Wizard.Builder<>(resources.constants().rollback(), new PatchContext());
checkServersState(servers -> {
if (servers != null) {
wb.addStep(CHECK_SERVERS, new CheckRunningServersStep(resources, servers, statementContext.selectedHost()));
}
wb.addStep(ROLLBACK, new org.jboss.hal.client.patching.wizard.RollbackStep(metadata, resources, statementContext.selectedHost(), patchId)).onBack((context, currentState) -> {
PatchState previous = null;
switch(currentState) {
case CHECK_SERVERS:
break;
case ROLLBACK:
previous = CHECK_SERVERS;
break;
default:
break;
}
return previous;
}).onNext((context, currentState) -> {
PatchState next = null;
switch(currentState) {
case CHECK_SERVERS:
next = ROLLBACK;
break;
case ROLLBACK:
break;
default:
break;
}
return next;
}).stayOpenAfterFinish().onFinish((wzd, context) -> {
String name = context.patchId;
wzd.showProgress(resources.constants().rollbackInProgress(), messages.rollbackInProgress(name));
series(new FlowContext(progress.get()), new RollbackTask(statementContext, dispatcher, serverActions, context)).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
wzd.showError(resources.constants().rollbackError(), messages.rollbackError(error.getMessage()), error.getMessage());
}
@Override
public void onSuccess(FlowContext context) {
callback.execute();
wzd.showSuccess(resources.constants().rollbackSuccessful(), messages.rollbackSucessful(name));
}
});
});
Wizard<PatchContext, PatchState> wizard = wb.build();
wizard.show();
});
}
Aggregations