Search in sources :

Example 1 with Deployment

use of org.jboss.hal.core.deployment.Deployment in project console by hal.

the class StandaloneDeploymentColumn method explodeSubs.

private void explodeSubs(Deployment deployment) {
    ResourceAddress address = new ResourceAddress().add(DEPLOYMENT, deployment.getName());
    Operation disable = new Operation.Builder(address, UNDEPLOY).build();
    Composite op = new Composite(disable);
    String id = Ids.deployment(deployment.getName());
    ItemMonitor.startProgress(id);
    deployment.getSubdeployments().forEach(subdeployment -> {
        Operation explode = new Operation.Builder(address, EXPLODE).param(PATH, subdeployment.getName()).build();
        op.add(explode);
    });
    dispatcher.execute(op, (Consumer<CompositeResult>) result -> {
        enable(deployment);
        MessageEvent.fire(eventBus, Message.success(resources.messages().deploymentExploded(deployment.getName())));
    }, (operation, failure) -> {
        ItemMonitor.stopProgress(id);
        SafeHtml message = failure.contains("WFLYDR0015") ? resources.messages().deploymentSubAlreadyExploded() : resources.messages().lastOperationException();
        MessageEvent.fire(eventBus, Message.error(message, failure));
    });
}
Also used : Dialog(org.jboss.hal.ballroom.dialog.Dialog) Provider(javax.inject.Provider) Environment(org.jboss.hal.config.Environment) Deployment(org.jboss.hal.core.deployment.Deployment) Constraint(org.jboss.hal.meta.security.Constraint) ItemActionFactory(org.jboss.hal.core.finder.ItemActionFactory) StatementContext(org.jboss.hal.meta.StatementContext) ItemDisplay(org.jboss.hal.core.finder.ItemDisplay) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) ManagementModel(org.jboss.hal.meta.ManagementModel) CheckDeployment(org.jboss.hal.client.deployment.DeploymentTasks.CheckDeployment) CreateEmptyDialog(org.jboss.hal.client.deployment.dialog.CreateEmptyDialog) UploadDeploymentStep(org.jboss.hal.client.deployment.wizard.UploadDeploymentStep) UploadOrReplace(org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace) Column(org.jboss.hal.spi.Column) HTMLElement(elemental2.dom.HTMLElement) Message(org.jboss.hal.spi.Message) Server(org.jboss.hal.core.runtime.server.Server) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) DEPLOYMENT_ADDRESS(org.jboss.hal.client.deployment.StandaloneDeploymentColumn.DEPLOYMENT_ADDRESS) DeploymentState(org.jboss.hal.client.deployment.wizard.DeploymentState) ServerActions(org.jboss.hal.core.runtime.server.ServerActions) DeploymentContext(org.jboss.hal.client.deployment.wizard.DeploymentContext) CrudOperations(org.jboss.hal.core.CrudOperations) AddUnmanagedDialog(org.jboss.hal.client.deployment.dialog.AddUnmanagedDialog) NAMES(org.jboss.hal.client.deployment.wizard.DeploymentState.NAMES) List(java.util.List) Status(org.jboss.hal.core.deployment.Deployment.Status) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) CLEAR_SELECTION(org.jboss.hal.core.finder.FinderColumn.RefreshMode.CLEAR_SELECTION) Flow.series(org.jboss.hal.flow.Flow.series) Finder(org.jboss.hal.core.finder.Finder) Footer(org.jboss.hal.spi.Footer) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) ModelNode(org.jboss.hal.dmr.ModelNode) MessageEvent(org.jboss.hal.spi.MessageEvent) SuccessfulOutcome(org.jboss.hal.core.SuccessfulOutcome) ColumnAction(org.jboss.hal.core.finder.ColumnAction) ItemAction(org.jboss.hal.core.finder.ItemAction) FlowContext(org.jboss.hal.flow.FlowContext) Outcome(org.jboss.hal.flow.Outcome) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) JsHelper(org.jboss.hal.js.JsHelper) Progress(org.jboss.hal.flow.Progress) AddressTemplate(org.jboss.hal.meta.AddressTemplate) AddUnmanagedDeployment(org.jboss.hal.client.deployment.DeploymentTasks.AddUnmanagedDeployment) UPLOAD(org.jboss.hal.client.deployment.wizard.DeploymentState.UPLOAD) RESTORE_SELECTION(org.jboss.hal.core.finder.FinderColumn.RefreshMode.RESTORE_SELECTION) FinderColumn(org.jboss.hal.core.finder.FinderColumn) ColumnActionFactory(org.jboss.hal.core.finder.ColumnActionFactory) Requires(org.jboss.hal.spi.Requires) CompositeResult(org.jboss.hal.dmr.CompositeResult) Operation(org.jboss.hal.dmr.Operation) NamesStep(org.jboss.hal.client.deployment.wizard.NamesStep) Ids(org.jboss.hal.resources.Ids) Wizard(org.jboss.hal.ballroom.wizard.Wizard) EventBus(com.google.web.bindery.event.shared.EventBus) CSS.pfIcon(org.jboss.hal.resources.CSS.pfIcon) ItemMonitor(org.jboss.hal.core.finder.ItemMonitor) Consumer(java.util.function.Consumer) Composite(org.jboss.hal.dmr.Composite) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) Collectors.toList(java.util.stream.Collectors.toList) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) Strings(org.jboss.hal.resources.Strings) UploadElement(org.jboss.hal.client.shared.uploadwizard.UploadElement) Elements.span(org.jboss.gwt.elemento.core.Elements.span) Composite(org.jboss.hal.dmr.Composite) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) CompositeResult(org.jboss.hal.dmr.CompositeResult) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Operation(org.jboss.hal.dmr.Operation)

