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 { ActionResponse, PaginationField } from "api/ActionAPI";
|
|
|
|
|
import type {
|
2021-08-27 09:25:28 +00:00
|
|
|
EvaluationReduxAction,
|
2022-02-17 04:31:59 +00:00
|
|
|
AnyReduxAction,
|
2020-01-24 09:54:40 +00:00
|
|
|
ReduxAction,
|
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
|
|
|
ReduxActionWithoutPayload,
|
|
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2023-04-14 09:10:03 +00:00
|
|
|
import type { JSUpdate } from "utils/JSPaneUtils";
|
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 {
|
2020-01-24 09:54:40 +00:00
|
|
|
ReduxActionErrorTypes,
|
2021-08-27 09:25:28 +00:00
|
|
|
ReduxActionTypes,
|
2022-04-12 10:50:01 +00:00
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
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";
|
2020-07-03 08:58:58 +00:00
|
|
|
import { batchAction } from "actions/batchActions";
|
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 { ExecuteErrorPayload } from "constants/AppsmithActionConstants/ActionConstants";
|
|
|
|
|
import type { ModalInfo } from "reducers/uiReducers/modalActionReducer";
|
2019-10-21 15:12:45 +00:00
|
|
|
|
2021-01-12 04:17:28 +00:00
|
|
|
export const createActionRequest = (payload: Partial<Action>) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.CREATE_ACTION_INIT,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-04 13:49:22 +00:00
|
|
|
export const createActionSuccess = (payload: Action) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.CREATE_ACTION_SUCCESS,
|
|
|
|
|
payload,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-11 15:24:27 +00:00
|
|
|
export type FetchActionsPayload = {
|
2020-01-24 09:54:40 +00:00
|
|
|
applicationId: string;
|
2019-12-11 15:24:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const fetchActions = (
|
2021-10-18 14:03:44 +00:00
|
|
|
{ applicationId }: { applicationId: string },
|
2022-02-17 04:31:59 +00:00
|
|
|
postEvalActions: Array<AnyReduxAction>,
|
2021-04-26 05:41:32 +00:00
|
|
|
): EvaluationReduxAction<unknown> => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_INIT,
|
2020-01-24 09:54:40 +00:00
|
|
|
payload: { applicationId },
|
2021-04-26 05:41:32 +00:00
|
|
|
postEvalActions,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
export const fetchActionsForView = ({
|
|
|
|
|
applicationId,
|
|
|
|
|
}: {
|
|
|
|
|
applicationId: string;
|
|
|
|
|
}): ReduxAction<FetchActionsPayload> => {
|
2020-07-15 13:01:35 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_INIT,
|
|
|
|
|
payload: { applicationId },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
export const fetchActionsForPage = (
|
|
|
|
|
pageId: string,
|
|
|
|
|
): EvaluationReduxAction<unknown> => {
|
2020-02-21 12:16:49 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_INIT,
|
|
|
|
|
payload: { pageId },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
export const fetchActionsForPageSuccess = (
|
|
|
|
|
actions: Action[],
|
|
|
|
|
): EvaluationReduxAction<unknown> => {
|
2020-02-21 12:16:49 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_SUCCESS,
|
|
|
|
|
payload: actions,
|
2022-06-06 03:56:14 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const fetchActionsForPageError = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_ACTIONS_FOR_PAGE_ERROR,
|
2020-02-21 12:16:49 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-31 15:40:21 +00:00
|
|
|
export const runActionViaShortcut = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.RUN_ACTION_SHORTCUT_REQUEST,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
export const runAction = (id: string, paginationField?: PaginationField) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2020-07-03 08:58:58 +00:00
|
|
|
type: ReduxActionTypes.RUN_ACTION_REQUEST,
|
2020-02-07 02:32:52 +00:00
|
|
|
payload: {
|
2020-07-03 08:58:58 +00:00
|
|
|
id,
|
|
|
|
|
paginationField,
|
2020-02-07 02:32:52 +00:00
|
|
|
},
|
2019-10-25 05:35:20 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-23 12:18:46 +00:00
|
|
|
export const softRefreshActions = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.PLUGIN_SOFT_REFRESH,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-28 17:37:21 +00:00
|
|
|
export const showActionConfirmationModal = (payload: ModalInfo) => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
2022-02-18 06:58:36 +00:00
|
|
|
type: ReduxActionTypes.SHOW_ACTION_MODAL,
|
2022-02-28 17:37:21 +00:00
|
|
|
payload,
|
2020-08-27 15:39:16 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-28 17:37:21 +00:00
|
|
|
export const cancelActionConfirmationModal = (payload: string) => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
2022-02-28 17:37:21 +00:00
|
|
|
type: ReduxActionTypes.CANCEL_ACTION_MODAL + `_FOR_${payload.trim()}`,
|
2020-08-27 15:39:16 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-28 17:37:21 +00:00
|
|
|
export const acceptActionConfirmationModal = (payload: string) => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
2022-02-28 17:37:21 +00:00
|
|
|
type: ReduxActionTypes.CONFIRM_ACTION_MODAL + `_FOR_${payload.trim()}`,
|
2020-08-27 15:39:16 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-06 13:35:31 +00:00
|
|
|
export const updateAction = (payload: { id: string }) => {
|
2020-07-28 10:41:51 +00:00
|
|
|
return batchAction({
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_ACTION_INIT,
|
|
|
|
|
payload,
|
2020-07-28 10:41:51 +00:00
|
|
|
});
|
2019-10-25 05:35:20 +00:00
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const updateActionSuccess = (payload: { data: Action }) => {
|
2019-10-25 05:35:20 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_ACTION_SUCCESS,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const clearActionResponse = (actionId: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CLEAR_ACTION_RESPONSE,
|
|
|
|
|
payload: {
|
|
|
|
|
actionId,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-07 03:46:16 +00:00
|
|
|
export const deleteAction = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
onSuccess?: () => void;
|
|
|
|
|
}) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.DELETE_ACTION_INIT,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-25 05:35:20 +00:00
|
|
|
export const deleteActionSuccess = (payload: { id: string }) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.DELETE_ACTION_SUCCESS,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-24 09:54:40 +00:00
|
|
|
export const moveActionRequest = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
destinationPageId: string;
|
|
|
|
|
originalPageId: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.MOVE_ACTION_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const moveActionSuccess = (payload: Action) => {
|
2020-01-24 09:54:40 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.MOVE_ACTION_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const moveActionError = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
originalPageId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.MOVE_ACTION_ERROR,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const copyActionRequest = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
destinationPageId: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.COPY_ACTION_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const copyActionSuccess = (payload: Action) => {
|
2020-01-24 09:54:40 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.COPY_ACTION_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const copyActionError = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
destinationPageId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.COPY_ACTION_ERROR,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePluginActionRequest = (payload: { id: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_PLUGIN_ACTION_REQUEST,
|
2020-02-18 10:41:52 +00:00
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePluginActionSuccess = (payload: {
|
2020-02-18 10:41:52 +00:00
|
|
|
id: string;
|
|
|
|
|
response: ActionResponse;
|
2020-09-28 05:12:23 +00:00
|
|
|
isPageLoad?: boolean;
|
2020-02-18 10:41:52 +00:00
|
|
|
}) => ({
|
2021-08-27 09:25:28 +00:00
|
|
|
type: ReduxActionTypes.EXECUTE_PLUGIN_ACTION_SUCCESS,
|
2020-02-18 10:41:52 +00:00
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-04-08 16:32:34 +00:00
|
|
|
export const setActionResponseDisplayFormat = (
|
|
|
|
|
payload: UpdateActionPropertyActionPayload,
|
|
|
|
|
) => ({
|
|
|
|
|
type: ReduxActionTypes.SET_ACTION_RESPONSE_DISPLAY_FORMAT,
|
|
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePluginActionError = (
|
|
|
|
|
executeErrorPayload: ExecuteErrorPayload,
|
|
|
|
|
): ReduxAction<ExecuteErrorPayload> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.EXECUTE_PLUGIN_ACTION_ERROR,
|
|
|
|
|
payload: executeErrorPayload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
export const saveActionName = (payload: { id: string; name: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.SAVE_ACTION_NAME_INIT,
|
2020-06-16 10:23:19 +00:00
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
export type SetActionPropertyPayload = {
|
|
|
|
|
actionId: string;
|
|
|
|
|
propertyName: string;
|
2020-07-14 06:53:33 +00:00
|
|
|
value: any;
|
2021-12-07 09:45:18 +00:00
|
|
|
skipSave?: boolean;
|
2020-07-03 08:58:58 +00:00
|
|
|
};
|
|
|
|
|
|
2022-09-01 05:11:57 +00:00
|
|
|
export const setActionProperty = (
|
|
|
|
|
payload: SetActionPropertyPayload,
|
|
|
|
|
postEvalActions?: Array<AnyReduxAction>,
|
|
|
|
|
) => ({
|
2020-07-03 08:58:58 +00:00
|
|
|
type: ReduxActionTypes.SET_ACTION_PROPERTY,
|
|
|
|
|
payload,
|
2022-09-01 05:11:57 +00:00
|
|
|
postEvalActions,
|
2020-06-16 10:23:19 +00:00
|
|
|
});
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
export type UpdateActionPropertyActionPayload = {
|
|
|
|
|
id: string;
|
|
|
|
|
field: string;
|
|
|
|
|
value: any;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const updateActionProperty = (
|
|
|
|
|
payload: UpdateActionPropertyActionPayload,
|
2022-09-01 05:11:57 +00:00
|
|
|
postEvalActions?: Array<AnyReduxAction>,
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
) => {
|
|
|
|
|
return batchAction({
|
2020-07-03 08:58:58 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_ACTION_PROPERTY,
|
|
|
|
|
payload,
|
2022-09-01 05:11:57 +00:00
|
|
|
postEvalActions,
|
2020-07-03 08:58:58 +00:00
|
|
|
});
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
};
|
2020-07-03 08:58:58 +00:00
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePageLoadActions = (): ReduxActionWithoutPayload => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS,
|
|
|
|
|
});
|
2021-05-18 11:51:32 +00:00
|
|
|
|
2023-04-14 09:10:03 +00:00
|
|
|
export const executeJSUpdates = (
|
|
|
|
|
payload: Record<string, JSUpdate>,
|
|
|
|
|
): ReduxAction<unknown> => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_JS_UPDATES,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-02-15 16:13:44 +00:00
|
|
|
export const setActionsToExecuteOnPageLoad = (
|
|
|
|
|
actions: Array<{
|
|
|
|
|
executeOnLoad: boolean;
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}>,
|
|
|
|
|
) => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_ACTION_TO_EXECUTE_ON_PAGELOAD,
|
|
|
|
|
payload: actions,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-17 12:05:17 +00:00
|
|
|
export const setJSActionsToExecuteOnPageLoad = (
|
|
|
|
|
actions: Array<{
|
|
|
|
|
executeOnLoad: boolean;
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
collectionId?: string;
|
|
|
|
|
}>,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_JS_ACTION_TO_EXECUTE_ON_PAGELOAD,
|
|
|
|
|
payload: actions,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-26 16:44:10 +00:00
|
|
|
export const bindDataOnCanvas = (payload: {
|
|
|
|
|
queryId: string;
|
|
|
|
|
applicationId: string;
|
|
|
|
|
pageId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.BIND_DATA_ON_CANVAS,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-21 15:12:45 +00:00
|
|
|
export default {
|
2019-10-29 12:02:58 +00:00
|
|
|
createAction: createActionRequest,
|
2019-10-21 15:12:45 +00:00
|
|
|
fetchActions,
|
2020-07-03 08:58:58 +00:00
|
|
|
runAction: runAction,
|
2019-10-21 15:12:45 +00:00
|
|
|
deleteAction,
|
2019-10-25 05:35:20 +00:00
|
|
|
deleteActionSuccess,
|
|
|
|
|
updateAction,
|
|
|
|
|
updateActionSuccess,
|
2021-07-26 16:44:10 +00:00
|
|
|
bindDataOnCanvas,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|