Search in sources :

Example 86 with AddressTemplate

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

the class DestinationPresenter method addCoreQueue.

// ------------------------------------------------------ core queue
// the custom add resource dialog is necessary because the "durable" and "filter" attributes are read-only
// after created
void addCoreQueue() {
    Metadata metadata = metadataRegistry.lookup(CORE_QUEUE_TEMPLATE);
    NameItem nameItem = new NameItem();
    Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(Ids.MESSAGING_CORE_QUEUE, ADD), metadata).fromRequestProperties().unboundFormItem(nameItem, 0).include(DURABLE, FILTER).unsorted().build();
    new AddResourceDialog(resources.messages().addResourceTitle(Names.CORE_QUEUE), form, (name, model) -> {
        AddressTemplate template = SELECTED_SERVER_TEMPLATE.append("queue=" + nameItem.getValue());
        ResourceAddress address = template.resolve(statementContext);
        crud.add(Names.CORE_QUEUE, nameItem.getValue(), address, model, (name1, address1) -> reload());
    }).show();
}
Also used : AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) Provider(javax.inject.Provider) StatementContext(org.jboss.hal.meta.StatementContext) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) TextBoxItem(org.jboss.hal.ballroom.form.TextBoxItem) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) Message(org.jboss.hal.spi.Message) FinishReset(org.jboss.hal.ballroom.form.Form.FinishReset) Metadata(org.jboss.hal.meta.Metadata) ResourceCheck(org.jboss.hal.dmr.ResourceCheck) Names(org.jboss.hal.resources.Names) ModelNodeHelper.asNamedNodes(org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes) CrudOperations(org.jboss.hal.core.CrudOperations) NameToken(com.gwtplatform.mvp.client.annotations.NameToken) FinderPath(org.jboss.hal.core.finder.FinderPath) List(java.util.List) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) Flow.series(org.jboss.hal.flow.Flow.series) Finder(org.jboss.hal.core.finder.Finder) Footer(org.jboss.hal.spi.Footer) SupportsExpertMode(org.jboss.hal.core.mvp.SupportsExpertMode) ModelNode(org.jboss.hal.dmr.ModelNode) Completable(rx.Completable) MessageEvent(org.jboss.hal.spi.MessageEvent) ProxyPlace(com.gwtplatform.mvp.client.proxy.ProxyPlace) SuccessfulOutcome(org.jboss.hal.core.SuccessfulOutcome) FlowContext(org.jboss.hal.flow.FlowContext) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Task(org.jboss.hal.flow.Task) Progress(org.jboss.hal.flow.Progress) AddressTemplate(org.jboss.hal.meta.AddressTemplate) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) Requires(org.jboss.hal.spi.Requires) ProxyCodeSplit(com.gwtplatform.mvp.client.annotations.ProxyCodeSplit) AddressTemplates(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates) Operation(org.jboss.hal.dmr.Operation) Ids(org.jboss.hal.resources.Ids) FinderPathFactory(org.jboss.hal.core.finder.FinderPathFactory) EventBus(com.google.web.bindery.event.shared.EventBus) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) Composite(org.jboss.hal.dmr.Composite) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) MbuiView(org.jboss.hal.core.mbui.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) AddressTemplate(org.jboss.hal.meta.AddressTemplate) 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)

Example 87 with AddressTemplate

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

the class DestinationPresenter method addJMSQueue.

