Search in sources :

Example 1 with ServerGroupDeployment

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

the class ContentColumn method undeploy.

private void undeploy(Content content) {
    if (!content.getServerGroupDeployments().isEmpty()) {
        Set<String> serverGroupsWithContent = content.getServerGroupDeployments().stream().map(ServerGroupDeployment::getServerGroup).collect(toSet());
        new DeployContentDialog1(content, serverGroupsWithContent, resources, (cnt, serverGroups) -> {
            List<Operation> operations = serverGroups.stream().map(serverGroup -> {
                ResourceAddress resourceAddress = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, content.getName());
                return new Operation.Builder(resourceAddress, REMOVE).build();
            }).collect(toList());
            dispatcher.execute(new Composite(operations), (CompositeResult cr) -> {
                refresh(RESTORE_SELECTION);
                MessageEvent.fire(eventBus, Message.success(resources.messages().contentUndeployed(content.getName())));
            });
        }).show();
    } else {
        MessageEvent.fire(eventBus, Message.warning(resources.messages().undeployedContent(content.getName())));
    }
}
Also used : Dialog(org.jboss.hal.ballroom.dialog.Dialog) LoadContent(org.jboss.hal.client.deployment.DeploymentTasks.LoadContent) Provider(javax.inject.Provider) Environment(org.jboss.hal.config.Environment) 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) AuthorisationDecision(org.jboss.hal.meta.security.AuthorisationDecision) UploadOrReplace(org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace) DeployContentDialog1(org.jboss.hal.client.deployment.dialog.DeployContentDialog1) Column(org.jboss.hal.spi.Column) HTMLElement(elemental2.dom.HTMLElement) Message(org.jboss.hal.spi.Message) Metadata(org.jboss.hal.meta.Metadata) Places(org.jboss.hal.core.mvp.Places) Names(org.jboss.hal.resources.Names) Collectors.toSet(java.util.stream.Collectors.toSet) UploadContentStep(org.jboss.hal.client.deployment.wizard.UploadContentStep) DeploymentState(org.jboss.hal.client.deployment.wizard.DeploymentState) DeploymentContext(org.jboss.hal.client.deployment.wizard.DeploymentContext) AddUnmanagedDialog(org.jboss.hal.client.deployment.dialog.AddUnmanagedDialog) Set(java.util.Set) Collectors.joining(java.util.stream.Collectors.joining) NAMES(org.jboss.hal.client.deployment.wizard.DeploymentState.NAMES) List(java.util.List) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) ROOT_ADDRESS(org.jboss.hal.client.deployment.ContentColumn.ROOT_ADDRESS) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) SecurityContextRegistry(org.jboss.hal.meta.security.SecurityContextRegistry) 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) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) ServerGroupDeployment(org.jboss.hal.core.deployment.ServerGroupDeployment) ModelNode(org.jboss.hal.dmr.ModelNode) MessageEvent.fire(org.jboss.hal.spi.MessageEvent.fire) MessageEvent(org.jboss.hal.spi.MessageEvent) Constraints(org.jboss.hal.meta.security.Constraints) 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) CONTENT_ADDRESS(org.jboss.hal.client.deployment.ContentColumn.CONTENT_ADDRESS) AddUnmanagedDeployment(org.jboss.hal.client.deployment.DeploymentTasks.AddUnmanagedDeployment) UPLOAD(org.jboss.hal.client.deployment.wizard.DeploymentState.UPLOAD) SERVER_GROUP_DEPLOYMENT_ADDRESS(org.jboss.hal.client.deployment.ContentColumn.SERVER_GROUP_DEPLOYMENT_ADDRESS) 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) PlaceRequest(com.gwtplatform.mvp.shared.proxy.PlaceRequest) ItemMonitor(org.jboss.hal.core.finder.ItemMonitor) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) Content(org.jboss.hal.core.deployment.Content) 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) DeployContentDialog1(org.jboss.hal.client.deployment.dialog.DeployContentDialog1) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList) Operation(org.jboss.hal.dmr.Operation)

Example 2 with ServerGroupDeployment

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

