chore(sqllab): Change icon color for running sql (#22050)
This commit is contained in:
parent
6f6cb1839e
commit
4f2e264b3f
|
|
@ -22,6 +22,7 @@ import createCache from '@emotion/cache';
|
|||
|
||||
export {
|
||||
css,
|
||||
keyframes,
|
||||
jsx,
|
||||
ThemeProvider,
|
||||
CacheProvider as EmotionCacheProvider,
|
||||
|
|
|
|||
|
|
@ -16,24 +16,22 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryState } from '@superset-ui/core';
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { render } from 'spec/helpers/testing-library';
|
||||
import TabStatusIcon from 'src/SqlLab/components/TabStatusIcon';
|
||||
|
||||
function setup() {
|
||||
const onClose = sinon.spy();
|
||||
const wrapper = shallow(
|
||||
<TabStatusIcon onClose={onClose} tabState="running" />,
|
||||
);
|
||||
return { wrapper, onClose };
|
||||
return render(<TabStatusIcon tabState={'running' as QueryState} />);
|
||||
}
|
||||
|
||||
describe('TabStatusIcon', () => {
|
||||
it('renders a circle without an x when hovered', () => {
|
||||
const { wrapper } = setup();
|
||||
expect(wrapper.find('div.circle')).toExist();
|
||||
expect(wrapper.text()).toBe('');
|
||||
const { container } = setup();
|
||||
expect(container.getElementsByClassName('circle')[0]).toBeInTheDocument();
|
||||
expect(
|
||||
container.getElementsByClassName('circle')[0]?.textContent ?? 'undefined',
|
||||
).toBe('');
|
||||
});
|
||||
});
|
||||
|
|
@ -17,12 +17,33 @@
|
|||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { QueryState } from '@superset-ui/core';
|
||||
import { QueryState, styled } from '@superset-ui/core';
|
||||
import Icons, { IconType } from 'src/components/Icons';
|
||||
|
||||
const IconContainer = styled.span`
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
left: 0px;
|
||||
`;
|
||||
|
||||
interface TabStatusIconProps {
|
||||
tabState: QueryState;
|
||||
}
|
||||
|
||||
const STATE_ICONS: Record<string, React.FC<IconType>> = {
|
||||
success: Icons.Check,
|
||||
failed: Icons.CancelX,
|
||||
};
|
||||
|
||||
export default function TabStatusIcon({ tabState }: TabStatusIconProps) {
|
||||
return <div className={`circle ${tabState}`} />;
|
||||
const StatusIcon = STATE_ICONS[tabState];
|
||||
return (
|
||||
<div className={`circle ${tabState}`}>
|
||||
{StatusIcon && (
|
||||
<IconContainer>
|
||||
<StatusIcon iconSize="xs" />
|
||||
</IconContainer>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,11 +161,12 @@ div.Workspace {
|
|||
vertical-align: middle;
|
||||
font-size: @font-size-m;
|
||||
font-weight: @font-weight-bold;
|
||||
color: @lightest;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.running {
|
||||
background-color: fade(@success, @opacity-heavy);
|
||||
color: @darkest;
|
||||
background-color: @info;
|
||||
}
|
||||
|
||||
.success {
|
||||
|
|
|
|||
Loading…
Reference in New Issue