Serving HTML and resources for Admin UI
parent
a0ae1d1c64
commit
fa7a74080d
|
|
@ -200,6 +200,7 @@
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<includes>
|
<includes>
|
||||||
<include>assets/</include>
|
<include>assets/</include>
|
||||||
|
<include>_admin/</include>
|
||||||
</includes>
|
</includes>
|
||||||
</overlay>
|
</overlay>
|
||||||
<overlay>
|
<overlay>
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,8 @@
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>target/generated-resources/@admin</directory>
|
<directory>target/generated-resources/_admin</directory>
|
||||||
|
<targetPath>_admin</targetPath>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build --dest ../../target/generated-resources/@admin/systeminformation",
|
"build": "vue-cli-service build --dest ../../target/generated-resources/_admin/systeminformation",
|
||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
@ -35,6 +35,9 @@
|
||||||
"typescript": "~3.9.3",
|
"typescript": "~3.9.3",
|
||||||
"vue-template-compiler": "^2.6.11"
|
"vue-template-compiler": "^2.6.11"
|
||||||
},
|
},
|
||||||
|
"vue": {
|
||||||
|
"filenameHashing": false
|
||||||
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"root": true,
|
"root": true,
|
||||||
"env": {
|
"env": {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import java.io.StringWriter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
|
@ -61,9 +62,10 @@ public class AdminUi {
|
||||||
@Inject
|
@Inject
|
||||||
private ServletContext servletContext;
|
private ServletContext servletContext;
|
||||||
|
|
||||||
private final Configuration configuration;
|
private Configuration configuration;
|
||||||
|
|
||||||
public AdminUi() {
|
@PostConstruct
|
||||||
|
private void init() {
|
||||||
configuration = new Configuration(Configuration.VERSION_2_3_30);
|
configuration = new Configuration(Configuration.VERSION_2_3_30);
|
||||||
configuration.setDefaultEncoding("UTF-8");
|
configuration.setDefaultEncoding("UTF-8");
|
||||||
configuration
|
configuration
|
||||||
|
|
@ -84,6 +86,15 @@ public class AdminUi {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/")
|
||||||
|
@Produces(MediaType.TEXT_HTML)
|
||||||
|
@AuthorizationRequired
|
||||||
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
|
public String getDashboard() {
|
||||||
|
return getApp("dashboard");
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{appName}")
|
@Path("/{appName}")
|
||||||
@Produces(MediaType.TEXT_HTML)
|
@Produces(MediaType.TEXT_HTML)
|
||||||
|
|
@ -113,7 +124,7 @@ public class AdminUi {
|
||||||
|
|
||||||
final Map<String, Object> data = new HashMap<>();
|
final Map<String, Object> data = new HashMap<>();
|
||||||
data.put("adminUiApps", adminUiApps.getAdminUiApps());
|
data.put("adminUiApps", adminUiApps.getAdminUiApps());
|
||||||
data.put("activeApp", appName);
|
data.put("activeApp", app);
|
||||||
|
|
||||||
final StringWriter writer = new StringWriter();
|
final StringWriter writer = new StringWriter();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,19 @@ public interface AdminUiApp {
|
||||||
int getOrder();
|
int getOrder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path portion of the URL of the JavaScript file providing the Admin UI
|
* Path portion of the URL of the JavaScript file(s) providing the Admin UI
|
||||||
* App.
|
* App.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getJsFileUrl();
|
String[] getJsFilesUrls();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path portion of the URL of the CSS file(s) of the application.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String[] getCssFilesUrls();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the icon from the Bootstrap Icons set
|
* Name of the icon from the Bootstrap Icons set
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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.ui.admin;
|
||||||
|
|
||||||
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class DashboardApp implements AdminUiApp {
|
||||||
|
|
||||||
|
private ResourceBundle adminBundle;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
private void init() {
|
||||||
|
adminBundle = ResourceBundle.getBundle(
|
||||||
|
"org.libreccm.ui.admin", globalizationHelper.getNegotiatedLocale()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "dashboard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel() {
|
||||||
|
return adminBundle.getString("dashboard.label");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return adminBundle.getString("dashboard.description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getJsFilesUrls() {
|
||||||
|
return new String[]{};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getCssFilesUrls() {
|
||||||
|
return new String[]{};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<String> getIconName() {
|
||||||
|
return Optional.of("house-fill");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<String> getSymbolUrl() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 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.ui.admin;
|
||||||
|
|
||||||
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class SystemInformationApp implements AdminUiApp {
|
||||||
|
|
||||||
|
private ResourceBundle adminBundle;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
private void init() {
|
||||||
|
adminBundle = ResourceBundle.getBundle(
|
||||||
|
"org.libreccm.ui.admin", globalizationHelper.getNegotiatedLocale()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "systeminformation";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel() {
|
||||||
|
return adminBundle.getString("systeminformation.label");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return adminBundle.getString("systeminformation.description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getJsFilesUrls() {
|
||||||
|
return new String[]{
|
||||||
|
"/@admin/systeminformation/js/app.js",
|
||||||
|
"/@admin/systeminformation/js/chunk-vendors.js",};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getCssFilesUrls() {
|
||||||
|
return new String[]{
|
||||||
|
"/@admin/systeminformation/css/app.css",};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<String> getIconName() {
|
||||||
|
return Optional.of("info-circle");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<String> getSymbolUrl() {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Copyright (C) 2020 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
|
||||||
|
|
||||||
|
systeminformation.label=System Information
|
||||||
|
systeminformation.description=Shows several system properties
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Copyright (C) 2020 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
|
||||||
|
|
||||||
|
systeminformation.label=System Informationen
|
||||||
|
systeminformation.description=Zeigt verschiedene Eigenschaften des Systems
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<body>
|
<body>
|
||||||
<h1>Admin UI</h1>
|
<h1>Admin UI</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<#list adminUis as adminUi>
|
<#list adminUiApps as app>
|
||||||
<li>{{adminUi.name}}</li>
|
<li>${app.name}</li>
|
||||||
</#list>
|
</#list>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue