use of org.jboss.hal.ballroom.form.Form in project console by hal.
the class ClusteringPresenter method addBridge.
void addBridge(ServerSubResource ssr) {
Metadata metadata = metadataRegistry.lookup(ssr.template);
NameItem nameItem = new NameItem();
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(ssr.baseId, Ids.ADD), metadata).unboundFormItem(nameItem, 0).fromRequestProperties().include(QUEUE_NAME, DISCOVERY_GROUP, STATIC_CONNECTORS).unsorted().build();
List<AddressTemplate> templates = asList(SELECTED_SERVER_TEMPLATE.append(CONNECTOR + EQ_WILDCARD), SELECTED_SERVER_TEMPLATE.append(IN_VM_CONNECTOR + EQ_WILDCARD), SELECTED_SERVER_TEMPLATE.append(HTTP_CONNECTOR + EQ_WILDCARD), SELECTED_SERVER_TEMPLATE.append(REMOTE_CONNECTOR + EQ_WILDCARD));
form.getFormItem(DISCOVERY_GROUP).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, SELECTED_SERVER_TEMPLATE.append(DISCOVERY_GROUP + EQ_WILDCARD)));
form.getFormItem(STATIC_CONNECTORS).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, templates));
new AddResourceDialog(resources.messages().addResourceTitle(ssr.type), form, (name, model) -> {
name = nameItem.getValue();
ResourceAddress address = SELECTED_SERVER_TEMPLATE.append(ssr.resource + "=" + name).resolve(statementContext);
crud.add(ssr.type, name, address, model, (n, a) -> reload());
}).show();
}
use of org.jboss.hal.ballroom.form.Form in project console by hal.
the class ConnectionPresenter method addHttpConnector.
void addHttpConnector() {
ServerSubResource ssr = ServerSubResource.HTTP_CONNECTOR;
Metadata metadata = metadataRegistry.lookup(ssr.template);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(ssr.baseId, Ids.ADD), metadata).unboundFormItem(new NameItem(), 0).fromRequestProperties().requiredOnly().build();
form.getFormItem(SOCKET_BINDING).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, AddressTemplate.of("/socket-binding-group=*/socket-binding=*")));
form.getFormItem(ENDPOINT).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, AddressTemplate.of("/{selected.profile}/subsystem=messaging-activemq/server=*/http-acceptor=*")));
new AddResourceDialog(ssr.type, form, (name, model) -> {
ResourceAddress address = SELECTED_SERVER_TEMPLATE.append(ssr.resource + EQ + name).resolve(statementContext);
crud.add(ssr.type, name, address, model, (n, a) -> reload());
}).show();
}
use of org.jboss.hal.ballroom.form.Form in project console by hal.
the class ConnectionPresenter method addPooledConnectionFactory.
void addPooledConnectionFactory(ServerSubResource ssr) {
Metadata metadata = metadataRegistry.lookup(ssr.template);
NameItem nameItem = new NameItem();
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(ssr.baseId, Ids.ADD), metadata).unboundFormItem(nameItem, 0).fromRequestProperties().include("entries", DISCOVERY_GROUP, CONNECTORS).unsorted().build();
List<AddressTemplate> templates = asList(SELECTED_SERVER_TEMPLATE.append(CONNECTOR + EQ_WILDCARD), SELECTED_SERVER_TEMPLATE.append(IN_VM_CONNECTOR + EQ_WILDCARD), SELECTED_SERVER_TEMPLATE.append(HTTP_CONNECTOR + EQ_WILDCARD), SELECTED_SERVER_TEMPLATE.append(REMOTE_CONNECTOR + EQ_WILDCARD));
form.getFormItem(DISCOVERY_GROUP).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, SELECTED_SERVER_TEMPLATE.append(DISCOVERY_GROUP + EQ_WILDCARD)));
form.getFormItem(CONNECTORS).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, templates));
new AddResourceDialog(resources.messages().addResourceTitle(ssr.type), form, (name, model) -> {
name = nameItem.getValue();
ResourceAddress address = SELECTED_SERVER_TEMPLATE.append(ssr.resource + EQ + name).resolve(statementContext);
crud.add(ssr.type, name, address, model, (n, a) -> reload());
}).show();
}
use of org.jboss.hal.ballroom.form.Form in project console by hal.
the class ConnectionView method init.
@PostConstruct
void init() {
Metadata metadata = mbuiContext.metadataRegistry().lookup(POOLED_CONNECTION_FACTORY_TEMPLATE);
crForm = cr.form(Ids.MESSAGING_SERVER, metadata, CREDENTIAL_REFERENCE, PASSWORD, () -> pooledConnectionFactoryForm.<String>getFormItem(PASSWORD).getValue(), () -> presenter.pooledConnectionFactoryAddress(pooledConnectionFactoryTable.hasSelection() ? pooledConnectionFactoryTable.selectedRow().getName() : null), () -> presenter.reload());
pooledConnectionFactoryTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(MESSAGING_SERVER, POOLED_CONNECTION_FACTORY, Ids.TABLE), metadata).button(mbuiContext.resources().constants().add(), table -> presenter.addPooledConnectionFactory(ServerSubResource.POOLED_CONNECTION_FACTORY), Constraint.executable(POOLED_CONNECTION_FACTORY_TEMPLATE, ADD)).button(mbuiContext.resources().constants().remove(), table -> presenter.remove(ServerSubResource.POOLED_CONNECTION_FACTORY, table.selectedRow()), Scope.SELECTED, Constraint.executable(POOLED_CONNECTION_FACTORY_TEMPLATE, REMOVE)).column(NAME, (cell, type, row, meta) -> row.getName()).build();
pooledConnectionFactoryForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(Ids.MESSAGING_POOLED_CONNECTION_FACTORY, Ids.FORM), metadata).onSave((form, changedValues) -> presenter.save(ServerSubResource.POOLED_CONNECTION_FACTORY, form, changedValues)).prepareReset(form -> presenter.reset(ServerSubResource.POOLED_CONNECTION_FACTORY, form)).build();
pooledConnectionFactoryForm.addFormValidation(new CredentialReference.AlternativeValidation<>(PASSWORD, () -> crForm.getModel(), mbuiContext.resources()));
Tabs tabs = new Tabs(Ids.build(Ids.MESSAGING_SERVER, POOLED_CONNECTION_FACTORY, Ids.TAB_CONTAINER));
tabs.add(Ids.build(Ids.MESSAGING_SERVER, POOLED_CONNECTION_FACTORY, ATTRIBUTES, Ids.TAB), mbuiContext.resources().constants().attributes(), pooledConnectionFactoryForm.element());
tabs.add(Ids.build(Ids.MESSAGING_SERVER, POOLED_CONNECTION_FACTORY, CREDENTIAL_REFERENCE, Ids.TAB), Names.CREDENTIAL_REFERENCE, crForm.element());
HTMLElement htmlSection = section().add(h(1).textContent(Names.POOLED_CONNECTION_FACTORY)).add(p().textContent(metadata.getDescription().getDescription())).add(pooledConnectionFactoryTable).add(tabs).element();
registerAttachable(pooledConnectionFactoryTable, pooledConnectionFactoryForm, crForm);
navigation.insertPrimary(Ids.build(MESSAGING_SERVER, POOLED_CONNECTION_FACTORY, Ids.ITEM), null, Names.POOLED_CONNECTION_FACTORY, "pficon pficon-replicator", htmlSection);
}
use of org.jboss.hal.ballroom.form.Form in project console by hal.
the class DestinationView method init.
@PostConstruct
void init() {
Metadata roleMetadata = mbuiContext.metadataRegistry().lookup(ROLE_TEMPLATE);
roleTable = new ModelNodeTable.Builder<NamedNode>(Ids.MESSAGING_SECURITY_SETTING_ROLE_TABLE, roleMetadata).button(mbuiContext.tableButtonFactory().add(ROLE_TEMPLATE, table -> presenter.addSecuritySettingRole())).button(mbuiContext.tableButtonFactory().remove(ROLE_TEMPLATE, table -> presenter.removeSecuritySettingRole(table.selectedRow()))).column(SECURITY_SETTING, mbuiContext.resources().constants().pattern(), (cell, type, row, meta) -> row.get(SECURITY_SETTING).asString()).column(ROLE, mbuiContext.resources().constants().role(), (cell, type, row, meta) -> row.getName()).build();
roleForm = new ModelNodeForm.Builder<NamedNode>(Ids.MESSAGING_SECURITY_SETTING_ROLE_FORM, roleMetadata).onSave((form, changedValues) -> presenter.saveSecuritySettingRole(form, changedValues)).prepareReset(form -> presenter.resetSecuritySettingRole(form)).build();
registerAttachable(roleTable, roleForm);
HTMLElement roleSection = section().add(h(1).textContent(Names.SECURITY_SETTING)).add(p().textContent(roleMetadata.getDescription().getDescription())).add(roleTable).add(roleForm).element();
// noinspection HardCodedStringLiteral
navigation.insertPrimary(Ids.MESSAGING_SECURITY_SETTING_ROLE_ITEM, "messaging-address-setting-item", Names.SECURITY_SETTING, fontAwesome("lock"), roleSection);
}
Aggregations