use of org.jboss.hal.ballroom.Tabs in project console by hal.
the class RemotingView method init.
@PostConstruct
void init() {
// remote connector
Metadata connectorMetadata = mbuiContext.metadataRegistry().lookup(CONNECTOR_TEMPLATE);
connectorForm = new ModelNodeForm.Builder<NamedNode>(Ids.REMOTING_CONNECTOR_FORM, connectorMetadata).unboundFormItem(new PropertiesItem(PROPERTY), 1).onSave((form, changedValues) -> presenter.saveConnector(form, changedValues)).prepareReset(form -> presenter.resetConnector(form)).build();
registerAttachable(connectorForm);
// remote connector security
Metadata connectorSecurityMetadata = mbuiContext.metadataRegistry().lookup(CONNECTOR_SECURITY_TEMPLATE);
connectorSecurityForm = new ModelNodeForm.Builder<>(Ids.REMOTING_CONNECTOR_SECURITY_FORM, connectorSecurityMetadata).unboundFormItem(new PropertiesItem(PROPERTY), 2).singleton(() -> new Operation.Builder(SELECTED_CONNECTOR_SECURITY_TEMPLATE.resolve(presenter.selectedConnectorContext), READ_RESOURCE_OPERATION).build(), () -> presenter.createConnectorSecurity()).onSave((form, changedValues) -> presenter.saveConnectorSecurity(form, changedValues)).prepareReset(form -> presenter.resetConnectorSecurity(form)).prepareRemove(form -> presenter.removeConnectorSecurity(form)).build();
registerAttachable(connectorSecurityForm);
// remote connector security policy
Metadata connectorSecurityPolicyMetadata = mbuiContext.metadataRegistry().lookup(CONNECTOR_SECURITY_POLICY_TEMPLATE);
connectorSecurityPolicyForm = new ModelNodeForm.Builder<>(Ids.REMOTING_CONNECTOR_SECURITY_POLICY_FORM, connectorSecurityPolicyMetadata).singleton(() -> new Operation.Builder(SELECTED_CONNECTOR_SECURITY_POLICY_TEMPLATE.resolve(presenter.selectedConnectorContext), READ_RESOURCE_OPERATION).build(), () -> presenter.createConnectorSecurityPolicy()).onSave((form, changedValues) -> presenter.saveConnectorSecurityPolicy(changedValues)).prepareReset(form -> presenter.resetConnectorSecurityPolicy(form)).prepareRemove(form -> presenter.removeConnectorSecurityPolicy(form)).build();
registerAttachable(connectorSecurityPolicyForm);
// remote connector tabs
Tabs connectorTabs = new Tabs(Ids.REMOTING_CONNECTOR_TAB_CONTAINER);
connectorTabs.add(Ids.REMOTING_CONNECTOR_TAB, mbuiContext.resources().constants().attributes(), connectorForm.element());
connectorTabs.add(Ids.REMOTING_CONNECTOR_SECURITY_TAB, Names.SECURITY, connectorSecurityForm.element());
connectorTabs.add(Ids.REMOTING_CONNECTOR_SECURITY_POLICY_TAB, Names.POLICY, connectorSecurityPolicyForm.element());
connectorTable.element().parentNode.appendChild(connectorTabs.element());
// http connector
Metadata httpConnectorMetadata = mbuiContext.metadataRegistry().lookup(HTTP_CONNECTOR_TEMPLATE);
httpConnectorForm = new ModelNodeForm.Builder<NamedNode>(Ids.REMOTING_HTTP_CONNECTOR_FORM, httpConnectorMetadata).unboundFormItem(new PropertiesItem(PROPERTY), 2).onSave((form, changedValues) -> presenter.saveHttpConnector(form, changedValues)).prepareReset(form -> presenter.resetHttpConnector(form)).build();
registerAttachable(httpConnectorForm);
// http connector security
Metadata httpConnectorSecurityMetadata = mbuiContext.metadataRegistry().lookup(HTTP_CONNECTOR_SECURITY_TEMPLATE);
httpConnectorSecurityForm = new ModelNodeForm.Builder<>(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_FORM, httpConnectorSecurityMetadata).unboundFormItem(new PropertiesItem(PROPERTY), 2).singleton(() -> new Operation.Builder(SELECTED_HTTP_CONNECTOR_SECURITY_TEMPLATE.resolve(presenter.selectedHttpConnectorContext), READ_RESOURCE_OPERATION).build(), () -> presenter.createHttpConnectorSecurity()).onSave((form, changedValues) -> presenter.saveHttpConnectorSecurity(form, changedValues)).prepareReset(form -> presenter.resetHttpConnectorSecurity(form)).prepareRemove(form -> presenter.removeHttpConnectorSecurity(form)).build();
registerAttachable(httpConnectorSecurityForm);
// http connector security policy
Metadata httpConnectorSecurityPolicyMetadata = mbuiContext.metadataRegistry().lookup(HTTP_CONNECTOR_SECURITY_POLICY_TEMPLATE);
httpConnectorSecurityPolicyForm = new ModelNodeForm.Builder<>(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_POLICY_FORM, httpConnectorSecurityPolicyMetadata).singleton(() -> new Operation.Builder(SELECTED_HTTP_CONNECTOR_SECURITY_POLICY_TEMPLATE.resolve(presenter.selectedHttpConnectorContext), READ_RESOURCE_OPERATION).build(), () -> presenter.createHttpConnectorSecurityPolicy()).onSave((form, changedValues) -> presenter.saveHttpConnectorSecurityPolicy(changedValues)).prepareReset(form -> presenter.resetHttpConnectorSecurityPolicy(form)).prepareRemove(form -> presenter.removeHttpConnectorSecurityPolicy(form)).build();
registerAttachable(httpConnectorSecurityPolicyForm);
// http connector tabs
Tabs httpConnectorTabs = new Tabs(Ids.REMOTING_HTTP_CONNECTOR_TAB_CONTAINER);
httpConnectorTabs.add(Ids.REMOTING_HTTP_CONNECTOR_TAB, mbuiContext.resources().constants().attributes(), httpConnectorForm.element());
httpConnectorTabs.add(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_TAB, Names.SECURITY, httpConnectorSecurityForm.element());
httpConnectorTabs.add(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_POLICY_TAB, Names.POLICY, httpConnectorSecurityPolicyForm.element());
httpConnectorTable.element().parentNode.appendChild(httpConnectorTabs.element());
}
use of org.jboss.hal.ballroom.Tabs in project console by hal.
the class DataSourceView method setup.
@Override
public void setup() {
if (setup) {
return;
}
// The metadata for the "statistic" resources is only available fro existing data-sources.
// That's why we cannot setup the UI in the constructor like in other views and
// using wildcards in the address templates. As a workaround we defer the UI setup
// until the DS name is known and replace the wildcards with the DS name.
Metadata poolMeta;
Metadata jdbcMeta;
if (presenter.isXa()) {
poolMeta = metadataRegistry.lookup(XA_DATA_SOURCE_POOL_TEMPLATE.replaceWildcards(presenter.getDataSource()));
jdbcMeta = metadataRegistry.lookup(XA_DATA_SOURCE_JDBC_TEMPLATE.replaceWildcards(presenter.getDataSource()));
} else {
poolMeta = metadataRegistry.lookup(DATA_SOURCE_POOL_TEMPLATE.replaceWildcards(presenter.getDataSource()));
jdbcMeta = metadataRegistry.lookup(DATA_SOURCE_JDBC_TEMPLATE.replaceWildcards(presenter.getDataSource()));
}
nonXaTabs = new Tabs(Ids.DATA_SOURCE_RUNTIME_TAB_CONTAINER);
xaTabs = new Tabs(Ids.XA_DATA_SOURCE_RUNTIME_TAB_CONTAINER);
poolForm = new ModelNodeForm.Builder<>(Ids.DATA_SOURCE_RUNTIME_POOL_FORM, poolMeta).readOnly().includeRuntime().exclude(STATISTICS_ENABLED).exclude(XA_ATTRIBUTES).build();
nonXaTabs.add(Ids.DATA_SOURCE_RUNTIME_POOL_TAB, Names.POOL, poolForm.element());
xaPoolForm = new ModelNodeForm.Builder<>(Ids.XA_DATA_SOURCE_RUNTIME_POOL_FORM, poolMeta).readOnly().includeRuntime().exclude(STATISTICS_ENABLED).build();
xaTabs.add(Ids.XA_DATA_SOURCE_RUNTIME_POOL_TAB, Names.POOL, xaPoolForm.element());
jdbcForm = new ModelNodeForm.Builder<>(Ids.DATA_SOURCE_RUNTIME_JDBC_FORM, jdbcMeta).readOnly().includeRuntime().exclude(STATISTICS_ENABLED).build();
nonXaTabs.add(Ids.DATA_SOURCE_RUNTIME_JDBC_TAB, Names.JDBC, jdbcForm.element());
xaJdbcForm = new ModelNodeForm.Builder<>(Ids.XA_DATA_SOURCE_RUNTIME_JDBC_FORM, jdbcMeta).readOnly().includeRuntime().exclude(STATISTICS_ENABLED).build();
xaTabs.add(Ids.XA_DATA_SOURCE_RUNTIME_JDBC_TAB, Names.JDBC, xaJdbcForm.element());
HTMLElement root = row().add(column().add(header = h(1).textContent(Names.DATASOURCE).element()).add(p().css(clearfix).add(a().css(clickable, pullRight).on(click, event -> refresh()).add(span().css(fontAwesome("refresh"), marginRight5)).add(span().textContent(resources.constants().refresh())))).add(nonXaTabs).add(xaTabs)).element();
registerAttachables(asList(poolForm, xaPoolForm, jdbcForm, xaJdbcForm));
initElement(root);
setup = true;
}
use of org.jboss.hal.ballroom.Tabs 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);
}
use of org.jboss.hal.ballroom.Tabs in project console by hal.
the class HaPolicyView method createColocated.
private void createColocated(HaPolicy haPolicy) {
Metadata colocatedMetadata = metadataRegistry.lookup(haPolicy.template);
Form<ModelNode> colocatedForm = form(haPolicy);
Form<ModelNode> masterForm = form(haPolicy.master);
Form<ModelNode> slaveForm = form(haPolicy.slave);
Tabs tabs = new Tabs(Ids.build(haPolicy.baseId, Ids.TAB_CONTAINER));
tabs.add(Ids.build(haPolicy.baseId, Ids.TAB), resources.constants().attributes(), colocatedForm.element());
tabs.add(Ids.build(haPolicy.master.baseId, Ids.TAB), Names.MASTER, masterForm.element());
tabs.add(Ids.build(haPolicy.slave.baseId, Ids.TAB), Names.SLAVE, slaveForm.element());
HTMLElement element = section().css(clearfix).add(h(1).textContent(haPolicy.type)).add(a().css(clickable, pullRight).on(click, event -> presenter.resetHaPolicy()).textContent(resources.constants().remove())).add(p().textContent(colocatedMetadata.getDescription().getDescription())).add(tabs).element();
policyForms.put(haPolicy, colocatedForm);
policyForms.put(haPolicy.master, masterForm);
policyForms.put(haPolicy.slave, slaveForm);
policyElements.put(haPolicy, element);
}
use of org.jboss.hal.ballroom.Tabs in project console by hal.
the class RemoteActiveMQView method init.
@PostConstruct
void init() {
Metadata metadata = mbuiContext.metadataRegistry().lookup(POOLED_CONNECTION_FACTORY_REMOTE_TEMPLATE);
crForm = cr.form(Ids.MESSAGING_REMOTE_ACTIVEMQ, 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_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, Ids.TABLE), metadata).button(mbuiContext.resources().constants().add(), table -> presenter.addConnectionFactory(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY), Constraint.executable(POOLED_CONNECTION_FACTORY_TEMPLATE, ADD)).button(mbuiContext.resources().constants().remove(), table -> presenter.remove(RemoteActiveMQSubResource.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(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY, form, changedValues)).prepareReset(form -> presenter.reset(RemoteActiveMQSubResource.POOLED_CONNECTION_FACTORY, form)).build();
pooledConnectionFactoryForm.addFormValidation(new CredentialReference.AlternativeValidation<>(PASSWORD, () -> crForm.getModel(), mbuiContext.resources()));
Tabs tabs = new Tabs(Ids.build(Ids.MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, Ids.TAB_CONTAINER));
tabs.add(Ids.build(Ids.MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, ATTRIBUTES, Ids.TAB), mbuiContext.resources().constants().attributes(), pooledConnectionFactoryForm.element());
tabs.add(Ids.build(Ids.MESSAGING_REMOTE_ACTIVEMQ, 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);
String primId = Ids.build(MESSAGING_REMOTE_ACTIVEMQ, POOLED_CONNECTION_FACTORY, Ids.ITEM);
navigation.insertPrimary(primId, "msg-remote-external-queue-item", Names.POOLED_CONNECTION_FACTORY, pfIcon("replicator"), htmlSection);
}
Aggregations