PromucFlow_constructor/app/client/src/constants/AppsmithActionConstants/ActionConstants.tsx

153 lines
4.7 KiB
TypeScript
Raw Normal View History

import { ErrorActionPayload } from "sagas/ErrorSagas";
import { ActionResponse } from "api/ActionAPI";
import { PluginType } from "entities/Action";
import queryActionSettingsConfig from "constants/AppsmithActionConstants/formConfig/QuerySettingsConfig";
import apiActionSettingsConfig from "constants/AppsmithActionConstants/formConfig/ApiSettingsConfig";
import apiActionEditorConfig from "constants/AppsmithActionConstants/formConfig/ApiEditorConfigs";
Introducing Google Sheets Plugin (#3517) * 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>
2021-04-22 03:30:09 +00:00
import saasActionSettingsConfig from "constants/AppsmithActionConstants/formConfig/GoogleSheetsSettingsConfig";
import apiActionDependencyConfig from "constants/AppsmithActionConstants/formConfig/ApiDependencyConfigs";
2020-03-06 09:45:21 +00:00
export type ExecuteActionPayloadEvent = {
type: EventType;
callback?: (result: ExecutionResult) => void;
};
export type ExecutionResult = {
success: boolean;
};
export type TriggerSource = {
id: string;
name: string;
};
export type ExecuteTriggerPayload = {
2020-02-18 10:41:52 +00:00
dynamicString: string;
2020-03-06 09:45:21 +00:00
event: ExecuteActionPayloadEvent;
2020-11-20 09:30:50 +00:00
responseData?: Array<any>;
2021-04-23 13:50:55 +00:00
triggerPropertyName?: string;
source?: TriggerSource;
widgetId?: string;
2021-04-23 13:50:55 +00:00
};
export type ContentType =
| "application/json"
| "application/x-www-form-urlencoded";
export interface APIHeaders {
"Content-Type": ContentType;
Accept?: string;
}
export interface APIRequest {
requestId?: string;
}
2020-02-18 10:41:52 +00:00
export enum EventType {
2020-03-06 09:45:21 +00:00
ON_RESET = "ON_RESET",
2020-02-18 10:41:52 +00:00
ON_PAGE_LOAD = "ON_PAGE_LOAD",
ON_PREV_PAGE = "ON_PREV_PAGE",
ON_NEXT_PAGE = "ON_NEXT_PAGE",
ON_PAGE_SIZE_CHANGE = "ON_PAGE_SIZE_CHANGE",
2020-02-18 10:41:52 +00:00
ON_ERROR = "ON_ERROR",
ON_SUCCESS = "ON_SUCCESS",
ON_ROW_SELECTED = "ON_ROW_SELECTED",
ON_SEARCH = "ON_SEARCH",
2020-02-18 10:41:52 +00:00
ON_CLICK = "ON_CLICK",
ON_DATA_POINT_CLICK = "ON_DATA_POINT_CLICK",
ON_FILES_SELECTED = "ON_FILES_SELECTED",
2020-02-18 10:41:52 +00:00
ON_HOVER = "ON_HOVER",
ON_TOGGLE = "ON_TOGGLE",
ON_LOAD = "ON_LOAD",
ON_MODAL_CLOSE = "ON_MODAL_CLOSE",
2020-02-18 10:41:52 +00:00
ON_TEXT_CHANGE = "ON_TEXT_CHANGE",
ON_SUBMIT = "ON_SUBMIT",
ON_CHECK_CHANGE = "ON_CHECK_CHANGE",
ON_SWITCH_CHANGE = "ON_SWITCH_CHANGE",
2020-02-18 10:41:52 +00:00
ON_SELECT = "ON_SELECT",
ON_DATE_SELECTED = "ON_DATE_SELECTED",
ON_DATE_RANGE_SELECTED = "ON_DATE_RANGE_SELECTED",
ON_OPTION_CHANGE = "ON_OPTION_CHANGE",
ON_FILTER_CHANGE = "ON_FILTER_CHANGE",
ON_FILTER_UPDATE = "ON_FILTER_UPDATE",
2020-04-15 11:42:11 +00:00
ON_MARKER_CLICK = "ON_MARKER_CLICK",
ON_CREATE_MARKER = "ON_CREATE_MARKER",
2020-08-07 07:23:15 +00:00
ON_TAB_CHANGE = "ON_TAB_CHANGE",
ON_VIDEO_START = "ON_VIDEO_START",
ON_VIDEO_END = "ON_VIDEO_END",
ON_VIDEO_PLAY = "ON_VIDEO_PLAY",
ON_VIDEO_PAUSE = "ON_VIDEO_PAUSE",
ON_AUDIO_START = "ON_AUDIO_START",
ON_AUDIO_END = "ON_AUDIO_END",
ON_AUDIO_PLAY = "ON_AUDIO_PLAY",
ON_AUDIO_PAUSE = "ON_AUDIO_PAUSE",
ON_RATE_CHANGED = "ON_RATE_CHANGED",
ON_IFRAME_URL_CHANGED = "ON_IFRAME_URL_CHANGED",
ON_IFRAME_MESSAGE_RECEIVED = "ON_IFRAME_MESSAGE_RECEIVED",
ON_SNIPPET_EXECUTE = "ON_SNIPPET_EXECUTE",
ON_SORT = "ON_SORT",
ON_CHECKBOX_GROUP_SELECTION_CHANGE = "ON_CHECKBOX_GROUP_SELECTION_CHANGE",
ON_LIST_PAGE_CHANGE = "ON_LIST_PAGE_CHANGE",
ON_RECORDING_START = "ON_RECORDING_START",
ON_RECORDING_COMPLETE = "ON_RECORDING_COMPLETE",
feat: Switch Group widget (#7590) * Feat: Switch Group Widget -- The first MVP of the widget * feat: Switch Group Widget -- Follow the same config and implementation as the other group widgets * feat: Switch Group Widget -- Elaborate the help text for defaultSelectedValues * feat: Switch Group Widget -- Add a widget icon * feat: Switch Group Widget -- Remove unnecessary property control at ItemsControl.tsx -- Refactor some code snippets for higher code quality -- Add basic cypress test cases * fix: icon for the widget optimised & replaced * feat: Switch Group Widget -- Add a unit test for defaultSelectedValuesValidation * feat: Switch Group Widget -- Make the validation type for defaultSelectedValues property to ValidationTypes.ARRAY -- Remove original validation function and its unit test * feat: Switch Group Widget -- Fix on typo -- Fix on formatting issue -- Change the help text for isRequired property * feat: Switch Group Widget -- Revert help text for isRequired property to the original one * feat: Switch Group Widget -- Set strict property to true on defaultSelectedValues * feat: Switch group widget -- Refactor utility function, getCamelCaseString -- Add the corresponding test case * feat: Switch group widget -- Implement options property as a plain JS field -- Reimplement update logic for selectedValues when options changes -- Add a new utility function for checking equality of object arrays -- Add a unit test for the above function -- Rewrite the corresponding Cypress test cases * feat: Switch Group Widget -- Remove isArrayEqual utility function and directly use functions from lodash * feat: Swtich Group Widget -- Make selectedValues as a derived property * feat: Switch Group Widget -- Replace the widget icon * feat: Switch Group Widget -- Rewrite a test case for onSelectionChange property * feat: Switch Group Widget -- Remove redundant calls for openPropertyPane * feat: Switch Group Widget -- Remove closePropertyPane call from afterEach hook * feat: Switch Group Widget -- Change the selector for every switch element in onSelectionChange test case * feat: Switch Group Widget -- Fix on failed Cypress test case, adding closePropertyPane command to onSelectionChange * feat: Switch Group Widget -- Remove template literal from a selector * feat: Switch Group Widget -- Make click on onSelectionChange test case forced * feat: Switch Group Widget -- Fix on crash issue when editing on Options property * feat: Switch Group Widget -- Add the widget icon to show in entity explorer * feat: Switch Group Widget -- Fix on blue color on mouse down -- Add a new property for alignment Co-authored-by: somangshu <somangshu.goswami1508@gmail.com>
2021-12-09 12:02:47 +00:00
ON_SWITCH_GROUP_SELECTION_CHANGE = "ON_SWITCH_GROUP_SELECTION_CHANGE",
ON_JS_FUNCTION_EXECUTE = "ON_JS_FUNCTION_EXECUTE",
2020-02-18 10:41:52 +00:00
}
2019-09-12 13:44:25 +00:00
export interface PageAction {
2019-10-21 15:12:45 +00:00
id: string;
pluginType: PluginType;
2019-10-21 15:12:45 +00:00
name: string;
jsonPathKeys: string[];
2020-05-07 08:07:29 +00:00
timeoutInMillisecond: number;
2019-09-16 10:37:38 +00:00
}
2019-12-03 04:28:14 +00:00
export interface ExecuteErrorPayload extends ErrorActionPayload {
2020-01-30 13:23:04 +00:00
actionId: string;
isPageLoad?: boolean;
data: ActionResponse;
2020-01-30 13:23:04 +00:00
}
// Group 1 = datasource (https://www.domain.com)
// Group 2 = path (/nested/path)
// Group 3 = params (?param=123&param2=12)
export const urlGroupsRegexExp = /^(https?:\/{2}\S+?)(\/[\s\S]*?)(\?(?![^{]*})[\s\S]*)?$/;
2021-01-14 14:37:21 +00:00
2020-12-14 18:48:13 +00:00
export const EXECUTION_PARAM_KEY = "executionParams";
export const THIS_DOT_PARAMS_KEY = "params";
export const RESP_HEADER_DATATYPE = "X-APPSMITH-DATATYPE";
export const API_REQUEST_HEADERS: APIHeaders = {
"Content-Type": "application/json",
};
export const POSTMAN = "POSTMAN";
export const CURL = "CURL";
export const Swagger = "Swagger";
export const defaultActionSettings: Record<PluginType, any> = {
[PluginType.API]: apiActionSettingsConfig,
[PluginType.DB]: queryActionSettingsConfig,
Introducing Google Sheets Plugin (#3517) * 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>
2021-04-22 03:30:09 +00:00
[PluginType.SAAS]: saasActionSettingsConfig,
[PluginType.REMOTE]: saasActionSettingsConfig,
[PluginType.JS]: [],
};
export const defaultActionEditorConfigs: Record<PluginType, any> = {
[PluginType.API]: apiActionEditorConfig,
[PluginType.DB]: [],
Introducing Google Sheets Plugin (#3517) * 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>
2021-04-22 03:30:09 +00:00
[PluginType.SAAS]: [],
[PluginType.REMOTE]: [],
[PluginType.JS]: [],
};
export const defaultActionDependenciesConfig: Record<
PluginType,
Record<string, string[]>
> = {
[PluginType.API]: apiActionDependencyConfig,
[PluginType.DB]: {},
[PluginType.SAAS]: {},
[PluginType.REMOTE]: {},
[PluginType.JS]: {},
};