Search in sources :

Example 1 with PLACE_HOLDER_ELEMENT

use of org.jboss.hal.core.modelbrowser.ModelBrowser.PLACE_HOLDER_ELEMENT in project console by hal.

the class ResourcePanel method update.

void update(Node<Context> node, ResourceAddress address, Metadata metadata) {
    SafeHtml safeHtml = SafeHtmlUtils.fromSafeConstant(metadata.getDescription().getDescription());
    Elements.innerHtml(this.description, safeHtml);
    tabs.setContent(dataId, PLACE_HOLDER_ELEMENT);
    tabs.setContent(attributesId, PLACE_HOLDER_ELEMENT);
    tabs.setContent(operationsId, PLACE_HOLDER_ELEMENT);
    Elements.setVisible(tabs.element(), description.hasAttributes());
    Elements.setVisible(empty, !description.hasAttributes());
    if (description.hasAttributes()) {
        Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true).build();
        dispatcher.execute(operation, result -> {
            List<String> plainObjects = new ArrayList<>();
            flattenDescription(metadata.getDescription().get(ATTRIBUTES), plainObjects);
            flattenModel(result, plainObjects);
            ModelNodeForm<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(Ids.MODEL_BROWSER, node.id, Ids.FORM), metadata).includeRuntime().showDeprecated().onSave((f, changedValues) -> modelBrowser.save(address, changedValues, metadata)).prepareReset(f -> modelBrowser.reset(address, f, metadata)).build();
            tabs.setContent(dataId, form.element());
            PatternFly.initComponents();
            form.attach();
            form.view(result);
        });
        tabs.setContent(attributesId, new AttributesTable(metadata.getDescription().getAttributes(ATTRIBUTES), resources).element());
        if (!metadata.getDescription().getOperations().isEmpty()) {
            tabs.setContent(operationsId, new OperationsTable(metadata.getDescription().getOperations(), resources).element());
        }
    }
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) Iterator(java.util.Iterator) Operation(org.jboss.hal.dmr.Operation) Ids(org.jboss.hal.resources.Ids) Node(org.jboss.hal.ballroom.tree.Node) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) ArrayList(java.util.ArrayList) ModelType(org.jboss.hal.dmr.ModelType) Tabs(org.jboss.hal.ballroom.Tabs) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) PLACE_HOLDER_ELEMENT(org.jboss.hal.core.modelbrowser.ModelBrowser.PLACE_HOLDER_ELEMENT) Property(org.jboss.hal.dmr.Property) List(java.util.List) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) CSS.lead(org.jboss.hal.resources.CSS.lead) Resources(org.jboss.hal.resources.Resources) Elements.p(org.jboss.gwt.elemento.core.Elements.p) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) HTMLElement(elemental2.dom.HTMLElement) PatternFly(org.jboss.hal.ballroom.PatternFly) Metadata(org.jboss.hal.meta.Metadata) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Elements(org.jboss.gwt.elemento.core.Elements) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) ArrayList(java.util.ArrayList) Operation(org.jboss.hal.dmr.Operation) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) ModelNode(org.jboss.hal.dmr.ModelNode)

Aggregations

SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)1 HTMLElement (elemental2.dom.HTMLElement)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Elements (org.jboss.gwt.elemento.core.Elements)1 Elements.p (org.jboss.gwt.elemento.core.Elements.p)1 PatternFly (org.jboss.hal.ballroom.PatternFly)1 Tabs (org.jboss.hal.ballroom.Tabs)1 Node (org.jboss.hal.ballroom.tree.Node)1 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)1 PLACE_HOLDER_ELEMENT (org.jboss.hal.core.modelbrowser.ModelBrowser.PLACE_HOLDER_ELEMENT)1 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)1 ModelNode (org.jboss.hal.dmr.ModelNode)1 ModelType (org.jboss.hal.dmr.ModelType)1 Operation (org.jboss.hal.dmr.Operation)1 Property (org.jboss.hal.dmr.Property)1 ResourceAddress (org.jboss.hal.dmr.ResourceAddress)1 Dispatcher (org.jboss.hal.dmr.dispatch.Dispatcher)1