|
|
@@ -30,24 +30,24 @@ from metadata.conf import has_navigator
|
|
|
<script type="text/html" id="context-popover-footer">
|
|
|
<div class="context-popover-flex-bottom-links">
|
|
|
<div class="context-popover-link-row">
|
|
|
- <a class="inactive-action pointer" data-bind="visible: showInAssistEnabled && (isDatabase || isTable || isColumn), click: function() { huePubSub.publish('context.popover.show.in.assist') }">
|
|
|
+ <a class="inactive-action pointer" data-bind="visible: showInAssistEnabled, click: function() { huePubSub.publish('context.popover.show.in.assist') }">
|
|
|
<i style="font-size: 11px;" title="${ _("Show in Assist...") }" class="fa fa-search"></i> ${ _("Assist") }
|
|
|
</a>
|
|
|
% if HAS_SQL_ENABLED.get():
|
|
|
- <a class="inactive-action pointer" data-bind="visible: (typeof isTable !== 'undefined' && isTable) || (typeof isView !== 'undefined' && isView) || (typeof isDatabase !== 'undefined' && isDatabase), click: function() { huePubSub.publish('context.popover.open.in.dashboard') }">
|
|
|
+ <a class="inactive-action pointer" data-bind="visible: openInDashboardEnabled, click: function() { huePubSub.publish('context.popover.open.in.dashboard') }">
|
|
|
<i style="font-size: 11px;" title="${ _("Open in Dashboard...") }" class="fa fa-external-link"></i> ${ _("Dashboard") }
|
|
|
</a>
|
|
|
% endif
|
|
|
- <a class="inactive-action pointer" data-bind="visible: (typeof isTable !== 'undefined' && isTable) || (typeof isView !== 'undefined' && isView) || (typeof isDatabase !== 'undefined' && isDatabase), click: function() { huePubSub.publish('context.popover.open.in.metastore', isTable ? 'table' : 'db') }">
|
|
|
+ <a class="inactive-action pointer" data-bind="visible: openInTableBrowserEnabled, click: function() { huePubSub.publish('context.popover.open.in.metastore', isTable ? 'table' : 'db') }">
|
|
|
<i style="font-size: 11px;" title="${ _("Open in Table Browser...") }" class="fa fa-external-link"></i> ${ _("Table Browser") }
|
|
|
</a>
|
|
|
- <a class="inactive-action pointer" data-bind="visible: typeof isHdfs !== 'undefined' && isHdfs, click: function() { huePubSub.publish('context.popover.replace.in.editor') }">
|
|
|
+ <a class="inactive-action pointer" data-bind="visible: replaceEditorContentEnabled, click: function() { huePubSub.publish('context.popover.replace.in.editor') }">
|
|
|
<i style="font-size: 11px;" title="${ _("Replace the editor content...") }" class="fa fa-pencil"></i> ${ _("Insert in the editor") }
|
|
|
</a>
|
|
|
- <a class="inactive-action pointer" data-bind="visible: typeof isHdfs !== 'undefined' && isHdfs, click: function() { huePubSub.publish('context.popover.open.in.file.browser') }">
|
|
|
+ <a class="inactive-action pointer" data-bind="visible: openInFileBrowserEnabled, click: function() { huePubSub.publish('context.popover.open.in.file.browser') }">
|
|
|
<i style="font-size: 11px;" title="${ _("Open in File Browser...") }" class="fa fa-external-link"></i> ${ _("File Browser") }
|
|
|
</a>
|
|
|
- <!-- ko if: typeof isAsterisk !== 'undefined' && isAsterisk -->
|
|
|
+ <!-- ko if: expandColumnsEnabled -->
|
|
|
<!-- ko with: contents.data -->
|
|
|
<!-- ko if: selectedColumns().length > 0 -->
|
|
|
<a class="inactive-action pointer" data-bind="click: expand">${ _("Expand to selected columns") }</a>
|
|
|
@@ -285,7 +285,6 @@ from metadata.conf import has_navigator
|
|
|
</div>
|
|
|
</script>
|
|
|
|
|
|
-
|
|
|
<script type="text/html" id="generic-document-context-template">
|
|
|
<div style="width:100%; text-align: center; margin-top: 40px; font-size: 140px; color: #787878;" data-bind="template: { name: 'document-icon-template', data: { document: { isDirectory: type === 'directory', definition: function() { return $data } } } }"></div>
|
|
|
<div style="width: 100%; margin-top: 20px; text-align:center">
|
|
|
@@ -372,7 +371,7 @@ from metadata.conf import has_navigator
|
|
|
<!-- ko if: !loading() && !hasErrors() -->
|
|
|
<!-- ko template: { name: template } --><!-- /ko -->
|
|
|
<!-- /ko -->
|
|
|
- <!-- ko template: { name: 'context-popover-footer' } --><!-- /ko -->
|
|
|
+ <!-- ko template: { name: 'context-popover-footer', data: $parent } --><!-- /ko -->
|
|
|
<!-- /ko -->
|
|
|
<!-- /ko -->
|
|
|
</div>
|
|
|
@@ -1021,6 +1020,7 @@ from metadata.conf import has_navigator
|
|
|
|
|
|
function DocumentContext(data) {
|
|
|
var self = this;
|
|
|
+ self.disposals = [];
|
|
|
|
|
|
// Adapt some details to a common format, the global search endpoint has different structure than the docs one
|
|
|
self.details = {
|
|
|
@@ -1033,13 +1033,30 @@ from metadata.conf import has_navigator
|
|
|
self.loading = ko.observable(true);
|
|
|
self.hasErrors = ko.observable(false);
|
|
|
self.errorText = ko.observable();
|
|
|
- self.showInAssistEnabled = false; // TODO: Enable for documents
|
|
|
self.template = 'context-document-details';
|
|
|
|
|
|
self.documentContents = ko.observable();
|
|
|
self.loadDocument();
|
|
|
+
|
|
|
+ var showInAssistPubSub = huePubSub.subscribe('context.popover.show.in.assist', function () {
|
|
|
+ huePubSub.publish('assist.doc.highlight', {
|
|
|
+ parentUuid: self.data.parentUuid,
|
|
|
+ docUuid: self.data.uuid
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ self.disposals.push(function () {
|
|
|
+ showInAssistPubSub.remove();
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
+ DocumentContext.prototype.dispose = function () {
|
|
|
+ var self = this;
|
|
|
+ while (self.disposals.length) {
|
|
|
+ self.disposals.pop()();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
DocumentContext.prototype.loadDocument = function () {
|
|
|
var self = this;
|
|
|
self.hasErrors(false);
|
|
|
@@ -1209,8 +1226,6 @@ from metadata.conf import has_navigator
|
|
|
self.left = ko.observable(0);
|
|
|
self.top = ko.observable(0);
|
|
|
|
|
|
- self.showInAssistEnabled = typeof params.showInAssistEnabled !== 'undefined' ? params.showInAssistEnabled : true;
|
|
|
-
|
|
|
var popoverSize = apiHelper.getFromTotalStorage('assist', 'popover.size', {
|
|
|
width: 450,
|
|
|
height: 400
|
|
|
@@ -1305,6 +1320,13 @@ from metadata.conf import has_navigator
|
|
|
self.isView = params.data.type === 'view';
|
|
|
self.isDocument = params.data.type.toLowerCase() === 'hue';
|
|
|
|
|
|
+ self.showInAssistEnabled = (typeof params.showInAssistEnabled !== 'undefined' ? params.showInAssistEnabled : true) && (self.isDocument || self.isDatabase || self.isTable || self.isColumn);
|
|
|
+ self.openInDashboardEnabled = self.isTable || self.isView || self.isDatabase;
|
|
|
+ self.openInTableBrowserEnabled = self.isTable || self.isView || self.isDatabase;
|
|
|
+ self.replaceEditorContentEnabled = self.isHdfs;
|
|
|
+ self.openInFileBrowserEnabled = self.isHdfs;
|
|
|
+ self.expandColumnsEnabled = self.isAsterisk;
|
|
|
+
|
|
|
if ((self.isColumn || self.isComplex) && self.data.tables && self.data.tables.length > 0) {
|
|
|
var identifierChain = self.data.identifierChain;
|
|
|
var foundTable = $.grep(self.data.tables, function (table) {
|
|
|
@@ -1504,20 +1526,25 @@ from metadata.conf import has_navigator
|
|
|
|
|
|
self.disposals = [];
|
|
|
|
|
|
- self.showInAssistEnabled = true;
|
|
|
-
|
|
|
self.isDatabase = params.data.type.toLowerCase() === 'database';
|
|
|
self.isTable = params.data.type.toLowerCase() === 'table';
|
|
|
self.isColumn = params.data.type.toLowerCase() === 'field';
|
|
|
self.isView = params.data.type.toLowerCase() === 'view';
|
|
|
self.isDocument = params.data.type.toLowerCase() === 'hue';
|
|
|
|
|
|
- // TODO: Handle HDFS, Complex and Function ?
|
|
|
+ // These are currently not in the global search results
|
|
|
self.isHdfs = false;
|
|
|
self.isAsterisk = false;
|
|
|
self.isComplex = false;
|
|
|
self.isFunction = false;
|
|
|
|
|
|
+ self.showInAssistEnabled = true;
|
|
|
+ self.openInDashboardEnabled = self.isTable || self.isView || self.isDatabase;
|
|
|
+ self.openInTableBrowserEnabled = self.isTable || self.isView || self.isDatabase;
|
|
|
+ self.replaceEditorContentEnabled = self.isHdfs;
|
|
|
+ self.openInFileBrowserEnabled = self.isHdfs;
|
|
|
+ self.expandColumnsEnabled = self.isAsterisk;
|
|
|
+
|
|
|
var adaptedData = { identifierChain: [] };
|
|
|
|
|
|
var path = params.data.originalName.split('.');
|