use of org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates.BRIDGE_TEMPLATE in project console by hal.
the class ClusteringView method init.
@PostConstruct
void init() {
Metadata metadata = mbuiContext.metadataRegistry().lookup(BRIDGE_TEMPLATE);
crForm = cr.form(MESSAGING_SERVER, metadata, CREDENTIAL_REFERENCE, PASSWORD, () -> bridgeForm.<String>getFormItem(PASSWORD).getValue(), () -> presenter.bridgeAddress(bridgeTable.hasSelection() ? bridgeTable.selectedRow().getName() : null), () -> presenter.reload());
bridgeTable = new ModelNodeTable.Builder<NamedNode>(Ids.build(MESSAGING_SERVER, BRIDGE, Ids.TABLE), metadata).button(mbuiContext.resources().constants().add(), table -> presenter.addBridge(ServerSubResource.BRIDGE), Constraint.executable(BRIDGE_TEMPLATE, ADD)).button(mbuiContext.resources().constants().remove(), table -> presenter.remove(ServerSubResource.BRIDGE, table.selectedRow()), Scope.SELECTED, Constraint.executable(BRIDGE_TEMPLATE, REMOVE)).column(NAME, (cell, type, row, meta) -> row.getName()).build();
bridgeForm = new ModelNodeForm.Builder<NamedNode>(Ids.build(Ids.MESSAGING_BRIDGE, Ids.FORM), metadata).onSave((form, changedValues) -> presenter.save(ServerSubResource.BRIDGE, form, changedValues)).prepareReset(form -> presenter.reset(ServerSubResource.BRIDGE, form)).build();
bridgeForm.addFormValidation(new CredentialReference.AlternativeValidation<>(PASSWORD, () -> crForm.getModel(), mbuiContext.resources()));
Tabs tabs = new Tabs(Ids.build(MESSAGING_SERVER, BRIDGE, Ids.TAB_CONTAINER));
tabs.add(Ids.build(MESSAGING_SERVER, BRIDGE, ATTRIBUTES, Ids.TAB), mbuiContext.resources().constants().attributes(), bridgeForm.element());
tabs.add(Ids.build(MESSAGING_SERVER, BRIDGE, CREDENTIAL_REFERENCE, Ids.TAB), Names.CREDENTIAL_REFERENCE, crForm.element());
HTMLElement bridgeSection = section().add(h(1).textContent(Names.BRIDGE)).add(p().textContent(metadata.getDescription().getDescription())).add(bridgeTable).add(tabs).element();
registerAttachable(bridgeTable, bridgeForm, crForm);
navigation.insertPrimary(Ids.build(MESSAGING_SERVER, BRIDGE, Ids.ITEM), null, Names.BRIDGE, "fa fa-road", bridgeSection);
}
Aggregations