Skip to content

Commit

Permalink
HAL-1303: Adjust PR
Browse files Browse the repository at this point in the history
  • Loading branch information
hpehl committed Sep 27, 2018
1 parent 43144c3 commit cca82d6
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ static List<String> filterData(Role role) {
private final List<String> standardRoleNames;

@Inject
public RoleColumn(final Finder finder,
final ColumnActionFactory columnActionFactory,
final MetadataRegistry metadataRegistry,
final StatementContext statementContext,
final Dispatcher dispatcher,
final EventBus eventBus,
final @Footer Provider<Progress> progress,
final AccessControl accessControl,
final AccessControlTokens tokens,
final Environment environment,
final Settings settings,
final Resources resources) {
public RoleColumn(Finder finder,
ColumnActionFactory columnActionFactory,
MetadataRegistry metadataRegistry,
StatementContext statementContext,
Dispatcher dispatcher,
EventBus eventBus,
@Footer Provider<Progress> progress,
AccessControl accessControl,
AccessControlTokens tokens,
Environment environment,
Settings settings,
Resources resources) {

super(new Builder<Role>(finder, Ids.ROLE, resources.constants().role())
.itemsProvider((context, callback) -> {
Expand Down Expand Up @@ -319,14 +319,14 @@ public void onSuccess(FlowContext context) {
}
});
});
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}


// ------------------------------------------------------ modify roles

private void editStandardRole(final Role role) {
private void editStandardRole(Role role) {
Metadata metadata = metadataRegistry.lookup(ROLE_MAPPING_TEMPLATE);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.ROLE_MAPPING_FORM, metadata)
.unboundFormItem(new NameItem(), 0)
Expand Down Expand Up @@ -409,7 +409,7 @@ public void onSuccess(FlowContext context) {

// ------------------------------------------------------ remove roles

private void removeScopedRole(Role role, final String type) {
private void removeScopedRole(Role role, String type) {
List<Task<FlowContext>> tasks = new ArrayList<>();
List<Assignment> assignments = accessControl.assignments().byRole(role).collect(toList());
if (!assignments.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.jboss.hal.client.configuration;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.inject.Inject;
Expand Down Expand Up @@ -56,6 +55,7 @@
import org.jboss.hal.spi.MessageEvent;
import org.jboss.hal.spi.Requires;

import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.joining;
import static org.jboss.hal.dmr.ModelDescriptionConstants.CLONE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.INCLUDES;
Expand All @@ -74,17 +74,17 @@ public class ProfileColumn extends FinderColumn<NamedNode> {
private final Resources resources;

@Inject
public ProfileColumn(final Finder finder,
final Dispatcher dispatcher,
final EventBus eventBus,
final PlaceManager placeManager,
final Places places,
final FinderPathFactory finderPathFactory,
final CrudOperations crud,
final ColumnActionFactory columnActionFactory,
final ItemActionFactory itemActionFactory,
final StatementContext statementContext,
final Resources resources) {
public ProfileColumn(Finder finder,
Dispatcher dispatcher,
EventBus eventBus,
PlaceManager placeManager,
Places places,
FinderPathFactory finderPathFactory,
CrudOperations crud,
ColumnActionFactory columnActionFactory,
ItemActionFactory itemActionFactory,
StatementContext statementContext,
Resources resources) {

super(new Builder<NamedNode>(finder, Ids.PROFILE, Names.PROFILE)
.itemsProvider((context, callback) ->
Expand Down Expand Up @@ -160,7 +160,7 @@ public String nextColumn() {
});

addColumnAction(columnActionFactory.add(Ids.PROFILE_ADD, Names.PROFILE,
PROFILE_TEMPLATE,Collections.singletonList(INCLUDES), this::createUniqueValidation));
PROFILE_TEMPLATE, singletonList(INCLUDES), this::createUniqueValidation));
addColumnAction(columnActionFactory.refresh(Ids.PROFILE_REFRESH));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void addCache(CacheType cacheType) {
crud.add(cacheType.type, name, address, model,
(n, a) -> this.refresh(Ids.build(cacheType.baseId, name)));
});
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ private void addRemoteCacheContainer() {
refresh(Ids.remoteCacheContainer(name));
});
});
dialog.addValidationHandlerForNameItem(createUniqueValidationFromFilteredItems(CacheContainer::isRemote));
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(
createUniqueValidationFromFilteredItems(CacheContainer::isRemote));
dialog.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected MailSessionColumn(Finder finder,
});
}
});
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}));
addColumnAction(columnActionFactory.refresh(Ids.MAIL_SESSION_REFRESH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
import org.jboss.hal.spi.Requires;

import static java.util.Arrays.asList;
import static org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.*;
import static org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.CONNECTION_FACTORY_TEMPLATE;
import static org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.JMS_BRIDGE_TEMPLATE;
import static org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.MESSAGING_SUBSYSTEM_TEMPLATE;
import static org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.POOLED_CONNECTION_FACTORY_TEMPLATE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.JMS_BRIDGE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
import static org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes;
Expand All @@ -64,15 +67,15 @@ static <T> void registerSuggestionHandler(Dispatcher dispatcher, StatementContex
}

@Inject
public JmsBridgeColumn(final Finder finder,
final ColumnActionFactory columnActionFactory,
final ItemActionFactory itemActionFactory,
final MetadataRegistry metadataRegistry,
final Dispatcher dispatcher,
final CrudOperations crud,
final StatementContext statementContext,
final Places places,
final Resources resources) {
public JmsBridgeColumn(Finder finder,
ColumnActionFactory columnActionFactory,
ItemActionFactory itemActionFactory,
MetadataRegistry metadataRegistry,
Dispatcher dispatcher,
CrudOperations crud,
StatementContext statementContext,
Places places,
Resources resources) {

super(new FinderColumn.Builder<NamedNode>(finder, Ids.JMS_BRIDGE, Names.JMS_BRIDGE)
.itemsProvider((context, callback) -> crud.readChildren(MESSAGING_SUBSYSTEM_TEMPLATE, JMS_BRIDGE,
Expand All @@ -91,12 +94,13 @@ public JmsBridgeColumn(final Finder finder,
.requiredOnly()
.build();
registerSuggestionHandler(dispatcher, statementContext, form);
AddResourceDialog dialog = new AddResourceDialog(resources.messages().addResourceTitle(Names.JMS_BRIDGE),
AddResourceDialog dialog = new AddResourceDialog(
resources.messages().addResourceTitle(Names.JMS_BRIDGE),
form, (name, model) -> crud.add(Names.JMS_BRIDGE, name, JMS_BRIDGE_TEMPLATE, model,
(n, a) -> {
refresh(Ids.jmsBridge(n));
}));
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}));
addColumnAction(columnActionFactory.refresh(Ids.JMS_BRIDGE_REFRESH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

import static org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.*;
import static org.jboss.hal.dmr.ModelDescriptionConstants.ADD;
import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
import static org.jboss.hal.dmr.ModelDescriptionConstants.PATH;
import static org.jboss.hal.dmr.ModelDescriptionConstants.SERVER;
import static org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes;
Expand Down Expand Up @@ -196,7 +197,8 @@ public ServerColumn(Finder finder,
e.getMessage()))));
}
});
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(
createUniqueValidation());
dialog.show();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public ResourceAdapterColumn(Finder finder,
resources.messages().addResourceTitle(Names.RESOURCE_ADAPTER), form,
(name, model) -> crud.add(Names.RESOURCE_ADAPTER, name, RESOURCE_ADAPTER_TEMPLATE, model,
(n, a) -> refresh(Ids.resourceAdapter(n))));
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public void onSuccess(FlowContext context) {
.addResourceSuccess(Names.UNMANAGED_DEPLOYMENT, name)));
}
}));
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ public class ServerGroupDeploymentColumn extends FinderColumn<ServerGroupDeploym
private final Resources resources;

