Azpect3120 0876222f4c FEAT: Many changes! Tree is almost done
Loading indicator for loading the tree. Tree displays PK, FK, R, and U.
Still some bugs with the connections and I want to implement a
"connection manager" which the ability to change, edit, and delete
connections. PLUS right now the tree view is only supported for PSQL.
Need to use different queries for different SQL types. SOME types, like
SQLlite, might not support the tree, and I will need a display for that.
Plus errors are not handled, just bubbled and logged :|
2024-08-09 18:04:04 -07:00

32 lines
1022 B
JavaScript

/*
* This file contains the functions that are used to toggle the visibility of the fields
* in the tree view of the tables.
*
* This file also contains the functions that are used to generate quick queries for the
* tables.
*/
function ToggleFields(id) {
const fields = document.getElementById(`fields-${id}`);
const button_svg = document.getElementById(`icon-${id}`);
if (fields.classList.contains("hidden")) {
fields.classList.remove("hidden");
button_svg.setAttribute("transform", "rotate(0)");
} else {
fields.classList.add("hidden");
button_svg.setAttribute("transform", "rotate(-90)");
}
}
function LoadTableQuery(table) {
const sql = document.getElementById("sql")
sql.value = `SELECT * FROM ${table};`;
sql.dispatchEvent(new Event("input", { bubbles: true }));
}
function LoadTableQueryWithFields(table, fields) {
const sql = document.getElementById("sql")
sql.value = `SELECT ${fields} FROM ${table};`;
sql.dispatchEvent(new Event("input", { bubbles: true }));
}