// ------------------------------------------------------ jms queue
// the custom add resource dialog is necessary because the "durable" and "selector" attributes are read-only
// after created
void addJMSQueue() {
    Metadata metadata = metadataRegistry.lookup(JMS_QUEUE_TEMPLATE);
    NameItem nameItem = new NameItem();
    Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(Ids.MESSAGING_JMS_QUEUE, ADD), metadata).fromRequestProperties().unboundFormItem(nameItem, 0).include(DURABLE, SELECTOR).unsorted().build();
    new AddResourceDialog(resources.messages().addResourceTitle(Names.JMS_QUEUE), form, (name, model) -> {
        AddressTemplate template = SELECTED_SERVER_TEMPLATE.append("jms-queue=" + nameItem.getValue());
        ResourceAddress address = template.resolve(statementContext);
        crud.add(Names.JMS_QUEUE, nameItem.getValue(), address, model, (name1, address1) -> reload());
    }).show();
}
Also used : AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) Provider(javax.inject.Provider) StatementContext(org.jboss.hal.meta.StatementContext) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) TextBoxItem(org.jboss.hal.ballroom.form.TextBoxItem) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) Message(org.jboss.hal.spi.Message) FinishReset(org.jboss.hal.ballroom.form.Form.FinishReset) Metadata(org.jboss.hal.meta.Metadata) ResourceCheck(org.jboss.hal.dmr.ResourceCheck) Names(org.jboss.hal.resources.Names) ModelNodeHelper.asNamedNodes(org.jboss.hal.dmr.ModelNodeHelper.asNamedNodes) CrudOperations(org.jboss.hal.core.CrudOperations) NameToken(com.gwtplatform.mvp.client.annotations.NameToken) FinderPath(org.jboss.hal.core.finder.FinderPath) List(java.util.List) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) Flow.series(org.jboss.hal.flow.Flow.series) Finder(org.jboss.hal.core.finder.Finder) Footer(org.jboss.hal.spi.Footer) SupportsExpertMode(org.jboss.hal.core.mvp.SupportsExpertMode) ModelNode(org.jboss.hal.dmr.ModelNode) Completable(rx.Completable) MessageEvent(org.jboss.hal.spi.MessageEvent) ProxyPlace(com.gwtplatform.mvp.client.proxy.ProxyPlace) SuccessfulOutcome(org.jboss.hal.core.SuccessfulOutcome) FlowContext(org.jboss.hal.flow.FlowContext) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Task(org.jboss.hal.flow.Task) Progress(org.jboss.hal.flow.Progress) AddressTemplate(org.jboss.hal.meta.AddressTemplate) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) Requires(org.jboss.hal.spi.Requires) ProxyCodeSplit(com.gwtplatform.mvp.client.annotations.ProxyCodeSplit) AddressTemplates(org.jboss.hal.client.configuration.subsystem.messaging.AddressTemplates) Operation(org.jboss.hal.dmr.Operation) Ids(org.jboss.hal.resources.Ids) FinderPathFactory(org.jboss.hal.core.finder.FinderPathFactory) EventBus(com.google.web.bindery.event.shared.EventBus) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) Composite(org.jboss.hal.dmr.Composite) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) NameTokens(org.jboss.hal.meta.token.NameTokens) Resources(org.jboss.hal.resources.Resources) MbuiView(org.jboss.hal.core.mbui.MbuiView) NamedNode(org.jboss.hal.dmr.NamedNode) Form(org.jboss.hal.ballroom.form.Form) AddressTemplate(org.jboss.hal.meta.AddressTemplate) 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)

Example 88 with AddressTemplate

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

the class LoggingProfileView method addFileHandlerResource.

