`
+const FIELDS_LIST_OPEN string = ``
const FIELDS_LIST_CLOSE string = `
`
const FIELD_TEMPLATE string = `
-
@@ -47,8 +48,9 @@ func TableTree(tree map[string][]string) string {
var body string
for _, table := range getSortedKeys(tree) {
- body += fmt.Sprintf(TABLE_TEMPLATE, table)
- body += FIELDS_LIST_OPEN + generateFields(tree[table]) + FIELDS_LIST_CLOSE
+ body += fmt.Sprintf(TABLE_TEMPLATE, table, table, table, table, table)
+ fields := fmt.Sprintf(FIELDS_LIST_OPEN, table)
+ body += fields + generateFields(tree[table]) + FIELDS_LIST_CLOSE
}
html += fmt.Sprintf(TREE_BODY_TEMPLATE, body)
diff --git a/tailwind.config.js b/tailwind.config.js
index a9fb18f..5a1165c 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -2,7 +2,8 @@
module.exports = {
content: [
"./web/templates/*.html",
- "./web/templates/**/*.html"
+ "./web/templates/**/*.html",
+ "./internal/templates/*.go"
],
darkMode: "class",
theme: {
diff --git a/web/static/scripts/tree.js b/web/static/scripts/tree.js
new file mode 100644
index 0000000..55cb93a
--- /dev/null
+++ b/web/static/scripts/tree.js
@@ -0,0 +1,25 @@
+/*
+ * 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 }));
+}
diff --git a/web/static/styles/main.css b/web/static/styles/main.css
index 4d0dc51..4d768ec 100644
--- a/web/static/styles/main.css
+++ b/web/static/styles/main.css
@@ -613,6 +613,14 @@ video {
margin-top: 1rem;
}
+.mr-auto {
+ margin-right: auto;
+}
+
+.ml-auto {
+ margin-left: auto;
+}
+
.block {
display: block;
}
@@ -657,6 +665,10 @@ video {
height: 100vh;
}
+.h-8 {
+ height: 2rem;
+}
+
.max-h-full {
max-height: 100%;
}
@@ -693,6 +705,10 @@ video {
width: 100%;
}
+.w-8 {
+ width: 2rem;
+}
+
.min-w-full {
min-width: 100%;
}
@@ -701,6 +717,20 @@ video {
flex-grow: 1;
}
+.rotate-180 {
+ --tw-rotate: 180deg;
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
+}
+
+.rotate-90 {
+ --tw-rotate: 90deg;
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
+}
+
+.transform {
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
+}
+
.grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@@ -854,6 +884,16 @@ video {
background-color: rgb(234 179 8 / var(--tw-bg-opacity));
}
+.bg-red-500 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(239 68 68 / var(--tw-bg-opacity));
+}
+
+.bg-red-400 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(248 113 113 / var(--tw-bg-opacity));
+}
+
.bg-opacity-50 {
--tw-bg-opacity: 0.5;
}
@@ -870,6 +910,15 @@ video {
padding: 1.5rem;
}
+.p-1 {
+ padding: 0.25rem;
+}
+
+.px-1 {
+ padding-left: 0.25rem;
+ padding-right: 0.25rem;
+}
+
.px-3 {
padding-left: 0.75rem;
padding-right: 0.75rem;
@@ -900,11 +949,6 @@ video {
padding-bottom: 1rem;
}
-.px-2 {
- padding-left: 0.5rem;
- padding-right: 0.5rem;
-}
-
.pb-2 {
padding-bottom: 0.5rem;
}
@@ -1005,16 +1049,46 @@ video {
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
+.duration-300 {
+ transition-duration: 300ms;
+}
+
+.duration-100 {
+ transition-duration: 100ms;
+}
+
+.duration-150 {
+ transition-duration: 150ms;
+}
+
+.\*\:hidden > * {
+ display: none;
+}
+
.hover\:bg-gray-100:hover {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
}
+.hover\:bg-gray-200:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(229 231 235 / var(--tw-bg-opacity));
+}
+
+.hover\:bg-gray-300:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(209 213 219 / var(--tw-bg-opacity));
+}
+
.hover\:text-gray-700:hover {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
}
+.hover\:underline:hover {
+ text-decoration-line: underline;
+}
+
.focus\:border-blue-500:focus {
--tw-border-opacity: 1;
border-color: rgb(59 130 246 / var(--tw-border-opacity));
diff --git a/web/templates/index.html b/web/templates/index.html
index 78e9b20..107422f 100644
--- a/web/templates/index.html
+++ b/web/templates/index.html
@@ -22,7 +22,7 @@
-
@@ -174,8 +174,9 @@
-
-
+
+
+