Example 2 with Deployment

use of org.jboss.hal.core.deployment.Deployment in project console by hal.

the class StandaloneDeploymentPresenter method reload.

private void reload(int tab) {
    ResourceAddress address = new ResourceAddress().add(DEPLOYMENT, deployment);
    Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).build();
    dispatcher.execute(operation, result -> {
        getView().reset();
        getView().update(new Deployment(Server.STANDALONE, result), tab);
    });
}
Also used : ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Deployment(org.jboss.hal.core.deployment.Deployment) Operation(org.jboss.hal.dmr.Operation)

Example 3 with Deployment

use of org.jboss.hal.core.deployment.Deployment 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();
}
Also used : Dialog(org.jboss.hal.ballroom.dialog.Dialog) Provider(javax.inject.Provider) Environment(org.jboss.hal.config.Environment) Deployment(org.jboss.hal.core.deployment.Deployment) Constraint(org.jboss.hal.meta.security.Constraint) ItemActionFactory(org.jboss.hal.core.finder.ItemActionFactory) StatementContext(org.jboss.hal.meta.StatementContext) ItemDisplay(org.jboss.hal.core.finder.ItemDisplay) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) ManagementModel(org.jboss.hal.meta.ManagementModel) CheckDeployment(org.jboss.hal.client.deployment.DeploymentTasks.CheckDeployment) CreateEmptyDialog(org.jboss.hal.client.deployment.dialog.CreateEmptyDialog) UploadDeploymentStep(org.jboss.hal.client.deployment.wizard.UploadDeploymentStep) UploadOrReplace(org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace) Column(org.jboss.hal.spi.Column) HTMLElement(elemental2.dom.HTMLElement) Message(org.jboss.hal.spi.Message) Server(org.jboss.hal.core.runtime.server.Server) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) DEPLOYMENT_ADDRESS(org.jboss.hal.client.deployment.StandaloneDeploymentColumn.DEPLOYMENT_ADDRESS) DeploymentState(org.jboss.hal.client.deployment.wizard.DeploymentState) ServerActions(org.jboss.hal.core.runtime.server.ServerActions) DeploymentContext(org.jboss.hal.client.deployment.wizard.DeploymentContext) CrudOperations(org.jboss.hal.core.CrudOperations) AddUnmanagedDialog(org.jboss.hal.client.deployment.dialog.AddUnmanagedDialog) NAMES(org.jboss.hal.client.deployment.wizard.DeploymentState.NAMES) List(java.util.List) Status(org.jboss.hal.core.deployment.Deployment.Status) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) CLEAR_SELECTION(org.jboss.hal.core.finder.FinderColumn.RefreshMode.CLEAR_SELECTION) Flow.series(org.jboss.hal.flow.Flow.series) Finder(org.jboss.hal.core.finder.Finder) Footer(org.jboss.hal.spi.Footer) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) ModelNode(org.jboss.hal.dmr.ModelNode) MessageEvent(org.jboss.hal.spi.MessageEvent) SuccessfulOutcome(org.jboss.hal.core.SuccessfulOutcome) ColumnAction(org.jboss.hal.core.finder.ColumnAction) ItemAction(org.jboss.hal.core.finder.ItemAction) FlowContext(org.jboss.hal.flow.FlowContext) Outcome(org.jboss.hal.flow.Outcome) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) JsHelper(org.jboss.hal.js.JsHelper) Progress(org.jboss.hal.flow.Progress) AddressTemplate(org.jboss.hal.meta.AddressTemplate) AddUnmanagedDeployment(org.jboss.hal.client.deployment.DeploymentTasks.AddUnmanagedDeployment) UPLOAD(org.jboss.hal.client.deployment.wizard.DeploymentState.UPLOAD) RESTORE_SELECTION(org.jboss.hal.core.finder.FinderColumn.RefreshMode.RESTORE_SELECTION) FinderColumn(org.jboss.hal.core.finder.FinderColumn) ColumnActionFactory(org.jboss.hal.core.finder.ColumnActionFactory) Requires(org.jboss.hal.spi.Requires) CompositeResult(org.jboss.hal.dmr.CompositeResult) Operation(org.jboss.hal.dmr.Operation) NamesStep(org.jboss.hal.client.deployment.wizard.NamesStep) Ids(org.jboss.hal.resources.Ids) Wizard(org.jboss.hal.ballroom.wizard.Wizard) EventBus(com.google.web.bindery.event.shared.EventBus) CSS.pfIcon(org.jboss.hal.resources.CSS.pfIcon) ItemMonitor(org.jboss.hal.core.finder.ItemMonitor) Consumer(java.util.function.Consumer) Composite(org.jboss.hal.dmr.Composite) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) Collectors.toList(java.util.stream.Collectors.toList) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) Strings(org.jboss.hal.resources.Strings) UploadElement(org.jboss.hal.client.shared.uploadwizard.UploadElement) Elements.span(org.jboss.gwt.elemento.core.Elements.span) DeploymentState(org.jboss.hal.client.deployment.wizard.DeploymentState) CheckDeployment(org.jboss.hal.client.deployment.DeploymentTasks.CheckDeployment) Metadata(org.jboss.hal.meta.Metadata) FlowContext(org.jboss.hal.flow.FlowContext) DeploymentContext(org.jboss.hal.client.deployment.wizard.DeploymentContext) UploadOrReplace(org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace) SuccessfulOutcome(org.jboss.hal.core.SuccessfulOutcome) Outcome(org.jboss.hal.flow.Outcome) UploadDeploymentStep(org.jboss.hal.client.deployment.wizard.UploadDeploymentStep) NamesStep(org.jboss.hal.client.deployment.wizard.NamesStep) Wizard(org.jboss.hal.ballroom.wizard.Wizard)

