apps.js: fixed app row id issue. implemented app description support. minor ui changes done.

This commit is contained in:
Shreyas Zare
2022-11-26 11:57:07 +05:30
parent 3e9f5ece28
commit 2d53006ebf

View File

@@ -56,7 +56,7 @@ function refreshApps() {
}
function getAppRowId(appName) {
return appName.replace(/ /g, "");
return btoa(appName).replace(/=/g, "");
}
function getAppRowHtml(app) {
@@ -70,7 +70,7 @@ function getAppRowHtml(app) {
//dnsApps
if (app.dnsApps.length > 0) {
dnsAppsTable = "<table class=\"table\" style=\"background: transparent;\"><thead><th>Class Path</th><th>Description</th></thead><tbody>";
dnsAppsTable = "<table class=\"table\" style=\"margin-bottom: 10px; background: transparent;\"><thead><th>Class Path</th><th>Description</th></thead><tbody>";
for (var j = 0; j < app.dnsApps.length; j++) {
var labels = "";
@@ -106,10 +106,17 @@ function getAppRowHtml(app) {
}
var id = getAppRowId(name);
var tableHtmlRow = "<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>";
var tableHtmlRow = "<tr id=\"trApp" + id + "\"><td><div><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>";
if (dnsAppsTable != null)
if (app.description != null)
tableHtmlRow += "<div style=\"margin-top: 10px;\">" + htmlEncode(app.description).replace(/\n/g, "<br />") + "</div>";
if (dnsAppsTable != null) {
tableHtmlRow += "<div style=\"margin-top: 10px;\"><a href=\"#" + id + "\" class=\"collapsed\" data-toggle=\"collapse\" aria-expanded=\"false\" aria-controls=\"" + id + "\">More Details <span class=\"glyphicon glyphicon-chevron-down\" style=\"font-size: 10px;\" aria-hidden=\"true\"></span></a>";
tableHtmlRow += "<div id=\"" + id + "\" class=\"collapse\" aria-expanded=\"false\">";
tableHtmlRow += dnsAppsTable;
tableHtmlRow += "</div></div>";
}
tableHtmlRow += "</td>";
tableHtmlRow += "<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>";
@@ -335,6 +342,7 @@ function installApp() {
HTTPRequest({
url: "/api/apps/install?token=" + sessionData.token + "&name=" + encodeURIComponent(appName),
method: "POST",
data: formData,
processData: false,
success: function (responseJSON) {
@@ -375,6 +383,7 @@ function updateApp() {
HTTPRequest({
url: "/api/apps/update?token=" + sessionData.token + "&name=" + encodeURIComponent(appName),
method: "POST",
data: formData,
processData: false,
success: function (responseJSON) {
@@ -472,6 +481,7 @@ function saveAppConfig() {
HTTPRequest({
url: "/api/apps/config/set?token=" + sessionData.token + "&name=" + encodeURIComponent(appName),
method: "POST",
data: "config=" + encodeURIComponent(config),
processData: false,
success: function (responseJSON) {