use of org.jboss.hal.dmr.Property in project console by hal.
the class DeploymentView method updateSessionAttributes.
@Override
public void updateSessionAttributes(List<Property> attributes) {
Elements.removeChildrenFrom(attributesTableBody);
for (Property attribute : attributes) {
attributesTableBody.appendChild(tr().add(td().textContent(attribute.getName())).add(td().textContent(attribute.getValue().asString())).element());
}
Elements.setVisible(attributesElement, !attributes.isEmpty());
}
use of org.jboss.hal.dmr.Property in project console by hal.
the class CacheContainerColumn method addRemoteCacheContainer.
private void addRemoteCacheContainer() {
Metadata rccMetadata = metadataRegistry.lookup(REMOTE_CACHE_CONTAINER_TEMPLATE);
Metadata rcMetadata = metadataRegistry.lookup(REMOTE_CLUSTER_TEMPLATE);
// add nested 'socket-bindings' attribute from 'remote-cluster' resource to top level metadata
String path = OPERATIONS + "/" + ADD + "/" + REQUEST_PROPERTIES;
Property socketBindingsDescription = rcMetadata.getDescription().findAttribute(path, SOCKET_BINDINGS);
failSafeGet(rccMetadata.getDescription(), path).get(SOCKET_BINDINGS).set(socketBindingsDescription.getValue());
ModelNode socketBindingsPermissions = failSafeGet(rcMetadata.getSecurityContext(), ATTRIBUTES + "/" + SOCKET_BINDINGS);
failSafeGet(rccMetadata.getSecurityContext(), ATTRIBUTES).get(SOCKET_BINDINGS).set(socketBindingsPermissions);
AddResourceDialog dialog = new AddResourceDialog(Ids.REMOTE_CACHE_CONTAINER_FORM, resources.messages().addResourceTitle(Names.REMOTE_CACHE_CONTAINER), rccMetadata, asList(DEFAULT_REMOTE_CLUSTER, SOCKET_BINDINGS), (name, model) -> {
String rcName = model.get(DEFAULT_REMOTE_CLUSTER).asString();
ModelNode socketBindings = model.remove(SOCKET_BINDINGS);
ResourceAddress rccAddress = REMOTE_CACHE_CONTAINER_TEMPLATE.resolve(statementContext, name);
ResourceAddress rcAddress = REMOTE_CLUSTER_TEMPLATE.resolve(statementContext, name, rcName);
List<Operation> operations = asList(new Operation.Builder(rccAddress, ADD).payload(model).build(), new Operation.Builder(rcAddress, ADD).param(SOCKET_BINDINGS, socketBindings).build());
dispatcher.execute(new Composite(operations), (CompositeResult result) -> {
MessageEvent.fire(eventBus, Message.success(resources.messages().addResourceSuccess(Names.REMOTE_CACHE_CONTAINER, name)));
refresh(Ids.remoteCacheContainer(name));
});
});
dialog.getForm().<String>getFormItem(NAME).addValidationHandler(createUniqueValidationFromFilteredItems(CacheContainer::isRemote));
dialog.show();
}
use of org.jboss.hal.dmr.Property in project console by hal.
the class CachePresenter method reload.
@Override
protected void reload() {
crud.readRecursive(resourceAddress(), result -> {
List<Property> properties = failSafePropertyList(result, MEMORY);
for (Property property : properties) {
if (property.getValue().isDefined()) {
memory = Memory.fromResource(property.getName());
break;
}
}
properties = failSafePropertyList(result, STORE);
for (Property property : properties) {
if (property.getValue().isDefined()) {
store = Store.fromResource(property.getName());
break;
}
}
getView().update(new Cache(cache, cacheType, result));
});
}
use of org.jboss.hal.dmr.Property in project console by hal.
the class HaPolicyPresenter method reload.
@Override
protected void reload() {
ResourceAddress address = SELECTED_SERVER_TEMPLATE.resolve(statementContext);
crud.readChildren(address, HA_POLICY, 2, children -> {
if (children.isEmpty()) {
haPolicy = null;
getView().empty();
} else {
Property child = children.get(0);
haPolicy = HaPolicy.fromResourceName(child.getName());
getView().update(haPolicy, child.getValue());
}
});
}
use of org.jboss.hal.dmr.Property in project console by hal.
the class ServletContainerView method update.
@Override
public void update(ModelNode payload) {
configurationForm.view(payload);
mimeMappingForm.view(new ModelNode());
mimeMappingItem.setValue(failSafePropertyList(payload, MIME_MAPPING).stream().collect(toMap(Property::getName, property -> property.getValue().get(VALUE).asString())));
welcomeFileForm.view(new ModelNode());
welcomeFileItem.setValue(failSafePropertyList(payload, WELCOME_FILE).stream().map(Property::getName).collect(toList()));
settings.forEach((settingType, form) -> form.view(failSafeGet(payload, settingType.path())));
}
Aggregations