Aggregations

Deployment (org.jboss.hal.core.deployment.Deployment)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 EventBus (com.google.web.bindery.event.shared.EventBus)2 HTMLElement (elemental2.dom.HTMLElement)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Collectors.toList (java.util.stream.Collectors.toList)2 Inject (javax.inject.Inject)2 Provider (javax.inject.Provider)2 Elements.span (org.jboss.gwt.elemento.core.Elements.span)2 Dialog (org.jboss.hal.ballroom.dialog.Dialog)2 Wizard (org.jboss.hal.ballroom.wizard.Wizard)2 AddUnmanagedDeployment (org.jboss.hal.client.deployment.DeploymentTasks.AddUnmanagedDeployment)2 CheckDeployment (org.jboss.hal.client.deployment.DeploymentTasks.CheckDeployment)2 UploadOrReplace (org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace)2 DEPLOYMENT_ADDRESS (org.jboss.hal.client.deployment.StandaloneDeploymentColumn.DEPLOYMENT_ADDRESS)2 AddUnmanagedDialog (org.jboss.hal.client.deployment.dialog.AddUnmanagedDialog)2 CreateEmptyDialog (org.jboss.hal.client.deployment.dialog.CreateEmptyDialog)2 DeploymentContext (org.jboss.hal.client.deployment.wizard.DeploymentContext)2