mirror of
https://github.com/apache/superset.git
synced 2024-09-06 22:07:34 -04:00
chore: Migrates RefreshChartOverlay into Chart (#13274)
* Migrates RefreshChartOverlay into Chart * Removes unused Chart width prop
This commit is contained in:
parent
6028a691b7
commit
a36c8336ec
@ -19,15 +19,15 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import Alert from 'src/components/Alert';
|
||||
import { styled, logging } from '@superset-ui/core';
|
||||
import { styled, logging, t } from '@superset-ui/core';
|
||||
|
||||
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
|
||||
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
|
||||
import Button from 'src/components/Button';
|
||||
import Loading from '../components/Loading';
|
||||
import RefreshChartOverlay from '../components/RefreshChartOverlay';
|
||||
import ErrorBoundary from '../components/ErrorBoundary';
|
||||
import ChartRenderer from './ChartRenderer';
|
||||
import { ChartErrorMessage } from './ChartErrorMessage';
|
||||
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
|
||||
|
||||
const propTypes = {
|
||||
annotationData: PropTypes.object,
|
||||
@ -43,8 +43,8 @@ const propTypes = {
|
||||
// formData contains chart's own filter parameter
|
||||
// and merged with extra filter that current dashboard applying
|
||||
formData: PropTypes.object.isRequired,
|
||||
height: PropTypes.number,
|
||||
width: PropTypes.number,
|
||||
height: PropTypes.number,
|
||||
setControlValue: PropTypes.func,
|
||||
timeout: PropTypes.number,
|
||||
vizType: PropTypes.string.isRequired,
|
||||
@ -87,6 +87,17 @@ const Styles = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const RefreshOverlayWrapper = styled.div`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
`;
|
||||
|
||||
class Chart extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -168,7 +179,6 @@ class Chart extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
chartAlert,
|
||||
chartStatus,
|
||||
@ -212,11 +222,11 @@ class Chart extends React.PureComponent {
|
||||
</div>
|
||||
|
||||
{!isLoading && !chartAlert && isFaded && (
|
||||
<RefreshChartOverlay
|
||||
width={width}
|
||||
height={height}
|
||||
onQuery={onQuery}
|
||||
/>
|
||||
<RefreshOverlayWrapper>
|
||||
<Button onClick={onQuery} buttonStyle="primary">
|
||||
{t('Run query')}
|
||||
</Button>
|
||||
</RefreshOverlayWrapper>
|
||||
)}
|
||||
|
||||
{isLoading && <Loading />}
|
||||
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* 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 React from 'react';
|
||||
import { t, styled } from '@superset-ui/core';
|
||||
import Button from 'src/components/Button';
|
||||
|
||||
type Callback = (...args: any[]) => void;
|
||||
|
||||
interface Props {
|
||||
height: number;
|
||||
width: number;
|
||||
onQuery: Callback;
|
||||
}
|
||||
|
||||
const RefreshOverlayWrapper = styled.div`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
`;
|
||||
|
||||
class RefreshChartOverlay extends React.PureComponent<Props> {
|
||||
render() {
|
||||
return (
|
||||
<RefreshOverlayWrapper>
|
||||
<div>
|
||||
<Button onClick={this.props.onQuery} buttonStyle="primary">
|
||||
{t('Run query')}
|
||||
</Button>
|
||||
</div>
|
||||
</RefreshOverlayWrapper>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default RefreshChartOverlay;
|
Loading…
Reference in New Issue
Block a user