use of org.jboss.hal.flow.FlowContext in project console by hal.
the class JmxPresenter method saveAuditLog.
void saveAuditLog(Map<String, Object> changedValues, boolean changedHandler, List<String> handler) {
if (!changedHandler) {
crud.saveSingleton(Names.AUDIT_LOG, AUDIT_LOG_TEMPLATE, changedValues, this::reload);
} else {
changedValues.remove(HANDLER);
Metadata metadata = metadataRegistry.lookup(AUDIT_LOG_TEMPLATE);
series(new FlowContext(progress.get()), new HandlerTasks.SaveAuditLog(dispatcher, statementContext, changedValues, metadata), new HandlerTasks.ReadHandlers(dispatcher, statementContext), new HandlerTasks.MergeHandler(dispatcher, statementContext, new HashSet<>(handler))).subscribe(new SuccessfulOutcome<FlowContext>(getEventBus(), resources) {
@Override
public void onSuccess(FlowContext context) {
reload();
}
});
}
}
use of org.jboss.hal.flow.FlowContext in project console by hal.
the class StandaloneDeploymentColumn method replace.
private void replace(Deployment deployment) {
UploadElement uploadElement = new UploadElement(resources.messages().noDeployment());
Dialog dialog = new Dialog.Builder(resources.constants().replaceDeployment()).add(uploadElement.element()).cancel().primary(resources.constants().replace(), () -> {
boolean valid = uploadElement.validate();
if (valid) {
ReplaceDeploymentPanel replaceDeploymentPanel = new ReplaceDeploymentPanel();
replaceDeploymentPanel.on();
series(new FlowContext(progress.get()), new CheckDeployment(dispatcher, deployment.getName()), // To replace an existing deployment, the original name and runtime-name must be preserved.
new UploadOrReplace(environment, dispatcher, deployment.getName(), deployment.getRuntimeName(), uploadElement.getFiles().item(0), false)).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
replaceDeploymentPanel.off();
MessageEvent.fire(eventBus, Message.error(resources.messages().contentReplaceError(deployment.getName()), error.getMessage()));
}
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.content(deployment.getName()));
replaceDeploymentPanel.off();
MessageEvent.fire(eventBus, Message.success(resources.messages().contentReplaceSuccess(deployment.getName())));
}
});
}
return valid;
}).build();
dialog.show();
}
use of org.jboss.hal.flow.FlowContext in project console by hal.
the class StandaloneDeploymentColumn method addUnmanaged.
private void addUnmanaged() {
Metadata metadata = metadataRegistry.lookup(DEPLOYMENT_TEMPLATE);
AddUnmanagedDialog dialog = new AddUnmanagedDialog(metadata, resources, (name, model) -> series(new FlowContext(progress.get()), new AddUnmanagedDeployment(dispatcher, name, model)).subscribe(new SuccessfulOutcome<FlowContext>(eventBus, resources) {
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.deployment(name));
MessageEvent.fire(eventBus, Message.success(resources.messages().addResourceSuccess(Names.UNMANAGED_DEPLOYMENT, name)));
}
}));
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}
use of org.jboss.hal.flow.FlowContext in project console by hal.
the class ContentColumn method addUnmanaged.
private void addUnmanaged() {
Metadata metadata = metadataRegistry.lookup(CONTENT_TEMPLATE);
AddUnmanagedDialog dialog = new AddUnmanagedDialog(metadata, resources, (name, model) -> series(new FlowContext(progress.get()), new AddUnmanagedDeployment(dispatcher, name, model)).subscribe(new org.jboss.hal.core.SuccessfulOutcome<FlowContext>(eventBus, resources) {
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.content(name));
MessageEvent.fire(eventBus, Message.success(resources.messages().addResourceSuccess(Names.UNMANAGED_DEPLOYMENT, name)));
}
}));
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}
use of org.jboss.hal.flow.FlowContext in project console by hal.
the class ServerGroupDeploymentColumn method addUnmanaged.
private void addUnmanaged() {
Metadata metadata = metadataRegistry.lookup(CONTENT_TEMPLATE);
AddUnmanagedDialog dialog = new AddUnmanagedDialog(metadata, resources, (name, model) -> {
if (model != null) {
String serverGroup = statementContext.selectedServerGroup();
String runtimeName = model.get(RUNTIME_NAME).asString();
series(new FlowContext(progress.get()), new AddUnmanagedDeployment(dispatcher, name, model), new AddServerGroupDeployment(environment, dispatcher, name, runtimeName, serverGroup)).subscribe(new SuccessfulOutcome<FlowContext>(eventBus, resources) {
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.serverGroupDeployment(serverGroup, name));
MessageEvent.fire(eventBus, Message.success(resources.messages().addResourceSuccess(Names.UNMANAGED_DEPLOYMENT, name)));
}
});
}
});
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}
Aggregations