From 05765885eb3a30a45ae0e81f1102e0809af31b03 Mon Sep 17 00:00:00 2001
From: Paul Rosenzweig <paulrosenzweig@users.noreply.github.com>
Date: Thu, 29 Aug 2019 13:57:06 -0400
Subject: [PATCH] only show queryable tables when there are multiple schemas
 (#10757)

---
 frontend/src/metabase/reference/databases/TableList.jsx   | 1 +
 .../metabase/reference/databases/TableList.unit.spec.js   | 8 ++++++++
 2 files changed, 9 insertions(+)
 create mode 100644 frontend/test/metabase/reference/databases/TableList.unit.spec.js

diff --git a/frontend/src/metabase/reference/databases/TableList.jsx b/frontend/src/metabase/reference/databases/TableList.jsx
index 0de78fa1d88..bed4382b90f 100644
--- a/frontend/src/metabase/reference/databases/TableList.jsx
+++ b/frontend/src/metabase/reference/databases/TableList.jsx
@@ -73,6 +73,7 @@ export const separateTablesBySchema = (
         ? 0
         : -1,
     )
+    .filter(isQueryable)
     .map((table, index, sortedTables) => {
       if (!table || !table.id || !table.name) {
         return;
diff --git a/frontend/test/metabase/reference/databases/TableList.unit.spec.js b/frontend/test/metabase/reference/databases/TableList.unit.spec.js
new file mode 100644
index 00000000000..69490765dbf
--- /dev/null
+++ b/frontend/test/metabase/reference/databases/TableList.unit.spec.js
@@ -0,0 +1,8 @@
+import { separateTablesBySchema } from "metabase/reference/databases/TableList";
+
+describe("separateTablesBySchema", () => {
+  it("should filter out hidden tables", () => {
+    const tables = { 1: {}, 2: { visibility_type: "hidden" } };
+    expect(separateTablesBySchema(tables).length).toBe(1);
+  });
+});
-- 
GitLab