use of org.jboss.hal.client.shared.uploadwizard.UploadElement 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.client.shared.uploadwizard.UploadElement in project console by hal.
the class ContentColumn method replace.
private void replace(Content content) {
UploadElement uploadElement = new UploadElement(resources.messages().noContent());
Dialog dialog = new Dialog.Builder(resources.constants().replaceContent()).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, content.getName()), // To replace an existing content, the original name and runtime-name must be preserved.
new UploadOrReplace(environment, dispatcher, content.getName(), content.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(content.getName()), error.getMessage()));
}
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.content(content.getName()));
replaceDeploymentPanel.off();
MessageEvent.fire(eventBus, Message.success(resources.messages().contentReplaceSuccess(content.getName())));
}
});
}
return valid;
}).build();
dialog.show();
}
Aggregations