diff --git a/static/index.html b/static/index.html
index f490d0c..ca7a7cd 100644
--- a/static/index.html
+++ b/static/index.html
@@ -65,9 +65,17 @@
background-color: rgb(214, 214, 214);
}
+ .privileges {
+ word-break: normal;
+ }
+
.null,
.key {
- width: 40px;
+ width: 30px;
+ }
+
+ .default {
+ width: 50px;
}
@@ -118,7 +126,7 @@
if (!data.columns) {
console.error(data);
- app.appendChild(htmlToElement("
" + data + "
"));
+ app.appendChild(htmlToElement(`
${data}
`));
continue;
}
@@ -128,17 +136,21 @@
app.appendChild(comment);
} catch (e) {}
+ function addField(fieldName) {
+ return fieldsIgnored.includes(fieldName.toLowerCase()) ? "" : `
${fieldName} | `;
+ }
+
var head = htmlToElement(`
- ${fieldsIgnored.includes("field") ? "" : "| Field | " }
- ${fieldsIgnored.includes("type") ? "" : "Type | " }
- ${fieldsIgnored.includes("collation") ? "" : "Collation | " }
- ${fieldsIgnored.includes("null") ? "" : "Null? | " }
- ${fieldsIgnored.includes("key") ? "" : "Key? | " }
- ${fieldsIgnored.includes("default") ? "" : "Default | " }
- ${fieldsIgnored.includes("extra") ? "" : "" }
- ${fieldsIgnored.includes("privileges") ? "" : "Privileges | " }
- ${fieldsIgnored.includes("comment") ? "" : "" }
+ ${addField("Field")}
+ ${addField("Type")}
+ ${addField("Collation")}
+ ${addField("Null")}
+ ${addField("Key")}
+ ${addField("Default")}
+ ${addField("Extra")}
+ ${addField("Privileges")}
+ ${addField("Comment")}
`);
@@ -147,30 +159,31 @@
var el = "";
for (var field in column) {
if (fieldsIgnored.includes(field.toLowerCase())) continue;
+
if (field.toLowerCase() === "privileges") {
column[field] = column[field].split(",").join(", ");
}
+
if (column[field]) {
- el += "" + column[field] + " | ";
+ el += `${column[field]} | `;
} else if (field == "Default") {
- el += "null | ";
+ el += "null | ";
} else {
- el += " | ";
+ el += ` | `;
}
+
}
- tableEl.appendChild(htmlToElement(`
-
- ${el}
-
- `))
+
+ tableEl.appendChild(htmlToElement(`${el}
`));
}
app.appendChild(tableEl);
}
var d = new Date();
- date.innerHTML = "Generated " + d.toString() + ".
Number of tables: " + Object.keys(tables)
- .length + "
Host: " + db.host;
+ date.innerHTML = `Generated ${d.toString()}.
+
Number of tables: ${Object.keys(tables).length}
+
Host: ${db.host}`;
})()