Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use about.jsp from generic #17

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 1 addition & 103 deletions src/main/resources/webapp/excel-importer-admin/pages/about.jsp
Original file line number Diff line number Diff line change
@@ -1,103 +1 @@
<%@ page import="ch.sbb.polarion.extension.generic.properties.CurrentExtensionConfiguration" %>
<%@ page import="ch.sbb.polarion.extension.generic.rest.model.Version" %>
<%@ page import="ch.sbb.polarion.extension.generic.util.ExtensionInfo" %>
<%@ page import="ch.sbb.polarion.extension.generic.util.VersionUtils" %>
<%@ page import="java.util.Collections" %>
<%@ page import="java.util.Properties" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<%!
private static final String ABOUT_TABLE_ROW = "<tr><td>%s</td><td>%s</td></tr>";
private static final String CONFIGURATION_PROPERTIES_TABLE_ROW = "<tr><td>%s</td><td>%s</td></tr>";

Version version = ExtensionInfo.getInstance().getVersion();
Properties properties = CurrentExtensionConfiguration.getInstance().getExtensionConfiguration().getProperties();
%>

<head>
<title></title>
<link rel="stylesheet" href="../ui/generic/css/common.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
<link rel="stylesheet" href="../ui/generic/css/about.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
<link rel="stylesheet" href="../ui/generic/css/github-markdown-light.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
</head>

<body>
<div class="standard-admin-page about-page">
<h1>About</h1>

<div class="about-page-text">
<img class="app-icon" src="../ui/images/app-icon.svg?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>" alt="" onerror="this.style.display='none'"/>

<h3>Extension info</h3>

<table>
<thead>
<tr>
<th>Manifest entry</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<%
out.println(ABOUT_TABLE_ROW.formatted(VersionUtils.BUNDLE_NAME, version.getBundleName()));
out.println(ABOUT_TABLE_ROW.formatted(VersionUtils.BUNDLE_VENDOR, version.getBundleVendor()));
if (version.getSupportEmail() != null) {
String mailToLink = "<a target=\"_blank\" href=\"mailto:%s\">%s</a>".formatted(version.getSupportEmail(), version.getSupportEmail());
out.println(ABOUT_TABLE_ROW.formatted(VersionUtils.SUPPORT_EMAIL, mailToLink));
}
out.println(ABOUT_TABLE_ROW.formatted(VersionUtils.AUTOMATIC_MODULE_NAME, version.getAutomaticModuleName()));
out.println(ABOUT_TABLE_ROW.formatted(VersionUtils.BUNDLE_VERSION, version.getBundleVersion()));
out.println(ABOUT_TABLE_ROW.formatted(VersionUtils.BUNDLE_BUILD_TIMESTAMP, version.getBundleBuildTimestamp()));
%>
</tbody>
</table>

<h3>Extension configuration properties</h3>

<table>
<thead>
<tr>
<th>Configuration property</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<%
Set<Object> keySet = properties.keySet();
List<String> propertyNames = new ArrayList<>();
for (Object key : keySet) {
propertyNames.add((String) key);
}
Collections.sort(propertyNames);

for (String key : propertyNames) {
String value = properties.getProperty(key);
String row = CONFIGURATION_PROPERTIES_TABLE_ROW.formatted(key, value);
out.println(row);
}
%>
</tbody>
</table>

<input id="scope" type="hidden" value="<%= request.getParameter("scope")%>"/>

<article class="markdown-body">
<%
try (InputStream inputStream = ExtensionInfo.class.getResourceAsStream("/webapp/excel-importer-admin/html/about.html")) {
assert inputStream != null;
String configurationHelp = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
out.println(configurationHelp);
}
%>
</article>
</div>
</div>
</body>
</html>
<jsp:include page="/common/jsp/about.jsp" />
Loading