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