Search in sources :

Example 1 with AddressTemplate

use of org.jboss.hal.meta.AddressTemplate 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();
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) SupportsExpertMode(org.jboss.hal.core.mvp.SupportsExpertMode) ModelNode(org.jboss.hal.dmr.ModelNode) StatementContext(org.jboss.hal.meta.StatementContext) ProxyPlace(com.gwtplatform.mvp.client.proxy.ProxyPlace) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) FormValidation(org.jboss.hal.ballroom.form.FormValidation) AddressTemplate(org.jboss.hal.meta.AddressTemplate) Arrays.asList(java.util.Arrays.asList) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) ModelNodeHelper.asNamedNodes(org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes) Requires(org.jboss.hal.spi.Requires) CrudOperations(org.jboss.hal.core.CrudOperations) ProxyCodeSplit(com.gwtplatform.mvp.client.annotations.ProxyCodeSplit) AddressTemplates(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates) NameToken(com.gwtplatform.mvp.client.annotations.NameToken) Ids(org.jboss.hal.resources.Ids) FinderPathFactory(org.jboss.hal.core.finder.FinderPathFactory) EventBus(com.google.web.bindery.event.shared.EventBus) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) FinderPath(org.jboss.hal.core.finder.FinderPath) Consumer(java.util.function.Consumer) List(java.util.List) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) MbuiView(org.jboss.hal.core.mbui.MbuiView) Finder(org.jboss.hal.core.finder.Finder) ValidationResult(org.jboss.hal.ballroom.form.ValidationResult) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Metadata(org.jboss.hal.meta.Metadata) ModelNode(org.jboss.hal.dmr.ModelNode) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete)

Example 2 with AddressTemplate

use of org.jboss.hal.meta.AddressTemplate in project console by hal.

the class ClusteringPresenter method addBroadcastGroup.

// Include JGROUPS_CLUSTER and SOCKET_BINDING fields in the Add form, as one of these fields is required.
void addBroadcastGroup(ServerSubResource ssr) {
    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));
    showBroadcastOrDiscoveryGroupAddDialog(ssr, formBuilderAugmentor -> {
        formBuilderAugmentor.include(CONNECTORS);
    }, formAugmentor -> {
        formAugmentor.getFormItem(CONNECTORS).registerSuggestHandler(new ReadChildrenAutoComplete(dispatcher, statementContext, templates));
    });
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete)

Example 3 with AddressTemplate

use of org.jboss.hal.meta.AddressTemplate 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();
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) SupportsExpertMode(org.jboss.hal.core.mvp.SupportsExpertMode) ModelNode(org.jboss.hal.dmr.ModelNode) StatementContext(org.jboss.hal.meta.StatementContext) ProxyPlace(com.gwtplatform.mvp.client.proxy.ProxyPlace) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) AddressTemplate(org.jboss.hal.meta.AddressTemplate) Arrays.asList(java.util.Arrays.asList) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) ModelNodeHelper.asNamedNodes(org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes) Requires(org.jboss.hal.spi.Requires) CrudOperations(org.jboss.hal.core.CrudOperations) ProxyCodeSplit(com.gwtplatform.mvp.client.annotations.ProxyCodeSplit) AddressTemplates(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates) NameToken(com.gwtplatform.mvp.client.annotations.NameToken) Ids(org.jboss.hal.resources.Ids) FinderPathFactory(org.jboss.hal.core.finder.FinderPathFactory) EventBus(com.google.web.bindery.event.shared.EventBus) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) FinderPath(org.jboss.hal.core.finder.FinderPath) List(java.util.List) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) MbuiView(org.jboss.hal.core.mbui.MbuiView) Finder(org.jboss.hal.core.finder.Finder) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Metadata(org.jboss.hal.meta.Metadata) ModelNode(org.jboss.hal.dmr.ModelNode) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete)

Example 4 with AddressTemplate

use of org.jboss.hal.meta.AddressTemplate in project console by hal.

the class ConnectionView method setPresenter.

