This repository has been archived by the owner on Dec 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(plugin-chart-table): migrate to API v1
- Loading branch information
Showing
47 changed files
with
13,829 additions
and
20,615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/superset-ui-core/src/chart/registries/ChartTransformPropsRegistrySingleton.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
packages/superset-ui-core/src/chart/types/TransformFunction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { QueryFormData, QueryContext } from '../..'; | ||
import ChartProps from '../models/ChartProps'; | ||
import { PlainObject } from './Base'; | ||
|
||
export interface PlainProps { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
[key: string]: any; | ||
} | ||
export type PlainProps = PlainObject; | ||
|
||
type TransformFunction<Input = PlainProps, Output = PlainProps> = (x: Input) => Output; | ||
|
||
export type PreTransformProps = TransformFunction<ChartProps, ChartProps>; | ||
export type TransformProps = TransformFunction<ChartProps>; | ||
export type TransformProps<Props extends ChartProps = ChartProps> = TransformFunction<Props>; | ||
export type PostTransformProps = TransformFunction; | ||
|
||
export type BuildQueryFunction<T extends QueryFormData> = (formData: T) => QueryContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
packages/superset-ui-core/src/query/types/PostProcessing.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { JsonObject } from '../../connection'; | ||
import { TimeGranularity } from '../../time-format'; | ||
|
||
/** | ||
* 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 type NumpyFunction = | ||
| 'average' | ||
| 'argmin' | ||
| 'argmax' | ||
| 'count' | ||
| 'count_nonzero' | ||
| 'cumsum' | ||
| 'cumprod' | ||
| 'max' | ||
| 'mean' | ||
| 'median' | ||
| 'nansum' | ||
| 'nanmin' | ||
| 'nanmax' | ||
| 'nanmean' | ||
| 'nanmedian' | ||
| 'nanpercentile' | ||
| 'min' | ||
| 'percentile' | ||
| 'prod' | ||
| 'product' | ||
| 'std' | ||
| 'sum' | ||
| 'var'; | ||
|
||
interface Aggregates { | ||
/** | ||
* The name of the generated aggregate column. | ||
*/ | ||
[colname: string]: { | ||
operator: NumpyFunction; | ||
/** | ||
* the name of the column to generate aggrates from. | ||
*/ | ||
column?: string; | ||
options?: JsonObject; | ||
}; | ||
} | ||
|
||
export interface PostProcessingAggregation { | ||
operation: 'aggregation'; | ||
options: { | ||
groupby: string[]; | ||
aggregates: Aggregates; | ||
}; | ||
} | ||
|
||
export interface PostProcessingBoxplot { | ||
operation: 'boxplot'; | ||
options: { | ||
groupby: string[]; | ||
metrics: string[]; | ||
whisker_type: 'tukey' | 'min/max' | 'percentile'; | ||
percentiles?: [number, number]; | ||
}; | ||
} | ||
|
||
export interface PostProcessingContribution { | ||
operation: 'contribution'; | ||
options?: { | ||
orientation?: 'row' | 'column'; | ||
columns?: string[]; | ||
rename_columns?: string[]; | ||
}; | ||
} | ||
|
||
export interface PostProcessingPivot { | ||
operation: 'pivot'; | ||
options: { | ||
index: string[]; | ||
columns: string[]; | ||
aggregates: Aggregates; | ||
}; | ||
} | ||
|
||
export interface PostProcessingProphet { | ||
operation: 'prophet'; | ||
options: { | ||
time_grain: TimeGranularity; | ||
periods: number; | ||
confidence_interval: number; | ||
yearly_seasonality?: boolean | number; | ||
weekly_seasonality?: boolean | number; | ||
daily_seasonality?: boolean | number; | ||
}; | ||
} | ||
|
||
/** | ||
* Parameters for chart data postprocessing. | ||
* See superset/utils/pandas_processing.py. | ||
*/ | ||
export type PostProcessingRule = | ||
| PostProcessingAggregation | ||
| PostProcessingBoxplot | ||
| PostProcessingContribution | ||
| PostProcessingPivot | ||
| PostProcessingProphet; |
Oops, something went wrong.