@Inject
public ServerGroupDeploymentColumn(final Finder finder,
final ColumnActionFactory columnActionFactory,
final ItemActionFactory itemActionFactory,
final Environment environment,
final EventBus eventBus,
final Dispatcher dispatcher,
final Places places,
final ServerActions serverActions,
final StatementContext statementContext,
final MetadataRegistry metadataRegistry,
final @Footer Provider<Progress> progress,
final Resources resources) {
public ServerGroupDeploymentColumn(Finder finder,
ColumnActionFactory columnActionFactory,
ItemActionFactory itemActionFactory,
Environment environment,
EventBus eventBus,
Dispatcher dispatcher,
Places places,
ServerActions serverActions,
StatementContext statementContext,
MetadataRegistry metadataRegistry,
@Footer Provider<Progress> progress,
Resources resources) {

super(new FinderColumn.Builder<ServerGroupDeployment>(finder, Ids.SERVER_GROUP_DEPLOYMENT, Names.DEPLOYMENT)
.useFirstActionAsBreadcrumbHandler()
Expand Down Expand Up @@ -184,12 +184,12 @@ public void onSuccess(FlowContext context) {
setBreadcrumbItemsProvider((context, callback) ->
itemsProvider.get(context, new AsyncCallback<List<ServerGroupDeployment>>() {
@Override
public void onFailure(final Throwable caught) {
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}

@Override
public void onSuccess(final List<ServerGroupDeployment> result) {
public void onSuccess(List<ServerGroupDeployment> result) {
// only running deployments w/ a reference server will show up in the breadcrumb dropdown
List<ServerGroupDeployment> deploymentsOnServer = result.stream()
.filter(ServerGroupDeployment::runningWithReferenceServer)
Expand Down Expand Up @@ -408,7 +408,7 @@ public void onSuccess(FlowContext context) {
});
}
});
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public void onSuccess(FlowContext context) {
.addResourceSuccess(Names.UNMANAGED_DEPLOYMENT, name)));
}
}));
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidation());
dialog.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.jboss.hal.client.deployment.dialog;

