fix: [explore][mixed time series chart] when user change size of view query window, query B part will disappear (#20750)

This commit is contained in:
Diego Medina
2022-07-22 09:39:13 -03:00
committed by GitHub
parent f011abae2b
commit 6e0ddcf848
2 changed files with 13 additions and 4 deletions

View File

@@ -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 => {

View File

@@ -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';
@@ -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);
@@ -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>
);
};