refactor(monorepo): move superset-ui to superset(stage 2) (#17552)

This commit is contained in:
Yongjie Zhao
2021-11-30 08:29:57 +08:00
committed by GitHub
parent bfba4f1689
commit 3c41ff68a4
1315 changed files with 27755 additions and 15167 deletions

View File

@@ -0,0 +1,128 @@
/**
* 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.
*/
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
D3_FORMAT_OPTIONS,
sections,
} from '@superset-ui/chart-controls';
import {
lineInterpolation,
showLegend,
xAxisLabel,
bottomMargin,
xAxisFormat,
yLogScale,
yAxisBounds,
xAxisShowMinmax,
yAxisShowMinmax,
yAxisLabel,
leftMargin,
} from '../NVD3Controls';
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyTimeseriesTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [
['metric'],
['adhoc_filters'],
[
{
name: 'freq',
config: {
type: 'SelectControl',
label: t('Frequency'),
default: 'W-MON',
freeForm: true,
clearable: false,
choices: [
['AS', 'Year (freq=AS)'],
['52W-MON', '52 weeks starting Monday (freq=52W-MON)'],
['W-SUN', '1 week starting Sunday (freq=W-SUN)'],
['W-MON', '1 week starting Monday (freq=W-MON)'],
['D', 'Day (freq=D)'],
['4W-MON', '4 weeks (freq=4W-MON)'],
],
description: t(
`The periodicity over which to pivot time. Users can provide
"Pandas" offset alias.
Click on the info bubble for more details on accepted "freq" expressions.`,
),
tooltipOnClick: () => {
window.open(
'https://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases',
);
},
},
},
],
],
},
{
label: t('Chart Options'),
expanded: true,
controlSetRows: [
[showLegend],
[lineInterpolation],
['color_picker', null],
],
},
{
label: t('X Axis'),
expanded: true,
controlSetRows: [
[xAxisLabel],
[bottomMargin],
[xAxisShowMinmax],
[
{
name: xAxisFormat.name,
config: {
...xAxisFormat.config,
default: 'SMART_NUMBER',
choices: D3_FORMAT_OPTIONS,
},
},
],
],
},
{
label: t('Y Axis'),
expanded: true,
controlSetRows: [
[yAxisLabel],
[leftMargin],
[yAxisShowMinmax],
[yLogScale],
['y_axis_format'],
[yAxisBounds],
],
},
],
controlOverrides: {
metric: {
clearable: false,
},
},
};
export default config;

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,43 @@
/**
* 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.
*/
import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core';
import transformProps from '../transformProps';
import thumbnail from './images/thumbnail.png';
import controlPanel from './controlPanel';
const metadata = new ChartMetadata({
category: t('Evolution'),
credits: ['http://nvd3.org'],
description: '',
name: t('Time-series Period Pivot'),
tags: [t('Legacy'), t('Time'), t('nvd3')],
thumbnail,
useLegacyApi: true,
});
export default class TimePivotChartPlugin extends ChartPlugin {
constructor() {
super({
loadChart: () => import('../ReactNVD3'),
metadata,
transformProps,
controlPanel,
});
}
}