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

Commit

Permalink
fix: remove annotation layer from query package
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Aug 13, 2019
1 parent a548fcf commit 8b528de
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
31 changes: 19 additions & 12 deletions packages/superset-ui-chart/src/clients/ChartClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import {
Json,
SupersetClientClass,
} from '@superset-ui/connection';
import { AnnotationLayerMetadata, QueryFormData, Datasource } from '@superset-ui/query';
import { QueryFormData, Datasource } from '@superset-ui/query';
import getChartBuildQueryRegistry from '../registries/ChartBuildQueryRegistrySingleton';
import getChartMetadataRegistry from '../registries/ChartMetadataRegistrySingleton';
import { QueryData } from '../models/ChartProps';
import { AnnotationLayerMetadata } from '../types/Annotation';

// This expands to Partial<All> & (union of all possible single-property types)
type AtLeastOne<All, Each = { [K in keyof All]: Pick<All, K> }> = Partial<All> & Each[keyof Each];
Expand Down Expand Up @@ -130,17 +131,23 @@ export default class ChartClient {
}

loadChartData(input: SliceIdAndOrFormData): Promise<ChartData> {
return this.loadFormData(input).then(formData =>
Promise.all([
this.loadAnnotations(formData.annotation_layers),
this.loadDatasource(formData.datasource),
this.loadQueryData(formData),
]).then(([annotationData, datasource, queryData]) => ({
annotationData,
datasource,
formData,
queryData,
})),
return this.loadFormData(input).then(
(
formData: QueryFormData & {
// eslint-disable-next-line camelcase
annotation_layers?: AnnotationLayerMetadata[];
},
) =>
Promise.all([
this.loadAnnotations(formData.annotation_layers),
this.loadDatasource(formData.datasource),
this.loadQueryData(formData),
]).then(([annotationData, datasource, queryData]) => ({
annotationData,
datasource,
formData,
queryData,
})),
);
}
}
1 change: 0 additions & 1 deletion packages/superset-ui-query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export { default as convertFilter } from './convertFilter';
export { default as convertMetric } from './convertMetric';
export { default as DatasourceKey } from './DatasourceKey';

export * from './types/Annotation';
export * from './types/QueryFormData';
export * from './types/Column';
export * from './types/Datasource';
Expand Down
3 changes: 0 additions & 3 deletions packages/superset-ui-query/src/types/QueryFormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* eslint-disable import/prefer-default-export */
// FormData uses snake_cased keys.
import { MetricKey, AdhocMetric } from './Metric';
import { AnnotationLayerMetadata } from './Annotation';
import { TimeRange } from './Time';
import { AdhocFilter } from './Filter';

Expand Down Expand Up @@ -47,8 +46,6 @@ export type BaseFormData = {
row_limit?: number;
/** The metric used to order timeseries for limiting */
timeseries_limit_metric?: QueryFormDataMetric;

annotation_layers?: AnnotationLayerMetadata[];
} & TimeRange &
QueryFormDataMetrics;

Expand Down

0 comments on commit 8b528de

Please sign in to comment.