-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.js
More file actions
33 lines (28 loc) · 1002 Bytes
/
ui.js
File metadata and controls
33 lines (28 loc) · 1002 Bytes
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
// ui.js
const TYPES = [
'int','bigint','decimal(10,2)','varchar(255)','text','date','timestamp','boolean'
];
function fillTypeOptions(select){
select.innerHTML = '';
TYPES.forEach(t => {
const opt = document.createElement('option'); opt.value = t; opt.textContent = t;
select.appendChild(opt);
});
}
function fillColumns(select, table){
select.innerHTML = '';
(table?.columns||[]).forEach(c=>{
const o=document.createElement('option'); o.value=c.id; o.textContent=`${c.name}`;
select.appendChild(o);
});
}
function fillTables(select, schema){
select.innerHTML = '';
schema.tables.forEach(t=>{
const o=document.createElement('option'); o.value=t.id; o.textContent=t.name;
select.appendChild(o);
});
}
// (optional) expose color list for other scripts if needed
const TABLE_COLOR_KEYS = ['white','blue','green','red'];
window.UI = { fillTypeOptions, fillColumns, fillTables, TYPES, TABLE_COLOR_KEYS };