Skip to content

Commit

Permalink
implementing feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Jul 7, 2022
1 parent 9241875 commit 460cbdf
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* under the License.
*/

import { isPhysicalColumn } from './types';
import { QueryFormColumn } from './types/QueryFormData';
import { isPhysicalColumn, QueryFormColumn } from './types';

export default function getColumnLabel(column: QueryFormColumn): string {
if (isPhysicalColumn(column)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* under the License.
*/

import { isSavedMetric, QueryFormMetric } from './types/QueryFormData';
import { isAdhocMetricSimple } from './types/Metric';
import { QueryFormMetric, isSavedMetric, isAdhocMetricSimple } from './types';

export default function getMetricLabel(metric: QueryFormMetric): string {
if (isSavedMetric(metric)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export * from './types/Column';
export * from './types/Datasource';
export * from './types/Metric';
export * from './types/Query';
export { isSavedMetric } from './types/QueryFormData';

export * from './api/v1/types';
export { default as makeApi } from './api/v1/makeApi';
Expand Down
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 { QueryObject } from './types';
import { ExtraFormDataOverride } from './types/QueryFormData';
import { ExtraFormDataOverride, QueryObject } from './types';
import {
EXTRA_FORM_DATA_OVERRIDE_EXTRA_KEYS,
EXTRA_FORM_DATA_OVERRIDE_REGULAR_MAPPINGS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Maybe } from '../../types';
import { QueryFormMetric } from './QueryFormData';
import { Maybe, QueryFormMetric } from '../../types';
import { Column } from './Column';

export type Aggregate =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,4 @@ export type QueryFormData = SqlaFormData;
// Type guards
//---------------------------------------------------

export function isSavedMetric(metric: QueryFormMetric): metric is SavedMetric {
return typeof metric === 'string';
}

export default {};
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
export * from './Datasource';
export * from './Column';
export * from './Filter';
export * from './Metric';
export * from './Operator';
export * from './Query';
export * from './QueryFormData';
export * from './QueryResponse';
export * from './Time';
export * from './AdvancedAnalytics';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* eslint sort-keys: 'off' */
/** The form data defined here is based on default visualizations packaged with Apache Superset */
import { TimeGranularity } from '../../../src/time-format/types';
import { TimeGranularity } from '@superset-ui/core';

export const bigNumberFormData = {
datasource: '3__table',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
isAdhocMetricSimple,
isAdhocMetricSQL,
isQueryFormMetric,
QueryFormMetric,
} from '@superset-ui/core';

const adhocMetricSimple = {
Expand Down Expand Up @@ -49,9 +48,9 @@ test('isSavedMetric returns true', () => {
});

test('isSavedMetric returns false', () => {
expect(isSavedMetric(adhocMetricSQL as QueryFormMetric)).toEqual(false);
expect(isSavedMetric(null as unknown as QueryFormMetric)).toEqual(false);
expect(isSavedMetric(undefined as unknown as QueryFormMetric)).toEqual(false);
expect(isSavedMetric(adhocMetricSQL)).toEqual(false);
expect(isSavedMetric(null)).toEqual(false);
expect(isSavedMetric(undefined)).toEqual(false);
});

test('isAdhocMetricSimple returns true', () => {
Expand Down

0 comments on commit 460cbdf

Please sign in to comment.