fix: SqlLab Run button fix (#12956)

* button fix

* tooltips disabled when it is disabled, border width changed

* added isDisabled to tooltip
This commit is contained in:
AAfghahi 2021-02-04 23:21:43 -05:00 committed by GitHub
parent 973306461c
commit ac3e16d0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -91,17 +91,20 @@ const RunQueryActionButton = ({
? (DropdownButton as React.FC)
: Button;
const isDisabled = !sql.trim();
return (
<StyledButton>
<ButtonComponent
onClick={() =>
onClick(shouldShowStopBtn, allowAsync, runQuery, stopQuery)
}
disabled={!sql.trim()}
disabled={isDisabled}
tooltip={
shouldShowStopBtn
? t('Stop running (Ctrl + x)')
: t('Run query (Ctrl + Return)')
(!isDisabled &&
(shouldShowStopBtn
? t('Stop running (Ctrl + x)')
: t('Run query (Ctrl + Return)'))) as string
}
cta
{...(overlayCreateAsMenu
@ -109,7 +112,11 @@ const RunQueryActionButton = ({
overlay: overlayCreateAsMenu,
icon: (
<Icon
color={supersetTheme.colors.grayscale.light5}
color={
isDisabled
? supersetTheme.colors.grayscale.base
: supersetTheme.colors.grayscale.light5
}
name="caret-down"
/>
),

View File

@ -82,7 +82,11 @@ const StyledDropdownButton = styled.div`
margin: 0;
width: 120px;
}
&:last-of-type {
:disabled {
background-color: ${({ theme }) => theme.colors.grayscale.light2};
color: ${({ theme }) => theme.colors.grayscale.base};
}
&:nth-child(2) {
margin: 0;
border-radius: ${({ theme }) =>
`0 ${theme.gridUnit}px ${theme.gridUnit}px 0`};
@ -98,6 +102,9 @@ const StyledDropdownButton = styled.div`
top: ${({ theme }) => theme.gridUnit * 0.75}px;
width: ${({ theme }) => theme.gridUnit * 0.25}px;
}
:disabled:before {
border-left: 1px solid ${({ theme }) => theme.colors.grayscale.base};
}
}
}
}