Skip to content

Commit

Permalink
fix: [explore][mixed time series chart] when user change size of view…
Browse files Browse the repository at this point in the history
… query window, query B part will disappear (#20750)
  • Loading branch information
diegomedina248 authored Jul 22, 2022
1 parent f011aba commit 6e0ddcf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ interface ViewQueryProps {

const StyledSyntaxContainer = styled.div`
height: 100%;
display: flex;
flex-direction: column;
`;

const StyledSyntaxHighlighter = styled(SyntaxHighlighter)`
height: calc(100% - 26px); // 100% - clipboard height
flex: 1;
`;

const ViewQuery: React.FC<ViewQueryProps> = props => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React, { useEffect, useState } from 'react';
import { ensureIsArray, t } from '@superset-ui/core';
import { styled, ensureIsArray, t } from '@superset-ui/core';
import Loading from 'src/components/Loading';
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import { getChartDataRequest } from 'src/components/Chart/chartAction';
Expand All @@ -32,6 +32,12 @@ type Result = {
language: string;
};

const ViewQueryModalContainer = styled.div`
height: 100%;
display: flex;
flex-direction: column;
`;

const ViewQueryModal: React.FC<Props> = props => {
const [result, setResult] = useState<Result[]>([]);
const [isLoading, setIsLoading] = useState(false);
Expand Down Expand Up @@ -71,14 +77,15 @@ const ViewQueryModal: React.FC<Props> = props => {
if (error) {
return <pre>{error}</pre>;
}

return (
<>
<ViewQueryModalContainer>
{result.map(item =>
item.query ? (
<ViewQuery sql={item.query} language={item.language || undefined} />
) : null,
)}
</>
</ViewQueryModalContainer>
);
};

Expand Down

0 comments on commit 6e0ddcf

Please sign in to comment.