CCM NG: Removal of JSF/Primefaces experiment for Admin UI and removal or Primefaces dependency

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5809 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2019-01-26 12:27:44 +00:00
parent 8007a7c19e
commit 71351799fc
9 changed files with 4 additions and 425 deletions

View File

@ -227,10 +227,10 @@
<artifactId>Saxon-HE</artifactId> <artifactId>Saxon-HE</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>org.primefaces</groupId> <groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId> <artifactId>primefaces</artifactId>
</dependency> </dependency>-->
<!-- Vaadin dependencies for Vaadin prototype --> <!-- Vaadin dependencies for Vaadin prototype -->
<dependency> <dependency>

View File

@ -59,8 +59,6 @@ import java.util.ResourceBundle;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.primefaces.component.schedule.Schedule.PropertyKeys.*;
/** /**
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>

View File

@ -1,141 +0,0 @@
/*
* Copyright (C) 2016 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.admin.ui.usersgroupsroles;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.security.Permission;
import org.libreccm.security.Role;
import org.libreccm.security.RoleMembership;
import org.libreccm.security.RoleRepository;
import org.primefaces.model.LazyDataModel;
import org.primefaces.model.SortOrder;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Named
@ViewScoped
public class RolesController implements Serializable {
private static final long serialVersionUID = 9092665507680111584L;
private static final Logger LOGGER = LogManager.getLogger(
RolesController.class);
@Inject
private RoleRepository roleRepo;
private final LazyDataModel<Role> tableModel;
private Role selectedRole;
private String selectedRoleName;
public RolesController() {
LOGGER.debug("Intializing RolesController and creating table model...");
tableModel = new RolesTableModel();
}
public LazyDataModel<Role> getTableModel() {
LOGGER.debug("getTableModel invoked...");
return tableModel;
}
public List<Role> getRoles() {
LOGGER.debug("getRoles invoked...");
return roleRepo.findAll();
}
public Role getSelectedRole() {
LOGGER.debug("getSelectedRole invoked...");
return selectedRole;
}
public void setSelectedRole(final Role selectedRole) {
LOGGER.debug("Setting selected role to \"{}\"...", selectedRole);
this.selectedRole = selectedRole;
selectedRoleName = selectedRole.getName();
}
public String getSelectedRoleName() {
return selectedRoleName;
}
public void setSelectedRoleName(final String name) {
selectedRoleName = name;
}
@Transactional(Transactional.TxType.REQUIRED)
public Set<RoleMembership> getSelectedRoleMemberships() {
final Role role = roleRepo.findById(selectedRole.getRoleId()).get();
return role.getMemberships();
}
@Transactional(Transactional.TxType.REQUIRED)
public List<Permission> getSelectedRolePermissions() {
final Role role = roleRepo.findById(selectedRole.getRoleId(),
Role.ENTITY_GRPAH_WITH_PERMISSIONS)
.get();
return role.getPermissions();
}
public void renameSelectedRole() {
selectedRole.setName(selectedRoleName);
roleRepo.save(selectedRole);
}
public void renameSelectedRoleCancel() {
selectedRoleName = selectedRole.getName();
}
private class RolesTableModel extends LazyDataModel<Role> {
private static final long serialVersionUID = 8878060757439667086L;
@Override
public List<Role> load(final int first,
final int pageSize,
final String sortField,
final SortOrder sortOrder,
final Map<String, Object> filters) {
final List<Role> roles;
if (filters.containsKey("name")) {
final String name = (String) filters.get("name");
roles = roleRepo.searchByName(name, pageSize, first);
setRowCount((int) roleRepo.searchByNameCount(name));
} else {
roles = roleRepo.findAllOrderedByRole(pageSize, first);
setRowCount((int) roleRepo.count());
}
return roles;
}
}
}

View File

@ -1,213 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:loadBundle basename="com.arsdigita.ui.admin.AdminResources"
var="texts" />
<h:head>
<title>
LibreCCM Admin
</title>
</h:head>
<h:body>
<f:metadata>
<f:event listener="#{authorizationListener.isPermitted}"
type="preRenderView" />
<f:attribute name="requiredPrivilege" value="admin" />
</f:metadata>
<div id="header">
<h:outputStylesheet library="admin-jsf" name="header.css" />
<div id="logo">
<h:graphicImage alt=""
height="70"
library="admin-jsf"
name="libreccm.png" />
</div>
<h:form id="user-widget">
<p:menuButton rendered="#{userContextController.loggedIn}"
value="#{userContextController.currentUserName}">
<p:menuitem action="#{userContextController.changePassword()}"
icon="fa fa-edit"
value="Change password" />
<p:menuitem action="#{userContextController.logout()}"
icon="fa fa-sign-out"
value="Logout" />
</p:menuButton>
</h:form>
</div>
<p:tabView dynamic="true" id="admin-tabs">
<p:tab title="#{texts['ui.admin.tab.applications']}">
<h:outputText value="Applications Placeholder" />
</p:tab>
<p:tab title="#{texts['ui.admin.tab.users_groups_roles.title']}">
<p:tabView dynamic="true"
id="user-groups-roles-tabs"
orientation="left">
<p:tab title="Users">
<h:outputText value="Users Placeholder" />
</p:tab>
<p:tab title="Groups">
<h:outputText value="Groups Placeholder" />
</p:tab>
<p:tab title="Roles">
<h:form id="rolesForm">
<p:dataTable id="rolesTable"
lazy="true"
paginator="true"
rows="20"
rowsPerPageTemplate="20,50"
scrollable="true"
tableStyle="table-layout: auto;"
value="#{rolesController.tableModel}"
var="role">
<f:facet name="header">
<h:outputText value="#{texts['ui.admin.tab.users_groups_roles.title']}" />
</f:facet>
<p:column filterBy="#{role.name}"
headerText="#{texts['ui.admin.roles.table.name']}"
id="role-name">
<h:outputText value="#{role.name}" />
</p:column>
<p:column style="text-align: center">
<p:commandButton icon="ui-icon-wrench"
iconPos="center"
oncomplete="PF('roleDialog').show()"
title="Edit"
update=":admin-tabs:user-groups-roles-tabs:rolesForm:roleDetails">
<f:setPropertyActionListener value="#{role}"
target="#{rolesController.selectedRole}" />
</p:commandButton>
</p:column>
<p:column style="text-align: center">
<p:commandButton icon="ui-icon-closethick"
iconPos="center"
title="Delete">
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="#{texts['ui.admin.tab.users_groups_roles.edit']}"
widgetVar="roleDialog"
modal="true"
showEffect="fade"
hideEffect="fade"
style="font-size: 1.2em;">
<p:outputPanel id="roleDetails">
<p:tabView dynamic="true"
id="rolesDetailTab">
<p:tab title="#{texts['ui.admin.tab.users_groups_roles.role_details']}">
<p:inputText
id="selectedRoleName"
value="#{rolesController.selectedRoleName}" />
<div>
<p:commandButton action="#{rolesController.renameSelectedRole()}"
oncomplete="PF('roleDialog').hide()"
update=":admin-tabs:user-groups-roles-tabs:rolesForm:rolesTable"
value="#{texts['ui.admin.tab.users_groups_roles.role_details.save']}"/>
<p:commandButton action="#{rolesController.renameSelectedRoleCancel()}"
oncomplete="PF('roleDialog').hide()"
value="#{texts['ui.admin.tab.users_groups_roles.role_details.cancel']}"/>
</div>
<!-- <h:outputText id="selectedRoleName"
value="#{rolesController.selectedRole.name}" />-->
</p:tab>
<p:tab title="#{texts['ui.admin.tab.users_groups_roles.role_members']}">
<p:dataTable value="#{rolesController.selectedRoleMemberships}"
var="membership">
<p:column headerText="Name">
<h:outputText value="#{membership.member.name}"/>
</p:column>
</p:dataTable>
</p:tab>
<p:tab title="#{texts['ui.admin.tab.users_groups_roles.role_permissions']}">
<p:dataTable tableStyle="table-layout: auto;"
value="#{rolesController.selectedRolePermissions}"
var="permission">
<p:column headerText="Privilege">
<h:outputText value="#{permission.grantedPrivilege}" />
</p:column>
<p:column headerText="On object">
<h:outputText rendered="#{permission.object != null}"
value="#{permission.object.displayName}" />
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
</p:outputPanel>
</p:dialog>
</h:form>
</p:tab>
</p:tabView>
</p:tab>
<p:tab title="#{texts['ui.admin.tab.categories.title']}">
<h:outputText value="Categories Placeholder" />
</p:tab>
<p:tab title="#{texts['ui.admin.tab.configuration.title']}">
<h:outputText value="Configuration Placeholder" />
</p:tab>
<p:tab title="#{texts['ui.admin.tab.workflows.title']}">
<h:outputText value="Workflows Placeholder" />
</p:tab>
<p:tab title="#{texts['ui.admin.tab.sysinfo.title']}">
<p:dataTable value="#{sysInfoController.systemInformation}"
var="prop">
<f:facet name="header">
<h:outputText value="#{texts['ui.admin.sysinfo.appinfo']}" />
</f:facet>
<p:column>
<h:outputText value="#{prop.name}" />
</p:column>
<p:column>
<h:outputText value="#{prop.value}" />
</p:column>
</p:dataTable>
<p:dataTable value="#{sysInfoController.javaSystemProperties}"
var="prop">
<f:facet name="header">
<h:outputText value="#{texts['ui.admin.sysinfo.java_system_properties']}" />
</f:facet>
<p:column>
<h:outputText value="#{prop.name}" />
</p:column>
<p:column>
<h:outputText value="#{prop.value}" />
</p:column>
</p:dataTable>
<p:dataTable value="#{sysInfoController.xmlConfig}"
var="prop">
<f:facet name="header">
<h:outputText value="#{texts['ui.admin.sysinfo.xml_config']}" />
</f:facet>
<p:column>
<h:outputText value="#{prop.name}" />
</p:column>
<p:column>
<h:outputText value="#{prop.value}" />
</p:column>
</p:dataTable>
<h:outputText value="Systeminformation Placeholder" />
</p:tab>
</p:tabView>
<h:outputText value="LibreCCM Admin Faces Placeholder" />
</h:body>
</html>

View File

@ -1,33 +0,0 @@
body {
margin: 0;
}
div#header {
background-color: #56a1bd;
background-image: -moz-linear-gradient(top, #56a1bd 5%, #024C68 95%);
background-image: -webkit-linear-gradient(top, #56a1bd 5%, #024C68 95%);
background-image: linear-gradient(top, #56a1bd 5%, #024C68 95%);
display: flex;
height: 70px;
padding: 0 10px;
position: relative;
}
#logo, #user-widget {
flex: 1;
}
#user-widget {
position: absolute;
top: 15px;
right: 10px;
}
.ui-widget, .ui-widget .ui-widget {
font-size: 90% !important;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,16 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<head>
<title>
JSF Test
</title>
</head>
<body>
<h:outputText value="JSF TEST ccm-core:/resources/"/>
</body>
</html>

View File

@ -1,16 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<head>
<title>
JSF Test
</title>
</head>
<body>
<h:outputText value="JSF TEST"/>
</body>
</html>

View File

@ -483,11 +483,11 @@
</dependency> </dependency>
<!-- PrimeFaces for JSF prototype --> <!-- PrimeFaces for JSF prototype -->
<dependency> <!-- <dependency>
<groupId>org.primefaces</groupId> <groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId> <artifactId>primefaces</artifactId>
<version>6.1</version> <version>6.1</version>
</dependency> </dependency>-->
<!-- Vaadin dependencies for Vaadin prototype --> <!-- Vaadin dependencies for Vaadin prototype -->
<!-- Vaadin dependencies --> <!-- Vaadin dependencies -->