diff --git a/.circleci/config.yml b/.circleci/config.yml index e64f346ac1ef7a54f465ff1621f72fd6846bbe3c..d8561622e662310109d17276197f6b49ed819661 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -399,6 +399,42 @@ jobs: - /home/circleci/.yarn-cache - /home/circleci/metabase/metabase/node_modules + fe-linter-eslint: + <<: *defaults + steps: + - attach_workspace: + at: /home/circleci/ + - restore_cache: + <<: *restore-fe-deps-cache + - run: + name: Run ESLint linter + command: yarn lint-eslint + no_output_timeout: 5m + + fe-linter-prettier: + <<: *defaults + steps: + - attach_workspace: + at: /home/circleci/ + - restore_cache: + <<: *restore-fe-deps-cache + - run: + name: Run Prettier formatting linter + command: yarn lint-prettier + no_output_timeout: 5m + + fe-linter-flow: + <<: *defaults + steps: + - attach_workspace: + at: /home/circleci/ + - restore_cache: + <<: *restore-fe-deps-cache + - run: + name: Run Flow type checker + command: yarn flow + no_output_timeout: 5m + fe-tests-karma: <<: *defaults steps: @@ -528,6 +564,15 @@ workflows: - fe-deps: requires: - checkout + - fe-linter-eslint: + requires: + - fe-deps + - fe-linter-prettier: + requires: + - fe-deps + - fe-linter-flow: + requires: + - fe-deps - fe-tests-karma: requires: - fe-deps diff --git a/frontend/src/metabase/dashboard/components/Dashboard.jsx b/frontend/src/metabase/dashboard/components/Dashboard.jsx index a375fbb6be2d8a63a296cf29859646a2141a4ab7..d8fa547e74c102aa6c64333458da85181d8d87db 100644 --- a/frontend/src/metabase/dashboard/components/Dashboard.jsx +++ b/frontend/src/metabase/dashboard/components/Dashboard.jsx @@ -88,6 +88,7 @@ type Props = { parameterId: ParameterId, defaultValue: string, ) => void, + setParameterIndex: (parameterId: ParameterId, index: number) => void, editingParameter: ?Parameter, diff --git a/frontend/src/metabase/parameters/components/Parameters.jsx b/frontend/src/metabase/parameters/components/Parameters.jsx index b84dbb1523a1d327910a958fa3a0f12110ca6d1e..98910f52ee035dcdb0643d270cb3fe4e670699e8 100644 --- a/frontend/src/metabase/parameters/components/Parameters.jsx +++ b/frontend/src/metabase/parameters/components/Parameters.jsx @@ -38,6 +38,7 @@ type Props = { parameterId: ParameterId, defaultValue: string, ) => void, + setParameterIndex?: (parameterId: ParameterId, index: number) => void, removeParameter?: (parameterId: ParameterId) => void, setEditingParameter?: (parameterId: ParameterId) => void, }; @@ -100,9 +101,17 @@ export default class Parameters extends Component { } } - handleSortEnd = ({ oldIndex, newIndex }) => { + handleSortEnd = ({ + oldIndex, + newIndex, + }: { + oldIndex: number, + newIndex: number, + }) => { const { parameters, setParameterIndex } = this.props; - setParameterIndex(parameters[oldIndex].id, newIndex); + if (setParameterIndex) { + setParameterIndex(parameters[oldIndex].id, newIndex); + } }; render() { @@ -189,7 +198,6 @@ import { SortableContainer, SortableElement, SortableHandle, - arrayMove, } from "react-sortable-hoc"; const StaticParameterWidgetList = ({ children, ...props }) => { diff --git a/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx b/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx index 37877ebf091e7f9ccce2585bb52ea336048666e0..6d7ce8869992903dc25f8588f898c36de3e3e7e5 100644 --- a/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx +++ b/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx @@ -278,7 +278,7 @@ export default class NativeQueryEditor extends Component { } }; - setParameterIndex = (parameterId, parameterIndex) => { + setParameterIndex = (parameterId: ParameterId, parameterIndex: number) => { const { query, setDatasetQuery } = this.props; query .setParameterIndex(parameterId, parameterIndex)