Search in sources :

Example 1 with HAL_INDEX

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

Example 2 with HAL_INDEX

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);
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) IsElement(org.jboss.gwt.elemento.core.IsElement) Constraint(org.jboss.hal.meta.security.Constraint) HAL_INDEX(org.jboss.hal.dmr.ModelDescriptionConstants.HAL_INDEX) ModelNodeHelper.storeIndex(org.jboss.hal.dmr.ModelNodeHelper.storeIndex) ModelNodeTable(org.jboss.hal.core.mbui.table.ModelNodeTable) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) CONSTANT_HEADERS(org.jboss.hal.dmr.ModelDescriptionConstants.CONSTANT_HEADERS) TextBoxItem(org.jboss.hal.ballroom.form.TextBoxItem) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Elements.section(org.jboss.gwt.elemento.core.Elements.section) AddressTemplate(org.jboss.hal.meta.AddressTemplate) Elements.p(org.jboss.gwt.elemento.core.Elements.p) VALUE(org.jboss.hal.dmr.ModelDescriptionConstants.VALUE) HTMLElement(elemental2.dom.HTMLElement) NAME(org.jboss.hal.dmr.ModelDescriptionConstants.NAME) HasPresenter(org.jboss.hal.core.mvp.HasPresenter) Metadata(org.jboss.hal.meta.Metadata) Elements.h(org.jboss.gwt.elemento.core.Elements.h) Pages(org.jboss.hal.ballroom.Pages) Table(org.jboss.hal.ballroom.table.Table) Ids(org.jboss.hal.resources.Ids) ModelNodeHelper.failSafeList(org.jboss.hal.dmr.ModelNodeHelper.failSafeList) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) List(java.util.List) LabelBuilder(org.jboss.hal.ballroom.LabelBuilder) Collectors.toList(java.util.stream.Collectors.toList) HEADERS(org.jboss.hal.dmr.ModelDescriptionConstants.HEADERS) PATH(org.jboss.hal.dmr.ModelDescriptionConstants.PATH) MetadataRegistry(org.jboss.hal.meta.MetadataRegistry) Resources(org.jboss.hal.resources.Resources) Attachable(org.jboss.hal.ballroom.Attachable) InlineAction(org.jboss.hal.ballroom.table.InlineAction) NamedNode(org.jboss.hal.dmr.NamedNode) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Form(org.jboss.hal.ballroom.form.Form) Scope(org.jboss.hal.ballroom.table.Scope) NamedNode(org.jboss.hal.dmr.NamedNode) Constraint(org.jboss.hal.meta.security.Constraint)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)2 List (java.util.List)2 Elements.h (org.jboss.gwt.elemento.core.Elements.h)2 Elements.p (org.jboss.gwt.elemento.core.Elements.p)2 Elements.section (org.jboss.gwt.elemento.core.Elements.section)2 Form (org.jboss.hal.ballroom.form.Form)2 Scope (org.jboss.hal.ballroom.table.Scope)2 Table (org.jboss.hal.ballroom.table.Table)2 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)2 ModelNodeTable (org.jboss.hal.core.mbui.table.ModelNodeTable)2 HAL_INDEX (org.jboss.hal.dmr.ModelDescriptionConstants.HAL_INDEX)2 ModelNode (org.jboss.hal.dmr.ModelNode)2 Metadata (org.jboss.hal.meta.Metadata)2 MetadataRegistry (org.jboss.hal.meta.MetadataRegistry)2 Constraint (org.jboss.hal.meta.security.Constraint)2 Ids (org.jboss.hal.resources.Ids)2 Resources (org.jboss.hal.resources.Resources)2 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1