use of org.jboss.hal.meta.Metadata in project console by hal.
the class ModclusterView method init.
@PostConstruct
void init() {
// --------- load-provider=dynamic
Metadata dynamicMetadata = mbuiContext.metadataRegistry().lookup(LOAD_PROVIDER_DYNAMIC_TEMPLATE);
loadProviderDynamicForm = new ModelNodeForm.Builder<>("load-provider-dynamic-form", dynamicMetadata).singleton(() -> presenter.loadProviderDynamicOperation(), () -> presenter.addLoadProviderDynamic()).prepareRemove(form -> presenter.removeLoadProviderDynamic()).onSave((form, changedValues) -> {
String name = presenter.getProxyName();
AddressTemplate template = LOAD_PROVIDER_DYNAMIC_TEMPLATE.replaceWildcards(presenter.getProxyName());
saveForm(Names.LOAD_PROVIDER_DYNAMIC, name, template.resolve(mbuiContext.statementContext(), name), changedValues, dynamicMetadata);
}).prepareReset(form -> {
String name = presenter.getProxyName();
AddressTemplate template = LOAD_PROVIDER_DYNAMIC_TEMPLATE.replaceWildcards(presenter.getProxyName());
resetForm(Names.LOAD_PROVIDER_DYNAMIC, name, template.resolve(mbuiContext.statementContext(), name), form, dynamicMetadata);
}).build();
HTMLElement loadProviderDynamicElement = section().add(div().add(h(1).textContent(LOAD_PROVIDER_DYNAMIC)).add(p().textContent(dynamicMetadata.getDescription().getDescription())).element()).add(loadProviderDynamicForm).element();
navigation.insertPrimary("load-provider-dynamic-item", "custom-load-metrics-item", LOAD_PROVIDER_DYNAMIC, "fa fa-shield", loadProviderDynamicElement);
registerAttachable(loadProviderDynamicForm);
// --------- load-provider=simple
Metadata simpleMetadata = mbuiContext.metadataRegistry().lookup(LOAD_PROVIDER_SIMPLE_TEMPLATE);
loadProviderSimpleForm = new ModelNodeForm.Builder<>("load-provider-simple-form", simpleMetadata).singleton(() -> presenter.loadProviderSimpleOperation(), () -> presenter.addLoadProviderSimple()).prepareRemove(form -> presenter.removeLoadProviderSimple()).onSave((form, changedValues) -> {
String name = presenter.getProxyName();
AddressTemplate template = LOAD_PROVIDER_SIMPLE_TEMPLATE.replaceWildcards(presenter.getProxyName());
saveForm(LOAD_PROVIDER_SIMPLE, name, template.resolve(mbuiContext.statementContext(), name), changedValues, simpleMetadata);
}).prepareReset(form -> {
String name = presenter.getProxyName();
AddressTemplate template = LOAD_PROVIDER_SIMPLE_TEMPLATE.replaceWildcards(presenter.getProxyName());
resetForm(LOAD_PROVIDER_SIMPLE, name, template.resolve(mbuiContext.statementContext(), name), form, simpleMetadata);
}).build();
HTMLElement loadProviderSimpleElement = section().add(div().add(h(1).textContent(LOAD_PROVIDER_SIMPLE)).add(p().textContent(simpleMetadata.getDescription().getDescription())).element()).add(loadProviderSimpleForm).element();
navigation.insertPrimary("load-provider-simple-item", "load-provider-dynamic-item", LOAD_PROVIDER_SIMPLE, "fa fa-exchange", loadProviderSimpleElement);
registerAttachable(loadProviderSimpleForm);
}
use of org.jboss.hal.meta.Metadata in project console by hal.
the class RemotingPresenter method saveConnectorSecurityPolicy.
void saveConnectorSecurityPolicy(Map<String, Object> changedValues) {
Metadata metadata = metadataRegistry.lookup(CONNECTOR_SECURITY_POLICY_TEMPLATE);
crud.saveSingleton(Names.REMOTE_CONNECTOR_SECURITY_POLICY, SELECTED_CONNECTOR_SECURITY_POLICY_TEMPLATE.resolve(selectedConnectorContext), changedValues, metadata, this::reload);
}
use of org.jboss.hal.meta.Metadata in project console by hal.
the class ResourceAdapterView method saveConnectionDefinition.
void saveConnectionDefinition(Form<NamedNode> form, Map<String, Object> changedValues) {
String name = form.getModel().getName();
ResourceAddress address = SELECTED_CONNECTION_DEFINITIONS_TEMPLATE.resolve(selectionAwareStatementContext, name);
Metadata metadata = mbuiContext.metadataRegistry().lookup(CONNECTION_DEFINITIONS_TEMPLATE);
Map<String, String> properties = form.getFormItem(CONFIG_PROPERTIES) != null ? form.<Map<String, String>>getFormItem(CONFIG_PROPERTIES).getValue() : Collections.emptyMap();
mbuiContext.po().saveWithProperties(Names.CONNECTION_DEFINITION, name, address, changedValues, metadata, CONFIG_PROPERTIES, properties, () -> presenter.reload());
}
use of org.jboss.hal.meta.Metadata in project console by hal.
the class ResourceAdapterView method saveAdminObject.
void saveAdminObject(Form<NamedNode> form, Map<String, Object> changedValues) {
String name = form.getModel().getName();
ResourceAddress address = SELECTED_ADMIN_OBJECTS_TEMPLATE.resolve(selectionAwareStatementContext, name);
Metadata metadata = mbuiContext.metadataRegistry().lookup(ADMIN_OBJECTS_TEMPLATE);
mbuiContext.po().saveWithProperties(Names.ADMIN_OBJECT, name, address, changedValues, metadata, CONFIG_PROPERTIES, form.<Map<String, String>>getFormItem(CONFIG_PROPERTIES).getValue(), () -> presenter.reload());
}
use of org.jboss.hal.meta.Metadata in project console by hal.
the class ResourceAdapterView method resetConfiguration.
void resetConfiguration(Form<ModelNode> form) {
Metadata metadata = mbuiContext.metadataRegistry().lookup(RESOURCE_ADAPTER_TEMPLATE);
ResourceAddress address = SELECTED_RESOURCE_ADAPTER_TEMPLATE.resolve(selectionAwareStatementContext);
mbuiContext.crud().reset(Names.RESOURCE_ADAPTER, presenter.getResourceAdapter(), address, form, metadata, new FinishReset<ModelNode>(form) {
@Override
public void afterReset(Form<ModelNode> form) {
presenter.reload();
}
});
}
Aggregations