|
|
@@ -2648,7 +2648,7 @@ from desktop.views import _ko
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- var activeSnippetTypeSub = huePubSub.subscribe('active.snippet.type.changed', updateType);
|
|
|
+ var activeSnippetTypeSub = huePubSub.subscribe('active.snippet.type.changed', function (details) { updateType(details.type) });
|
|
|
|
|
|
self.disposals.push(function () {
|
|
|
activeSnippetTypeSub.remove();
|
|
|
@@ -2765,7 +2765,7 @@ from desktop.views import _ko
|
|
|
<!-- ko hueSpinner: { spin: filter.querySpec() && filter.querySpec().query !== '' && someLoading(), inline: true, center: true} --><!-- /ko -->
|
|
|
</div>
|
|
|
|
|
|
- <!-- ko if: HAS_OPTIMIZER && !isSolr() -->
|
|
|
+ <!-- ko if: showRisks -->
|
|
|
<div class="assist-flex-header assist-divider"><div class="assist-inner-header">${ _('Query Analysis') }</div></div>
|
|
|
<div class="assist-flex-third">
|
|
|
<!-- ko if: ! activeRisks().hints -->
|
|
|
@@ -2856,6 +2856,20 @@ from desktop.views import _ko
|
|
|
self.isSolr = ko.observable(false);
|
|
|
self.activeTab = params.activeTab;
|
|
|
|
|
|
+ self.sourceType = ko.observable(params.sourceType());
|
|
|
+
|
|
|
+ self.showRisks = ko.pureComputed(function () {
|
|
|
+ return window.HAS_OPTIMIZER && !self.isSolr() && (self.sourceType() === 'impala' || self.sourceType() === 'hive')
|
|
|
+ });
|
|
|
+
|
|
|
+ var typeSub = huePubSub.subscribe('active.snippet.type.changed', function (details) {
|
|
|
+ self.sourceType(details.type);
|
|
|
+ });
|
|
|
+
|
|
|
+ self.disposals.push(function () {
|
|
|
+ typeSub.remove();
|
|
|
+ });
|
|
|
+
|
|
|
self.uploadingTableStats = ko.observable(false);
|
|
|
self.activeStatement = ko.observable();
|
|
|
self.activeTables = ko.observableArray();
|
|
|
@@ -3432,6 +3446,8 @@ from desktop.views import _ko
|
|
|
}).extend({ rateLimit: 300 })
|
|
|
};
|
|
|
|
|
|
+ self.sourceType = ko.observable('solr');
|
|
|
+
|
|
|
self.activeTables = ko.observableArray();
|
|
|
|
|
|
self.filteredTables = AssistantUtils.getFilteredTablesPureComputed(self);
|
|
|
@@ -3455,6 +3471,8 @@ from desktop.views import _ko
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ self.sourceType = ko.observable(collection.engine());
|
|
|
+
|
|
|
var assistDbSource = new AssistDbSource({
|
|
|
i18n : i18n,
|
|
|
initialNamespace: collection.activeNamespace,
|
|
|
@@ -3550,7 +3568,7 @@ from desktop.views import _ko
|
|
|
<!-- ko if: visible -->
|
|
|
<div class="right-assist-contents">
|
|
|
<!-- ko if: editorAssistantTabAvailable-->
|
|
|
- <div data-bind="component: { name: 'editor-assistant-panel', params: { activeTab: activeTab } }, visible: activeTab() === 'editorAssistant'"></div>
|
|
|
+ <div data-bind="component: { name: 'editor-assistant-panel', params: { activeTab: activeTab, sourceType: sourceType } }, visible: activeTab() === 'editorAssistant'"></div>
|
|
|
<!-- /ko -->
|
|
|
|
|
|
<!-- ko if: functionsTabAvailable -->
|
|
|
@@ -3587,6 +3605,7 @@ from desktop.views import _ko
|
|
|
|
|
|
self.activeTab = ko.observable();
|
|
|
self.visible = params.visible;
|
|
|
+ self.sourceType = ko.observable();
|
|
|
|
|
|
self.editorAssistantTabAvailable = ko.observable(false);
|
|
|
self.dashboardAssistantTabAvailable = ko.observable(false);
|
|
|
@@ -3636,10 +3655,11 @@ from desktop.views import _ko
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- var updateContentsForType = function (type) {
|
|
|
+ var updateContentsForType = function (type, isSqlDialect) {
|
|
|
+ self.sourceType(type);
|
|
|
self.functionsTabAvailable(type === 'hive' || type === 'impala' || type === 'pig');
|
|
|
self.langRefTabAvailable(type === 'impala');
|
|
|
- self.editorAssistantTabAvailable((!window.IS_EMBEDDED || window.EMBEDDED_ASSISTANT_ENABLED) && (type === 'hive' || type === 'impala'));
|
|
|
+ self.editorAssistantTabAvailable((!window.IS_EMBEDDED || window.EMBEDDED_ASSISTANT_ENABLED) && isSqlDialect);
|
|
|
self.dashboardAssistantTabAvailable(type === 'dashboard');
|
|
|
self.schedulesTabAvailable(false);
|
|
|
if (type !== 'dashboard') {
|
|
|
@@ -3657,12 +3677,12 @@ from desktop.views import _ko
|
|
|
updateTabs();
|
|
|
};
|
|
|
|
|
|
- var snippetTypeSub = huePubSub.subscribe('active.snippet.type.changed', updateContentsForType);
|
|
|
+ var snippetTypeSub = huePubSub.subscribe('active.snippet.type.changed', function (details) { updateContentsForType(details.type, details.isSqlDialect) });
|
|
|
self.disposals.push(snippetTypeSub.remove.bind(snippetTypeSub));
|
|
|
|
|
|
huePubSub.subscribe('set.current.app.name', function (appName) {
|
|
|
if (appName === 'dashboard') {
|
|
|
- updateContentsForType(appName);
|
|
|
+ updateContentsForType(appName, false);
|
|
|
}
|
|
|
});
|
|
|
huePubSub.publish('get.current.app.name');
|