Skip to content

Commit

Permalink
Merge pull request hal#355 from michpetrov/hal-1640
Browse files Browse the repository at this point in the history
HAL-1640: fix the scope of host-related meatadata requirements
  • Loading branch information
hpehl authored Dec 20, 2019
2 parents 5578359 + 83ff6ad commit d8bd669
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@
import org.jboss.hal.spi.Footer;
import org.jboss.hal.spi.Requires;

import static org.jboss.hal.client.runtime.BrowseByColumn.DC_ADDRESS;
import static org.jboss.hal.client.runtime.BrowseByColumn.ANY_HOST;
import static org.jboss.hal.client.runtime.BrowseByColumn.SERVER_CONFIG_ADDRESS;
import static org.jboss.hal.client.runtime.BrowseByColumn.SERVER_GROUP_ADDRESS;

@Column(Ids.DOMAIN_BROWSE_BY)
@Requires(value = {DC_ADDRESS, SERVER_GROUP_ADDRESS, SERVER_CONFIG_ADDRESS}, recursive = false)
@Requires(value = {ANY_HOST, SERVER_GROUP_ADDRESS, SERVER_CONFIG_ADDRESS}, recursive = false)
public class BrowseByColumn extends StaticItemColumn {

// necessary for the constraints in topology preview
static final String DC_ADDRESS = "/{domain.controller}";
static final String ANY_HOST = "/host=*";
static final String SERVER_GROUP_ADDRESS = "/server-group=*";
static final String SERVER_CONFIG_ADDRESS = "/{domain.controller}/server-config=*";
static final String SERVER_CONFIG_ADDRESS = ANY_HOST + "/server-config=*";

public static boolean browseByHosts(FinderContext context) {
FinderSegment firstSegment = context.getPath().iterator().next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@
public class ConfigurationChangesPresenter extends
ApplicationFinderPresenter<ConfigurationChangesPresenter.MyView, ConfigurationChangesPresenter.MyProxy> {

public static final String HOST_CONFIGURATION_CHANGES_ADDRESS = "{selected.host}/subsystem=core-management/service=configuration-changes";
public static final String CONFIGURATION_CHANGES_ADDRESS = "/subsystem=core-management/service=configuration-changes";
public static final String HOST_CONFIGURATION_CHANGES_ADDRESS = "{selected.host}" + CONFIGURATION_CHANGES_ADDRESS;
public static final AddressTemplate HOST_CONFIGURATION_CHANGES_TEMPLATE = AddressTemplate.of(
HOST_CONFIGURATION_CHANGES_ADDRESS);
private static final String SERVER_CONFIGURATION_CHANGES_ADDRESS = "/{selected.host}/{selected.server}/subsystem=core-management/service=configuration-changes";
private static final String SERVER_CONFIGURATION_CHANGES_ADDRESS = "/{selected.host}/{selected.server}" + CONFIGURATION_CHANGES_ADDRESS;
public static final AddressTemplate SERVER_CONFIGURATION_CHANGES_TEMPLATE = AddressTemplate.of(
SERVER_CONFIGURATION_CHANGES_ADDRESS);
private static final String PROFILE_CONFIGURATION_CHANGES_ADDRESS = "/profile=*/subsystem=core-management/service=configuration-changes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@

import org.jboss.hal.meta.AddressTemplate;

import static org.jboss.hal.client.runtime.configurationchanges.ConfigurationChangesPresenter.CONFIGURATION_CHANGES_ADDRESS;

interface AddressTemplates {

String DOMAIN_CONTROLLER = "{domain.controller}";
String SELECTED_HOST = "{selected.host}";
String ANY_HOST = "host=*";

String ELYTRON_ADDRESS = DOMAIN_CONTROLLER + "/subsystem=elytron";
String HTTP_INTERFACE_ADDRESS = SELECTED_HOST + "/core-service=management/management-interface=http-interface";
String HTTP_INTERFACE_ADDRESS = ANY_HOST + "/core-service=management/management-interface=http-interface";
String HOST_CONNECTION_ADDRESS = "/core-service=management/host-connection=*";
String HOST_CONFIGURATION_CHANGES_ADDRESS = DOMAIN_CONTROLLER + "/subsystem=core-management/service=configuration-changes";
String HOST_MANAGEMENT_OPERATIONS_ADDRESS = DOMAIN_CONTROLLER + "/core-service=management/service=management-operations";
String INTERFACE_ADDRESS = SELECTED_HOST + "/interface=*";
String JVM_ADDRESS = SELECTED_HOST + "/jvm=*";
String NATIVE_INTERFACE_ADDRESS = SELECTED_HOST + "/core-service=management/management-interface=native-interface";
String PATH_ADDRESS = SELECTED_HOST + "/path=*";
String SOCKET_BINDING_GROUP_ADDRESS = SELECTED_HOST + "/socket-binding-group=*";
String SYSTEM_PROPERTY_ADDRESS = SELECTED_HOST + "/system-property=*";
String HOST_CONFIGURATION_CHANGES_ADDRESS = ANY_HOST + CONFIGURATION_CHANGES_ADDRESS;
String HOST_MANAGEMENT_OPERATIONS_ADDRESS = ANY_HOST + "/core-service=management/service=management-operations";
String INTERFACE_ADDRESS = ANY_HOST + "/interface=*";
String JVM_ADDRESS = ANY_HOST + "/jvm=*";
String NATIVE_INTERFACE_ADDRESS = ANY_HOST + "/core-service=management/management-interface=native-interface";
String PATH_ADDRESS = ANY_HOST + "/path=*";
String SOCKET_BINDING_GROUP_ADDRESS = ANY_HOST + "/socket-binding-group=*";
String SYSTEM_PROPERTY_ADDRESS = ANY_HOST + "/system-property=*";

AddressTemplate HTTP_INTERFACE_TEMPLATE = AddressTemplate.of(HTTP_INTERFACE_ADDRESS);
AddressTemplate NATIVE_INTERFACE_TEMPLATE = AddressTemplate.of(NATIVE_INTERFACE_ADDRESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
import static org.jboss.hal.client.runtime.configurationchanges.ConfigurationChangesPresenter.HOST_CONFIGURATION_CHANGES_TEMPLATE;
import static org.jboss.hal.client.runtime.configurationchanges.ConfigurationChangesPresenter.CONFIGURATION_CHANGES_ADDRESS;
import static org.jboss.hal.client.runtime.host.AddressTemplates.HOST_CONFIGURATION_CHANGES_ADDRESS;
import static org.jboss.hal.client.runtime.host.AddressTemplates.HOST_CONNECTION_ADDRESS;
import static org.jboss.hal.client.runtime.host.AddressTemplates.HOST_CONNECTION_TEMPLATE;
Expand Down Expand Up @@ -196,7 +196,7 @@ public List<ItemAction<Host>> actions() {
.with(HOST, item.getAddressName())
.build();
actions.add(itemActionFactory.placeRequest(resources.constants().configurationChanges(),
ccPlaceRequest, Constraint.executable(HOST_CONFIGURATION_CHANGES_TEMPLATE, ADD)));
ccPlaceRequest, Constraint.executable(hostTemplate(item).append(CONFIGURATION_CHANGES_ADDRESS), ADD)));
}
// TODO Add additional operations like :reload(admin-mode=true), :clean-obsolete-content or :take-snapshot
actions.add(ItemAction.separator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void reloadView() {

void saveHost(Form<Host> form, Map<String, Object> changedValues) {
boolean hostNameChanged = changedValues.containsKey(NAME);
crud.save(Names.HOST, form.getModel().getName(), AddressTemplate.of(SELECTED_HOST), changedValues, () -> {
crud.save(Names.HOST, form.getModel().getName(), AddressTemplate.of("/{selected.host}"), changedValues, () -> {
reload();
if (hostNameChanged) {
DialogFactory.showConfirmation(resources.constants().hostNameChanged(),
Expand Down Expand Up @@ -406,7 +406,7 @@ public void reloadServer(Host host, String urlConsole) {
// @formatter:off
@ProxyCodeSplit
@NameToken(NameTokens.HOST_CONFIGURATION)
@Requires(value = {SELECTED_HOST, INTERFACE_ADDRESS, JVM_ADDRESS, PATH_ADDRESS, SOCKET_BINDING_GROUP_ADDRESS,
@Requires(value = {ANY_HOST, INTERFACE_ADDRESS, JVM_ADDRESS, PATH_ADDRESS, SOCKET_BINDING_GROUP_ADDRESS,
SYSTEM_PROPERTY_ADDRESS, HTTP_INTERFACE_ADDRESS, NATIVE_INTERFACE_ADDRESS}, recursive = false)
public interface MyProxy extends ProxyPlace<HostPresenter> {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
import static java.util.Collections.emptyList;
import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.toList;
import static org.jboss.hal.client.runtime.configurationchanges.ConfigurationChangesPresenter.SERVER_CONFIGURATION_CHANGES_TEMPLATE;
import static org.jboss.hal.client.runtime.configurationchanges.ConfigurationChangesPresenter.CONFIGURATION_CHANGES_ADDRESS;
import static org.jboss.hal.core.finder.FinderColumn.RefreshMode.RESTORE_SELECTION;
import static org.jboss.hal.core.runtime.TopologyTasks.serversOfHost;
import static org.jboss.hal.core.runtime.TopologyTasks.serversOfServerGroup;
Expand All @@ -103,15 +103,17 @@
import static org.jboss.hal.resources.Ids.FORM;

@Column(Ids.SERVER)
@Requires(value = {"/{domain.controller}/server-config=*", "/{domain.controller}/server=*"}, recursive = false)
@Requires(value = {"/host=*/server-config=*", "/host=*/server=*", "/host=*/server=*" + CONFIGURATION_CHANGES_ADDRESS}, recursive = false)
public class ServerColumn extends FinderColumn<Server> implements ServerActionHandler, ServerResultHandler {

static final String HOST_KEY = "/host=";

static AddressTemplate serverConfigTemplate(Server server) {
return serverConfigTemplate(server.getHost());
}

static AddressTemplate serverConfigTemplate(String host) {
return AddressTemplate.of("/host=" + host + "/server-config=*");
return AddressTemplate.of(HOST_KEY + host + "/server-config=*");
}

private final Finder finder;
Expand Down Expand Up @@ -332,7 +334,7 @@ public List<ItemAction<Server>> actions() {
.build());
if (!item.isStarted()) {
AddressTemplate template = AddressTemplate
.of("/host=" + item.getHost() + "/server-config=" + item.getName());
.of(HOST_KEY + item.getHost() + "/server-config=" + item.getName());
actions.add(itemActionFactory.remove(Names.SERVER, item.getName(),
template, serverConfigTemplate(item), ServerColumn.this));
}
Expand All @@ -351,9 +353,11 @@ public List<ItemAction<Server>> actions() {
.nameToken(NameTokens.CONFIGURATION_CHANGES)
.with(params)
.build();
AddressTemplate template = AddressTemplate
.of(HOST_KEY + item.getHost() + "/server=" + item.getName())
.append(CONFIGURATION_CHANGES_ADDRESS);
actions.add(itemActionFactory.placeRequest(resources.constants().configurationChanges(),
ccPlaceRequest, Constraint.executable(SERVER_CONFIGURATION_CHANGES_TEMPLATE,
LIST_CHANGES_OPERATION)));
ccPlaceRequest, Constraint.executable(template, LIST_CHANGES_OPERATION)));
}

actions.add(ItemAction.separator());
Expand Down

0 comments on commit d8bd669

Please sign in to comment.