Display sidebar even if there are no tables (or any other objects)

This commit is contained in:
Dan Sosedoff 2016-11-15 20:55:03 -06:00
parent 474c439076
commit 9f8f45db5a
2 changed files with 203 additions and 269 deletions

File diff suppressed because one or more lines are too long

View File

@ -124,8 +124,6 @@ function buildSchemaSection(name, objects) {
section += "<div class='schema-container'>";
for (group of ["table", "view", "materialized_view", "sequence"]) {
if (objects[group].length == 0) continue;
group_klass = "";
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 += "<ul>"
if (!objects[group]) continue;
for (item of objects[group]) {
var id = name + "." + item;
section += "<li class='schema-" + group + "' data-type='" + group + "' data-id='" + id + "'>" + icons[group] + "&nbsp;" + item + "</li>";
@ -149,6 +149,15 @@ function loadSchemas() {
$("#objects").html("");
getObjects(function(data) {
if (Object.keys(data).length == 0) {
data["public"] = {
table: [],
view: [],
materialized_view: [],
sequence: []
};
}
for (schema in data) {
$(buildSchemaSection(schema, data[schema])).appendTo("#objects");
}