fix: 7630 fixing where clause add delete row (#7968)
* Added new row addition action for form value changes * Added comments * Added special handling for where clause rows
This commit is contained in:
parent
cf3cdced07
commit
6023bb10e4
|
|
@ -22,6 +22,7 @@ import { SAAS_EDITOR_FORM } from "constants/forms";
|
|||
import { getFormData } from "selectors/formSelectors";
|
||||
import { setActionProperty } from "actions/pluginActionActions";
|
||||
import { autofill } from "redux-form";
|
||||
import { get } from "lodash";
|
||||
|
||||
function* handleDatasourceCreatedSaga(actionPayload: ReduxAction<Datasource>) {
|
||||
const plugin = yield select(getPlugin, actionPayload.payload.pluginId);
|
||||
|
|
@ -64,7 +65,6 @@ function* formValueChangeSaga(
|
|||
if (field === "dynamicBindingPathList" || field === "name") return;
|
||||
if (form !== SAAS_EDITOR_FORM) return;
|
||||
const { values } = yield select(getFormData, SAAS_EDITOR_FORM);
|
||||
|
||||
if (field === "datasource.id") {
|
||||
const datasource = yield select(getDatasource, actionPayload.payload);
|
||||
|
||||
|
|
@ -83,13 +83,29 @@ function* formValueChangeSaga(
|
|||
return;
|
||||
}
|
||||
|
||||
yield put(
|
||||
setActionProperty({
|
||||
actionId: values.id,
|
||||
propertyName: field,
|
||||
value: actionPayload.payload,
|
||||
}),
|
||||
);
|
||||
// Special handling of the case when the where clause row is added or removed
|
||||
if (
|
||||
actionPayload.type === ReduxFormActionTypes.ARRAY_REMOVE ||
|
||||
actionPayload.type === ReduxFormActionTypes.ARRAY_PUSH
|
||||
) {
|
||||
// Sending only the value for the where clause rather than the payload
|
||||
const value = get(values, field);
|
||||
yield put(
|
||||
setActionProperty({
|
||||
actionId: values.id,
|
||||
propertyName: field,
|
||||
value,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
yield put(
|
||||
setActionProperty({
|
||||
actionId: values.id,
|
||||
propertyName: field,
|
||||
value: actionPayload.payload,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default function* root() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user