mirror of https://github.com/apache/superset.git
[SQL Lab] fix table metadata loading spinner (#7121)
* [SQL Lab] fix table metadata loading spinner The loading spinner used to be close to the new table name that was just added, and recently flickers and disappears early. This puts the spinner where it's expected to be. * Use class * Addressing comments * adapt CSS * add missing license
This commit is contained in:
parent
1104aca5bd
commit
79dbb3f1fe
|
@ -190,7 +190,11 @@ class TableElement extends React.PureComponent {
|
|||
</div>
|
||||
<div className="pull-right">
|
||||
{table.isMetadataLoading || table.isExtraMetadataLoading ?
|
||||
<Loading size={50} />
|
||||
<Loading
|
||||
size={50}
|
||||
position="normal"
|
||||
className="margin-zero"
|
||||
/>
|
||||
:
|
||||
this.renderControls()
|
||||
}
|
||||
|
@ -239,7 +243,6 @@ class TableElement extends React.PureComponent {
|
|||
<Collapse
|
||||
in={this.state.expanded}
|
||||
timeout={this.props.timeout}
|
||||
transitionAppear
|
||||
onExited={this.removeFromStore.bind(this)}
|
||||
>
|
||||
<div className="TableElement table-schema m-b-10">
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
img.loading.margin-zero {
|
||||
margin: 0px;
|
||||
}
|
|
@ -19,13 +19,17 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import './Loading.css';
|
||||
|
||||
const propTypes = {
|
||||
size: PropTypes.number,
|
||||
position: PropTypes.oneOf(['floating', 'normal']),
|
||||
className: PropTypes.string,
|
||||
};
|
||||
const defaultProps = {
|
||||
size: 50,
|
||||
position: 'floating',
|
||||
className: '',
|
||||
};
|
||||
|
||||
const FLOATING_STYLE = {
|
||||
|
@ -37,7 +41,7 @@ const FLOATING_STYLE = {
|
|||
transform: 'translate(-50%, -50%)',
|
||||
};
|
||||
|
||||
export default function Loading({ size, position }) {
|
||||
export default function Loading({ size, position, className }) {
|
||||
const style = position === 'floating' ? FLOATING_STYLE : {};
|
||||
const styleWithWidth = {
|
||||
...style,
|
||||
|
@ -45,7 +49,7 @@ export default function Loading({ size, position }) {
|
|||
};
|
||||
return (
|
||||
<img
|
||||
className="loading"
|
||||
className={`loading ${className}`}
|
||||
alt="Loading..."
|
||||
src="/static/assets/images/loading.gif"
|
||||
style={styleWithWidth}
|
||||
|
|
Loading…
Reference in New Issue