Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

fix(chart-controls): export/import DTTM_ALIAS properly #1035

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
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