Преглед изворни кода

[core] Fix column stat refresh and accuracy indication

The column stat refresh was calling the table refresh URL, it will now call the correct one (column added at the end of the URL). It also removes the accuracy indication on column stats as we don't have that information on the column level.
Johan Ahlen пре 10 година
родитељ
комит
fae25ad

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/assistHelper.js

@@ -63,7 +63,7 @@ AssistHelper.prototype.fetchTableHtmlPreview = function(tableName, successCallba
   });
 };
 
-AssistHelper.prototype.refreshTableStats = function(tableName, successCallback, errorCallback) {
+AssistHelper.prototype.refreshTableStats = function(tableName, columnName, successCallback, errorCallback) {
   var self = this;
   var pollRefresh = function (url) {
     $.post(url, function (data) {
@@ -79,7 +79,7 @@ AssistHelper.prototype.refreshTableStats = function(tableName, successCallback,
     }).fail(errorCallback);
   };
 
-  $.post("/" + self.options.app + "/api/analyze/" + self.activeDatabase() + "/" + tableName + "/", function (data) {
+  $.post("/" + self.options.app + "/api/analyze/" + self.activeDatabase() + "/" + tableName + "/"  + (columnName || ""), function (data) {
     if (data.status == 0 && data.watch_url) {
       pollRefresh(data.watch_url);
     } else {

+ 3 - 3
desktop/core/src/desktop/templates/ko_components.mako

@@ -250,7 +250,7 @@ from desktop.views import _ko
       <h3 class="popover-title" style="text-align: left">
         <a class="pull-right pointer close-popover" style="margin-left: 8px" data-bind="click: function() { $parent.analysisStats(null) }"><i class="fa fa-times"></i></a>
         <a class="pull-right pointer stats-refresh" style="margin-left: 8px" data-bind="click: refresh"><i class="fa fa-refresh" data-bind="css: { 'fa-spin' : refreshing }"></i></a>
-        <span class="pull-right stats-warning muted" data-bind="visible: inaccurate" rel="tooltip" data-placement="top" title="${ _('The column stats for this table are not accurate') }" style="margin-left: 8px"><i class="fa fa-exclamation-triangle"></i></span>
+        <span class="pull-right stats-warning muted" data-bind="visible: inaccurate() && column == null" rel="tooltip" data-placement="top" title="${ _('The column stats for this table are not accurate') }" style="margin-left: 8px"><i class="fa fa-exclamation-triangle"></i></span>
         <i data-bind="visible: loading" class='fa fa-spinner fa-spin'></i>
         <!-- ko if: column == null -->
         <strong class="table-name" data-bind="text: table"></strong> ${ _(' table analysis') }
@@ -518,7 +518,7 @@ from desktop.views import _ko
         self.terms = ko.observableArray();
         self.termsTabActive = ko.observable(false);
         self.prefixFilter = ko.observable().extend({'throttle': 500});
-        self.type = type
+        self.type = type;
         self.isComplexType = /^(map|array|struct)/i.test(type);
 
         self.prefixFilter.subscribe(function (newValue) {
@@ -570,7 +570,7 @@ from desktop.views import _ko
         var shouldFetchTerms = self.termsTabActive() || self.terms().length > 0;
         self.refreshing(true);
 
-        self.assistHelper.refreshTableStats(self.table, function() {
+        self.assistHelper.refreshTableStats(self.table, self.column, function() {
           self.refreshing(false);
           self.fetchData();
           if (shouldFetchTerms) {