webapp: refactored apps.js.

This commit is contained in:
Shreyas Zare
2021-05-23 19:01:25 +05:30
parent a1cd3cd380
commit 331e18b197

View File

@@ -38,21 +38,21 @@ function refreshApps() {
var updateUrl = apps[i].updateUrl;
var updateAvailable = apps[i].updateAvailable;
var detailsTable = "<table class=\"table\"><thead><th>Class Path</th><th>Description</th><th>Record Data Template</th></thead><tbody>";
var requestHandlersTable = "<table class=\"table\"><thead><th>Class Path</th><th>Description</th><th>Record Data Template</th></thead><tbody>";
for (var j = 0; j < apps[i].details.length; j++) {
detailsTable += "<tr><td>" + htmlEncode(apps[i].details[j].classPath) + "</td><td>" +
htmlEncode(apps[i].details[j].description).replace(/\n/g, "<br />") + "</td><td>" +
(apps[i].details[j].recordDataTemplate == null ? "" : "<pre>" + htmlEncode(apps[i].details[j].recordDataTemplate) + "</pre>") + "</td></tr>";
for (var j = 0; j < apps[i].requestHandlers.length; j++) {
requestHandlersTable += "<tr><td>" + htmlEncode(apps[i].requestHandlers[j].classPath) + "</td><td>" +
htmlEncode(apps[i].requestHandlers[j].description).replace(/\n/g, "<br />") + "</td><td>" +
(apps[i].requestHandlers[j].recordDataTemplate == null ? "" : "<pre>" + htmlEncode(apps[i].requestHandlers[j].recordDataTemplate) + "</pre>") + "</td></tr>";
}
if (apps[i].details.length == 0)
detailsTable += "<tr><td colspan=\"3\" align=\"center\">No Class Paths Found!</td></tr>";
if (apps[i].requestHandlers.length == 0)
requestHandlersTable += "<tr><td colspan=\"3\" align=\"center\">No Request Handlers Found!</td></tr>";
detailsTable += "</tbody></table>"
requestHandlersTable += "</tbody></table>"
tableHtmlRows += "<tr id=\"trApp" + id + "\"><td><div style=\"margin-bottom: 20px;\"><span style=\"font-weight: bold; font-size: 16px;\">" + htmlEncode(name) + "</span><br /><span id=\"trAppVersion" + id + "\" class=\"label label-primary\">Version " + htmlEncode(version) + "</span> <span id=\"trAppUpdateVersion" + id + "\" class=\"label label-warning\" style=\"" + (updateAvailable ? "" : "display: none;") + "\">Update " + htmlEncode(updateVersion) + "</span></div>";
tableHtmlRows += "<div><div style=\"font-weight: bold; margin-bottom: 4px;\">APP Record Request Handlers</div>" + detailsTable + "</div></td>";
tableHtmlRows += "<div><div style=\"font-weight: bold; margin-bottom: 4px;\">APP Record Request Handlers</div>" + requestHandlersTable + "</div></td>";
tableHtmlRows += "<td><button type=\"button\" class=\"btn btn-default\" style=\"font-size: 12px; padding: 2px 0px; width: 80px; margin-bottom: 6px; display: block;\" onclick=\"showAppConfigModal(this, '" + name + "');\" data-loading-text=\"Loading...\">Config</button>";
tableHtmlRows += "<button type=\"button\" class=\"btn btn-warning\" style=\"font-size: 12px; padding: 2px 0px; width: 80px; margin-bottom: 6px; display: block;\" onclick=\"showUpdateAppModal('" + name + "');\">Update</button>";
tableHtmlRows += "<button id=\"btnAppsStoreUpdate" + id + "\" type=\"button\" data-id=\"" + id + "\" class=\"btn btn-warning\" style=\"font-size: 12px; padding: 2px 0px; width: 80px; margin-bottom: 6px; " + (updateAvailable ? "" : "display: none;") + "\" onclick=\"updateStoreApp(this, '" + name + "', '" + updateUrl + "', false);\" data-loading-text=\"Updating...\">Store Update</button>";