the class ContentColumn method deploy.

void deploy(Content content) {
    Operation operation = new Operation.Builder(ResourceAddress.root(), READ_CHILDREN_NAMES_OPERATION).param(CHILD_TYPE, SERVER_GROUP).build();
    dispatcher.execute(operation, result -> {
        Set<String> serverGroupsWithoutContent = result.asList().stream().map(ModelNode::asString).collect(toSet());
        Set<String> serverGroupsWithContent = content.getServerGroupDeployments().stream().map(ServerGroupDeployment::getServerGroup).collect(toSet());
        serverGroupsWithoutContent.removeAll(serverGroupsWithContent);
        if (serverGroupsWithoutContent.isEmpty()) {
            MessageEvent.fire(eventBus, Message.warning(resources.messages().contentAlreadyDeployedToAllServerGroups(content.getName())));
        } else {
            new DeployContentDialog1(content, serverGroupsWithoutContent, resources, (cnt, serverGroups, enable) -> {
                List<Operation> operations = serverGroups.stream().map(serverGroup -> {
                    ResourceAddress resourceAddress = new ResourceAddress().add(SERVER_GROUP, serverGroup).add(DEPLOYMENT, content.getName());
                    return new Operation.Builder(resourceAddress, ADD).param(RUNTIME_NAME, content.getRuntimeName()).param(ENABLED, enable).build();
                }).collect(toList());
                if (enable) {
                    ItemMonitor.startProgress(Ids.content(cnt.getName()));
                }
                dispatcher.execute(new Composite(operations), (CompositeResult cr) -> {
                    if (enable) {
                        ItemMonitor.stopProgress(Ids.content(cnt.getName()));
                    }
                    refresh(RESTORE_SELECTION);
                    MessageEvent.fire(eventBus, Message.success(resources.messages().contentDeployed1(content.getName())));
                });
            }).show();
        }
    });
}
Also used : Dialog(org.jboss.hal.ballroom.dialog.Dialog) LoadContent(org.jboss.hal.client.deployment.DeploymentTasks.LoadContent) Provider(javax.inject.Provider) Environment(org.jboss.hal.config.Environment) 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) AuthorisationDecision(org.jboss.hal.meta.security.AuthorisationDecision) UploadOrReplace(org.jboss.hal.client.deployment.DeploymentTasks.UploadOrReplace) DeployContentDialog1(org.jboss.hal.client.deployment.dialog.DeployContentDialog1) Column(org.jboss.hal.spi.Column) HTMLElement(elemental2.dom.HTMLElement) Message(org.jboss.hal.spi.Message) Metadata(org.jboss.hal.meta.Metadata) Places(org.jboss.hal.core.mvp.Places) Names(org.jboss.hal.resources.Names) Collectors.toSet(java.util.stream.Collectors.toSet) UploadContentStep(org.jboss.hal.client.deployment.wizard.UploadContentStep) DeploymentState(org.jboss.hal.client.deployment.wizard.DeploymentState) DeploymentContext(org.jboss.hal.client.deployment.wizard.DeploymentContext) AddUnmanagedDialog(org.jboss.hal.client.deployment.dialog.AddUnmanagedDialog) Set(java.util.Set) Collectors.joining(java.util.stream.Collectors.joining) NAMES(org.jboss.hal.client.deployment.wizard.DeploymentState.NAMES) List(java.util.List) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) ROOT_ADDRESS(org.jboss.hal.client.deployment.ContentColumn.ROOT_ADDRESS) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) SecurityContextRegistry(org.jboss.hal.meta.security.SecurityContextRegistry) 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) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) ServerGroupDeployment(org.jboss.hal.core.deployment.ServerGroupDeployment) ModelNode(org.jboss.hal.dmr.ModelNode) MessageEvent.fire(org.jboss.hal.spi.MessageEvent.fire) MessageEvent(org.jboss.hal.spi.MessageEvent) Constraints(org.jboss.hal.meta.security.Constraints) 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) CONTENT_ADDRESS(org.jboss.hal.client.deployment.ContentColumn.CONTENT_ADDRESS) AddUnmanagedDeployment(org.jboss.hal.client.deployment.DeploymentTasks.AddUnmanagedDeployment) UPLOAD(org.jboss.hal.client.deployment.wizard.DeploymentState.UPLOAD) SERVER_GROUP_DEPLOYMENT_ADDRESS(org.jboss.hal.client.deployment.ContentColumn.SERVER_GROUP_DEPLOYMENT_ADDRESS) 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) PlaceRequest(com.gwtplatform.mvp.shared.proxy.PlaceRequest) ItemMonitor(org.jboss.hal.core.finder.ItemMonitor) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) Content(org.jboss.hal.core.deployment.Content) 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) DeployContentDialog1(org.jboss.hal.client.deployment.dialog.DeployContentDialog1) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList) Operation(org.jboss.hal.dmr.Operation)

