mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-15 03:36:33 +03:00
Display sidebar even if there are no tables (or any other objects)
This commit is contained in:
parent
474c439076
commit
9f8f45db5a
File diff suppressed because one or more lines are too long
@ -124,8 +124,6 @@ function buildSchemaSection(name, objects) {
|
|||||||
section += "<div class='schema-container'>";
|
section += "<div class='schema-container'>";
|
||||||
|
|
||||||
for (group of ["table", "view", "materialized_view", "sequence"]) {
|
for (group of ["table", "view", "materialized_view", "sequence"]) {
|
||||||
if (objects[group].length == 0) continue;
|
|
||||||
|
|
||||||
group_klass = "";
|
group_klass = "";
|
||||||
if (name == "public" && group == "table") group_klass = "expanded";
|
if (name == "public" && group == "table") group_klass = "expanded";
|
||||||
|
|
||||||
@ -133,6 +131,8 @@ function buildSchemaSection(name, objects) {
|
|||||||
section += "<div class='schema-group-title'><i class='fa fa-chevron-right'></i><i class='fa fa-chevron-down'></i> " + titles[group] + " (" + objects[group].length + ")</div>";
|
section += "<div class='schema-group-title'><i class='fa fa-chevron-right'></i><i class='fa fa-chevron-down'></i> " + titles[group] + " (" + objects[group].length + ")</div>";
|
||||||
section += "<ul>"
|
section += "<ul>"
|
||||||
|
|
||||||
|
if (!objects[group]) continue;
|
||||||
|
|
||||||
for (item of objects[group]) {
|
for (item of objects[group]) {
|
||||||
var id = name + "." + item;
|
var id = name + "." + item;
|
||||||
section += "<li class='schema-" + group + "' data-type='" + group + "' data-id='" + id + "'>" + icons[group] + " " + item + "</li>";
|
section += "<li class='schema-" + group + "' data-type='" + group + "' data-id='" + id + "'>" + icons[group] + " " + item + "</li>";
|
||||||
@ -149,6 +149,15 @@ function loadSchemas() {
|
|||||||
$("#objects").html("");
|
$("#objects").html("");
|
||||||
|
|
||||||
getObjects(function(data) {
|
getObjects(function(data) {
|
||||||
|
if (Object.keys(data).length == 0) {
|
||||||
|
data["public"] = {
|
||||||
|
table: [],
|
||||||
|
view: [],
|
||||||
|
materialized_view: [],
|
||||||
|
sequence: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
for (schema in data) {
|
for (schema in data) {
|
||||||
$(buildSchemaSection(schema, data[schema])).appendTo("#objects");
|
$(buildSchemaSection(schema, data[schema])).appendTo("#objects");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user