-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
47 lines (47 loc) · 1.47 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(function () {
function renderTableCard(table) {
const tablesContainer = document.getElementById("tables-container");
const tableBody = document.createElement("div");
const tableCard = `
<div class="table-header"></div>
<div class="table-body">
<h3 class="white-text table-heading">
${table.schemaName}
<span class="table-subheading">(MODEL for ${table.tableName})</span>
</h3>
${
table.columns.length &&
table.columns
.map(
(column, i) =>
`<div class="field-container">
<div>
<b
class="field-option ${
column.modifiers &&
column.modifiers.findIndex(
(obj) => obj.name === "nullable"
) !== -1
? "active-color"
: ""
}"
>
N
</b>
<span class="white-text">${column.name}</span>
</div>
<span class="white-text">${column.dataType}</span>
</div>`
)
.join("")
}
<br />
</div>
`;
tableBody.innerHTML = tableCard;
tableBody.setAttribute("class", "table-container");
tableBody.onclick = ($event) => openSchemaForm($event, table);
tablesContainer.appendChild(tableBody);
}
renderTableCard(tablesData[0]);
})();