Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sqllab): hide tracking url when fetching #20905

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions superset-frontend/src/SqlLab/components/ResultSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { CSSProperties } from 'react';
import React from 'react';
import ButtonGroup from 'src/components/ButtonGroup';
import Alert from 'src/components/Alert';
import Button from 'src/components/Button';
Expand Down Expand Up @@ -54,8 +54,6 @@ enum LIMITING_FACTOR {
NOT_LIMITED = 'NOT_LIMITED',
}

const LOADING_STYLES: CSSProperties = { position: 'relative', minHeight: 100 };

interface ResultSetProps {
showControls?: boolean;
actions: Record<string, any>;
Expand All @@ -80,6 +78,14 @@ interface ResultSetState {
alertIsOpen: boolean;
}

const Styles = styled.div`
position: relative;
minheight: 100px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be min-height @ktmud

.sql-result-track-job {
margin-top: ${({ theme }) => theme.gridUnit * 2}px;
}
`;

// Making text render line breaks/tabs as is as monospace,
// but wrapping text too so text doesn't overflow
const MonospaceDiv = styled.div`
Expand Down Expand Up @@ -109,9 +115,6 @@ const ResultSetButtons = styled.div`

const ResultSetErrorMessage = styled.div`
padding-top: ${({ theme }) => 4 * theme.gridUnit}px;
.sql-result-track-job {
margin-top: ${({ theme }) => 2 * theme.gridUnit}px;
}
`;

export default class ResultSet extends React.PureComponent<
Expand Down Expand Up @@ -421,7 +424,11 @@ export default class ResultSet extends React.PureComponent<
exploreDBId = this.props.database.explore_database_id;
}
let trackingUrl;
if (query.trackingUrl) {
if (
query.trackingUrl &&
query.state !== 'success' &&
query.state !== 'fetching'
) {
trackingUrl = (
<Button
className="sql-result-track-job"
Expand Down Expand Up @@ -582,7 +589,7 @@ export default class ResultSet extends React.PureComponent<
: null;

return (
<div style={LOADING_STYLES}>
<Styles>
<div>{!progressBar && <Loading position="normal" />}</div>
{/* show loading bar whenever progress bar is completed but needs time to render */}
<div>{query.progress === 100 && <Loading position="normal" />}</div>
Expand All @@ -591,8 +598,8 @@ export default class ResultSet extends React.PureComponent<
{progressMsg && <Alert type="success" message={progressMsg} />}
</div>
<div>{query.progress !== 100 && progressBar}</div>
<div>{trackingUrl}</div>
</div>
{trackingUrl && <div>{trackingUrl}</div>}
</Styles>
);
}
}