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();
}
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();
}
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();
}
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());
}
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();
}
Aggregations