private void addFileHandlerResource(String templateSuffix, String id, String type, String... attributes) {
    AddressTemplate metadataTemplate = LOGGING_PROFILE_TEMPLATE.append(templateSuffix);
    Metadata metadata = mbuiContext.metadataRegistry().lookup(metadataTemplate);
    AddressTemplate selectionTemplate = SELECTED_LOGGING_PROFILE_TEMPLATE.append(templateSuffix);
    ModelNodeForm.Builder<ModelNode> builder = new ModelNodeForm.Builder<>(id, metadata).fromRequestProperties().unboundFormItem(new NameItem(), 0).customFormItem("file", (attributeDescription) -> new FileFormItem(FILE, true)).unsorted();
    if (attributes != null) {
        builder.include(asList(attributes));
    }
    AddResourceDialog dialog = new AddResourceDialog(mbuiContext.resources().messages().addResourceTitle(type), builder.build(), (name, modelNode) -> {
        ResourceAddress address = selectionTemplate.resolve(selectionAwareStatementContext, name);
        crud().add(type, name, address, modelNode, (n, a) -> presenter.reload());
    });
    dialog.show();
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) Constraint(org.jboss.hal.meta.security.Constraint) StatementContext(org.jboss.hal.meta.StatementContext) LOGGING_PROFILE_TEMPLATE(org.jboss.hal.client.configuration.subsystem.logging.AddressTemplates.LOGGING_PROFILE_TEMPLATE) TAB_CONTAINER(org.jboss.hal.resources.Ids.TAB_CONTAINER) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Elements.p(org.jboss.gwt.elemento.core.Elements.p) HTMLElement(elemental2.dom.HTMLElement) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Elements.h(org.jboss.gwt.elemento.core.Elements.h) CrudOperations(org.jboss.hal.core.CrudOperations) Table(org.jboss.hal.ballroom.table.Table) Collections.emptyList(java.util.Collections.emptyList) SuggestHandler(org.jboss.hal.ballroom.form.SuggestHandler) FORM(org.jboss.hal.resources.Ids.FORM) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) ModelNodeHelper.failSafeGet(org.jboss.hal.dmr.ModelNodeHelper.failSafeGet) List(java.util.List) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) SelectionAwareStatementContext(org.jboss.hal.meta.SelectionAwareStatementContext) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) PostConstruct(javax.annotation.PostConstruct) JSON_FORMATTER_TEMPLATE(org.jboss.hal.client.configuration.subsystem.logging.AddressTemplates.JSON_FORMATTER_TEMPLATE) CSS.fontAwesome(org.jboss.hal.resources.CSS.fontAwesome) ModelNode(org.jboss.hal.dmr.ModelNode) FileFormItem(org.jboss.hal.core.ui.FileFormItem) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) MbuiViewImpl(org.jboss.hal.core.mbui.MbuiViewImpl) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) XML_FORMATTER_TEMPLATE(org.jboss.hal.client.configuration.subsystem.logging.AddressTemplates.XML_FORMATTER_TEMPLATE) TAB(org.jboss.hal.resources.Ids.TAB) Elements.section(org.jboss.gwt.elemento.core.Elements.section) AddressTemplate(org.jboss.hal.meta.AddressTemplate) MbuiElement(org.jboss.hal.spi.MbuiElement) Constants(org.jboss.hal.resources.Constants) EmptyState(org.jboss.hal.ballroom.EmptyState) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) DomGlobal.document(elemental2.dom.DomGlobal.document) Operation(org.jboss.hal.dmr.Operation) Ids(org.jboss.hal.resources.Ids) CATEGORY(org.jboss.hal.resources.Names.CATEGORY) ReadChildrenAutoComplete(org.jboss.hal.ballroom.autocomplete.ReadChildrenAutoComplete) CSS.marginTopLarge(org.jboss.hal.resources.CSS.marginTopLarge) FormItem(org.jboss.hal.ballroom.form.FormItem) MbuiContext(org.jboss.hal.core.mbui.MbuiContext) MbuiView(org.jboss.hal.spi.MbuiView) SELECTED_LOGGING_PROFILE_TEMPLATE(org.jboss.hal.client.configuration.subsystem.logging.AddressTemplates.SELECTED_LOGGING_PROFILE_TEMPLATE) NamedNode(org.jboss.hal.dmr.NamedNode) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) NameItem(org.jboss.hal.core.mbui.dialog.NameItem) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) Metadata(org.jboss.hal.meta.Metadata) ModelNode(org.jboss.hal.dmr.ModelNode) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) FileFormItem(org.jboss.hal.core.ui.FileFormItem)

Example 89 with AddressTemplate

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

the class JGroupsPresenter method addResourceDialog.

void addResourceDialog(AddressTemplate template, String resourceid, String displayName) {
    AddressTemplate addressTemplate = AddressTemplate.of(template.resolve(filterStatementContext));
    crud.add(resourceid, displayName, addressTemplate, (n, a) -> reload());
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate)

Example 90 with AddressTemplate

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

the class LoggingProfileView method addResource.

// ------------------------------------------------------ helper methods
private void addResource(String templateSuffix, String id, String type, String... attributes) {
    AddressTemplate metadataTemplate = LOGGING_PROFILE_TEMPLATE.append(templateSuffix);
    Metadata metadata = mbuiContext.metadataRegistry().lookup(metadataTemplate);
    AddressTemplate selectionTemplate = SELECTED_LOGGING_PROFILE_TEMPLATE.append(templateSuffix);
    AddResourceDialog dialog = new AddResourceDialog(id, mbuiContext.resources().messages().addResourceTitle(type), metadata, attributes == null ? emptyList() : asList(attributes), (name, modelNode) -> {
        ResourceAddress address = selectionTemplate.resolve(selectionAwareStatementContext, name);
        crud().add(type, name, address, modelNode, (n, a) -> presenter.reload());
    });
    FormItem<Object> handlers = dialog.getForm().getFormItem("handlers");
    if (handlers != null) {
        handlers.registerSuggestHandler(suggestHandlers);
    }
    FormItem<Object> namedFormatter = dialog.getForm().getFormItem("named-formatter");
    if (namedFormatter != null) {
        namedFormatter.registerSuggestHandler(namedFormatters);
    }
    dialog.show();
}
Also used : AddressTemplate(org.jboss.hal.meta.AddressTemplate) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Metadata(org.jboss.hal.meta.Metadata)

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