Skip to content
Snippets Groups Projects
Unverified Commit f95b5d36 authored by Tim Macdonald's avatar Tim Macdonald Committed by GitHub
Browse files

Toggle search typeahead (#15418)

* Set lein as the preferred build tool for Cider

* Add search-typeahead-enabled setting
parent d39c1f5c
No related branches found
No related tags found
No related merge requests found
......@@ -41,4 +41,5 @@
;; prefer keeping source width about ~118, GitHub seems to cut off stuff at either 119 or 120 and
;; it's nicer to look at code in GH when you don't have to scroll back and forth
(fill-column . 118)
(clojure-docstring-fill-column . 118))))
(clojure-docstring-fill-column . 118)
(cider-preferred-build-tool . lein))))
......@@ -103,7 +103,7 @@ function _init(reducers, getRoutes, callback) {
MetabaseSettings.on("anon-tracking-enabled", () => {
window[
"ga-disable-" + MetabaseSettings.get("ga-code")
] = MetabaseSettings.isTrackingEnabled() ? null : true;
] = MetabaseSettings.trackingEnabled() ? null : true;
});
MetabaseSettings.on("user-locale", async locale => {
......
......@@ -23,6 +23,7 @@ export type SettingName =
| "ldap-configured?"
| "map-tile-server-url"
| "password-complexity"
| "search-typeahead-enabled"
| "setup-token"
| "site-url"
| "types"
......@@ -90,10 +91,6 @@ class Settings {
return /.+\.metabaseapp.com\/?$/i.test(this.get("site-url"));
}
isTrackingEnabled() {
return this.get("anon-tracking-enabled") || false;
}
googleAuthEnabled() {
return this.get("google-auth-client-id") != null;
}
......@@ -102,16 +99,24 @@ class Settings {
return this.get("setup-token") != null;
}
ssoEnabled() {
return this.get("google-auth-client-id") != null;
hideEmbedBranding() {
return this.get("hide-embed-branding?");
}
ldapEnabled() {
return this.get("ldap-configured?");
}
hideEmbedBranding() {
return this.get("hide-embed-branding?");
searchTypeaheadEnabled() {
return this.get("search-typeahead-enabled");
}
ssoEnabled() {
return this.get("google-auth-client-id") != null;
}
trackingEnabled() {
return this.get("anon-tracking-enabled") || false;
}
docsUrl(page = "", anchor = "") {
......
......@@ -13,6 +13,7 @@ import OnClickOutsideWrapper from "metabase/components/OnClickOutsideWrapper";
import SearchResult from "metabase/search/components/SearchResult";
import { DefaultSearchColor } from "metabase/nav/constants";
import MetabaseSettings from "metabase/lib/settings";
const ActiveSearchColor = lighten(color("nav"), 0.1);
......@@ -141,7 +142,7 @@ export default class SearchBar extends React.Component {
}
}}
/>
{active && (
{active && MetabaseSettings.searchTypeaheadEnabled() && (
<div className="absolute left right text-dark" style={{ top: 60 }}>
{searchText.length > 0 ? (
<Card
......
......@@ -2,7 +2,14 @@
(:require [cheshire.core :as json]
[clojure.string :as str]
[honeysql.core :as hsql]
[metabase.models :refer [Card Collection Dashboard Metric Pulse Segment Table]]))
[metabase.models :refer [Card Collection Dashboard Metric Pulse Segment Table]]
[metabase.models.setting :refer [defsetting]]
[metabase.util.i18n :refer [deferred-tru]]))
(defsetting search-typeahead-enabled
(deferred-tru "Enable typeahead search in the Metabase navbar?")
:type :boolean
:default true)
(def ^:dynamic db-max-results
"Number of raw results to fetch from the database. This number is in place to prevent massive application DB load by
......
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