This is an automated email from the ASF dual-hosted git repository.
tai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 13cc1a3 fix: front end CI tests and test runner (#10897)
13cc1a3 is described below
commit 13cc1a3d2ddc35205d104551d6a4ab896e429d8e
Author: Elizabeth Thompson <[email protected]>
AuthorDate: Wed Sep 16 11:35:18 2020 -0700
fix: front end CI tests and test runner (#10897)
---
.github/workflows/superset-frontend.yml | 1 -
.../dashboard/util/getComponentWidthFromDrop.js | 34 ++++++++++++++--------
.../explore/components/controls/BoundsControl.jsx | 4 +--
.../components/controls/FilterBoxItemControl.jsx | 4 +--
4 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/.github/workflows/superset-frontend.yml
b/.github/workflows/superset-frontend.yml
index 8ddaa3b..86d0e53 100644
--- a/.github/workflows/superset-frontend.yml
+++ b/.github/workflows/superset-frontend.yml
@@ -33,7 +33,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
- - name: npm install
working-directory: ./superset-frontend
run: |
npm install
diff --git a/superset-frontend/src/dashboard/util/getComponentWidthFromDrop.js
b/superset-frontend/src/dashboard/util/getComponentWidthFromDrop.js
index 01d2836..766df53 100644
--- a/superset-frontend/src/dashboard/util/getComponentWidthFromDrop.js
+++ b/superset-frontend/src/dashboard/util/getComponentWidthFromDrop.js
@@ -37,21 +37,29 @@ export default function getComponentWidthFromDrop({
return component.meta.width;
}
- const draggingWidth = getDetailedComponentWidth({
+ const {
+ width: draggingWidth,
+ minimumWidth: minDraggingWidth,
+ } = getDetailedComponentWidth({
component,
components,
});
- const destinationWidth = getDetailedComponentWidth({
+ const {
+ width: destinationWidth,
+ occupiedWidth: draggingOccupiedWidth,
+ } = getDetailedComponentWidth({
id: destination.id,
components,
});
- let destinationCapacity =
- destinationWidth.width - destinationWidth.occupiedWidth;
+ let destinationCapacity = Number(destinationWidth - draggingOccupiedWidth);
if (Number.isNaN(destinationCapacity)) {
- const grandparentWidth = getDetailedComponentWidth({
+ const {
+ width: grandparentWidth,
+ occupiedWidth: grandparentOccupiedWidth,
+ } = getDetailedComponentWidth({
id: findParentId({
childId: destination.id,
layout: components,
@@ -59,17 +67,19 @@ export default function getComponentWidthFromDrop({
components,
});
- destinationCapacity =
- grandparentWidth.width - grandparentWidth.occupiedWidth;
+ destinationCapacity = Number(grandparentWidth - grandparentOccupiedWidth);
}
- if (Number.isNaN(destinationCapacity) || Number.isNaN(draggingWidth.width)) {
- return draggingWidth.width;
+ if (
+ Number.isNaN(destinationCapacity) ||
+ Number.isNaN(Number(draggingWidth))
+ ) {
+ return draggingWidth;
}
- if (destinationCapacity >= draggingWidth.width) {
- return draggingWidth.width;
+ if (destinationCapacity >= draggingWidth) {
+ return draggingWidth;
}
- if (destinationCapacity >= draggingWidth.minimumWidth) {
+ if (destinationCapacity >= minDraggingWidth) {
return destinationCapacity;
}
diff --git
a/superset-frontend/src/explore/components/controls/BoundsControl.jsx
b/superset-frontend/src/explore/components/controls/BoundsControl.jsx
index f52f430..5c7c567 100644
--- a/superset-frontend/src/explore/components/controls/BoundsControl.jsx
+++ b/superset-frontend/src/explore/components/controls/BoundsControl.jsx
@@ -67,10 +67,10 @@ export default class BoundsControl extends React.Component {
onChange() {
const mm = this.state.minMax;
const errors = [];
- if (mm[0] && Number.isNaN(mm[0])) {
+ if (mm[0] && Number.isNaN(Number(mm[0]))) {
errors.push(t('`Min` value should be numeric or empty'));
}
- if (mm[1] && Number.isNaN(mm[1])) {
+ if (mm[1] && Number.isNaN(Number(mm[1]))) {
errors.push(t('`Max` value should be numeric or empty'));
}
if (errors.length === 0) {
diff --git
a/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx
b/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx
index 237174c..9802174 100644
--- a/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx
+++ b/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx
@@ -116,9 +116,9 @@ export default class FilterBoxItemControl extends
React.Component {
if (type === 'BOOLEAN') {
typedValue = value === 'true';
} else if (INTEGRAL_TYPES.has(type)) {
- typedValue = Number.isNaN(value) ? null : parseInt(value, 10);
+ typedValue = Number.isNaN(Number(value)) ? null : parseInt(value,
10);
} else if (DECIMAL_TYPES.has(type)) {
- typedValue = Number.isNaN(value) ? null : parseFloat(value);
+ typedValue = Number.isNaN(Number(value)) ? null : parseFloat(value);
}
}
}