Example 3 with ServerGroupDeployment

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

the class ServerGroupDeploymentPresenter method reload.

@Override
protected void reload() {
    List<Task<FlowContext>> tasks = new ArrayList<>();
    tasks.add(new ReadServerGroupDeployments(environment, dispatcher, serverGroup, deployment));
    tasks.addAll(runningServers(environment, dispatcher, properties(SERVER_GROUP, serverGroup)));
    tasks.add(new LoadDeploymentsFromRunningServer(environment, dispatcher));
    series(new FlowContext(progress.get()), tasks).subscribe(new Outcome<FlowContext>() {

        @Override
        public void onError(FlowContext context, Throwable error) {
            MessageEvent.fire(getEventBus(), Message.error(resources.messages().deploymentReadError(deployment)));
        }

        @Override
        public void onSuccess(FlowContext context) {
            List<ServerGroupDeployment> serverGroupDeployments = context.get(DeploymentTasks.SERVER_GROUP_DEPLOYMENTS);
            if (!serverGroupDeployments.isEmpty()) {
                ServerGroupDeployment serverGroupDeployment = serverGroupDeployments.get(0);
                getView().update(serverGroup, serverGroupDeployment);
            } else {
                MessageEvent.fire(getEventBus(), Message.error(resources.messages().deploymentReadError(deployment)));
            }
        }
    });
}
Also used : ReadServerGroupDeployments(org.jboss.hal.client.deployment.DeploymentTasks.ReadServerGroupDeployments) ServerGroupDeployment(org.jboss.hal.core.deployment.ServerGroupDeployment) Task(org.jboss.hal.flow.Task) ArrayList(java.util.ArrayList) LoadDeploymentsFromRunningServer(org.jboss.hal.client.deployment.DeploymentTasks.LoadDeploymentsFromRunningServer) ArrayList(java.util.ArrayList) List(java.util.List) FlowContext(org.jboss.hal.flow.FlowContext)

Aggregations

ArrayList (java.util.ArrayList)3 List (java.util.List)3 ServerGroupDeployment (org.jboss.hal.core.deployment.ServerGroupDeployment)3 EventBus (com.google.web.bindery.event.shared.EventBus)2 PlaceRequest (com.gwtplatform.mvp.shared.proxy.PlaceRequest)2 HTMLElement (elemental2.dom.HTMLElement)2 Set (java.util.Set)2 Collectors.joining (java.util.stream.Collectors.joining)2 Collectors.toList (java.util.stream.Collectors.toList)2 Collectors.toSet (java.util.stream.Collectors.toSet)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 DialogFactory (org.jboss.hal.ballroom.dialog.DialogFactory)2 Wizard (org.jboss.hal.ballroom.wizard.Wizard)2 CONTENT_ADDRESS (org.jboss.hal.client.deployment.ContentColumn.CONTENT_ADDRESS)2 ROOT_ADDRESS (org.jboss.hal.client.deployment.ContentColumn.ROOT_ADDRESS)2 SERVER_GROUP_DEPLOYMENT_ADDRESS (org.jboss.hal.client.deployment.ContentColumn.SERVER_GROUP_DEPLOYMENT_ADDRESS)2 AddUnmanagedDeployment (org.jboss.hal.client.deployment.DeploymentTasks.AddUnmanagedDeployment)2