From 79dbb3f1fe13f0875e3c4d849f8e3bea4d3045ec Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 9 Apr 2019 20:51:35 -0700 Subject: [PATCH] [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 --- .../src/SqlLab/components/TableElement.jsx | 7 +++++-- superset/assets/src/components/Loading.css | 21 +++++++++++++++++++ superset/assets/src/components/Loading.jsx | 8 +++++-- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 superset/assets/src/components/Loading.css diff --git a/superset/assets/src/SqlLab/components/TableElement.jsx b/superset/assets/src/SqlLab/components/TableElement.jsx index 96027a926b..ce8847eb74 100644 --- a/superset/assets/src/SqlLab/components/TableElement.jsx +++ b/superset/assets/src/SqlLab/components/TableElement.jsx @@ -190,7 +190,11 @@ class TableElement extends React.PureComponent {
{table.isMetadataLoading || table.isExtraMetadataLoading ? - + : this.renderControls() } @@ -239,7 +243,6 @@ class TableElement extends React.PureComponent {
diff --git a/superset/assets/src/components/Loading.css b/superset/assets/src/components/Loading.css new file mode 100644 index 0000000000..4118962727 --- /dev/null +++ b/superset/assets/src/components/Loading.css @@ -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; +} diff --git a/superset/assets/src/components/Loading.jsx b/superset/assets/src/components/Loading.jsx index a7d8f40b05..5c132d9c1b 100644 --- a/superset/assets/src/components/Loading.jsx +++ b/superset/assets/src/components/Loading.jsx @@ -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 (