Search in sources :

Example 96 with Metadata

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);
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) Element(elemental2.dom.Element) Alert(org.jboss.hal.ballroom.Alert) LOAD_PROVIDER_DYNAMIC_TEMPLATE(org.jboss.hal.client.configuration.subsystem.modcluster.AddressTemplates.LOAD_PROVIDER_DYNAMIC_TEMPLATE) MbuiViewImpl(org.jboss.hal.core.mbui.MbuiViewImpl) Icons(org.jboss.hal.resources.Icons) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) AddressTemplate(org.jboss.hal.meta.AddressTemplate) MbuiElement(org.jboss.hal.spi.MbuiElement) HTMLElement(elemental2.dom.HTMLElement) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Table(org.jboss.hal.ballroom.table.Table) LOAD_PROVIDER_SIMPLE(org.jboss.hal.resources.Names.LOAD_PROVIDER_SIMPLE) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) ModelNodeHelper.failSafeGet(org.jboss.hal.dmr.ModelNodeHelper.failSafeGet) List(java.util.List) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) LOAD_PROVIDER_SIMPLE_TEMPLATE(org.jboss.hal.client.configuration.subsystem.modcluster.AddressTemplates.LOAD_PROVIDER_SIMPLE_TEMPLATE) PostConstruct(javax.annotation.PostConstruct) MbuiView(org.jboss.hal.spi.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) LOAD_PROVIDER_DYNAMIC(org.jboss.hal.resources.Names.LOAD_PROVIDER_DYNAMIC) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) AddressTemplate(org.jboss.hal.meta.AddressTemplate) HTMLElement(elemental2.dom.HTMLElement) Metadata(org.jboss.hal.meta.Metadata) PostConstruct(javax.annotation.PostConstruct)

Example 97 with Metadata

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);
}
Also used : Metadata(org.jboss.hal.meta.Metadata)

Example 98 with Metadata

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());
}
Also used : ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Metadata(org.jboss.hal.meta.Metadata) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map)

Example 99 with Metadata

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());
}
Also used : ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Metadata(org.jboss.hal.meta.Metadata) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map)

Example 100 with Metadata

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();
        }
    });
}
Also used : ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Metadata(org.jboss.hal.meta.Metadata) ModelNode(org.jboss.hal.dmr.ModelNode)

Aggregations

Metadata (org.jboss.hal.meta.Metadata)281 ResourceAddress (org.jboss.hal.dmr.ResourceAddress)146 ModelNode (org.jboss.hal.dmr.ModelNode)128 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)95 AddResourceDialog (org.jboss.hal.core.mbui.dialog.AddResourceDialog)80 NamedNode (org.jboss.hal.dmr.NamedNode)73 Ids (org.jboss.hal.resources.Ids)70 Form (org.jboss.hal.ballroom.form.Form)68 Names (org.jboss.hal.resources.Names)67 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)63 Resources (org.jboss.hal.resources.Resources)60 List (java.util.List)59 Operation (org.jboss.hal.dmr.Operation)59 AddressTemplate (org.jboss.hal.meta.AddressTemplate)59 Inject (javax.inject.Inject)52 Map (java.util.Map)51 StatementContext (org.jboss.hal.meta.StatementContext)51 Dispatcher (org.jboss.hal.dmr.dispatch.Dispatcher)50 EventBus (com.google.web.bindery.event.shared.EventBus)49 MetadataRegistry (org.jboss.hal.meta.MetadataRegistry)46