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 {
|
export {
|
||||||
css,
|
css,
|
||||||
|
keyframes,
|
||||||
jsx,
|
jsx,
|
||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
CacheProvider as EmotionCacheProvider,
|
CacheProvider as EmotionCacheProvider,
|
||||||
|
|
|
||||||
|
|
@ -16,24 +16,22 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import { QueryState } from '@superset-ui/core';
|
||||||
import React from 'react';
|
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';
|
import TabStatusIcon from 'src/SqlLab/components/TabStatusIcon';
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
const onClose = sinon.spy();
|
return render(<TabStatusIcon tabState={'running' as QueryState} />);
|
||||||
const wrapper = shallow(
|
|
||||||
<TabStatusIcon onClose={onClose} tabState="running" />,
|
|
||||||
);
|
|
||||||
return { wrapper, onClose };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('TabStatusIcon', () => {
|
describe('TabStatusIcon', () => {
|
||||||
it('renders a circle without an x when hovered', () => {
|
it('renders a circle without an x when hovered', () => {
|
||||||
const { wrapper } = setup();
|
const { container } = setup();
|
||||||
expect(wrapper.find('div.circle')).toExist();
|
expect(container.getElementsByClassName('circle')[0]).toBeInTheDocument();
|
||||||
expect(wrapper.text()).toBe('');
|
expect(
|
||||||
|
container.getElementsByClassName('circle')[0]?.textContent ?? 'undefined',
|
||||||
|
).toBe('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -17,12 +17,33 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
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 {
|
interface TabStatusIconProps {
|
||||||
tabState: QueryState;
|
tabState: QueryState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const STATE_ICONS: Record<string, React.FC<IconType>> = {
|
||||||
|
success: Icons.Check,
|
||||||
|
failed: Icons.CancelX,
|
||||||
|
};
|
||||||
|
|
||||||
export default function TabStatusIcon({ tabState }: TabStatusIconProps) {
|
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;
|
vertical-align: middle;
|
||||||
font-size: @font-size-m;
|
font-size: @font-size-m;
|
||||||
font-weight: @font-weight-bold;
|
font-weight: @font-weight-bold;
|
||||||
|
color: @lightest;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.running {
|
.running {
|
||||||
background-color: fade(@success, @opacity-heavy);
|
background-color: @info;
|
||||||
color: @darkest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.success {
|
.success {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue