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)