@Override
public void setPresenter(ConnectionPresenter presenter) {
    super.setPresenter(presenter);
    // register the suggestion handlers here rather than in a @PostConstruct method
    // they need a valid presenter reference!
    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));
    connectionFactoryForm.getFormItem(CONNECTORS).registerSuggestHandler(new ReadChildrenAutoComplete(mbuiContext.dispatcher(), presenter.statementContext, templates));
    pooledConnectionFactoryForm.getFormItem(CONNECTORS).registerSuggestHandler(new ReadChildrenAutoComplete(mbuiContext.dispatcher(), presenter.statementContext, templates));
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete)

Example 5 with AddressTemplate

use of org.jboss.hal.meta.AddressTemplate in project console by hal.

the class StoreElement method tableForm.

private Form<ModelNode> tableForm(CacheType cacheType, Store store, Table table, MetadataRegistry metadataRegistry) {
    AddressTemplate template = cacheType.template.append(STORE + "=" + store.resource).append(TABLE + "=" + table.resource);
    Metadata metadata = metadataRegistry.lookup(template);
    String id = Ids.build(cacheType.baseId, store.baseId, table.baseId, Ids.FORM);
    return new ModelNodeForm.Builder<>(id, metadata).include(PREFIX).customFormItem(ID_COLUMN, ad -> new ColumnFormItem(ID_COLUMN)).customFormItem(DATA_COLUMN, ad -> new ColumnFormItem(DATA_COLUMN)).customFormItem(TIMESTAMP_COLUMN, ad -> new ColumnFormItem(TIMESTAMP_COLUMN)).include(BATCH_SIZE, FETCH_SIZE).unsorted().onSave((f, changedValues) -> presenter.saveTable(table, changedValues)).prepareReset(f -> presenter.resetTable(table, f)).build();
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) ModelNode(org.jboss.hal.dmr.ModelNode) IsElement(org.jboss.gwt.elemento.core.IsElement) JQuery.$(org.jboss.hal.ballroom.JQuery.$) CSS.bootstrapSelect(org.jboss.hal.resources.CSS.bootstrapSelect) HashMap(java.util.HashMap) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Property(org.jboss.hal.dmr.Property) AddressTemplate(org.jboss.hal.meta.AddressTemplate) HTMLElement(elemental2.dom.HTMLElement) Map(java.util.Map) EmptyState(org.jboss.hal.ballroom.EmptyState) HTMLSelectElement(elemental2.dom.HTMLSelectElement) HasPresenter(org.jboss.hal.core.mvp.HasPresenter) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Ids(org.jboss.hal.resources.Ids) CSS(org.jboss.hal.resources.CSS) CSS.btnGroup(org.jboss.hal.resources.CSS.btnGroup) CSS.selectpicker(org.jboss.hal.resources.CSS.selectpicker) ModelNodeHelper.failSafeGet(org.jboss.hal.dmr.ModelNodeHelper.failSafeGet) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) Resources(org.jboss.hal.resources.Resources) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) CSS.width(org.jboss.hal.resources.CSS.width) Attachable(org.jboss.hal.ballroom.Attachable) Elements(org.jboss.gwt.elemento.core.Elements) SelectBoxBridge(org.jboss.hal.ballroom.form.SelectBoxBridge) Form(org.jboss.hal.ballroom.form.Form) Metadata(org.jboss.hal.meta.Metadata) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm)

Aggregations

AddressTemplate (org.jboss.hal.meta.AddressTemplate)90 Metadata (org.jboss.hal.meta.Metadata)43 ModelNode (org.jboss.hal.dmr.ModelNode)41 ResourceAddress (org.jboss.hal.dmr.ResourceAddress)36 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)35 AddResourceDialog (org.jboss.hal.core.mbui.dialog.AddResourceDialog)29 Operation (org.jboss.hal.dmr.Operation)29 Form (org.jboss.hal.ballroom.form.Form)27 Ids (org.jboss.hal.resources.Ids)27 Names (org.jboss.hal.resources.Names)26 List (java.util.List)24 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)24 Resources (org.jboss.hal.resources.Resources)24 HTMLElement (elemental2.dom.HTMLElement)22 LabelBuilder (org.jboss.hal.ballroom.LabelBuilder)22 StatementContext (org.jboss.hal.meta.StatementContext)21 EventBus (com.google.web.bindery.event.shared.EventBus)20 Inject (javax.inject.Inject)20 Dispatcher (org.jboss.hal.dmr.dispatch.Dispatcher)20 NamedNode (org.jboss.hal.dmr.NamedNode)19