Browse Source

[frontend] Add a feature flag for predict typeahead

Johan Ahlen 4 years ago
parent
commit
e2842ad006

+ 1 - 0
desktop/core/src/desktop/js/types/types.ts

@@ -34,6 +34,7 @@ export interface hueWindow {
   CACHEABLE_TTL?: { default?: number; optimizer?: number };
   CLOSE_SESSIONS?: { [dialect: string]: boolean };
   CUSTOM_DASHBOARD_URL?: string;
+  ENABLE_PREDICT?: boolean;
   HAS_CATALOG?: boolean;
   HAS_CONNECTORS?: boolean;
   HAS_OPTIMIZER?: boolean;

+ 1 - 0
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -95,6 +95,7 @@
   window.ENABLE_DOWNLOAD = '${ conf.ENABLE_DOWNLOAD.get() }' === 'True';
   window.ENABLE_NEW_CREATE_TABLE = '${ hasattr(ENABLE_NEW_CREATE_TABLE, 'get') and ENABLE_NEW_CREATE_TABLE.get()}' === 'True';
   window.ENABLE_NOTEBOOK_2 = '${ ENABLE_NOTEBOOK_2.get() }' === 'True';
+  window.ENABLE_PREDICT = '${ OPTIMIZER.ENABLE_PREDICT.get() }' === 'True';
   window.ENABLE_SQL_INDEXER = '${ ENABLE_SQL_INDEXER.get() }' === 'True';
 
   window.ENABLE_QUERY_BUILDER = '${ ENABLE_QUERY_BUILDER.get() }' === 'True';

+ 6 - 0
desktop/libs/metadata/src/metadata/conf.py

@@ -172,6 +172,12 @@ OPTIMIZER = ConfigSection(
       default=False,
       type=coerce_bool
     ),
+    ENABLE_PREDICT = Config(
+      key="enable_predict",
+      help=_t("Enables the predict API for editor typeahead."),
+      default=False,
+      type=coerce_bool
+    ),
     QUERY_HISTORY_UPLOAD_LIMIT = Config(
       key="query_history_upload_limit",
       help=_t("Allow admins to upload the last N executed queries in the quick start wizard. Use 0 to disable."),