use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class RealmsPresenter method addPropertiesRealm.
// ------------------------------------------------------ properties realm
void addPropertiesRealm() {
Metadata metadata = metadataRegistry.lookup(PROPERTIES_REALM_TEMPLATE);
Metadata upMetadata = metadata.forComplexAttribute(USERS_PROPERTIES, true);
upMetadata.copyComplexAttributeAttributes(asList(PATH, RELATIVE_TO), metadata);
String id = Ids.build(Ids.ELYTRON_PROPERTIES_REALM, Ids.ADD);
NameItem nameItem = new NameItem();
Form<ModelNode> form = new ModelNodeForm.Builder<>(id, metadata).addOnly().unboundFormItem(nameItem, 0).include(PATH, RELATIVE_TO, GROUPS_ATTRIBUTE).build();
form.getFormItem(RELATIVE_TO).registerSuggestHandler(new PathsAutoComplete());
new AddResourceDialog(resources.messages().addResourceTitle(Names.PROPERTIES_REALM), form, (name, model) -> {
if (model != null) {
move(model, PATH, USERS_PROPERTIES + "/" + PATH);
move(model, RELATIVE_TO, USERS_PROPERTIES + "/" + RELATIVE_TO);
}
ResourceAddress address = PROPERTIES_REALM_TEMPLATE.resolve(statementContext, nameItem.getValue());
crud.add(Names.PROPERTIES_REALM, name, address, model, (n, a) -> reload(PROPERTIES_REALM, nodes -> getView().updateResourceElement(PROPERTIES_REALM, nodes)));
}).show();
}
use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class RealmsPresenter method addJdbcRealm.
void addJdbcRealm() {
Metadata metadata = metadataRegistry.lookup(JDBC_REALM_TEMPLATE).forComplexAttribute(PRINCIPAL_QUERY);
NameItem nameItem = new NameItem();
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(Ids.ELYTRON_JDBC_REALM, Ids.ADD), metadata).addOnly().requiredOnly().unboundFormItem(nameItem, 0).build();
AddResourceDialog dialog = new AddResourceDialog(resources.messages().addResourceTitle(Names.JDBC_REALM), form, (n1, model) -> {
ModelNode payload = new ModelNode();
payload.get(PRINCIPAL_QUERY).add(model);
crud.add(Names.JDBC_REALM, nameItem.getValue(), JDBC_REALM_TEMPLATE, payload, (n2, address) -> reloadJdbcRealms());
});
dialog.show();
}
use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class FilterPresenter method addResponseHeader.
void addResponseHeader() {
Metadata metadata = metadataRegistry.lookup(RESPONSE_HEADER_TEMPLATE);
ModelNodeForm<ModelNode> form = new ModelNodeForm.Builder<>(Ids.UNDERTOW_RESPONSE_HEADER_ADD, metadata).unboundFormItem(new NameItem(), 0).fromRequestProperties().build();
List<String> responseHeader = Arrays.stream(ResponseHeader.values()).map(ResponseHeader::header).collect(toList());
form.getFormItem(HEADER_NAME).registerSuggestHandler(new StaticAutoComplete(responseHeader));
AddResourceDialog dialog = new AddResourceDialog(resources.messages().addResourceTitle(Names.RESPONSE_HEADER), form, (name, model) -> {
// noinspection ConstantConditions
SafeHtml successMessage = resources.messages().addResourceSuccess(Names.RESPONSE_HEADER, model.get(HEADER_NAME).asString());
crud.add(name, RESPONSE_HEADER_TEMPLATE, model, successMessage, (n, a) -> reload());
});
dialog.show();
}
use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class SocketBindingGroupPresenter method addSocketBinding.
// ------------------------------------------------------ nested socket binding resources
void addSocketBinding(SocketBinding socketBinding) {
Metadata metadata = metadataRegistry.lookup(ROOT_TEMPLATE.append(socketBinding.templateSuffix()));
NameItem nameItem = new NameItem();
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(socketBinding.baseId, Ids.ADD), metadata).unboundFormItem(nameItem, 0).fromRequestProperties().build();
FormItem<Object> formItem = form.getFormItem(SOCKET_BINDING_REF);
if (formItem != null) {
AddressTemplate template = ROOT_TEMPLATE.append(INBOUND.templateSuffix());
formItem.registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, template));
}
AddResourceDialog dialog = new AddResourceDialog(resources.messages().addResourceTitle(socketBinding.type), form, (name, model) -> {
name = nameItem.getValue();
ResourceAddress address = SELECTED_TEMPLATE.append(socketBinding.templateSuffix()).resolve(statementContext, name);
crud.add(socketBinding.type, name, address, model, (n, a) -> reload());
});
dialog.show();
}
use of org.jboss.hal.core.mbui.dialog.NameItem in project console by hal.
the class ServerPresenter method addLocation.
void addLocation() {
Metadata metadata = metadataRegistry.lookup(LOCATION_TEMPLATE);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.UNDERTOW_HOST_LOCATION_ADD, metadata).unboundFormItem(new NameItem(), 0).fromRequestProperties().build();
form.getFormItem(HANDLER).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, HANDLER_SUGGESTIONS));
AddResourceDialog dialog = new AddResourceDialog(resources.messages().addResourceTitle(Names.LOCATION), form, (name, model) -> {
ResourceAddress address = SELECTED_HOST_TEMPLATE.append(LOCATION + EQUALS + encodeValue(name)).resolve(statementContext);
crud.add(Names.LOCATION, name, address, model, (n, a) -> reloadLocation());
});
dialog.show();
}
Aggregations