Search in sources :

Example 1 with CLASS

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);
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) Elements.div(org.jboss.gwt.elemento.core.Elements.div) DEPLOYMENT_PERMISSIONS_TEMPLATE(org.jboss.hal.client.configuration.subsystem.securitymanager.AddressTemplates.DEPLOYMENT_PERMISSIONS_TEMPLATE) Constraint(org.jboss.hal.meta.security.Constraint) HAL_INDEX(org.jboss.hal.dmr.ModelDescriptionConstants.HAL_INDEX) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) HashMap(java.util.HashMap) LayoutBuilder.column(org.jboss.hal.ballroom.LayoutBuilder.column) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Elements.section(org.jboss.gwt.elemento.core.Elements.section) Elements.p(org.jboss.gwt.elemento.core.Elements.p) HTMLElement(elemental2.dom.HTMLElement) Map(java.util.Map) EmptyState(org.jboss.hal.ballroom.EmptyState) HalViewImpl(org.jboss.hal.core.mvp.HalViewImpl) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Elements.h(org.jboss.gwt.elemento.core.Elements.h) CLASS(org.jboss.hal.dmr.ModelDescriptionConstants.CLASS) Table(org.jboss.hal.ballroom.table.Table) LayoutBuilder.row(org.jboss.hal.ballroom.LayoutBuilder.row) Ids(org.jboss.hal.resources.Ids) CSS.marginTopLarge(org.jboss.hal.resources.CSS.marginTopLarge) VerticalNavigation(org.jboss.hal.ballroom.VerticalNavigation) List(java.util.List) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) Resources(org.jboss.hal.resources.Resources) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) Scope(org.jboss.hal.ballroom.table.Scope) EmptyState(org.jboss.hal.ballroom.EmptyState) HTMLElement(elemental2.dom.HTMLElement) Constraint(org.jboss.hal.meta.security.Constraint) Metadata(org.jboss.hal.meta.Metadata) ModelNode(org.jboss.hal.dmr.ModelNode)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Inject (javax.inject.Inject)1 Elements (org.jboss.gwt.elemento.core.Elements)1 Elements.div (org.jboss.gwt.elemento.core.Elements.div)1 Elements.h (org.jboss.gwt.elemento.core.Elements.h)1 Elements.p (org.jboss.gwt.elemento.core.Elements.p)1 Elements.section (org.jboss.gwt.elemento.core.Elements.section)1 EmptyState (org.jboss.hal.ballroom.EmptyState)1 LayoutBuilder.column (org.jboss.hal.ballroom.LayoutBuilder.column)1 LayoutBuilder.row (org.jboss.hal.ballroom.LayoutBuilder.row)1 VerticalNavigation (org.jboss.hal.ballroom.VerticalNavigation)1 Form (org.jboss.hal.ballroom.form.Form)1 Scope (org.jboss.hal.ballroom.table.Scope)1 Table (org.jboss.hal.ballroom.table.Table)1 DEPLOYMENT_PERMISSIONS_TEMPLATE (org.jboss.hal.client.configuration.subsystem.securitymanager.AddressTemplates.DEPLOYMENT_PERMISSIONS_TEMPLATE)1 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)1 ModelNodeTable (org.jboss.hal.core.mbui.table.ModelNodeTable)1