use of org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace 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.deployment.DeploymentTasks.UploadOrReplace 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();
}
use of org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace in project console by hal.
the class ContentColumn method uploadContent.
private void uploadContent() {
Metadata metadata = metadataRegistry.lookup(CONTENT_TEMPLATE);
Wizard<DeploymentContext, DeploymentState> wizard = new Wizard.Builder<DeploymentContext, DeploymentState>(resources.messages().addResourceTitle(resources.constants().content()), new DeploymentContext()).addStep(UPLOAD, new UploadContentStep(resources)).addStep(NAMES, new NamesStep(environment, metadata, resources)).onBack((context, currentState) -> currentState == NAMES ? UPLOAD : null).onNext((context, currentState) -> currentState == UPLOAD ? NAMES : null).stayOpenAfterFinish().onFinish((wzd, context) -> {
String name = context.name;
String runtimeName = context.runtimeName;
wzd.showProgress(resources.constants().uploadInProgress(), resources.messages().uploadInProgress(name));
series(new FlowContext(progress.get()), new CheckDeployment(dispatcher, name), new UploadOrReplace(environment, dispatcher, name, runtimeName, context.file, false)).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
wzd.showError(resources.constants().uploadError(), resources.messages().uploadError(name), error.getMessage());
}
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.content(name));
wzd.showSuccess(resources.constants().uploadSuccessful(), resources.messages().uploadSuccessful(name), resources.messages().view(resources.constants().content()), cxt -> {
/* nothing to do, content is already selected */
});
}
});
}).build();
wizard.show();
}
use of org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace in project console by hal.
the class ServerGroupDeploymentColumn method uploadAndDeploy.
private void uploadAndDeploy() {
Metadata metadata = metadataRegistry.lookup(SERVER_GROUP_DEPLOYMENT_TEMPLATE);
Wizard<DeploymentContext, DeploymentState> wizard = new Wizard.Builder<DeploymentContext, DeploymentState>(resources.messages().addResourceTitle(resources.constants().content()), new DeploymentContext()).addStep(UPLOAD, new UploadDeploymentStep(resources)).addStep(NAMES, new NamesStep(environment, metadata, resources)).onBack((context, currentState) -> currentState == NAMES ? UPLOAD : null).onNext((context, currentState) -> currentState == UPLOAD ? NAMES : null).stayOpenAfterFinish().onFinish((wzd, context) -> {
String name = context.name;
String runtimeName = context.runtimeName;
wzd.showProgress(resources.constants().deploymentInProgress(), resources.messages().deploymentInProgress(name));
series(new FlowContext(progress.get()), new CheckDeployment(dispatcher, name), new UploadOrReplace(environment, dispatcher, name, runtimeName, context.file, false), new AddServerGroupDeployment(environment, dispatcher, name, runtimeName, statementContext.selectedServerGroup())).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
wzd.showError(resources.constants().deploymentError(), resources.messages().deploymentError(name), error.getMessage());
}
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.serverGroupDeployment(statementContext.selectedServerGroup(), name));
wzd.showSuccess(resources.constants().deploymentSuccessful(), resources.messages().deploymentSuccessful(name), resources.messages().view(Names.DEPLOYMENT), cxt -> {
/* nothing to do, content is already selected */
});
}
});
}).build();
wizard.show();
}
use of org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace in project console by hal.
the class StandaloneDeploymentColumn method uploadDeployment.
private void uploadDeployment() {
Metadata metadata = metadataRegistry.lookup(DEPLOYMENT_TEMPLATE);
Wizard<DeploymentContext, DeploymentState> wizard = new Wizard.Builder<DeploymentContext, DeploymentState>(resources.messages().addResourceTitle(Names.DEPLOYMENT), new DeploymentContext()).addStep(UPLOAD, new UploadDeploymentStep(resources)).addStep(NAMES, new NamesStep(environment, metadata, resources)).onBack((context, currentState) -> currentState == NAMES ? UPLOAD : null).onNext((context, currentState) -> currentState == UPLOAD ? NAMES : null).stayOpenAfterFinish().onFinish((wzd, context) -> {
String name = context.name;
String runtimeName = context.runtimeName;
wzd.showProgress(resources.constants().deploymentInProgress(), resources.messages().deploymentInProgress(name));
series(new FlowContext(progress.get()), new CheckDeployment(dispatcher, name), new UploadOrReplace(environment, dispatcher, name, runtimeName, context.file, context.enabled)).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
wzd.showError(resources.constants().deploymentError(), resources.messages().deploymentError(name), error.getMessage());
}
@Override
public void onSuccess(FlowContext context) {
refresh(Ids.deployment(name));
wzd.showSuccess(resources.constants().uploadSuccessful(), resources.messages().uploadSuccessful(name), resources.messages().view(Names.DEPLOYMENT), cxt -> {
/* nothing to do, deployment is already selected */
});
}
});
}).build();
wizard.show();
}
Aggregations