use of org.jboss.hal.dmr.ModelDescriptionConstants.CLASS 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);
}
Aggregations