Skip to content
Snippets Groups Projects
Unverified Commit f91d7a5f authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Add display_name to Table search results (#10612)

parent 98cc8e72
No related merge requests found
......@@ -66,6 +66,7 @@
:model :text
:id :integer
:name :text
:display_name :text
:description :text
:archived :boolean
;; returned for Card, Dashboard, Pulse, and Collection
......@@ -132,6 +133,7 @@
[_]
[:id
:name
:display_name
:description
[:id :table_id]
[:db_id :database_id]
......@@ -308,7 +310,7 @@
{:select (:select base-query)
:from [[(merge
base-query
{:select [:id :schema :db_id :name :description
{:select [:id :schema :db_id :name :description :display_name
[(hx/concat (hx/literal "/db/") :db_id (hx/literal "/")
(hsql/call :case [:not= :schema nil] :schema :else (hx/literal "")) (hx/literal "/")
:id (hx/literal "/"))
......
......@@ -28,6 +28,7 @@
(def ^:private default-search-row
{:id true
:description nil
:display_name nil
:archived false
:collection_id false
:collection_position nil
......@@ -298,19 +299,23 @@
(defn- default-table-search-row [table-name]
(merge
default-search-row
{:name table-name, :table_name table-name :table_id true, :archived nil, :model "table", :database_id true}))
{:name table-name
:display_name table-name
:table_name table-name
:table_id true
:archived nil
:model "table"
:database_id true}))
(let [table-name (tu/random-name)]
(expect
[(default-table-search-row table-name)]
(tt/with-temp Table [table {:name table-name}]
(search-request :crowberto :q table-name))))
(expect
[(default-table-search-row "Round Table")]
(tt/with-temp Table [table {:name "Round Table"}]
(search-request :crowberto :q "Round Table")))
(let [table-name (tu/random-name)]
(expect
[(default-table-search-row table-name)]
(tt/with-temp Table [table {:name table-name}]
(search-request :rasta :q table-name))))
(expect
[(default-table-search-row "Kitchen Table")]
(tt/with-temp Table [table {:name "Kitchen Table"}]
(search-request :rasta :q "Kitchen Table")))
;; you should not be able to see a Table if the current user doesn't have permissions for that Table
(expect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment