Skip to content

Commit

Permalink
fix(chart-controls): export/import DTTM_ALIAS properly (apache-supers…
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud authored and NejcZdovc committed Apr 20, 2021
1 parent 6eec23d commit 9294438
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 12 deletions.
3 changes: 1 addition & 2 deletions packages/superset-ui-chart-controls/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t, QueryMode } from '@superset-ui/core';
import { DTTM_ALIAS } from '@superset-ui/core/src/query/buildQueryObject';
import { t, QueryMode, DTTM_ALIAS } from '@superset-ui/core';
import { ColumnMeta } from './types';

// eslint-disable-next-line import/prefer-default-export
Expand Down
2 changes: 0 additions & 2 deletions packages/superset-ui-core/src/query/buildQueryObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import extractQueryFields from './extractQueryFields';
import { overrideExtraFormData } from './processExtraFormData';
import { AdhocFilter } from './types';

export const DTTM_ALIAS = '__timestamp';

/**
* Build the common segments of all query objects (e.g. the granularity field derived from
* either sql alchemy or druid). The segments specific to each viz type is constructed in the
Expand Down
19 changes: 19 additions & 0 deletions packages/superset-ui-core/src/query/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export const DTTM_ALIAS = '__timestamp';
2 changes: 1 addition & 1 deletion packages/superset-ui-core/src/query/extractQueryFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { t } from '../translation';
import { removeDuplicates } from '../utils';
import { DTTM_ALIAS } from './buildQueryObject';
import { DTTM_ALIAS } from './constants';
import getMetricLabel from './getMetricLabel';
import {
QueryFields,
Expand Down
1 change: 1 addition & 0 deletions packages/superset-ui-core/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import * as ApiLegacy from './api/legacy';
import * as ApiV1 from './api/v1';

export * from './constants';
export { default as buildQueryContext } from './buildQueryContext';
export { default as buildQueryObject } from './buildQueryObject';
export { default as convertFilter } from './convertFilter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/
import extractQueryFields from '@superset-ui/core/src/query/extractQueryFields';
import { configure } from '../../src/translation';
import { QueryMode } from '../../src';
import { DTTM_ALIAS } from '../../src/query/buildQueryObject';
import { QueryMode, DTTM_ALIAS } from '../../src';
import { NUM_METRIC } from '../fixtures';

configure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import {
getNumberFormatter,
NumberFormats,
NumberFormatter,
DTTM_ALIAS,
} from '@superset-ui/core';
import { createSelector } from 'reselect';
import { PlainObject } from './types';

const DTTM_ALIAS = '__timestamp';

type inputType = {
columns: string[];
metrics: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ChartProps, QueryFormMetric, AdhocMetric } from '@superset-ui/core';
import { ChartProps, QueryFormMetric, AdhocMetric, DTTM_ALIAS } from '@superset-ui/core';
import getProcessColumnsFunction from './processColumns';
import getProcessMetricsFunction from './processMetrics';
import getProcessDataFunction from './processData';
Expand All @@ -26,8 +26,6 @@ const processColumns = getProcessColumnsFunction();
const processMetrics = getProcessMetricsFunction();
const processData = getProcessDataFunction();

const DTTM_ALIAS = '__timestamp';

type PlainObject = {
[key: string]: any;
};
Expand Down

0 comments on commit 9294438

Please sign in to comment.