query - busy indicator, canceling

This commit is contained in:
Jan Prochazka
2020-04-13 15:20:37 +02:00
parent fc98409583
commit 41322f237a
10 changed files with 88 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import _ from 'lodash'
import _ from 'lodash';
import React from 'react';
import styled from 'styled-components';
import { showMenu } from '../modals/DropDownMenu';
@@ -13,12 +13,12 @@ const AppObjectDiv = styled.div`
}
cursor: pointer;
white-space: nowrap;
font-weight: ${props => (props.isBold ? 'bold' : 'normal')};
font-weight: ${(props) => (props.isBold ? 'bold' : 'normal')};
`;
const AppObjectSpan = styled.span`
white-space: nowrap;
font-weight: ${props => (props.isBold ? 'bold' : 'normal')};
font-weight: ${(props) => (props.isBold ? 'bold' : 'normal')};
`;
const IconWrap = styled.span`
@@ -33,13 +33,14 @@ export function AppObjectCore({
makeAppObj,
onClick,
isBold,
isBusy,
component = 'div',
prefix = null,
...other
}) {
const appObjectParams = useAppObjectParams();
const handleContextMenu = event => {
const handleContextMenu = (event) => {
if (!Menu) return;
event.preventDefault();
@@ -60,9 +61,7 @@ export function AppObjectCore({
{...other}
>
{prefix}
<IconWrap>
<Icon />
</IconWrap>
<IconWrap>{isBusy ? <i className="fas fa-spinner fa-spin"></i> : <Icon />}</IconWrap>
{title}
</Component>
);

View File

@@ -2,7 +2,7 @@ import React from 'react';
import _ from 'lodash';
import { getIconImage } from '../icons';
const openedTabAppObject = () => ({ tabid, props, selected, icon, title }, { setOpenedTabs }) => {
const openedTabAppObject = () => ({ tabid, props, selected, icon, title, busy }, { setOpenedTabs }) => {
const key = tabid;
const Icon = (props) => getIconImage(icon, props);
const isBold = !!selected;
@@ -16,7 +16,7 @@ const openedTabAppObject = () => ({ tabid, props, selected, icon, title }, { set
);
};
return { title, key, Icon, isBold, onClick };
return { title, key, Icon, isBold, onClick, isBusy: busy };
};
export default openedTabAppObject;