mirror of
https://github.com/danbulant/mysqlExporter
synced 2026-07-04 02:40:41 +00:00
Fix formatting
This commit is contained in:
parent
584526b9e9
commit
c0a1d3eb75
1 changed files with 34 additions and 27 deletions
|
|
@ -118,6 +118,21 @@
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const func = e => {
|
||||||
|
var id = (e.target.id.startsWith("hidden_") ? "" : "hidden_") + e.target.id;
|
||||||
|
var idShort = (!e.target.id.startsWith("hidden_") ? e.target.id : e.target.id.substr("hidden_".length));
|
||||||
|
|
||||||
|
let hidden = document.getElementById(id);
|
||||||
|
hidden.classList.toggle("hidden");
|
||||||
|
|
||||||
|
if (hidden.classList.contains("hidden")) {
|
||||||
|
document.getElementById(idShort).innerText += "...";
|
||||||
|
} else {
|
||||||
|
document.getElementById(idShort).innerText = document.getElementById(idShort).innerText.substr(0,
|
||||||
|
document.getElementById(idShort).innerText.length - 3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function key(title, color, color2, color3) {
|
function key(title, color, color2, color3) {
|
||||||
return `<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="24"
|
return `<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="24"
|
||||||
width="24" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
width="24" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
|
@ -140,6 +155,7 @@
|
||||||
</g>
|
</g>
|
||||||
</svg>`;
|
</svg>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function multikey() {
|
function multikey() {
|
||||||
return `<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
return `<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||||
width="22.000000pt" height="24.000000pt" viewBox="0 0 1113.000000 1280.000000"
|
width="22.000000pt" height="24.000000pt" viewBox="0 0 1113.000000 1280.000000"
|
||||||
|
|
@ -295,7 +311,7 @@ l145 -6 113 -146 c62 -80 188 -237 280 -348 l167 -202 50 -6 c190 -26 347
|
||||||
var text = column[field];
|
var text = column[field];
|
||||||
column[field] = document.createElement("span");
|
column[field] = document.createElement("span");
|
||||||
var span = column[field];
|
var span = column[field];
|
||||||
if(text.length < 20) {
|
if (text.length < 20) {
|
||||||
span.innerText = text;
|
span.innerText = text;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -307,19 +323,7 @@ l145 -6 113 -146 c62 -80 188 -237 280 -348 l167 -202 50 -6 c190 -26 347
|
||||||
hidden.id = "hidden_span_" + table + "_" + column.Field;
|
hidden.id = "hidden_span_" + table + "_" + column.Field;
|
||||||
shown.id = "span_" + table + "_" + column.Field;
|
shown.id = "span_" + table + "_" + column.Field;
|
||||||
|
|
||||||
span.onclick = e => {
|
span.onclick = func;
|
||||||
var id = (e.target.id.startsWith("hidden_") ? "" : "hidden_") + e.target.id;
|
|
||||||
var idShort = (!e.target.id.startsWith("hidden_") ? e.target.id : e.target.id.substr("hidden_".length));
|
|
||||||
|
|
||||||
let hidden = document.getElementById(id);
|
|
||||||
hidden.classList.toggle("hidden");
|
|
||||||
|
|
||||||
if(hidden.classList.contains("hidden")) {
|
|
||||||
document.getElementById(idShort).innerText += "...";
|
|
||||||
} else {
|
|
||||||
document.getElementById(idShort).innerText = document.getElementById(idShort).innerText.substr(0, document.getElementById(idShort).innerText.length - 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// hidden.onclick = e => {
|
// hidden.onclick = e => {
|
||||||
// let hidden = document.getElementById(e.target.id);
|
// let hidden = document.getElementById(e.target.id);
|
||||||
|
|
@ -331,26 +335,29 @@ l145 -6 113 -146 c62 -80 188 -237 280 -348 l167 -202 50 -6 c190 -26 347
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "key":
|
case "key":
|
||||||
switch(column[field]) {
|
switch (column[field]) {
|
||||||
case "PRI":
|
case "PRI":
|
||||||
column[field] = htmlToElement(key("Primary key", "#f39c12", "#f1c40f", "#f39c12"));
|
column[field] = htmlToElement(key("Primary key", "#f39c12", "#f1c40f",
|
||||||
|
"#f39c12"));
|
||||||
break;
|
break;
|
||||||
case "UNI":
|
case "UNI":
|
||||||
column[field] = htmlToElement(key("Unique key", "#bfbfbf", "#dbdbdb", "#808080"));
|
column[field] = htmlToElement(key("Unique key", "#bfbfbf", "#dbdbdb",
|
||||||
|
"#808080"));
|
||||||
break;
|
break;
|
||||||
case "MUL":
|
case "MUL":
|
||||||
column[field] = "";
|
column[field] = "";
|
||||||
break;
|
break;
|
||||||
case "": break;
|
case "":
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error("Unknown key:", column[field]);
|
console.error("Unknown key:", column[field]);
|
||||||
}
|
}
|
||||||
case "extra":
|
case "extra":
|
||||||
if (column[field] === "auto_increment") {
|
if (column[field] === "auto_increment") {
|
||||||
column[field] = "AI";
|
column[field] = "AI";
|
||||||
td.title = "Auto increment";
|
td.title = "Auto increment";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column[field]) {
|
if (column[field]) {
|
||||||
|
|
@ -370,7 +377,7 @@ l145 -6 113 -146 c62 -80 188 -237 280 -348 l167 -202 50 -6 c190 -26 347
|
||||||
let t = document.querySelector(`#${el.id} > .key`);
|
let t = document.querySelector(`#${el.id} > .key`);
|
||||||
|
|
||||||
var d = data.indexes.filter(e => e.Column_name === column.Field);
|
var d = data.indexes.filter(e => e.Column_name === column.Field);
|
||||||
if(d[0] && !t.childElementCount)
|
if (d[0] && !t.childElementCount)
|
||||||
t.appendChild(htmlToElement(multikey()));
|
t.appendChild(htmlToElement(multikey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue