PromucFlow_constructor/app/client/src/sagas/DebuggerSagas.ts

710 lines
22 KiB
TypeScript
Raw Normal View History

chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import type { LogDebuggerErrorAnalyticsPayload } from "actions/debuggerActions";
2021-07-08 05:31:08 +00:00
import {
addErrorLogs,
2021-07-08 05:31:08 +00:00
debuggerLog,
debuggerLogInit,
deleteErrorLog,
2021-07-08 05:31:08 +00:00
} from "actions/debuggerActions";
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type {
Log,
LogActionPayload,
LogObject,
} from "entities/AppsmithConsole";
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import { ENTITY_TYPE, LOG_CATEGORY } from "entities/AppsmithConsole";
import {
all,
call,
fork,
put,
select,
take,
takeEvery,
} from "redux-saga/effects";
import { findIndex, flatten, get, isEmpty, isMatch, set } from "lodash";
2021-04-23 13:50:55 +00:00
import { getDebuggerErrors } from "selectors/debuggerSelectors";
feat: JS Editor (#6003) * Changes to add js plugin * routes+reducer+create template * added debugger to js editor page * entity explorer changes * create js function * added copy, move and delete action * added js plugin * added existing js functions to data tree * removed actionconfig for js collection * new js function added to data tree and entity as well * parsing flow added * changes to data tree * parse and update js functions * small changes for def creator for js action * create delete modified * small changes for update * update flow change * entity properties added * removed linting errors * small changes in entity explorer * changes for update * move, copy implementation * conflict resolved * changes for dependecy map creation * Only make the variables the binding paths * Basic eval sync working * Minor fixes * removed unwanted code * entity props and autocomplete * saving in progress show * redirection fix after delete js action * removed unnecessary line * Fixing merge conflict * added sample body * removed dummy data and added plugin Type * few PR comments fixed * automplete fix * few more PR comments fix * PR commnets fix * move and copy api change * js colleciton name refactor & 'move to page' changes & search * view changes * autocomplete added for js collections * removing till async is implemented * small changes * separate js pane response view * Executing functions * js collection to js objects * entity explorer issue and resolve action on page switch * removed unused line * small color fix * js file icon added * added js action to property pane * Property pane changes for actions * property pane changes for js functions * showing syntax error for now * actions sorted in response tab * added js objects to slash and recent entitties * enabling this to be used inside of function * eval fix * feature flag changes for entity explorer and property pane * debugger changes * copy bug fix * small changes for eval * debugger bug fix * chnaged any to specific types * error in console fix * icons update * fixed test case * test case fix * non empty check for functions * evaluate test case fix * added new icons * text change * updated time for debounce for trial * after release mereg * changed icon * after merge * PR comments simple * fixed PR comments - redux form, settings remove * js object interface changes * name refactor * export default change * delete resolve actions chnage * after merge * adding execute fn as 3rd option and removed create new js function * issue 7054 fixed - app crash * execute function on response tab changes * refactor function name part 1 * refactor of js function name * try catch added refactor * test fix * not used line removed * test cases locator fixed Co-authored-by: Nidhi <nidhi.nair93@gmail.com> Co-authored-by: hetunandu <hetu@appsmith.com>
2021-09-08 17:32:22 +00:00
import {
getAction,
getPlugin,
getJSCollection,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
getAppMode,
changes in evaluation for EE - split (#27144) ## Description Evaluation split changes for EE. 1. RequiresLinting function has moved to common place - on EE extra checks will be added 2. DataTreeFactory - getActionsForCurrentPage changed to getCurrentActions -- which will be modified on EE to acomodate package actions 3. same as above for getJSCollectionsForCurrentPage --> changed to getCurrentJSCollections #### PR fixes following issue(s) Fixes # (issue number) > if no issue exists, please create an issue and ask the maintainers about this first > > > #### Type of change - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-09-12 11:51:39 +00:00
} from "@appsmith/selectors/entitiesSelector";
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import type { Action } from "entities/Action";
import { PluginType } from "entities/Action";
import type { JSCollection } from "entities/JSCollection";
2021-04-23 13:50:55 +00:00
import LOG_TYPE from "entities/AppsmithConsole/logtype";
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
import type { ConfigTree, DataTree } from "entities/DataTree/dataTreeFactory";
import {
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
getConfigTree,
getDataTree,
getEvaluationInverseDependencyMap,
} from "selectors/dataTreeSelectors";
import {
createLogTitleString,
getDependencyChain,
} from "components/editorComponents/Debugger/helpers";
import {
ACTION_CONFIGURATION_UPDATED,
createMessage,
WIDGET_PROPERTIES_UPDATED,
refactor: admin settings (#9906) * refactor admin settings feature * separated save-restart bar to separate component * created new CE dir to facilitate code split * created separate ee dir and exporting everything we have in ce file. * little mod * minor fix * splitting settings types config * using object literals for category types instead of enums * CE: support use of component for each category * minor style fix * authentication page UI changes implemented * github signup doc url added back * removed comments * routing updates * made subcategories listing in left pane optional * added muted saml to auth listing * added breadcrumbs and enabled button * created separate component for auth page and auth config * added callout and disconnect components * updated breadcrumbs component * minor updates to common components * updated warning callout and added icon * ce: test cases fixed * updated test file name * warning banner callout added on auth page * updated callout banner for form login * CE: Split config files * CE: moved the window declaration in EE file as its dependency will be updated in EE * CE: Splitting ApiConstants and SocialLogin constants * CE: split login page * CE: moved getSocialLoginButtonProps func to EE file as it's dependencies will be updated in EE * added key icon * CE: created a factory class to share social auths list * Minor style fix for social btns * Updated the third party auth styles * Small fixes to styling * ce: splitting forms constants * breadcrumbs implemented for all pages in admin settings * Settings breadcrumbs separated * splitted settings breadcrumbs between ce and ee * renamed default import * minor style fix * added login form config. * updated login/signup pages to use form login disabled config * removed common functionality outside * implemented breadcrumb component from scratch without using blueprint * removed unwanted code * Small style update * updated breadcrumb categories file name and breadcrumb icon * added cypress tests for admin settings auth page * added comments * update locator for upgrade button * added link for intercom on upgrade button * removed unnecessary file * minor style fix * style fix for auth option cards * split messages constant * fixed imports for message constants splitting. * added message constants * updated unit test cases * fixed messages import in cypress index * fixed messages import again, cypress fails to read re-exported objs. * added OIDC auth method on authentication page * updated import statements from ee to @appsmith * removed dead code * updated read more link UI * PR comments fixes * some UI fixes * used color and fonts from theme * fixed some imports * fixed some imports * removed warning imports * updated OIDC logo and auth method desc copies * css changes * css changes * css changes * updated cypress test for breadcrumb * moved callout component to ads as calloutv2 * UI changes for form fields * updated css for spacing between form fields * added sub-text on auth pages * added active class for breadcrumb item * added config for disable signup toggle and fixed UI issues of restart banner * fixed admin settings page bugs * assigned true as default state for signup * fixed messages import statements * updated code for PR comments related suggestions * reverted file path change in cypress support * updated cypress test * updated cypress test Co-authored-by: Ankita Kinger <ankita@appsmith.com>
2022-02-11 18:08:46 +00:00
} from "@appsmith/constants/messages";
import AppsmithConsole from "utils/AppsmithConsole";
import { getWidget } from "./selectors";
2021-07-08 05:31:08 +00:00
import AnalyticsUtil from "utils/AnalyticsUtil";
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import type { Plugin } from "api/PluginApi";
2021-07-08 05:31:08 +00:00
import { getCurrentPageId } from "selectors/editorSelectors";
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import type { WidgetProps } from "widgets/BaseWidget";
import * as log from "loglevel";
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
import type { DependencyMap } from "utils/DynamicBindingUtils";
import type { TriggerMeta } from "@appsmith/sagas/ActionExecution/ActionExecutionSagas";
import {
getEntityNameAndPropertyPath,
isAction,
isWidget,
} from "@appsmith/workers/Evaluation/evaluationUtils";
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
2021-04-23 13:50:55 +00:00
// Saga to format action request values to be shown in the debugger
function* formatActionRequestSaga(
payload: LogActionPayload,
requestPath?: any,
) {
// If there are no headers or body we don't format anything.
if (!payload.source || !payload.state || !requestPath) {
return payload;
2021-04-23 13:50:55 +00:00
}
const request = get(payload, requestPath);
2021-04-23 13:50:55 +00:00
const source = payload.source;
const action: Action | undefined = yield select(getAction, source.id);
// Only formatting for apis and not queries
if (action && action.pluginType === PluginType.API) {
// Formatting api headers here
if (request.headers) {
let formattedHeaders = [];
2021-04-23 13:50:55 +00:00
// Convert headers from Record<string, array>[] to Record<string, string>[]
// for showing in the logs
formattedHeaders = Object.keys(request.headers).map((key: string) => {
const value = request.headers[key];
return {
[key]: value[0],
};
});
set(payload, `${requestPath}.headers`, formattedHeaders);
}
// Formatting api body
if (request.body) {
let body = request.body;
2021-04-23 13:50:55 +00:00
try {
body = JSON.parse(body);
set(payload, `${requestPath}.body`, body);
} catch (e) {
// Nothing to do here, we show the api body as it is if it cannot be shown as
// an object
}
}
// Return the final payload to be logged
return payload;
2021-04-23 13:50:55 +00:00
} else {
return payload;
2021-04-23 13:50:55 +00:00
}
}
function* onEntityDeleteSaga(payload: Log[]) {
const sortedLogs = payload.reduce(
(
sortedLogs: {
withSource: Log[];
withoutSource: Log[];
},
log,
) => {
return log.source
? { ...sortedLogs, withSource: [...sortedLogs.withSource, log] }
: { ...sortedLogs, withSource: [...sortedLogs.withoutSource, log] };
},
{
withSource: [],
withoutSource: [],
},
);
if (!isEmpty(sortedLogs.withoutSource)) {
yield put(debuggerLog(sortedLogs.withoutSource));
2021-04-23 13:50:55 +00:00
}
if (isEmpty(sortedLogs.withSource)) return;
2021-04-23 13:50:55 +00:00
const errors: Record<string, Log> = yield select(getDebuggerErrors);
2021-04-23 13:50:55 +00:00
const errorIds = Object.keys(errors);
const logSourceIds = sortedLogs.withSource.map((log) => log.source?.id);
const errorsToDelete = errorIds.reduce((errorList: Log[], currentId) => {
const isPresent = logSourceIds.some((id) => id && currentId.includes(id));
return isPresent ? [...errorList, errors[currentId]] : errorList;
}, []);
2021-04-23 13:50:55 +00:00
sortedLogs.withSource.filter(
(log) => log.source && errorIds.includes(log.source.id),
);
if (!isEmpty(errorsToDelete)) {
const errorPayload = errorsToDelete.map((log) => ({
id: log.id as string,
analytics: log.analytics,
}));
AppsmithConsole.deleteErrors(errorPayload);
}
yield put(debuggerLog(sortedLogs.withSource));
}
function getLogsFromDependencyChain(
dependencyChain: string[],
payload: Log,
dataTree: DataTree,
) {
return dependencyChain.map((path) => {
const entityInfo = getEntityNameAndPropertyPath(path);
const entity = dataTree[entityInfo.entityName];
let log = {
...payload,
state: {
[entityInfo.propertyPath]: get(dataTree, path),
},
};
2021-04-23 13:50:55 +00:00
if (isAction(entity)) {
log = {
...log,
text: createMessage(ACTION_CONFIGURATION_UPDATED),
source: {
type: ENTITY_TYPE.ACTION,
name: entityInfo.entityName,
id: entity.actionId,
},
};
} else if (isWidget(entity)) {
log = {
...log,
text: createMessage(WIDGET_PROPERTIES_UPDATED),
source: {
type: ENTITY_TYPE.WIDGET,
name: entityInfo.entityName,
id: entity.widgetId,
},
};
2021-04-23 13:50:55 +00:00
}
return log;
});
2021-04-23 13:50:55 +00:00
}
function* logDependentEntityProperties(payload: Log[]) {
const validLogs = payload.filter((log) => log.state && log.source);
if (isEmpty(validLogs)) return;
yield take(ReduxActionTypes.SET_EVALUATED_TREE);
const dataTree: DataTree = yield select(getDataTree);
const inverseDependencyMap: DependencyMap = yield select(
getEvaluationInverseDependencyMap,
);
const finalPayload: Log[][] = [];
for (const log of validLogs) {
const propertyPath = `${log.source?.name}.` + log.source?.propertyPath;
const dependencyChain = getDependencyChain(
propertyPath,
inverseDependencyMap,
);
const payloadValue = getLogsFromDependencyChain(
dependencyChain,
log,
dataTree,
);
finalPayload.push(payloadValue);
}
//logging them all at once rather than updating them individually
yield put(debuggerLog(flatten(finalPayload)));
}
function* onTriggerPropertyUpdates(payload: Log[]) {
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
const configTree: ConfigTree = yield select(getConfigTree);
const validLogs = payload.filter(
(log) => log.source && log.source.propertyPath,
);
if (isEmpty(validLogs)) return;
const errorsPathsToDeleteFromConsole = new Set<string>();
for (const log of validLogs) {
const { source } = log;
if (!source || !source.propertyPath) continue;
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
const widget = configTree[source.name];
// If property is not a trigger property we ignore
if (!isWidget(widget) || !(source.propertyPath in widget.triggerPaths))
return false;
// If the value of the property is empty(or set to 'No Action')
if (widget[source.propertyPath] === "") {
errorsPathsToDeleteFromConsole.add(`${source.id}-${source.propertyPath}`);
}
}
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
const errorIdsToDelete = Array.from(errorsPathsToDeleteFromConsole).map(
(path) => ({ id: path }),
);
AppsmithConsole.deleteErrors(errorIdsToDelete);
}
function* debuggerLogSaga(action: ReduxAction<Log[]>) {
const { payload: logs } = action;
// array of logs without LOG_TYPE and logs which are not handled in switch statement below.
let otherLogs: Log[] = [];
// Group logs by LOG_TYPE
const sortedLogs = logs.reduce(
(sortedLogs: Record<string, Log[]>, currentLog: Log) => {
if (currentLog.logType) {
return sortedLogs.hasOwnProperty(currentLog.logType)
? {
...sortedLogs,
[currentLog.logType]: [
...sortedLogs[currentLog.logType],
currentLog,
],
}
: {
...sortedLogs,
[currentLog.logType]: [currentLog],
};
} else {
otherLogs.push(currentLog);
return sortedLogs;
2021-04-23 13:50:55 +00:00
}
},
{},
);
for (const item in sortedLogs) {
const logType = Number(item);
const payload = sortedLogs[item];
switch (logType) {
case LOG_TYPE.WIDGET_UPDATE:
yield put(debuggerLog(payload));
yield call(logDependentEntityProperties, payload);
yield call(onTriggerPropertyUpdates, payload);
return;
case LOG_TYPE.ACTION_UPDATE:
yield put(debuggerLog(payload));
yield call(logDependentEntityProperties, payload);
return;
case LOG_TYPE.JS_ACTION_UPDATE:
yield put(debuggerLog(payload));
return;
case LOG_TYPE.JS_PARSE_ERROR:
yield put(addErrorLogs(payload));
break;
case LOG_TYPE.JS_PARSE_SUCCESS: {
const errorIds = payload.map((log) => ({ id: log.source?.id ?? "" }));
AppsmithConsole.deleteErrors(errorIds);
break;
2021-04-23 13:50:55 +00:00
}
// @ts-expect-error: Types are not available
case LOG_TYPE.TRIGGER_EVAL_ERROR:
yield put(debuggerLog(payload));
case LOG_TYPE.EVAL_ERROR:
case LOG_TYPE.LINT_ERROR:
case LOG_TYPE.EVAL_WARNING:
case LOG_TYPE.WIDGET_PROPERTY_VALIDATION_ERROR: {
const filteredLogs = payload.filter(
(log) => log.source && log.source.propertyPath && log.text,
2021-04-23 13:50:55 +00:00
);
yield put(addErrorLogs(filteredLogs));
break;
2021-04-23 13:50:55 +00:00
}
case LOG_TYPE.ACTION_EXECUTION_ERROR:
{
const allFormatedLogs: Log[] = [];
for (const log of payload) {
const formattedLog: Log = yield call(
formatActionRequestSaga,
log,
"state",
);
allFormatedLogs.push(formattedLog);
}
yield put(addErrorLogs(allFormatedLogs));
yield put(debuggerLog(allFormatedLogs));
}
break;
case LOG_TYPE.ACTION_EXECUTION_SUCCESS:
{
const allFormatedLogs: Log[] = [];
for (const log of payload) {
const formattedLog: Log = yield call(
formatActionRequestSaga,
log,
"state.request",
);
allFormatedLogs.push(formattedLog);
}
const payloadIds = payload.map((log) => ({
id: log.source?.id ?? "",
}));
AppsmithConsole.deleteErrors(payloadIds);
yield put(debuggerLog(allFormatedLogs));
}
break;
case LOG_TYPE.ENTITY_DELETED:
yield fork(onEntityDeleteSaga, payload);
break;
default:
otherLogs = otherLogs.concat(payload);
}
}
if (!isEmpty(otherLogs)) {
yield put(debuggerLog(otherLogs));
2021-04-23 13:50:55 +00:00
}
}
2021-07-08 05:31:08 +00:00
// This saga is intended for analytics only
function* logDebuggerErrorAnalyticsSaga(
action: ReduxAction<LogDebuggerErrorAnalyticsPayload>,
) {
2021-07-08 12:44:31 +00:00
try {
const { payload } = action;
const currentPageId: string | undefined = yield select(getCurrentPageId);
2021-07-08 05:31:08 +00:00
2021-07-08 12:44:31 +00:00
if (payload.entityType === ENTITY_TYPE.WIDGET) {
const widget: WidgetProps | undefined = yield select(
getWidget,
payload.entityId,
);
const widgetType = widget?.type || payload?.analytics?.widgetType || "";
2021-07-08 12:44:31 +00:00
const propertyPath = `${widgetType}.${payload.propertyPath}`;
2021-07-08 05:31:08 +00:00
2021-07-08 12:44:31 +00:00
// Sending widget type for widgets
AnalyticsUtil.logEvent(payload.eventName, {
entityType: widgetType,
propertyPath,
errorId: payload.errorId,
2021-07-08 12:44:31 +00:00
errorMessages: payload.errorMessages,
pageId: currentPageId,
errorMessage: payload.errorMessage,
errorType: payload.errorType,
2021-07-08 12:44:31 +00:00
});
} else if (payload.entityType === ENTITY_TYPE.ACTION) {
const action: Action | undefined = yield select(
getAction,
payload.entityId,
);
const pluginId = action?.pluginId || payload?.analytics?.pluginId || "";
const plugin: Plugin = yield select(getPlugin, pluginId);
feat: show lint errors in async functions bound to sync fields (#21187) ## Description This PR improves the error resolution journey for users. Lint warnings are added to async JS functions which are bound to data fields (sync fields). - JSObjects are "linted" by individual properties (as opposed to being "linted" as a whole) - Only edited jsobject properties get "linted", improving jsObject linting by ~35%.(This largely depends on the size of the JSObject) <img width="500" alt="Screenshot 2023-04-03 at 11 17 45" src="https://user-images.githubusercontent.com/46670083/229482424-233f3950-ffec-46f5-8c42-680dff6a412f.png"> <img width="500" alt="Screenshot 2023-03-14 at 11 26 00" src="https://user-images.githubusercontent.com/46670083/224975572-b2d8d404-aac6-43fb-be14-20edf7c56117.png"> <img width="500" alt="Screenshot 2023-03-14 at 11 41 11" src="https://user-images.githubusercontent.com/46670083/224975952-c40848b1-69d8-489d-9b62-24127ea1a2f1.png"> Fixes #20289 Fixes #20008 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - CYPRESS - JEST ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [x] Test plan has been peer reviewed by QA - [x] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-04-03 10:41:15 +00:00
const pluginName = plugin?.name.replace(/ /g, "");
2021-07-08 12:44:31 +00:00
let propertyPath = `${pluginName}`;
2021-07-08 05:31:08 +00:00
2021-07-08 12:44:31 +00:00
if (payload.propertyPath) {
propertyPath += `.${payload.propertyPath}`;
}
2021-07-08 05:31:08 +00:00
2021-07-08 12:44:31 +00:00
// Sending plugin name for actions
AnalyticsUtil.logEvent(payload.eventName, {
entityType: pluginName,
propertyPath,
errorId: payload.errorId,
2021-07-08 12:44:31 +00:00
errorMessages: payload.errorMessages,
pageId: currentPageId,
errorMessage: payload.errorMessage,
errorType: payload.errorType,
errorSubType: payload.errorSubType,
2021-07-08 12:44:31 +00:00
});
feat: JS Editor (#6003) * Changes to add js plugin * routes+reducer+create template * added debugger to js editor page * entity explorer changes * create js function * added copy, move and delete action * added js plugin * added existing js functions to data tree * removed actionconfig for js collection * new js function added to data tree and entity as well * parsing flow added * changes to data tree * parse and update js functions * small changes for def creator for js action * create delete modified * small changes for update * update flow change * entity properties added * removed linting errors * small changes in entity explorer * changes for update * move, copy implementation * conflict resolved * changes for dependecy map creation * Only make the variables the binding paths * Basic eval sync working * Minor fixes * removed unwanted code * entity props and autocomplete * saving in progress show * redirection fix after delete js action * removed unnecessary line * Fixing merge conflict * added sample body * removed dummy data and added plugin Type * few PR comments fixed * automplete fix * few more PR comments fix * PR commnets fix * move and copy api change * js colleciton name refactor & 'move to page' changes & search * view changes * autocomplete added for js collections * removing till async is implemented * small changes * separate js pane response view * Executing functions * js collection to js objects * entity explorer issue and resolve action on page switch * removed unused line * small color fix * js file icon added * added js action to property pane * Property pane changes for actions * property pane changes for js functions * showing syntax error for now * actions sorted in response tab * added js objects to slash and recent entitties * enabling this to be used inside of function * eval fix * feature flag changes for entity explorer and property pane * debugger changes * copy bug fix * small changes for eval * debugger bug fix * chnaged any to specific types * error in console fix * icons update * fixed test case * test case fix * non empty check for functions * evaluate test case fix * added new icons * text change * updated time for debounce for trial * after release mereg * changed icon * after merge * PR comments simple * fixed PR comments - redux form, settings remove * js object interface changes * name refactor * export default change * delete resolve actions chnage * after merge * adding execute fn as 3rd option and removed create new js function * issue 7054 fixed - app crash * execute function on response tab changes * refactor function name part 1 * refactor of js function name * try catch added refactor * test fix * not used line removed * test cases locator fixed Co-authored-by: Nidhi <nidhi.nair93@gmail.com> Co-authored-by: hetunandu <hetu@appsmith.com>
2021-09-08 17:32:22 +00:00
} else if (payload.entityType === ENTITY_TYPE.JSACTION) {
const action: JSCollection = yield select(
getJSCollection,
payload.entityId,
);
if (!action) return;
feat: JS Editor (#6003) * Changes to add js plugin * routes+reducer+create template * added debugger to js editor page * entity explorer changes * create js function * added copy, move and delete action * added js plugin * added existing js functions to data tree * removed actionconfig for js collection * new js function added to data tree and entity as well * parsing flow added * changes to data tree * parse and update js functions * small changes for def creator for js action * create delete modified * small changes for update * update flow change * entity properties added * removed linting errors * small changes in entity explorer * changes for update * move, copy implementation * conflict resolved * changes for dependecy map creation * Only make the variables the binding paths * Basic eval sync working * Minor fixes * removed unwanted code * entity props and autocomplete * saving in progress show * redirection fix after delete js action * removed unnecessary line * Fixing merge conflict * added sample body * removed dummy data and added plugin Type * few PR comments fixed * automplete fix * few more PR comments fix * PR commnets fix * move and copy api change * js colleciton name refactor & 'move to page' changes & search * view changes * autocomplete added for js collections * removing till async is implemented * small changes * separate js pane response view * Executing functions * js collection to js objects * entity explorer issue and resolve action on page switch * removed unused line * small color fix * js file icon added * added js action to property pane * Property pane changes for actions * property pane changes for js functions * showing syntax error for now * actions sorted in response tab * added js objects to slash and recent entitties * enabling this to be used inside of function * eval fix * feature flag changes for entity explorer and property pane * debugger changes * copy bug fix * small changes for eval * debugger bug fix * chnaged any to specific types * error in console fix * icons update * fixed test case * test case fix * non empty check for functions * evaluate test case fix * added new icons * text change * updated time for debounce for trial * after release mereg * changed icon * after merge * PR comments simple * fixed PR comments - redux form, settings remove * js object interface changes * name refactor * export default change * delete resolve actions chnage * after merge * adding execute fn as 3rd option and removed create new js function * issue 7054 fixed - app crash * execute function on response tab changes * refactor function name part 1 * refactor of js function name * try catch added refactor * test fix * not used line removed * test cases locator fixed Co-authored-by: Nidhi <nidhi.nair93@gmail.com> Co-authored-by: hetunandu <hetu@appsmith.com>
2021-09-08 17:32:22 +00:00
const plugin: Plugin = yield select(getPlugin, action.pluginId);
const pluginName = plugin?.name?.replace(/ /g, "");
feat: JS Editor (#6003) * Changes to add js plugin * routes+reducer+create template * added debugger to js editor page * entity explorer changes * create js function * added copy, move and delete action * added js plugin * added existing js functions to data tree * removed actionconfig for js collection * new js function added to data tree and entity as well * parsing flow added * changes to data tree * parse and update js functions * small changes for def creator for js action * create delete modified * small changes for update * update flow change * entity properties added * removed linting errors * small changes in entity explorer * changes for update * move, copy implementation * conflict resolved * changes for dependecy map creation * Only make the variables the binding paths * Basic eval sync working * Minor fixes * removed unwanted code * entity props and autocomplete * saving in progress show * redirection fix after delete js action * removed unnecessary line * Fixing merge conflict * added sample body * removed dummy data and added plugin Type * few PR comments fixed * automplete fix * few more PR comments fix * PR commnets fix * move and copy api change * js colleciton name refactor & 'move to page' changes & search * view changes * autocomplete added for js collections * removing till async is implemented * small changes * separate js pane response view * Executing functions * js collection to js objects * entity explorer issue and resolve action on page switch * removed unused line * small color fix * js file icon added * added js action to property pane * Property pane changes for actions * property pane changes for js functions * showing syntax error for now * actions sorted in response tab * added js objects to slash and recent entitties * enabling this to be used inside of function * eval fix * feature flag changes for entity explorer and property pane * debugger changes * copy bug fix * small changes for eval * debugger bug fix * chnaged any to specific types * error in console fix * icons update * fixed test case * test case fix * non empty check for functions * evaluate test case fix * added new icons * text change * updated time for debounce for trial * after release mereg * changed icon * after merge * PR comments simple * fixed PR comments - redux form, settings remove * js object interface changes * name refactor * export default change * delete resolve actions chnage * after merge * adding execute fn as 3rd option and removed create new js function * issue 7054 fixed - app crash * execute function on response tab changes * refactor function name part 1 * refactor of js function name * try catch added refactor * test fix * not used line removed * test cases locator fixed Co-authored-by: Nidhi <nidhi.nair93@gmail.com> Co-authored-by: hetunandu <hetu@appsmith.com>
2021-09-08 17:32:22 +00:00
// Sending plugin name for actions
AnalyticsUtil.logEvent(payload.eventName, {
entityType: pluginName,
errorId: payload.errorId,
propertyPath: payload.propertyPath,
feat: JS Editor (#6003) * Changes to add js plugin * routes+reducer+create template * added debugger to js editor page * entity explorer changes * create js function * added copy, move and delete action * added js plugin * added existing js functions to data tree * removed actionconfig for js collection * new js function added to data tree and entity as well * parsing flow added * changes to data tree * parse and update js functions * small changes for def creator for js action * create delete modified * small changes for update * update flow change * entity properties added * removed linting errors * small changes in entity explorer * changes for update * move, copy implementation * conflict resolved * changes for dependecy map creation * Only make the variables the binding paths * Basic eval sync working * Minor fixes * removed unwanted code * entity props and autocomplete * saving in progress show * redirection fix after delete js action * removed unnecessary line * Fixing merge conflict * added sample body * removed dummy data and added plugin Type * few PR comments fixed * automplete fix * few more PR comments fix * PR commnets fix * move and copy api change * js colleciton name refactor & 'move to page' changes & search * view changes * autocomplete added for js collections * removing till async is implemented * small changes * separate js pane response view * Executing functions * js collection to js objects * entity explorer issue and resolve action on page switch * removed unused line * small color fix * js file icon added * added js action to property pane * Property pane changes for actions * property pane changes for js functions * showing syntax error for now * actions sorted in response tab * added js objects to slash and recent entitties * enabling this to be used inside of function * eval fix * feature flag changes for entity explorer and property pane * debugger changes * copy bug fix * small changes for eval * debugger bug fix * chnaged any to specific types * error in console fix * icons update * fixed test case * test case fix * non empty check for functions * evaluate test case fix * added new icons * text change * updated time for debounce for trial * after release mereg * changed icon * after merge * PR comments simple * fixed PR comments - redux form, settings remove * js object interface changes * name refactor * export default change * delete resolve actions chnage * after merge * adding execute fn as 3rd option and removed create new js function * issue 7054 fixed - app crash * execute function on response tab changes * refactor function name part 1 * refactor of js function name * try catch added refactor * test fix * not used line removed * test cases locator fixed Co-authored-by: Nidhi <nidhi.nair93@gmail.com> Co-authored-by: hetunandu <hetu@appsmith.com>
2021-09-08 17:32:22 +00:00
errorMessages: payload.errorMessages,
pageId: currentPageId,
});
2021-07-08 12:44:31 +00:00
}
} catch (e) {
log.error(e);
2021-07-08 05:31:08 +00:00
}
}
function* addDebuggerErrorLogsSaga(action: ReduxAction<Log[]>) {
const errorLogs = action.payload;
const currentDebuggerErrors: Record<string, Log> = yield select(
getDebuggerErrors,
);
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
const appMode: ReturnType<typeof getAppMode> = yield select(getAppMode);
yield put(debuggerLogInit(errorLogs));
const validErrorLogs = errorLogs.filter((log) => log.source && log.id);
if (isEmpty(validErrorLogs)) return;
for (const errorLog of validErrorLogs) {
const { id, messages, source } = errorLog;
if (!source || !id) continue;
const analyticsPayload = {
entityName: source.name,
entityType: source.type,
entityId: source.id,
propertyPath: source.propertyPath ?? "",
};
// If this is a new error
if (!currentDebuggerErrors.hasOwnProperty(id)) {
const errorMessages = errorLog.messages ?? [];
yield put({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload: {
...analyticsPayload,
eventName: "DEBUGGER_NEW_ERROR",
errorMessages,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
appMode,
},
});
// Log analytics for new error messages
//errorID has timestamp for 1:1 mapping with new and resolved errors
if (errorMessages.length && errorLog) {
const currentEnvDetails: { id: string; name: string } = yield select(
getCurrentEnvironmentDetails,
);
yield all(
errorMessages.map((errorMessage) =>
put({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload: {
...analyticsPayload,
environmentId: currentEnvDetails.id,
environmentName: currentEnvDetails.name,
eventName: "DEBUGGER_NEW_ERROR_MESSAGE",
errorId: errorLog.id + "_" + errorLog.timestamp,
errorMessage: errorMessage.message,
errorType: errorMessage.type,
errorSubType: errorMessage.subType,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
appMode,
},
}),
),
);
}
} else {
const updatedErrorMessages = messages ?? [];
const existingErrorMessages = currentDebuggerErrors[id].messages ?? [];
const currentEnvDetails: { id: string; name: string } = yield select(
getCurrentEnvironmentDetails,
);
// Log new error messages
yield all(
updatedErrorMessages.map((updatedErrorMessage) => {
const exists = findIndex(
existingErrorMessages,
(existingErrorMessage) => {
return isMatch(existingErrorMessage, updatedErrorMessage);
},
);
if (exists < 0) {
//errorID has timestamp for 1:1 mapping with new and resolved errors
return put({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload: {
...analyticsPayload,
environmentId: currentEnvDetails.id,
environmentName: currentEnvDetails.name,
eventName: "DEBUGGER_NEW_ERROR_MESSAGE",
errorId: errorLog.id + "_" + errorLog.timestamp,
errorMessage: updatedErrorMessage.message,
errorType: updatedErrorMessage.type,
errorSubType: updatedErrorMessage.subType,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
appMode,
},
});
}
}),
);
// Log resolved error messages
yield all(
existingErrorMessages.map((existingErrorMessage) => {
const exists = findIndex(
updatedErrorMessages,
(updatedErrorMessage) => {
return isMatch(updatedErrorMessage, existingErrorMessage);
},
);
if (exists < 0) {
//errorID has timestamp for 1:1 mapping with new and resolved errors
return put({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload: {
...analyticsPayload,
environmentId: currentEnvDetails.id,
environmentName: currentEnvDetails.name,
eventName: "DEBUGGER_RESOLVED_ERROR_MESSAGE",
errorId:
currentDebuggerErrors[id].id +
"_" +
currentDebuggerErrors[id].timestamp,
errorMessage: existingErrorMessage.message,
errorType: existingErrorMessage.type,
errorSubType: existingErrorMessage.subType,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
appMode,
},
});
}
}),
);
}
}
}
function* deleteDebuggerErrorLogsSaga(
action: ReduxAction<{ id: string; analytics: Log["analytics"] }[]>,
) {
const { payload } = action;
const currentDebuggerErrors: Record<string, Log> = yield select(
getDebuggerErrors,
);
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
const appMode: ReturnType<typeof getAppMode> = yield select(getAppMode);
const existingErrorPayloads = payload.filter((item) =>
currentDebuggerErrors.hasOwnProperty(item.id),
);
if (isEmpty(existingErrorPayloads)) return;
const validErrorPayloadsToDelete = existingErrorPayloads.filter((payload) => {
const existingError = currentDebuggerErrors[payload.id];
return existingError && existingError.source;
});
if (isEmpty(validErrorPayloadsToDelete)) return;
for (const validErrorPayload of validErrorPayloadsToDelete) {
const error = currentDebuggerErrors[validErrorPayload.id];
if (!error || !error.source) continue;
const analyticsPayload = {
entityName: error.source.name,
entityType: error.source.type,
entityId: error.source.id,
propertyPath: error.source.propertyPath ?? "",
analytics: validErrorPayload.analytics,
};
const errorMessages = error.messages;
yield put({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload: {
...analyticsPayload,
eventName: "DEBUGGER_RESOLVED_ERROR",
errorMessages,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
appMode,
},
});
if (errorMessages) {
const currentEnvDetails: { id: string; name: string } = yield select(
getCurrentEnvironmentDetails,
);
//errorID has timestamp for 1:1 mapping with new and resolved errors
yield all(
errorMessages.map((errorMessage) => {
return put({
type: ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
payload: {
...analyticsPayload,
environmentId: currentEnvDetails.id,
environmentName: currentEnvDetails.name,
eventName: "DEBUGGER_RESOLVED_ERROR_MESSAGE",
errorId: error.id + "_" + error.timestamp,
errorMessage: errorMessage.message,
errorType: errorMessage.type,
errorSubType: errorMessage.subType,
chore: Add appmode in debugger analytics (#25842) ## Description Add Appmode in debugger analytics #### PR fixes following issue(s) Fixes #25730 #### Type of change - Chore ## Testing > #### How Has This Been Tested? #### Test Plan #### Issues raised during DP testing ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-02 07:48:09 +00:00
appMode,
},
});
}),
);
}
}
const validErrorIds = validErrorPayloadsToDelete.map((payload) => payload.id);
yield put(deleteErrorLog(validErrorIds));
}
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
// takes a log object array and stores it in the redux store
fix: access outer scope variables inside callbacks (#20168) ## Description Any platform function that accepts a callback were unable to access the variables declared in its parent scopes. This was a implementation miss when we originally designed platform functions and again when we turned almost every platform function into a Promise. This PR fixes this limitation along with some other edge cases. - Access outer scope variables inside the callback of run, postMessage, setInterval, getGeoLocation and watchGeolocation functions. - Fixes certain edge cases where functions with callbacks when called inside the then block doesn't get executed. Eg `showAlert.then(() => /* Doesn't execute */ Api1.run(() => {}))` - Changes the implementation of all the platform function in appsmith to maintain the execution metadata (info on from where a function was invoked, event associated with it etc) #### Refactor changes - Added a new folder **_fns_** that would now hold all the platform functions. - Introduced a new ExecutionMetadata singleton class that is now responsible for hold all the meta data related to the current evaluation. - Remove TRIGGER_COLLECTOR array where all callback based platform functions were batched and introduced an Event Emitter based implementation to handle batched fn calls. - All callback based functions now emits event when invoked. These events have handlers attached to the TriggerEmitter object. These handler does the job of batching these invocations and telling the main thread. It also ensures that platform fn calls that gets triggered out the the context of a request/response cycle work. #### Architecture <img width="751" alt="Screenshot 2023-02-07 at 10 04 26" src="https://user-images.githubusercontent.com/32433245/217259200-5eac71bc-f0d3-4d3c-9b69-2a8dc81351bc.png"> Fixes #13156 Fixes #20225 ## Type of change - Bug fix (non-breaking change which fixes an issue) - Refactor ## How Has This Been Tested? - Jest - Cypress - Manual ### Test Plan - [ ] https://github.com/appsmithorg/TestSmith/issues/2181 - [ ] https://github.com/appsmithorg/TestSmith/issues/2182 - [ ] Post message - https://appsmith-git-chore-outer-scope-variable-access-get-appsmith.vercel.app/app/post-msg-app/page1-635fcfba2987b442a739b938/edit - [ ] Apps: https://appsmith-git-chore-outer-scope-variable-access-get-appsmith.vercel.app/app/earworm-1/home-630c9d85b4658d0f257c4987/edit - [ ] https://appsmith-git-chore-outer-scope-variable-access-get-appsmith.vercel.app/app/automation-test-cases/page-1-630c6b90d4ecd573f6bb01e9/edit#0hmn8m90ei ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reviewing all Cypress test
2023-02-11 18:33:20 +00:00
export function* storeLogs(logs: LogObject[]) {
AppsmithConsole.addLogs(
logs.map((log: LogObject) => {
return {
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
text: createLogTitleString(log.data),
logData: log.data,
fix: access outer scope variables inside callbacks (#20168) ## Description Any platform function that accepts a callback were unable to access the variables declared in its parent scopes. This was a implementation miss when we originally designed platform functions and again when we turned almost every platform function into a Promise. This PR fixes this limitation along with some other edge cases. - Access outer scope variables inside the callback of run, postMessage, setInterval, getGeoLocation and watchGeolocation functions. - Fixes certain edge cases where functions with callbacks when called inside the then block doesn't get executed. Eg `showAlert.then(() => /* Doesn't execute */ Api1.run(() => {}))` - Changes the implementation of all the platform function in appsmith to maintain the execution metadata (info on from where a function was invoked, event associated with it etc) #### Refactor changes - Added a new folder **_fns_** that would now hold all the platform functions. - Introduced a new ExecutionMetadata singleton class that is now responsible for hold all the meta data related to the current evaluation. - Remove TRIGGER_COLLECTOR array where all callback based platform functions were batched and introduced an Event Emitter based implementation to handle batched fn calls. - All callback based functions now emits event when invoked. These events have handlers attached to the TriggerEmitter object. These handler does the job of batching these invocations and telling the main thread. It also ensures that platform fn calls that gets triggered out the the context of a request/response cycle work. #### Architecture <img width="751" alt="Screenshot 2023-02-07 at 10 04 26" src="https://user-images.githubusercontent.com/32433245/217259200-5eac71bc-f0d3-4d3c-9b69-2a8dc81351bc.png"> Fixes #13156 Fixes #20225 ## Type of change - Bug fix (non-breaking change which fixes an issue) - Refactor ## How Has This Been Tested? - Jest - Cypress - Manual ### Test Plan - [ ] https://github.com/appsmithorg/TestSmith/issues/2181 - [ ] https://github.com/appsmithorg/TestSmith/issues/2182 - [ ] Post message - https://appsmith-git-chore-outer-scope-variable-access-get-appsmith.vercel.app/app/post-msg-app/page1-635fcfba2987b442a739b938/edit - [ ] Apps: https://appsmith-git-chore-outer-scope-variable-access-get-appsmith.vercel.app/app/earworm-1/home-630c9d85b4658d0f257c4987/edit - [ ] https://appsmith-git-chore-outer-scope-variable-access-get-appsmith.vercel.app/app/automation-test-cases/page-1-630c6b90d4ecd573f6bb01e9/edit#0hmn8m90ei ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reviewing all Cypress test
2023-02-11 18:33:20 +00:00
source: log.source,
severity: log.severity,
timestamp: log.timestamp,
category: LOG_CATEGORY.USER_GENERATED,
feat: Error Navigation (#21753) ## Description > ``` const isOnCanvas = matchBuilderPath(window.location.pathname); if (isOnCanvas) { dispatch(showDebuggerAction(!showDebugger)); }} ``` The condition check to verify if we are on canvas was removed as we are opening debugger throughout all pages. > Now debugger is accessible from all pages in Appsmith. (Earlier it was not present in Datasources pages.) Fixes #19567 #21935 #21934 #21907 #21223 Media > [Video](https://www.loom.com/share/ff5eebb5e0a74e0bad6ead26050b5833) ## Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual - Jest - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-04-10 12:59:14 +00:00
isExpanded: false,
};
}),
);
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
}
export function* updateTriggerMeta(
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
triggerMeta: TriggerMeta,
dynamicTrigger: string,
) {
let name = "";
if (!!triggerMeta.source && triggerMeta.source.hasOwnProperty("name")) {
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
name = triggerMeta.source.name;
} else if (!!triggerMeta.triggerPropertyName) {
name = triggerMeta.triggerPropertyName;
}
if (
name.length === 0 &&
!!dynamicTrigger &&
!(dynamicTrigger.includes("{") || dynamicTrigger.includes("}"))
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
) {
// We use the dynamic trigger as the name if it is not a binding
name = dynamicTrigger.replace("()", "");
triggerMeta["triggerPropertyName"] = name;
feat: console log implementation in appsmith (#16286) * feat: capture console from across the app (#15676) * create: console override file - Adds methods to override the given console functionality to capture the console statements written by the user * update: evaluate function to extract console op - Added logs extraction for both sync and async functions - Adding them to the return object of the evaluations * update: timestamp field to log addition method - Added optional argument to function definition for inputting the timestamp of the log - This is done to maintain timings of the execution of the log * update: interface for log objects * update: post function execution logic - Added logic to push the logs generated by the evaluation to the logs store * update: added handling for sending nested fns - While console logging functions or objects that had functions was causing an error - Added a check for removing functions and replacing them with name of the functions instead * chore: added types and comments * fix: updated evaluation tests * fix: added check for log in returned obj * update: added the source data in the trigger logs - Removed on js execute logs from showing up here since they are already handled. If they are not removed, they will show up on the first page load twice * add: ellipsis function for log title string - This is to keep big object contained in the first line only * update: made logs reset function public * update: resetting logs before new eval - Logs object has to be cleared before next eval can happen to make sure there are no roll overs from last evals * chore: added comments * add: extracting logs after eval of functions * add: storing logs to redux after eval * refactor: updated types * add: func to store logs w/ severity as arg * refactor: updating func call for user logs * chore: fixed elipsis logic * chore: removed unused type * chore: updated preview text logic * add: type for transfer object post eval * update: aded new userLogs obj to dataTreeEvaluator * update: passing logs from object to saga * update: parsing received userlogs * refactor: used predefined fns * refactor: moved resetlogs to common func * chore: updated comments * feat: update redux store and UI for system + user logs (#15936) * update: updated types for the redux store - Added category and data fields in the log object * update: types of log redux store * update: calls for the console log store function * update: icon fetch func for log item UI * update: syncing UI with the new designs (WIP) * chore: fixed lint error * update: filters for logs * update: icon for clearing log filters * update: filtering function - Added checks against category and severity * update: logitem UI - updated type of the UI object - added css based ellipsis - added toggle for console logs - added array of json views for objects/arrays - css tweaks * update: debugger cta - Removed copy option - Updated UI * update: logic for expanding user logs - Removed debugger CTA - Fixed position for the expand/collapse icon - Added joining char for when the log is expanded * update: assets for new UI - updated colors - Added new icon * hotfix: ternserver code * add: search across the text of log * update: icons for the app * update: click to expand/collapse of logs * fix: search keyword update on change within JSObjects * fix: alignment of log items in both states * update: jest tests for debugger errors and filter * fix: drop down options color issue - the icon used was not the standard one - We have a lot of duplicates of the same icon * fix: synced with ADS changes on release * fix: remove dependency from old icon * add: cypress selectors for automation testing * fix: replaced static messages with variables * fix: updated the dependency map for filter * fix: height of the filter drop down * fix: chaining logic for search filter * fix: syncing the padding values to ADS * fix: help icon visibility issue * fix: width of filter dropdown Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> * add: e2e tests for console statements using IIFE * test: added test for console logs in jsobjects * fix: functionality of expanding context menu on msg click * fix: added try catch and handling for numbers * hotfix: handling unwanted toasts * fix: alignment and clickable cursor * fix: alignment of expanded span in console logs * add: analytics event on new console log created * fix: added handling for boolean and undefined * fix: removed log reset from common func - Whenever we are creating global DTO, the logs were being reset. This caused logs to reset whenever a promise was encountered in the logs. * fix: combined JS log saving to widget process * add: new analytics event on filter changed * update: added handling for empty value * update: removed comma between multiple logs * update: synced test changes with release * update: removed unused wait timings * Logs spec script update * update: ts methods in log spec e2e test * logs spec update * update: removed body clicks from test script * Logs spec update * update: removed ask from google option * refactor: ui fixes * fix: text selection of logs * fix: updated dropdown width management * update: made the flushlogs function async * update: added handling for promises * update: added test with promises fail and pass * fix: added sync variant to work for sync objects * refactor: commented out unused tests * update: exceptions in the name of log entity * fix: pagination of logs to handle dynamic data stream * fix: removed unused async function * fix: moved logs handling to separate saga * fix: color for context menu text Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-09-04 11:58:05 +00:00
}
}
2021-04-23 13:50:55 +00:00
export default function* debuggerSagasListeners() {
2021-07-08 05:31:08 +00:00
yield all([
takeEvery(ReduxActionTypes.DEBUGGER_LOG_INIT, debuggerLogSaga),
2021-07-08 05:31:08 +00:00
takeEvery(
ReduxActionTypes.DEBUGGER_ERROR_ANALYTICS,
logDebuggerErrorAnalyticsSaga,
),
takeEvery(
ReduxActionTypes.DEBUGGER_ADD_ERROR_LOG_INIT,
addDebuggerErrorLogsSaga,
),
takeEvery(
ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG_INIT,
deleteDebuggerErrorLogsSaga,
),
2021-07-08 05:31:08 +00:00
]);
2021-04-23 13:50:55 +00:00
}