import org.jboss.hal.ballroom.form.Form;
import org.jboss.hal.ballroom.form.FormItemValidation;
import org.jboss.hal.client.configuration.PathsAutoComplete;
import org.jboss.hal.core.mbui.dialog.AddResourceDialog;
import org.jboss.hal.core.mbui.dialog.NameItem;
Expand Down Expand Up @@ -76,8 +75,8 @@ public AddUnmanagedDialog(Metadata metadata, Resources resources, AddResourceDia
});
}

public void addValidationHandlerForNameItem(FormItemValidation<String> validationHandler) {
dialog.addValidationHandlerForNameItem(validationHandler);
public Form<ModelNode> getForm() {
return dialog.getForm();
}

public void show() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ public void onMetadata(Metadata metadata) {
resources.messages().addResourceSuccess(Names.SERVER,
serverName), (name, address1) -> refresh(RESTORE_SELECTION));
});
dialog.addValidationHandlerForNameItem(createUniqueValidation());
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(
createUniqueValidation());
dialog.show();
form.<String>getFormItem(GROUP).setValue(statementContext.selectedServerGroup());
}
Expand Down
11 changes: 6 additions & 5 deletions config/src/main/java/org/jboss/hal/config/Role.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import jsinterop.annotations.JsType;
import org.jboss.hal.resources.Ids;
import org.jboss.hal.spi.EsReturn;
import org.jboss.hal.spi.NamedObject;
import org.jetbrains.annotations.NonNls;

/** A standard or scoped role used when RBAC is turned on. */
Expand Down Expand Up @@ -72,13 +73,13 @@ public enum Type {
private boolean includeAll;

@JsIgnore
public Role(@NonNls final String name) {
public Role(@NonNls String name) {
this(name, null, Type.STANDARD, Collections.emptySet());
}

@JsIgnore
public Role(@NonNls final String name, final Role baseRole, final Type type,
final Iterable<String> scope) {
public Role(@NonNls String name, Role baseRole, Type type,
Iterable<String> scope) {
this.name = name;
this.baseRole = baseRole;
this.type = type;
Expand All @@ -91,7 +92,7 @@ public Role(@NonNls final String name, final Role baseRole, final Type type,

@Override
@JsIgnore
public boolean equals(final Object o) {
public boolean equals(Object o) {
if (this == o) {
return true;
}
Expand Down Expand Up @@ -170,7 +171,7 @@ public boolean isIncludeAll() {
}

@JsIgnore
public void setIncludeAll(final boolean includeAll) {
public void setIncludeAll(boolean includeAll) {
this.includeAll = includeAll;
}

Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/org/jboss/hal/core/CrudOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public void add(String id, String type, AddressTemplate template, Iterable<Strin
public void onMetadata(Metadata metadata) {
AddResourceDialog dialog = new AddResourceDialog(id, resources.messages().addResourceTitle(type),
metadata, attributes, (name, model) -> add(type, name, template, model, callback));
dialog.addValidationHandlerForNameItem(nameItemValidator);
if (nameItemValidator != null) {
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(nameItemValidator);
}
dialog.show();
}
});
Expand Down
Loading

0 comments on commit cca82d6

Please sign in to comment.