|
@@ -24,6 +24,8 @@ from desktop.views import commonheader, commonfooter, _ko
|
|
|
from beeswax.conf import LIST_PARTITIONS_LIMIT
|
|
from beeswax.conf import LIST_PARTITIONS_LIMIT
|
|
|
|
|
|
|
|
from metastore.conf import ENABLE_NEW_CREATE_TABLE
|
|
from metastore.conf import ENABLE_NEW_CREATE_TABLE
|
|
|
|
|
+
|
|
|
|
|
+from webpack_loader.templatetags.webpack_loader import render_bundle
|
|
|
%>
|
|
%>
|
|
|
|
|
|
|
|
<%namespace name="actionbar" file="actionbar.mako" />
|
|
<%namespace name="actionbar" file="actionbar.mako" />
|
|
@@ -64,11 +66,13 @@ ${ commonheader(_("Metastore"), app_name, user, request) | n,unicode }
|
|
|
<link rel="stylesheet" href="${ static('desktop/ext/css/bootstrap-wysihtml5-0.0.2.css') }">
|
|
<link rel="stylesheet" href="${ static('desktop/ext/css/bootstrap-wysihtml5-0.0.2.css') }">
|
|
|
<link rel="stylesheet" href="${ static('notebook/css/notebook.css') }">
|
|
<link rel="stylesheet" href="${ static('notebook/css/notebook.css') }">
|
|
|
|
|
|
|
|
|
|
+## ${ render_bundle('vendors~tableBrowser') | n,unicode }
|
|
|
|
|
+${ render_bundle('tableBrowser') | n,unicode }
|
|
|
|
|
+
|
|
|
<span class="notebook">
|
|
<span class="notebook">
|
|
|
|
|
|
|
|
${ components.menubar(is_embeddable) }
|
|
${ components.menubar(is_embeddable) }
|
|
|
|
|
|
|
|
-<script src="${ static('metastore/js/metastore.ko.js') }"></script>
|
|
|
|
|
<link rel="stylesheet" href="${ static('metastore/css/metastore.css') }" type="text/css">
|
|
<link rel="stylesheet" href="${ static('metastore/css/metastore.css') }" type="text/css">
|
|
|
|
|
|
|
|
<script type="text/html" id="metastore-breadcrumbs">
|
|
<script type="text/html" id="metastore-breadcrumbs">
|
|
@@ -1041,141 +1045,6 @@ ${ components.menubar(is_embeddable) }
|
|
|
queryAndWatchUrl('/notebook/browse/' + catalogEntry.path.join('/') + '/', catalogEntry.getSourceType(),
|
|
queryAndWatchUrl('/notebook/browse/' + catalogEntry.path.join('/') + '/', catalogEntry.getSourceType(),
|
|
|
catalogEntry.namespace && catalogEntry.namespace.id, catalogEntry.compute)
|
|
catalogEntry.namespace && catalogEntry.namespace.id, catalogEntry.compute)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- (function () {
|
|
|
|
|
- if (ko.options) {
|
|
|
|
|
- ko.options.deferUpdates = true;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $(document).ready(function () {
|
|
|
|
|
- var options = {
|
|
|
|
|
- user: '${ user.username }',
|
|
|
|
|
- optimizerEnabled: '${ is_optimizer_enabled }' === 'True',
|
|
|
|
|
- navigatorEnabled: window.HAS_CATALOG,
|
|
|
|
|
- optimizerUrl: '${ optimizer_url }',
|
|
|
|
|
- navigatorUrl: '${ navigator_url }',
|
|
|
|
|
- sourceType: '${ source_type }'
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var viewModel = new MetastoreViewModel(options);
|
|
|
|
|
-
|
|
|
|
|
- huePubSub.subscribe('metastore.scroll.to.top', function () {
|
|
|
|
|
- $('${ MAIN_SCROLLABLE }').scrollTop(0);
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- huePubSub.subscribe('metastore.clear.selection', function () {
|
|
|
|
|
- viewModel.sources().forEach(function (source) {
|
|
|
|
|
- source.namespaces().forEach(function (namespace) {
|
|
|
|
|
- namespace.selectedDatabases.removeAll();
|
|
|
|
|
- namespace.databases().forEach(function (database) {
|
|
|
|
|
- database.selectedTables.removeAll();
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- });
|
|
|
|
|
- }, 'metastore');
|
|
|
|
|
-
|
|
|
|
|
- viewModel.currentTab.subscribe(function(tab){
|
|
|
|
|
- if (tab === 'relationships') {
|
|
|
|
|
- // viewModel.database().table().getRelationships();
|
|
|
|
|
- } else if (tab === 'sample') {
|
|
|
|
|
- var selector = 'samplesTable';
|
|
|
|
|
- % if conf.CUSTOM.BANNER_TOP_HTML.get():
|
|
|
|
|
- var bannerTopHeight = 30;
|
|
|
|
|
- % else:
|
|
|
|
|
- var bannerTopHeight = 0;
|
|
|
|
|
- % endif
|
|
|
|
|
- if ($(selector).parents('.dataTables_wrapper').length == 0){
|
|
|
|
|
- hueUtils.waitForRendered(selector, function(el){ return el.find('td').length > 0 }, function(){
|
|
|
|
|
- $(selector).dataTable({
|
|
|
|
|
- "bPaginate": false,
|
|
|
|
|
- "bLengthChange": false,
|
|
|
|
|
- "bInfo": false,
|
|
|
|
|
- "bDestroy": true,
|
|
|
|
|
- "bFilter": false,
|
|
|
|
|
- "bAutoWidth": false,
|
|
|
|
|
- "oLanguage": {
|
|
|
|
|
- "sEmptyTable": "${_('No data available')}",
|
|
|
|
|
- "sZeroRecords": "${_('No matching records')}"
|
|
|
|
|
- },
|
|
|
|
|
- "fnDrawCallback": function (oSettings) {
|
|
|
|
|
- $(selector).parents('.dataTables_wrapper').css('overflow-x', 'hidden');
|
|
|
|
|
- $(selector).jHueTableExtender2({
|
|
|
|
|
- fixedHeader: true,
|
|
|
|
|
- fixedFirstColumn: true,
|
|
|
|
|
- includeNavigator: false,
|
|
|
|
|
- lockSelectedRow: false,
|
|
|
|
|
- parentId: 'sample',
|
|
|
|
|
- classToRemove: 'sample-table',
|
|
|
|
|
- mainScrollable: '${ MAIN_SCROLLABLE }',
|
|
|
|
|
- % if is_embeddable:
|
|
|
|
|
- stickToTopPosition: 51 + bannerTopHeight,
|
|
|
|
|
- % else:
|
|
|
|
|
- stickToTopPosition: 76 + bannerTopHeight,
|
|
|
|
|
- % endif
|
|
|
|
|
- clonedContainerPosition: 'fixed',
|
|
|
|
|
- app: 'metastore'
|
|
|
|
|
- });
|
|
|
|
|
- $(selector).jHueHorizontalScrollbar();
|
|
|
|
|
- },
|
|
|
|
|
- "aoColumnDefs": [
|
|
|
|
|
- {
|
|
|
|
|
- "sType": "numeric",
|
|
|
|
|
- "aTargets": [ "sort-numeric" ]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- "sType": "string",
|
|
|
|
|
- "aTargets": [ "sort-string" ]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- "sType": "date",
|
|
|
|
|
- "aTargets": [ "sort-date" ]
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- viewModel.scrollToColumn = function (col) {
|
|
|
|
|
- if (!col.table.samples.loading()) {
|
|
|
|
|
- $('.page-content').scrollTop(0);
|
|
|
|
|
- viewModel.currentTab('sample');
|
|
|
|
|
- hueUtils.waitForRendered('#sampleTable', function (el) {
|
|
|
|
|
- return el.parent().hasClass('dataTables_wrapper')
|
|
|
|
|
- }, function () {
|
|
|
|
|
- var sampleTable = $('#sampleTable');
|
|
|
|
|
- var sampleCol = sampleTable.find('th').filter(function () {
|
|
|
|
|
- return $.trim($(this).text()).indexOf(col.catalogEntry.name) > -1;
|
|
|
|
|
- });
|
|
|
|
|
- sampleTable.find('.columnSelected').removeClass('columnSelected');
|
|
|
|
|
- sampleTable.find('tr td:nth-child(' + (sampleCol.index() + 1) + ')').addClass('columnSelected');
|
|
|
|
|
- var scrollLeft = 0;
|
|
|
|
|
- sampleTable.find('th:lt(' + sampleCol.index() + ')').each(function () {
|
|
|
|
|
- scrollLeft += $(this).outerWidth();
|
|
|
|
|
- });
|
|
|
|
|
- scrollLeft = Math.max(0, scrollLeft - 40);
|
|
|
|
|
- sampleTable.parent().scrollLeft(scrollLeft);
|
|
|
|
|
- sampleTable.parent().trigger('scroll_update');
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- ko.applyBindings(viewModel, $('#metastoreComponents')[0]);
|
|
|
|
|
-
|
|
|
|
|
- huePubSub.subscribe('cluster.config.set.config', function (clusterConfig) {
|
|
|
|
|
- viewModel.appConfig(clusterConfig && clusterConfig['app_config']);
|
|
|
|
|
- });
|
|
|
|
|
- huePubSub.publish('cluster.config.get.config');
|
|
|
|
|
-
|
|
|
|
|
- if (location.getParameter('refresh') === 'true') {
|
|
|
|
|
- dataCatalog.getEntry({ namespace: viewModel.source().namespace().namespace, compute: viewModel.source().namespace().compute, sourceType: viewModel.source().type, path: [], definition: { type: 'source' }}).done(function (entry) {
|
|
|
|
|
- entry.clearCache({ invalidate: viewMode.source().type === 'impala' ? 'invalidate' : 'cache', silenceErrors: true });
|
|
|
|
|
- hueUtils.replaceURL('?');
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- })();
|
|
|
|
|
</script>
|
|
</script>
|
|
|
</span>
|
|
</span>
|
|
|
|
|
|