* cherry pick -make new * revert to enable fix from release * attempt to hook into existing datasource editor * gSheets plugin skeleton from Rest API * Changes for database migration * fix for auth code * separate it out * action page loads! * add to explorer * create action from datasource * Editor JSON WIP * working query form * Editor JSON WIP * import to * fix toast message * redirect from datasource and editor pages * fix onboarding * fix imports and constants * refactor form out * refactor queryForm * Merge branch 'release' into feature/google-sheets * Merge branch 'release' into feature/google-sheets * initial values from settings, editor and form * Check * remove dangling code around lightTheme * Safety net * remove class * try mouseover solve * force click * changes from review * fix action form name on import * Merge branch 'release' into feature/google-sheets * minor cleanup * Merge branch 'release' into feature/google-sheets * WIP * Google sheets changes * Merge conflicts * Merging and fixes, needs refactoring * Check * Merge branch 'release' into feature/google-sheets * Fixed tests * Add cloud services env variable * Clean up saga * Clean up * Refactoring * Deleted svg file * Minor fixes * Modified design to allow behaviour in google sheets methods (#3486) * Modified design to allow behaviour in google sheets methods * Review changes * Removed sysout * Added handling of edge cases with table data * Merge branch 'release' into feature/google-sheets * Fixes * Fixes * Added validations * Improved tests * Removed extraneous injected bean * Review changes * Fixed bug with method * Changes to Google sheets plugin's request and response structures (#3692) * Method changes * Removed logging * Renaming options * Reverting pom version * Modified type of collection variables, fixed errors * Converted row offset field to one that supports dynamic bindings * Review changes * List SAAS plugin type actions under lightning menu apis (#3820) * list saas plugin type actions under lightning menu apis * combine saas plugin type actions in the other sub menu of lightning menu Co-authored-by: Hetu Nandu <hetunandu@gmail.com> * Fix merge issues * Prettified query editor and a few fixes w/ ux * Test fixes * Reformatting request * code for REST added (#3876) Co-authored-by: hetunandu <hetu@appsmith.com> * Renamed body to row object * Renamed placeholder for range * Renamed range heading * Modifications to handle range semantics * Use spreadsheet Url instead of id * Ordering of methods * Removed logging * Add tests for Dynamic text controls * Add tests for url helpers * Fix coverage config * Nevermind * Interface changes * There is no body here * Yay to hints * Delete row field is separately handled as row index * placeholder support (#4001) * Fixed tests, typos and creating new sheets with random rows * Switched to using 'rowIndex' throughout * binding path added for query input field (#4016) * - Fixed QA bugs (#4032) - Split delete sheet into two - Removed dynamic query input types from hidden keys * Proper exceptions * Removed extra logging * Throw exception if update method does not match any of the columns * Same for bulk update * Zero-indexed delete row * I'm a space bound rocket ship * Logic to register installations with cs (#4062) * Logic to register installations with cs * Clean up * Casting to string * Checking to see if this makes the test pass * Added an extra null check Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
105 lines
3.1 KiB
TypeScript
105 lines
3.1 KiB
TypeScript
import { all, put, select, takeEvery } from "redux-saga/effects";
|
|
import {
|
|
ReduxAction,
|
|
ReduxActionTypes,
|
|
ReduxActionWithMeta,
|
|
ReduxFormActionTypes,
|
|
} from "constants/ReduxActionConstants";
|
|
import history from "utils/history";
|
|
import { getDatasource, getPlugin } from "selectors/entitiesSelector";
|
|
import { Datasource } from "entities/Datasource";
|
|
import {
|
|
SAAS_EDITOR_DATASOURCE_ID_URL,
|
|
SAAS_EDITOR_API_ID_URL,
|
|
} from "pages/Editor/SaaSEditor/constants";
|
|
|
|
import {
|
|
getCurrentApplicationId,
|
|
getCurrentPageId,
|
|
} from "selectors/editorSelectors";
|
|
import { Action, PluginType } from "entities/Action";
|
|
import { SAAS_EDITOR_FORM } from "constants/forms";
|
|
import { getFormData } from "selectors/formSelectors";
|
|
import { setActionProperty } from "actions/actionActions";
|
|
import { autofill } from "redux-form";
|
|
|
|
function* handleDatasourceCreatedSaga(actionPayload: ReduxAction<Datasource>) {
|
|
const plugin = yield select(getPlugin, actionPayload.payload.pluginId);
|
|
// Only look at SAAS plugins
|
|
if (plugin.type !== PluginType.SAAS) return;
|
|
|
|
const applicationId = yield select(getCurrentApplicationId);
|
|
const pageId = yield select(getCurrentPageId);
|
|
|
|
history.push(
|
|
SAAS_EDITOR_DATASOURCE_ID_URL(
|
|
applicationId,
|
|
pageId,
|
|
plugin.packageName,
|
|
actionPayload.payload.id,
|
|
),
|
|
);
|
|
}
|
|
|
|
function* handleActionCreatedSaga(actionPayload: ReduxAction<Action>) {
|
|
const { id, pluginId } = actionPayload.payload;
|
|
const plugin = yield select(getPlugin, pluginId);
|
|
|
|
if (plugin.type !== "SAAS") return;
|
|
const applicationId = yield select(getCurrentApplicationId);
|
|
const pageId = yield select(getCurrentPageId);
|
|
history.push(
|
|
SAAS_EDITOR_API_ID_URL(applicationId, pageId, plugin.packageName, id, {
|
|
editName: "true",
|
|
}),
|
|
);
|
|
}
|
|
|
|
function* formValueChangeSaga(
|
|
actionPayload: ReduxActionWithMeta<string, { field: string; form: string }>,
|
|
) {
|
|
const { form, field } = actionPayload.meta;
|
|
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);
|
|
|
|
// Update the datasource not just the datasource id.
|
|
yield put(
|
|
setActionProperty({
|
|
actionId: values.id,
|
|
propertyName: "datasource",
|
|
value: datasource,
|
|
}),
|
|
);
|
|
|
|
// Update the datasource of the form as well
|
|
yield put(autofill(SAAS_EDITOR_FORM, "datasource", datasource));
|
|
|
|
return;
|
|
}
|
|
|
|
yield put(
|
|
setActionProperty({
|
|
actionId: values.id,
|
|
propertyName: field,
|
|
value: actionPayload.payload,
|
|
}),
|
|
);
|
|
}
|
|
|
|
export default function* root() {
|
|
yield all([
|
|
takeEvery(
|
|
ReduxActionTypes.CREATE_DATASOURCE_SUCCESS,
|
|
handleDatasourceCreatedSaga,
|
|
),
|
|
takeEvery(ReduxActionTypes.CREATE_ACTION_SUCCESS, handleActionCreatedSaga),
|
|
// Intercepting the redux-form change actionType
|
|
takeEvery(ReduxFormActionTypes.VALUE_CHANGE, formValueChangeSaga),
|
|
takeEvery(ReduxFormActionTypes.ARRAY_REMOVE, formValueChangeSaga),
|
|
]);
|
|
}
|