Browse Source

HUE-7062 [dashboard] Only suggest aggregate functions when the formula editor is empty

Johan Ahlen 8 năm trước cách đây
mục cha
commit
332729d

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/solrExpressionParser.jison

@@ -69,7 +69,7 @@ SolrExpressionAutocomplete
    }
  | 'CURSOR' 'EOF'
    {
-     return { suggestFunctions: true, suggestFields: true }
+     return { suggestAggregateFunctions: true }
    }
  ;
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/solrExpressionParser.js


+ 2 - 4
desktop/core/src/desktop/static/desktop/spec/autocomplete/solrExpressionParserSpec.js

@@ -24,11 +24,9 @@
       expect(result).toEqual(expectedResult);
     };
 
-    it('should suggest functions and fields for "|"', function () {
+    it('should suggest aggregate functions for "|"', function () {
       testParser('', '', {
-        suggestFunctions: true,
-        suggestFields: true,
-        locations: []
+        suggestAggregateFunctions: true
       });
     });
 

+ 13 - 1
desktop/core/src/desktop/templates/ko_components/ko_simple_ace_editor.mako

@@ -491,7 +491,6 @@ from desktop.views import _ko
           var self = this;
           var syncEntries = [];
           if (parseResult.suggestFunctions) {
-
             Object.keys(SOLR_FUNCTIONS).forEach(function (name) {
               syncEntries.push({
                 category: CATEGORIES.FUNCTION,
@@ -504,6 +503,19 @@ from desktop.views import _ko
             });
           }
 
+          if (parseResult.suggestAggregateFunctions) {
+            Object.keys(SOLR_AGGREGATE_FUNCTIONS).forEach(function (name) {
+              syncEntries.push({
+                category: CATEGORIES.FUNCTION,
+                value: name + '()',
+                meta: SOLR_AGGREGATE_FUNCTIONS[name].returnTypes.join('|'),
+                weightAdjust: 0, // Add when we type aware
+                popular: ko.observable(false),
+                details: SOLR_AGGREGATE_FUNCTIONS[name]
+              })
+            });
+          }
+
           self.entries(syncEntries);
         };
 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác