You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2023/01/25 23:00:20 UTC

[superset] branch spelling-frontend created (now 4c86246796)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a change to branch spelling-frontend
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 4c86246796 Fixing fallout from a the ComparisionType correction

This branch includes the following new commits:

     new 4c86246796 Fixing fallout from a the ComparisionType correction

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: Fixing fallout from a the ComparisionType correction

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch spelling-frontend
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 4c862467964ce938a5d2f376362f819629273745
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Wed Jan 25 16:00:00 2023 -0700

    Fixing fallout from a the ComparisionType correction
---
 .../src/operators/renameOperator.ts                    | 10 +++++-----
 .../src/operators/utils/isDerivedSeries.ts             |  4 ++--
 .../test/operators/renameOperator.test.ts              | 10 +++++-----
 .../test/operators/utils/isDerivedSeries.test.ts       | 18 +++++++++---------
 .../test/MixedTimeseries/buildQuery.test.ts            |  6 +++---
 5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts
index 34dc028361..37b9701a02 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/renameOperator.ts
@@ -21,7 +21,7 @@ import {
   PostProcessingRename,
   ensureIsArray,
   getMetricLabel,
-  ComparisionType,
+  ComparisonType,
   getXAxisLabel,
 } from '@superset-ui/core';
 import { PostProcessingFactory } from './types';
@@ -50,9 +50,9 @@ export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
       (
         isTimeComparison(formData, queryObject) &&
         [
-          ComparisionType.Difference,
-          ComparisionType.Ratio,
-          ComparisionType.Percentage,
+          ComparisonType.Difference,
+          ComparisonType.Ratio,
+          ComparisonType.Percentage,
         ].includes(formData.comparison_type)
       )
     ) &&
@@ -66,7 +66,7 @@ export const renameOperator: PostProcessingFactory<PostProcessingRename> = (
       // we will rename the "metric" from the metricWithOffset label
       // for example: "count__1 year ago" =>	"1 year ago"
       isTimeComparison(formData, queryObject) &&
-      formData.comparison_type === ComparisionType.Values
+      formData.comparison_type === ComparisonType.Values
     ) {
       const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
       const timeOffsets = ensureIsArray(formData.time_compare);
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/isDerivedSeries.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/isDerivedSeries.ts
index 24623e5570..67815756f8 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/isDerivedSeries.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/isDerivedSeries.ts
@@ -21,7 +21,7 @@ import {
   ensureIsArray,
   JsonObject,
   QueryFormData,
-  ComparisionType,
+  ComparisonType,
 } from '@superset-ui/core';
 import { isString } from 'lodash';
 
@@ -30,7 +30,7 @@ export const isDerivedSeries = (
   formData: QueryFormData,
 ): boolean => {
   const comparisonType = formData.comparison_type;
-  if (comparisonType !== ComparisionType.Values) {
+  if (comparisonType !== ComparisonType.Values) {
     return false;
   }
 
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/operators/renameOperator.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/operators/renameOperator.test.ts
index 3aed86401e..8251a48d52 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/operators/renameOperator.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/operators/renameOperator.test.ts
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { ComparisionType, QueryObject, SqlaFormData } from '@superset-ui/core';
+import { ComparisonType, QueryObject, SqlaFormData } from '@superset-ui/core';
 import { renameOperator } from '@superset-ui/chart-controls';
 
 const formData: SqlaFormData = {
@@ -74,9 +74,9 @@ test('should skip renameOperator if does not exist x_axis and is_timeseries', ()
 
 test('should skip renameOperator if exists derived metrics', () => {
   [
-    ComparisionType.Difference,
-    ComparisionType.Ratio,
-    ComparisionType.Percentage,
+    ComparisonType.Difference,
+    ComparisonType.Ratio,
+    ComparisonType.Percentage,
   ].forEach(type => {
     expect(
       renameOperator(
@@ -126,7 +126,7 @@ test('should add renameOperator if exist "actual value" time comparison', () =>
       {
         ...formData,
         ...{
-          comparison_type: ComparisionType.Values,
+          comparison_type: ComparisonType.Values,
           time_compare: ['1 year ago', '1 year later'],
         },
       },
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/isDerivedSeries.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/isDerivedSeries.test.ts
index 05a1d738ab..29c8c65867 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/isDerivedSeries.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/isDerivedSeries.test.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 import { isDerivedSeries } from '@superset-ui/chart-controls';
-import { SqlaFormData, ComparisionType } from '@superset-ui/core';
+import { SqlaFormData, ComparisonType } from '@superset-ui/core';
 
 const formData: SqlaFormData = {
   datasource: 'foo',
@@ -31,15 +31,15 @@ const series = {
 
 test('should be false if comparison type is not actual values', () => {
   expect(isDerivedSeries(series, formData)).toEqual(false);
-  Object.keys(ComparisionType)
-    .filter(type => type === ComparisionType.Values)
+  Object.keys(ComparisonType)
+    .filter(type => type === ComparisonType.Values)
     .forEach(type => {
-      const formDataWithComparisionType = {
+      const formDataWithComparisonType = {
         ...formData,
         comparison_type: type,
         time_compare: ['1 month ago'],
       };
-      expect(isDerivedSeries(series, formDataWithComparisionType)).toEqual(
+      expect(isDerivedSeries(series, formDataWithComparisonType)).toEqual(
         false,
       );
     });
@@ -48,7 +48,7 @@ test('should be false if comparison type is not actual values', () => {
 test('should be true if comparison type is values', () => {
   const formDataWithActualTypes = {
     ...formData,
-    comparison_type: ComparisionType.Values,
+    comparison_type: ComparisonType.Values,
     time_compare: ['1 month ago', '1 month later'],
   };
   expect(isDerivedSeries(series, formDataWithActualTypes)).toEqual(true);
@@ -62,7 +62,7 @@ test('should be false if series name does not match time_compare', () => {
   };
   const formDataWithActualTypes = {
     ...formData,
-    comparison_type: ComparisionType.Values,
+    comparison_type: ComparisonType.Values,
     time_compare: ['1 month ago', '1 month later'],
   };
   expect(isDerivedSeries(arbitrary_series, formDataWithActualTypes)).toEqual(
@@ -78,7 +78,7 @@ test('should be false if time compare is not suffix', () => {
   };
   const formDataWithActualTypes = {
     ...formData,
-    comparison_type: ComparisionType.Values,
+    comparison_type: ComparisonType.Values,
     time_compare: ['1 month ago', '1 month later'],
   };
   expect(isDerivedSeries(series, formDataWithActualTypes)).toEqual(false);
@@ -92,7 +92,7 @@ test('should be false if series name invalid', () => {
   };
   const formDataWithActualTypes = {
     ...formData,
-    comparison_type: ComparisionType.Values,
+    comparison_type: ComparisonType.Values,
     time_compare: ['1 month ago', '1 month later'],
   };
   expect(isDerivedSeries(series, formDataWithActualTypes)).toEqual(false);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts
index 066b796b59..701797391d 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 import {
-  ComparisionType,
+  ComparisonType,
   FreeFormAdhocFilter,
   RollingType,
   TimeGranularity,
@@ -72,14 +72,14 @@ const formDataMixedChartWithAA = {
   ...formDataMixedChart,
   rolling_type: RollingType.Cumsum,
   time_compare: ['1 years ago'],
-  comparison_type: ComparisionType.Values,
+  comparison_type: ComparisonType.Values,
   resample_rule: '1AS',
   resample_method: 'zerofill',
 
   rolling_type_b: RollingType.Sum,
   rolling_periods_b: 1,
   min_periods_b: 1,
-  comparison_type_b: ComparisionType.Difference,
+  comparison_type_b: ComparisonType.Difference,
   time_compare_b: ['3 years ago'],
   resample_rule_b: '1A',
   resample_method_b: 'asfreq',