Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nytai committed Jul 16, 2020
1 parent 02805ec commit c5f2929
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ReactWrapper } from 'enzyme';
import { act } from 'react-dom/test-utils';

// taken from: https://github.com/enzymejs/enzyme/issues/2073
// There is currently and issue with enzyme and react-16's hooks
// that results in a race condition between tests and react hook updates.
// This function ensures tests run after all react updates are done.
export default async function waitForComponentToPaint(wrapper, amount = 0) {
export default async function waitForComponentToPaint<P = {}>(
wrapper: ReactWrapper<P>,
amount = 0,
) {
await act(async () => {
await new Promise(resolve => setTimeout(resolve, amount));
wrapper.update();
Expand Down
9 changes: 6 additions & 3 deletions superset-frontend/src/components/ListView/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { t } from '@superset-ui/translation';
import React, { FunctionComponent } from 'react';
import { Col, Row, Alert } from 'react-bootstrap';
import styled from '@superset-ui/style';
import cx from 'classnames';
import Button from 'src/components/Button';
import Loading from 'src/components/Loading';
import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox';
Expand Down Expand Up @@ -59,7 +60,6 @@ const BulkSelectWrapper = styled(Alert)`
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
padding-right: 16px;
padding-right: 36px;
color: #3d3d3d;
background-color: ${({ theme }) => theme.colors.primary.light4};
Expand All @@ -78,7 +78,6 @@ const BulkSelectWrapper = styled(Alert)`
margin: -8px 0 -8px 16px;
width: 1px;
height: 32px;
background: rgba(0, 0, 0, 0.0001);
box-shadow: inset -1px 0px 0px #dadada;
display: inline-flex;
vertical-align: middle;
Expand Down Expand Up @@ -226,7 +225,11 @@ const ListView: FunctionComponent<ListViewProps> = ({
<Button
data-test="bulk-select-action"
key={action.key}
className={`supersetButton ${action.type}`}
className={cx('supersetButton', {
danger: action.type === 'danger',
primary: action.type === 'primary',
secondary: action.type === 'secondary',
})}
onClick={() =>
action.onSelect(selectedFlatRows.map(r => r.original))
}
Expand Down
7 changes: 4 additions & 3 deletions superset-frontend/src/components/Menu/SubMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ const StyledHeader = styled.header`
}
.navbar-right {
.supersetButton {
margin: ${({ theme }) => theme.gridUnit * 2}px
${({ theme }) => theme.gridUnit * 4}px
${({ theme }) => theme.gridUnit * 2}px 0;
margin: ${({ theme }) =>
`${theme.gridUnit * 2}px ${theme.gridUnit * 4}px ${
theme.gridUnit * 2
}px 0`};
}
}
.navbar-nav {
Expand Down
8 changes: 5 additions & 3 deletions superset-frontend/src/views/datasetList/DatasetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -603,19 +603,21 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
{ virtualCount: 0, physicalCount: 0 },
);

if (!selected.length) return t('0 Selected');
else if (virtualCount && !physicalCount)
if (!selected.length) {
return t('0 Selected');
} else if (virtualCount && !physicalCount) {
return t(
'%s Selected (Virtual)',
selected.length,
virtualCount,
);
else if (physicalCount && !virtualCount)
} else if (physicalCount && !virtualCount) {
return t(
'%s Selected (Physical)',
selected.length,
physicalCount,
);
}

return t(
'%s Selected (%s Physical, %s Virtual)',
Expand Down

0 comments on commit c5f2929

Please sign in to comment.