use of org.jboss.hal.dmr.ModelDescriptionConstants.HAL_INDEX in project console by hal.
the class SecurityManagerView method createPermissionUI.
private void createPermissionUI(Permission permission) {
Metadata metadata = metadataRegistry.lookup(DEPLOYMENT_PERMISSIONS_TEMPLATE).forComplexAttribute(permission.resource);
Constraint constraint = Constraint.writable(DEPLOYMENT_PERMISSIONS_TEMPLATE, permission.resource);
EmptyState emptyState = new EmptyState.Builder(Ids.DEPLOYMENT_PERMISSIONS_EMPTY, Names.DEPLOYMENT_PERMISSIONS).description(resources.messages().noDeploymentPermissions()).primaryAction(resources.constants().add(), () -> presenter.addDeploymentPermissions(), constraint).build();
emptyState.element().classList.add(marginTopLarge);
emptyStates.put(permission, emptyState);
Table<ModelNode> table = new ModelNodeTable.Builder<>(Ids.build(permission.baseId, Ids.TABLE), metadata).button(resources.constants().add(), t -> presenter.addPermission(permission), constraint).button(resources.constants().remove(), t -> presenter.removePermission(permission, t.selectedRow().get(HAL_INDEX).asInt()), Scope.SELECTED, constraint).column(CLASS).build();
tables.put(permission, table);
registerAttachable(table);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.build(permission.baseId, Ids.FORM), metadata).onSave((f, changedValues) -> presenter.savePermission(permission, f.getModel().get(HAL_INDEX).asInt(), changedValues)).build();
forms.put(permission, form);
registerAttachable(form);
HTMLElement masterDetail;
HTMLElement section = section().add(emptyState).add(masterDetail = div().add(h(1).textContent(permission.type)).add(p().textContent(metadata.getDescription().getDescription())).add(table).add(form).element()).element();
masterDetails.put(permission, masterDetail);
navigation.addPrimary(Ids.build(permission.baseId, Ids.ITEM), permission.type, permission.icon, section);
}
use of org.jboss.hal.dmr.ModelDescriptionConstants.HAL_INDEX in project console by hal.
the class ConstantHeadersElement method showHeaders.
public void showHeaders(ModelNode modelNode) {
selectedPath = modelNode.get(PATH).asString();
int selectedIndex = modelNode.get(HAL_INDEX).asInt();
List<NamedNode> headers = failSafeList(modelNode, HEADERS).stream().map(node -> new NamedNode(node.get(NAME).asString(), node)).collect(toList());
headersElement.update(selectedIndex, headers);
pages.showPage(Ids.CONSTANT_HEADERS_PATH_PAGE);
}
Aggregations