2023-05-11 05:26:03 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
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
|
|
|
import {
|
|
|
|
|
all,
|
2021-04-22 03:30:09 +00:00
|
|
|
call,
|
2023-06-13 11:00:37 +00:00
|
|
|
fork,
|
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
|
|
|
put,
|
|
|
|
|
select,
|
|
|
|
|
take,
|
2021-04-22 03:30:09 +00:00
|
|
|
takeEvery,
|
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
|
|
|
takeLatest,
|
|
|
|
|
} from "redux-saga/effects";
|
2023-02-10 10:41:17 +00:00
|
|
|
import {
|
|
|
|
|
change,
|
|
|
|
|
getFormInitialValues,
|
|
|
|
|
getFormValues,
|
|
|
|
|
initialize,
|
2023-05-22 08:44:06 +00:00
|
|
|
isValid,
|
2023-02-10 10:41:17 +00:00
|
|
|
} from "redux-form";
|
2023-10-05 00:31:56 +00:00
|
|
|
import { get, isEmpty, merge, omit, partition, set } from "lodash";
|
2022-09-02 09:16:30 +00:00
|
|
|
import equal from "fast-deep-equal/es6";
|
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 {
|
2023-11-29 14:39:47 +00:00
|
|
|
ApplicationPayload,
|
2019-11-07 09:32:38 +00:00
|
|
|
ReduxAction,
|
2021-02-11 12:28:06 +00:00
|
|
|
ReduxActionWithCallbacks,
|
2021-04-22 03:30:09 +00:00
|
|
|
ReduxActionWithMeta,
|
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
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
|
|
|
|
import {
|
|
|
|
|
ReduxActionErrorTypes,
|
|
|
|
|
ReduxActionTypes,
|
2021-04-22 03:30:09 +00:00
|
|
|
ReduxFormActionTypes,
|
2022-04-12 10:50:01 +00:00
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2020-04-28 06:52:53 +00:00
|
|
|
import {
|
|
|
|
|
getCurrentApplicationId,
|
|
|
|
|
getCurrentPageId,
|
|
|
|
|
} from "selectors/editorSelectors";
|
2020-05-19 06:10:59 +00:00
|
|
|
import {
|
|
|
|
|
getDatasource,
|
2023-10-05 00:31:56 +00:00
|
|
|
getDatasourceActionRouteInfo,
|
2020-05-19 06:10:59 +00:00
|
|
|
getDatasourceDraft,
|
2022-11-30 05:59:45 +00:00
|
|
|
getDatasources,
|
2023-06-13 11:00:37 +00:00
|
|
|
getDatasourcesUsedInApplicationByActions,
|
2023-10-05 00:31:56 +00:00
|
|
|
getEditorConfig,
|
2023-07-21 05:53:17 +00:00
|
|
|
getEntityExplorerDatasources,
|
2023-10-05 00:31:56 +00:00
|
|
|
getGenerateCRUDEnabledPluginMap,
|
|
|
|
|
getPlugin,
|
|
|
|
|
getPluginByPackageName,
|
|
|
|
|
getPluginForm,
|
|
|
|
|
getPluginPackageFromDatasourceId,
|
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 {
|
|
|
|
|
executeDatasourceQueryReduxAction,
|
2023-10-05 00:31:56 +00:00
|
|
|
UpdateDatasourceSuccessAction,
|
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
|
|
|
} from "actions/datasourceActions";
|
2020-06-03 05:40:48 +00:00
|
|
|
import {
|
2023-10-05 00:31:56 +00:00
|
|
|
addMockDatasourceToWorkspace,
|
2020-06-03 05:40:48 +00:00
|
|
|
changeDatasource,
|
2023-10-05 00:31:56 +00:00
|
|
|
createDatasourceSuccess,
|
2022-11-30 05:59:45 +00:00
|
|
|
createTempDatasourceFromForm,
|
2023-10-05 00:31:56 +00:00
|
|
|
fetchDatasourceStructure,
|
2022-11-30 05:59:45 +00:00
|
|
|
removeTempDatasource,
|
2023-02-10 10:41:17 +00:00
|
|
|
resetDefaultKeyValPairFlag,
|
2023-10-05 00:31:56 +00:00
|
|
|
setDatasourceViewMode,
|
|
|
|
|
setDatasourceViewModeFlag,
|
|
|
|
|
updateDatasourceAuthState,
|
|
|
|
|
updateDatasourceSuccess,
|
2020-06-03 05:40:48 +00:00
|
|
|
} from "actions/datasourceActions";
|
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 { ApiResponse } from "api/ApiResponses";
|
|
|
|
|
import type { CreateDatasourceConfig } from "api/DatasourcesApi";
|
|
|
|
|
import DatasourcesApi from "api/DatasourcesApi";
|
2023-06-01 17:26:05 +00:00
|
|
|
import type {
|
|
|
|
|
Datasource,
|
2023-07-21 05:53:17 +00:00
|
|
|
DatasourceStorage,
|
2023-10-25 10:18:05 +00:00
|
|
|
DatasourceStructureContext,
|
2023-06-01 17:26:05 +00:00
|
|
|
MockDatasource,
|
|
|
|
|
TokenResponse,
|
|
|
|
|
} from "entities/Datasource";
|
2023-10-05 00:31:56 +00:00
|
|
|
import {
|
|
|
|
|
AuthenticationStatus,
|
|
|
|
|
FilePickerActionStatus,
|
|
|
|
|
ToastMessageType,
|
|
|
|
|
} from "entities/Datasource";
|
2023-04-14 07:19:42 +00:00
|
|
|
import {
|
|
|
|
|
INTEGRATION_EDITOR_MODES,
|
|
|
|
|
INTEGRATION_TABS,
|
2023-04-21 11:03:39 +00:00
|
|
|
RESPONSE_STATUS,
|
2023-04-14 07:19:42 +00:00
|
|
|
SHOW_FILE_PICKER_KEY,
|
|
|
|
|
} from "constants/routes";
|
2020-04-28 06:52:53 +00:00
|
|
|
import history from "utils/history";
|
2021-12-07 09:45:18 +00:00
|
|
|
import {
|
|
|
|
|
API_EDITOR_FORM_NAME,
|
|
|
|
|
DATASOURCE_DB_FORM,
|
|
|
|
|
DATASOURCE_REST_API_FORM,
|
2022-09-02 17:15:08 +00:00
|
|
|
} from "@appsmith/constants/forms";
|
2019-11-13 07:34:59 +00:00
|
|
|
import { validateResponse } from "./ErrorSagas";
|
2020-03-06 04:59:24 +00:00
|
|
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
2023-05-22 08:44:06 +00:00
|
|
|
import type { GetFormData } from "selectors/formSelectors";
|
2020-04-28 06:52:53 +00:00
|
|
|
import { getFormData } from "selectors/formSelectors";
|
2022-06-15 15:37:41 +00:00
|
|
|
import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors";
|
2020-11-23 06:28:15 +00:00
|
|
|
import { getConfigInitialValues } from "components/formControls/utils";
|
2021-08-27 09:25:28 +00:00
|
|
|
import { setActionProperty } from "actions/pluginActionActions";
|
2022-01-14 06:31:54 +00:00
|
|
|
import { authorizeDatasourceWithAppsmithToken } from "api/CloudServicesApi";
|
2021-03-13 14:24:45 +00:00
|
|
|
import {
|
|
|
|
|
createMessage,
|
|
|
|
|
DATASOURCE_CREATE,
|
|
|
|
|
DATASOURCE_DELETE,
|
2023-05-22 08:44:06 +00:00
|
|
|
DATASOURCE_SCHEMA_NOT_AVAILABLE,
|
2021-03-13 14:24:45 +00:00
|
|
|
DATASOURCE_UPDATE,
|
|
|
|
|
DATASOURCE_VALID,
|
2023-05-12 15:04:38 +00:00
|
|
|
FILES_NOT_SELECTED_EVENT,
|
feat: Added file id mapping in datasource config (#21699)
## Description
This PR adds:
- File Id mapping of the google sheets selected by user, in datasource
configuration, so that when creating queries on top of such gsheet
datasource, only the selected spreadsheets can be seen in the
spreadsheet dropdown.
Changes done on client side:
- As soon as user selects file in file picker popup, the callback will
get the file ids and update the datasource to contain file ids as a part
of datasource configuration properties.
- If user cancels the file selection, file ids is sent as empty array
and datasource is updated.
Changes done on server side:
- In `GoogleSheetPlugin.java` where we have defined execute and trigger
methods for gsheet query, here I have added a new variable
allowedFileIds, which gets the list of authorised file ids from
datasource configuration object and the same list is passed to functions
like `transformTriggerResponse` and `transformExecutionResponse`, which
returns file list data based on the allowedFileIds. In FileListMethod
class, these methods contain the logic to send only authorised file
data.
- Since these two methods are a part of triggerMethod and
executionMethod interfaces, all gsheet query operation classes that
extend this method, their function definition needed to be updated with
this third allowedFileIds parameter.
- Similarly all gsheet query operations test classes were using these
two methods, and hence this third parameter needed to be added there as
well.
How to test:
- With this improvement, when we select `file1` and `file2` for one
datasource and `file3` and `file4` for another datasource, In the query
dropdown for first ds, we should only see `file1` and `file2`, for
second datasource, we should only see `file3` and `file4`.
- Please check following gsheet operations:
- Fetch Many
- Fetch Details
- Update One
- Update Many
- Insert Many
> Add a TL;DR when description is extra long (helps content team)
Fixes #21074
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- JUnit
### 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
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-04-04 08:13:49 +00:00
|
|
|
GSHEET_AUTHORISED_FILE_IDS_KEY,
|
2022-01-14 06:31:54 +00:00
|
|
|
OAUTH_APPSMITH_TOKEN_NOT_FOUND,
|
|
|
|
|
OAUTH_AUTHORIZATION_APPSMITH_ERROR,
|
|
|
|
|
OAUTH_AUTHORIZATION_FAILED,
|
|
|
|
|
OAUTH_AUTHORIZATION_SUCCESSFUL,
|
2022-02-11 18:08:46 +00:00
|
|
|
} from "@appsmith/constants/messages";
|
2021-04-23 13:50:55 +00:00
|
|
|
import AppsmithConsole from "utils/AppsmithConsole";
|
|
|
|
|
import { ENTITY_TYPE } from "entities/AppsmithConsole";
|
2021-04-22 03:30:09 +00:00
|
|
|
import localStorage from "utils/localStorage";
|
|
|
|
|
import log from "loglevel";
|
2022-03-25 10:43:26 +00:00
|
|
|
import { APPSMITH_TOKEN_STORAGE_KEY } from "pages/Editor/SaaSEditor/constants";
|
2021-03-30 05:29:03 +00:00
|
|
|
import { checkAndGetPluginFormConfigsSaga } from "sagas/PluginSagas";
|
2023-10-05 00:31:56 +00:00
|
|
|
import { PluginPackageName, PluginType } from "entities/Action";
|
2021-04-23 13:50:55 +00:00
|
|
|
import LOG_TYPE from "entities/AppsmithConsole/logtype";
|
2021-06-15 05:54:14 +00:00
|
|
|
import { isDynamicValue } from "utils/DynamicBindingUtils";
|
2022-08-04 05:40:44 +00:00
|
|
|
import { getQueryParams } from "utils/URLUtils";
|
2023-03-21 08:16:46 +00:00
|
|
|
import type { GenerateCRUDEnabledPluginMap, Plugin } from "api/PluginApi";
|
2022-04-12 10:50:01 +00:00
|
|
|
import { getIsGeneratePageInitiator } from "utils/GenerateCrudUtil";
|
2022-06-21 13:57:34 +00:00
|
|
|
import { shouldBeDefined, trimQueryString } from "utils/helpers";
|
2022-01-25 13:56:52 +00:00
|
|
|
import { inGuidedTour } from "selectors/onboardingSelectors";
|
2021-12-07 09:45:18 +00:00
|
|
|
import { updateReplayEntity } from "actions/pageActions";
|
2022-01-14 06:31:54 +00:00
|
|
|
import OAuthApi from "api/OAuthApi";
|
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 { AppState } from "@appsmith/reducers";
|
2023-11-20 11:00:26 +00:00
|
|
|
import {
|
2023-11-29 14:39:47 +00:00
|
|
|
getApplicationByIdFromWorkspaces,
|
2023-11-20 11:00:26 +00:00
|
|
|
getCurrentApplicationIdForCreateNewApp,
|
|
|
|
|
getWorkspaceIdForImport,
|
|
|
|
|
} from "@appsmith/selectors/applicationSelectors";
|
2022-03-25 10:43:26 +00:00
|
|
|
import {
|
|
|
|
|
apiEditorIdURL,
|
|
|
|
|
datasourcesEditorIdURL,
|
|
|
|
|
generateTemplateFormURL,
|
|
|
|
|
integrationEditorURL,
|
|
|
|
|
saasEditorDatasourceIdURL,
|
2023-10-12 05:31:22 +00:00
|
|
|
} from "@appsmith/RouteBuilder";
|
2022-11-30 05:59:45 +00:00
|
|
|
import {
|
|
|
|
|
DATASOURCE_NAME_DEFAULT_PREFIX,
|
2023-05-03 06:43:27 +00:00
|
|
|
GOOGLE_SHEET_FILE_PICKER_OVERLAY_CLASS,
|
2023-05-04 04:13:34 +00:00
|
|
|
GOOGLE_SHEET_SPECIFIC_SHEETS_SCOPE,
|
2022-11-30 05:59:45 +00:00
|
|
|
TEMP_DATASOURCE_ID,
|
|
|
|
|
} from "constants/Datasource";
|
|
|
|
|
import { getUntitledDatasourceSequence } from "utils/DatasourceSagaUtils";
|
2023-05-19 18:37:06 +00:00
|
|
|
import { toast } from "design-system";
|
2023-04-13 11:09:24 +00:00
|
|
|
import { fetchPluginFormConfig } from "actions/pluginActions";
|
2023-06-08 09:28:29 +00:00
|
|
|
import { addClassToDocumentRoot } from "pages/utils";
|
2023-04-21 11:03:39 +00:00
|
|
|
import { AuthorizationStatus } from "pages/common/datasourceAuth";
|
2023-06-01 07:27:15 +00:00
|
|
|
import {
|
|
|
|
|
getFormDiffPaths,
|
|
|
|
|
getFormName,
|
|
|
|
|
isGoogleSheetPluginDS,
|
|
|
|
|
} from "utils/editorContextUtils";
|
2023-07-03 13:06:05 +00:00
|
|
|
import { getDefaultEnvId } from "@appsmith/api/ApiUtils";
|
2023-11-23 05:25:15 +00:00
|
|
|
import { MAX_DATASOURCE_SUGGESTIONS } from "@appsmith/pages/Editor/Explorer/hooks";
|
2023-08-06 11:52:27 +00:00
|
|
|
import { klona } from "klona/lite";
|
2023-09-11 07:09:41 +00:00
|
|
|
import {
|
|
|
|
|
getCurrentEditingEnvironmentId,
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
} from "@appsmith/selectors/environmentSelectors";
|
2023-09-13 09:09:47 +00:00
|
|
|
import { waitForFetchEnvironments } from "@appsmith/sagas/EnvironmentSagas";
|
2023-11-14 15:14:45 +00:00
|
|
|
import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-17 10:28:54 +00:00
|
|
|
function* fetchDatasourcesSaga(
|
2022-06-15 15:37:41 +00:00
|
|
|
action: ReduxAction<{ workspaceId?: string } | undefined>,
|
2022-03-17 10:28:54 +00:00
|
|
|
) {
|
2019-11-13 07:34:59 +00:00
|
|
|
try {
|
2022-06-21 13:57:34 +00:00
|
|
|
let workspaceId: string = yield select(getCurrentWorkspaceId);
|
2022-06-15 15:37:41 +00:00
|
|
|
if (action.payload?.workspaceId) workspaceId = action.payload?.workspaceId;
|
2022-03-17 10:28:54 +00:00
|
|
|
|
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 response: ApiResponse<Datasource[]> =
|
|
|
|
|
yield DatasourcesApi.fetchDatasources(workspaceId);
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2019-11-13 07:34:59 +00:00
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCES_SUCCESS,
|
|
|
|
|
payload: response.data,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2019-11-07 09:32:38 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_DATASOURCES_ERROR,
|
2019-11-13 07:34:59 +00:00
|
|
|
payload: { error },
|
2019-11-07 09:32:38 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 11:00:37 +00:00
|
|
|
function* handleFetchDatasourceStructureOnLoad() {
|
|
|
|
|
try {
|
|
|
|
|
// we fork to prevent the call from blocking
|
|
|
|
|
yield fork(fetchDatasourceStructureOnLoad);
|
|
|
|
|
} catch (error) {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* fetchDatasourceStructureOnLoad() {
|
|
|
|
|
try {
|
|
|
|
|
// get datasources of all actions used in the the application
|
2023-07-21 05:53:17 +00:00
|
|
|
let datasourcesUsedInApplication: Datasource[] = yield select(
|
2023-06-13 11:00:37 +00:00
|
|
|
getDatasourcesUsedInApplicationByActions,
|
|
|
|
|
);
|
|
|
|
|
|
2023-07-21 05:53:17 +00:00
|
|
|
// get datasources present in entity explorer and not part of any action.
|
|
|
|
|
if (datasourcesUsedInApplication.length < MAX_DATASOURCE_SUGGESTIONS) {
|
|
|
|
|
const datasourceInEntityExplorer: Datasource[] = yield select(
|
|
|
|
|
getEntityExplorerDatasources,
|
|
|
|
|
);
|
|
|
|
|
datasourcesUsedInApplication = [
|
|
|
|
|
...datasourcesUsedInApplication,
|
|
|
|
|
...datasourceInEntityExplorer,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//fetch datasource structure for each datasource
|
2023-06-13 11:00:37 +00:00
|
|
|
for (const datasource of datasourcesUsedInApplication) {
|
|
|
|
|
yield put(fetchDatasourceStructure(datasource.id, true));
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-07 03:46:16 +00:00
|
|
|
function* fetchMockDatasourcesSaga() {
|
|
|
|
|
try {
|
2022-06-21 13:57:34 +00:00
|
|
|
const response: ApiResponse = yield DatasourcesApi.fetchMockDatasources();
|
2021-07-07 03:46:16 +00:00
|
|
|
// not validating the api call here. If the call is unsuccessful it'll be unblocking. And we'll hide the mock DB section.
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS,
|
|
|
|
|
payload: !!response && !!response.data ? response.data : [],
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_MOCK_DATASOURCES_ERROR,
|
|
|
|
|
payload: { error },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
interface addMockDb
|
|
|
|
|
extends ReduxActionWithCallbacks<
|
2021-07-08 05:59:11 +00:00
|
|
|
{
|
|
|
|
|
name: string;
|
2022-06-15 15:37:41 +00:00
|
|
|
workspaceId: string;
|
2021-07-08 05:59:11 +00:00
|
|
|
pluginId: string;
|
2021-07-08 10:33:41 +00:00
|
|
|
packageName: string;
|
2023-06-01 17:26:05 +00:00
|
|
|
skipRedirection?: boolean;
|
2021-07-08 05:59:11 +00:00
|
|
|
},
|
2021-07-07 03:46:16 +00:00
|
|
|
unknown,
|
|
|
|
|
unknown
|
2021-07-29 08:13:10 +00:00
|
|
|
> {
|
|
|
|
|
extraParams?: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function* addMockDbToDatasources(actionPayload: addMockDb) {
|
2021-07-07 03:46:16 +00:00
|
|
|
try {
|
2023-06-01 17:26:05 +00:00
|
|
|
const { name, packageName, pluginId, skipRedirection, workspaceId } =
|
|
|
|
|
actionPayload.payload;
|
2021-07-29 08:13:10 +00:00
|
|
|
const { isGeneratePageMode } = actionPayload.extraParams;
|
2023-11-29 14:39:47 +00:00
|
|
|
const currentApplicationIdForCreateNewApp: string | undefined =
|
|
|
|
|
yield select(getCurrentApplicationIdForCreateNewApp);
|
|
|
|
|
const application: ApplicationPayload | undefined = yield select(
|
|
|
|
|
getApplicationByIdFromWorkspaces,
|
|
|
|
|
currentApplicationIdForCreateNewApp || "",
|
|
|
|
|
);
|
|
|
|
|
const pageId: string = !!currentApplicationIdForCreateNewApp
|
|
|
|
|
? application?.defaultPageId
|
|
|
|
|
: yield select(getCurrentPageId);
|
2023-06-17 06:36:10 +00:00
|
|
|
const response: ApiResponse<Datasource> =
|
|
|
|
|
yield DatasourcesApi.addMockDbToDatasources(
|
|
|
|
|
name,
|
|
|
|
|
workspaceId,
|
|
|
|
|
pluginId,
|
|
|
|
|
packageName,
|
|
|
|
|
);
|
2021-07-29 08:13:10 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2021-07-07 03:46:16 +00:00
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.ADD_MOCK_DATASOURCES_SUCCESS,
|
|
|
|
|
payload: response.data,
|
|
|
|
|
});
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCES_INIT,
|
|
|
|
|
});
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PLUGINS_REQUEST,
|
|
|
|
|
});
|
|
|
|
|
yield call(checkAndGetPluginFormConfigsSaga, response.data.pluginId);
|
2023-06-17 06:36:10 +00:00
|
|
|
// fetch datasource structure for the created mock datasource.
|
|
|
|
|
yield put(fetchDatasourceStructure(response.data.id, true));
|
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 isGeneratePageInitiator =
|
|
|
|
|
getIsGeneratePageInitiator(isGeneratePageMode);
|
2023-06-01 17:26:05 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const isInGuidedTour: boolean = yield select(inGuidedTour);
|
2023-06-01 17:26:05 +00:00
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
if (isGeneratePageInitiator) {
|
|
|
|
|
history.push(
|
2022-03-25 10:43:26 +00:00
|
|
|
generateTemplateFormURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-03-25 10:43:26 +00:00
|
|
|
params: {
|
|
|
|
|
datasourceId: response.data.id,
|
|
|
|
|
},
|
2021-10-18 14:03:44 +00:00
|
|
|
}),
|
2021-07-29 08:13:10 +00:00
|
|
|
);
|
|
|
|
|
} else {
|
2023-06-01 17:26:05 +00:00
|
|
|
if (isInGuidedTour || skipRedirection) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-29 16:19:31 +00:00
|
|
|
let url = "";
|
|
|
|
|
const plugin: Plugin = yield select(getPlugin, response.data.pluginId);
|
|
|
|
|
if (plugin && plugin.type === PluginType.SAAS) {
|
|
|
|
|
url = saasEditorDatasourceIdURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2023-06-29 16:19:31 +00:00
|
|
|
pluginPackageName: plugin.packageName,
|
|
|
|
|
datasourceId: response.data.id,
|
|
|
|
|
params: {
|
|
|
|
|
viewMode: true,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
url = datasourcesEditorIdURL({
|
|
|
|
|
pageId,
|
|
|
|
|
datasourceId: response.data.id,
|
|
|
|
|
params: omit(getQueryParams(), "viewMode"),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
history.push(url);
|
2021-07-29 08:13:10 +00:00
|
|
|
}
|
2021-07-07 03:46:16 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.ADD_MOCK_DATASOURCES_ERROR,
|
|
|
|
|
payload: { error },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-29 10:03:56 +00:00
|
|
|
export function* deleteDatasourceSaga(
|
2021-04-22 03:30:09 +00:00
|
|
|
actionPayload: ReduxActionWithCallbacks<{ id: string }, unknown, unknown>,
|
2020-04-29 10:03:56 +00:00
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const id = actionPayload.payload.id;
|
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 response: ApiResponse<Datasource> =
|
|
|
|
|
yield DatasourcesApi.deleteDatasource(id);
|
2022-07-11 04:06:29 +00:00
|
|
|
const pageId: string = yield select(getCurrentPageId);
|
2020-04-29 10:03:56 +00:00
|
|
|
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2020-04-29 10:03:56 +00:00
|
|
|
|
|
|
|
|
if (isValidResponse) {
|
2022-06-21 13:57:34 +00:00
|
|
|
const pluginPackageName = shouldBeDefined<string>(
|
|
|
|
|
yield select((state: AppState) =>
|
|
|
|
|
getPluginPackageFromDatasourceId(state, id),
|
|
|
|
|
),
|
|
|
|
|
`Plugin package not found for the given id - ${id}`,
|
2022-01-14 06:31:54 +00:00
|
|
|
);
|
2021-10-18 14:03:44 +00:00
|
|
|
const datasourcePathWithoutQuery = trimQueryString(
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourcesEditorIdURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourceId: id,
|
|
|
|
|
}),
|
2021-10-18 14:03:44 +00:00
|
|
|
);
|
2022-01-14 06:31:54 +00:00
|
|
|
|
|
|
|
|
const saasPathWithoutQuery = trimQueryString(
|
2022-03-25 10:43:26 +00:00
|
|
|
saasEditorDatasourceIdURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-01-14 06:31:54 +00:00
|
|
|
pluginPackageName,
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourceId: id,
|
|
|
|
|
}),
|
2022-01-14 06:31:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
window.location.pathname === datasourcePathWithoutQuery ||
|
|
|
|
|
window.location.pathname === saasPathWithoutQuery
|
|
|
|
|
) {
|
2021-07-07 03:46:16 +00:00
|
|
|
history.push(
|
2022-03-25 10:43:26 +00:00
|
|
|
integrationEditorURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-03-25 10:43:26 +00:00
|
|
|
selectedTab: INTEGRATION_TABS.NEW,
|
|
|
|
|
params: {
|
|
|
|
|
...getQueryParams(),
|
|
|
|
|
mode: INTEGRATION_EDITOR_MODES.AUTO,
|
|
|
|
|
},
|
|
|
|
|
}),
|
2021-07-07 03:46:16 +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
|
|
|
}
|
|
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(createMessage(DATASOURCE_DELETE, response.data.name), {
|
|
|
|
|
kind: "success",
|
2020-04-29 10:03:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_SUCCESS,
|
|
|
|
|
payload: response.data,
|
|
|
|
|
});
|
2020-05-19 06:10:59 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_DRAFT,
|
|
|
|
|
payload: {
|
|
|
|
|
id: response.data.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.info({
|
|
|
|
|
logType: LOG_TYPE.ENTITY_DELETED,
|
|
|
|
|
text: "Datasource deleted",
|
|
|
|
|
source: {
|
|
|
|
|
id: response.data.id,
|
|
|
|
|
name: response.data.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-04-22 03:30:09 +00:00
|
|
|
if (actionPayload.onSuccess) {
|
|
|
|
|
yield put(actionPayload.onSuccess);
|
|
|
|
|
}
|
2020-04-29 10:03:56 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2022-06-21 13:57:34 +00:00
|
|
|
const datasource = shouldBeDefined<Datasource>(
|
|
|
|
|
yield select(getDatasource, actionPayload.payload.id),
|
|
|
|
|
`Datasource not found for id - ${actionPayload.payload.id}`,
|
|
|
|
|
);
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show((error as Error).message, {
|
|
|
|
|
kind: "error",
|
2020-11-24 07:01:37 +00:00
|
|
|
});
|
2020-04-29 10:03:56 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.DELETE_DATASOURCE_ERROR,
|
2020-10-12 13:37:18 +00:00
|
|
|
payload: { error, id: actionPayload.payload.id, show: false },
|
2020-04-29 10:03:56 +00:00
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.error({
|
2022-06-21 13:57:34 +00:00
|
|
|
text: (error as Error).message,
|
2021-04-23 13:50:55 +00:00
|
|
|
source: {
|
|
|
|
|
id: actionPayload.payload.id,
|
2022-06-21 13:57:34 +00:00
|
|
|
name: datasource.name,
|
2021-04-23 13:50:55 +00:00
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-04-22 03:30:09 +00:00
|
|
|
if (actionPayload.onError) {
|
|
|
|
|
yield put(actionPayload.onError);
|
|
|
|
|
}
|
2020-04-29 10:03:56 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-05 00:31:56 +00:00
|
|
|
const getConnectionMethod = (
|
|
|
|
|
datasourceStoragePayload: DatasourceStorage,
|
|
|
|
|
pluginPackageName: string,
|
|
|
|
|
) => {
|
|
|
|
|
const properties = get(
|
|
|
|
|
datasourceStoragePayload,
|
|
|
|
|
"datasourceConfiguration.properties",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
switch (pluginPackageName) {
|
|
|
|
|
case PluginPackageName.MY_SQL:
|
|
|
|
|
return properties?.[1]?.value;
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-11 12:28:06 +00:00
|
|
|
function* updateDatasourceSaga(
|
2023-05-19 18:37:06 +00:00
|
|
|
actionPayload: ReduxActionWithCallbacks<
|
2023-07-21 05:53:17 +00:00
|
|
|
Datasource & { isInsideReconnectModal: boolean; currEditingEnvId?: string },
|
2023-05-19 18:37:06 +00:00
|
|
|
unknown,
|
|
|
|
|
unknown
|
|
|
|
|
>,
|
2021-02-11 12:28:06 +00:00
|
|
|
) {
|
2020-04-28 06:52:53 +00:00
|
|
|
try {
|
2023-11-07 06:34:47 +00:00
|
|
|
const currentEnvDetails: { editingId: string; name: string } = yield select(
|
2023-09-11 07:09:41 +00:00
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
2021-07-29 08:13:10 +00:00
|
|
|
const queryParams = getQueryParams();
|
2023-07-21 05:53:17 +00:00
|
|
|
const currentEnvironment =
|
2023-11-07 06:34:47 +00:00
|
|
|
actionPayload.payload?.currEditingEnvId || currentEnvDetails.editingId;
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
const datasourcePayload = omit(actionPayload.payload, "name");
|
2023-07-21 05:53:17 +00:00
|
|
|
const datasourceStoragePayload =
|
|
|
|
|
datasourcePayload.datasourceStorages[currentEnvironment];
|
2023-05-04 04:13:34 +00:00
|
|
|
const pluginPackageName: PluginPackageName = yield select(
|
|
|
|
|
getPluginPackageFromDatasourceId,
|
|
|
|
|
datasourcePayload?.id,
|
|
|
|
|
);
|
2023-07-03 13:06:05 +00:00
|
|
|
// when clicking save button, it should be changed as configured
|
2023-07-21 05:53:17 +00:00
|
|
|
set(datasourceStoragePayload, `isConfigured`, true);
|
|
|
|
|
if (!datasourceStoragePayload.hasOwnProperty("datasourceId")) {
|
|
|
|
|
if (datasourcePayload.id !== TEMP_DATASOURCE_ID)
|
|
|
|
|
set(datasourceStoragePayload, `datasourceId`, datasourcePayload.id);
|
|
|
|
|
} else if (datasourceStoragePayload.datasourceId === TEMP_DATASOURCE_ID) {
|
|
|
|
|
datasourceStoragePayload.datasourceId = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!datasourceStoragePayload.hasOwnProperty("environmentId")) {
|
|
|
|
|
set(datasourceStoragePayload, `environmentId`, currentEnvironment);
|
|
|
|
|
}
|
feat: gsheet form config changes (#20395)
## Description
As a part of Limiting Google Sheets access project, we are modifying the
UI of datasource configuration form for google sheets datasource as per
[figma
link](https://www.figma.com/file/TcFhqEbAc8ymHTRF5wR1qv/Limited-GSheet-Access?node-id=7%3A8&t=FN3j084OyCErlu67-0)
This PR contains the code changes required for this new flow. Please
check https://github.com/appsmithorg/appsmith/issues/20159 for more
information.
This improvement was suggested in form config for feature flag, I have
created https://github.com/appsmithorg/appsmith/issues/20925 to track
it, will be fixing it.
Steps to test:
1. Create new google sheet datasource, you should see first option in
the dropdown as `Read/Write | Selected Sheets` selected by default.
2. In this case if we click on save and authorise, it should take us to
google accounts page, where we can select the account.
3. Once account is selected, we should land on permissions page, where
we can check the new permission of `See, edit, create, and delete only
the specific Google Drive files you use with this app`, click on allow.
4. This will take us back to datasource config page in appsmith.
5. Other two options in dropdown are for providing Read/Write or Read
only access to all files in google drive. For Read Only option we should
see permissions as before, where as for read/write option we should see
two permissions: `See, edit, create, and delete all of your Google Drive
files` and `https://www.googleapis.com/auth/spreadsheets`.
7. Since this feature is hidden behind feature flag, we would also need
to test the flow for normal user and ensure that current implementation
is working as is without any issues
Fixes #20158 , #20159
> if no issue exists, please create an issue and ask the maintainers
about this first
## Type of change
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-02-24 10:12:28 +00:00
|
|
|
|
2023-05-04 04:13:34 +00:00
|
|
|
// When importing app with google sheets with specific sheets scope
|
|
|
|
|
// We do not want to set isConfigured to true immediately on save
|
|
|
|
|
// instead we want to wait for authorisation as well as file selection to be complete
|
2023-06-01 07:27:15 +00:00
|
|
|
if (isGoogleSheetPluginDS(pluginPackageName)) {
|
2023-07-21 05:53:17 +00:00
|
|
|
const value = get(datasourceStoragePayload, `authentication.scopeString`);
|
2023-07-03 13:06:05 +00:00
|
|
|
const scopeString: string = value ? value : "";
|
2023-05-04 04:13:34 +00:00
|
|
|
if (scopeString.includes(GOOGLE_SHEET_SPECIFIC_SHEETS_SCOPE)) {
|
2023-07-21 05:53:17 +00:00
|
|
|
datasourceStoragePayload.isConfigured = false;
|
2023-05-04 04:13:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 05:53:17 +00:00
|
|
|
const isNewStorage = !datasourceStoragePayload.hasOwnProperty("id");
|
|
|
|
|
let response: ApiResponse<Datasource>;
|
|
|
|
|
|
|
|
|
|
// if storage is new, we have to use create datasource call
|
|
|
|
|
if (isNewStorage) {
|
|
|
|
|
response = yield DatasourcesApi.createDatasource(datasourcePayload);
|
|
|
|
|
} else {
|
|
|
|
|
// if storage is already created, we can use update datasource call
|
|
|
|
|
response = yield DatasourcesApi.updateDatasourceStorage(
|
|
|
|
|
datasourceStoragePayload,
|
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
|
|
|
);
|
2023-07-21 05:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2020-04-28 06:52:53 +00:00
|
|
|
if (isValidResponse) {
|
2023-07-21 05:53:17 +00:00
|
|
|
//Update call only returns the updated storage of current environment.
|
|
|
|
|
//So we need to update the other storages with the old values.
|
|
|
|
|
// TODO server should send ony the updated storage or whole datasource.
|
|
|
|
|
if (!isNewStorage) {
|
|
|
|
|
Object.keys(datasourcePayload.datasourceStorages).forEach(
|
|
|
|
|
(storageId: string) => {
|
|
|
|
|
if (storageId !== currentEnvironment) {
|
|
|
|
|
response.data.datasourceStorages[storageId] =
|
|
|
|
|
datasourcePayload.datasourceStorages[storageId];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
const responseData: Datasource = response.data;
|
|
|
|
|
const plugin: Plugin = yield select(getPlugin, responseData?.pluginId);
|
2023-05-22 08:44:06 +00:00
|
|
|
const formName: string = getFormName(plugin);
|
|
|
|
|
const state: AppState = yield select();
|
|
|
|
|
const isFormValid = isValid(formName)(state);
|
|
|
|
|
const formData: GetFormData = yield select(getFormData, formName);
|
|
|
|
|
const formDiffPaths: string[] = getFormDiffPaths(
|
|
|
|
|
formData.initialValues,
|
|
|
|
|
formData.values,
|
|
|
|
|
);
|
2020-10-06 15:10:21 +00:00
|
|
|
AnalyticsUtil.logEvent("SAVE_DATA_SOURCE", {
|
2023-07-21 05:53:17 +00:00
|
|
|
datasourceId: responseData?.id,
|
|
|
|
|
datasourceName: responseData.name,
|
|
|
|
|
environmentId: currentEnvironment,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentName: currentEnvDetails.name,
|
2023-03-21 08:16:46 +00:00
|
|
|
pluginName: plugin?.name || "",
|
|
|
|
|
pluginPackageName: plugin?.packageName || "",
|
2023-05-22 08:44:06 +00:00
|
|
|
isFormValid: isFormValid,
|
|
|
|
|
editedFields: formDiffPaths,
|
2023-10-05 00:31:56 +00:00
|
|
|
connectionMethod: getConnectionMethod(
|
|
|
|
|
datasourceStoragePayload,
|
|
|
|
|
pluginPackageName,
|
|
|
|
|
),
|
2020-10-06 15:10:21 +00:00
|
|
|
});
|
2023-07-21 05:53:17 +00:00
|
|
|
toast.show(createMessage(DATASOURCE_UPDATE, responseData.name), {
|
2023-05-19 18:37:06 +00:00
|
|
|
kind: "success",
|
2020-04-28 06:52:53 +00:00
|
|
|
});
|
2020-10-09 13:24:50 +00:00
|
|
|
|
|
|
|
|
const expandDatasourceId = state.ui.datasourcePane.expandDatasourceId;
|
|
|
|
|
|
2021-04-19 13:17:27 +00:00
|
|
|
// Dont redirect if action payload has an onSuccess
|
|
|
|
|
yield put(
|
2021-07-29 08:13:10 +00:00
|
|
|
updateDatasourceSuccess(
|
2023-07-21 05:53:17 +00:00
|
|
|
responseData,
|
2021-07-29 08:13:10 +00:00
|
|
|
!actionPayload.onSuccess,
|
|
|
|
|
queryParams,
|
|
|
|
|
),
|
2021-04-19 13:17:27 +00:00
|
|
|
);
|
2020-05-19 06:10:59 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_DRAFT,
|
|
|
|
|
payload: {
|
2023-07-21 05:53:17 +00:00
|
|
|
id: responseData.id,
|
2020-05-19 06:10:59 +00:00
|
|
|
},
|
|
|
|
|
});
|
2021-07-07 03:46:16 +00:00
|
|
|
if (actionPayload.onSuccess) {
|
|
|
|
|
yield put(actionPayload.onSuccess);
|
|
|
|
|
}
|
2023-07-21 05:53:17 +00:00
|
|
|
if (expandDatasourceId === responseData.id) {
|
|
|
|
|
yield put(fetchDatasourceStructure(responseData.id, true));
|
2020-10-09 13:24:50 +00:00
|
|
|
}
|
2021-04-23 13:50:55 +00:00
|
|
|
|
|
|
|
|
AppsmithConsole.info({
|
|
|
|
|
text: "Datasource configuration saved",
|
|
|
|
|
source: {
|
2023-07-21 05:53:17 +00:00
|
|
|
id: responseData.id,
|
|
|
|
|
name: responseData.name,
|
2021-04-23 13:50:55 +00:00
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
state: {
|
2023-07-03 13:06:05 +00:00
|
|
|
datasourceConfiguration:
|
2023-07-21 05:53:17 +00:00
|
|
|
responseData.datasourceStorages[currentEnvironment]
|
2023-07-03 13:06:05 +00:00
|
|
|
.datasourceConfiguration,
|
2021-04-23 13:50:55 +00:00
|
|
|
},
|
|
|
|
|
});
|
2022-11-30 05:59:45 +00:00
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
// If the datasource is being updated from the reconnect modal, we don't want to change the view mode
|
|
|
|
|
// or update initial values as the next form open will be from the reconnect modal itself
|
|
|
|
|
if (!datasourcePayload.isInsideReconnectModal) {
|
2023-05-26 06:39:07 +00:00
|
|
|
// Don't redirect to view mode if the plugin is google sheets
|
|
|
|
|
if (pluginPackageName !== PluginPackageName.GOOGLE_SHEETS) {
|
2023-07-21 05:53:17 +00:00
|
|
|
yield put(
|
|
|
|
|
setDatasourceViewMode({
|
|
|
|
|
datasourceId: response.data.id,
|
|
|
|
|
viewMode: true,
|
|
|
|
|
}),
|
|
|
|
|
);
|
2023-05-26 06:39:07 +00:00
|
|
|
}
|
2023-05-19 18:37:06 +00:00
|
|
|
// updating form initial values to latest data, so that next time when form is opened
|
|
|
|
|
// isDirty will use updated initial values data to compare actual values with
|
2023-07-21 05:53:17 +00:00
|
|
|
yield put(initialize(DATASOURCE_DB_FORM, responseData));
|
2023-05-19 18:37:06 +00:00
|
|
|
}
|
2020-04-28 06:52:53 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.UPDATE_DATASOURCE_ERROR,
|
|
|
|
|
payload: { error },
|
|
|
|
|
});
|
2021-02-11 12:28:06 +00:00
|
|
|
if (actionPayload.onError) {
|
|
|
|
|
yield put(actionPayload.onError);
|
|
|
|
|
}
|
2020-04-28 06:52:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-22 03:30:09 +00:00
|
|
|
function* redirectAuthorizationCodeSaga(
|
|
|
|
|
actionPayload: ReduxAction<{
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
pageId: string;
|
|
|
|
|
pluginType: PluginType;
|
|
|
|
|
}>,
|
2021-02-11 12:28:06 +00:00
|
|
|
) {
|
2021-04-22 03:30:09 +00:00
|
|
|
const { datasourceId, pageId, pluginType } = actionPayload.payload;
|
2022-06-15 15:37:41 +00:00
|
|
|
const isImport: string = yield select(getWorkspaceIdForImport);
|
2023-11-14 15:14:45 +00:00
|
|
|
const branchName: string | undefined = yield select(getCurrentGitBranch);
|
2021-04-22 03:30:09 +00:00
|
|
|
|
|
|
|
|
if (pluginType === PluginType.API) {
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvironment: string = yield select(
|
|
|
|
|
getCurrentEditingEnvironmentId,
|
|
|
|
|
);
|
2023-11-14 15:14:45 +00:00
|
|
|
let windowLocation = `/api/v1/datasources/${datasourceId}/pages/${pageId}/code?environmentId=${currentEnvironment}`;
|
|
|
|
|
if (!!branchName) {
|
|
|
|
|
windowLocation = windowLocation + `&branchName=` + branchName;
|
|
|
|
|
}
|
|
|
|
|
window.location.href = windowLocation;
|
2022-01-14 06:31:54 +00:00
|
|
|
} else {
|
2021-04-22 03:30:09 +00:00
|
|
|
try {
|
|
|
|
|
// Get an "appsmith token" from the server
|
2022-06-21 13:57:34 +00:00
|
|
|
const response: ApiResponse<string> = yield OAuthApi.getAppsmithToken(
|
2021-04-22 03:30:09 +00:00
|
|
|
datasourceId,
|
|
|
|
|
pageId,
|
2022-03-17 10:28:54 +00:00
|
|
|
!!isImport,
|
2021-04-22 03:30:09 +00:00
|
|
|
);
|
2022-01-14 06:31:54 +00:00
|
|
|
|
2021-04-22 03:30:09 +00:00
|
|
|
if (validateResponse(response)) {
|
|
|
|
|
const appsmithToken = response.data;
|
|
|
|
|
// Save the token for later use once we come back from the auth flow
|
|
|
|
|
localStorage.setItem(APPSMITH_TOKEN_STORAGE_KEY, appsmithToken);
|
|
|
|
|
// Redirect to the cloud services to authorise
|
2022-01-14 06:31:54 +00:00
|
|
|
window.location.assign(
|
|
|
|
|
authorizeDatasourceWithAppsmithToken(appsmithToken),
|
|
|
|
|
);
|
2021-04-22 03:30:09 +00:00
|
|
|
}
|
|
|
|
|
} catch (e) {
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(OAUTH_AUTHORIZATION_FAILED, {
|
|
|
|
|
kind: "error",
|
2021-04-22 03:30:09 +00:00
|
|
|
});
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* getOAuthAccessTokenSaga(
|
|
|
|
|
actionPayload: ReduxAction<{ datasourceId: string }>,
|
|
|
|
|
) {
|
|
|
|
|
const { datasourceId } = actionPayload.payload;
|
|
|
|
|
// get the saved appsmith token that started the auth request
|
|
|
|
|
const appsmithToken = localStorage.getItem(APPSMITH_TOKEN_STORAGE_KEY);
|
2023-05-30 11:49:35 +00:00
|
|
|
const applicationId: string = yield select(getCurrentApplicationId);
|
|
|
|
|
const pageId: string = yield select(getCurrentPageId);
|
2021-04-22 03:30:09 +00:00
|
|
|
if (!appsmithToken) {
|
|
|
|
|
// Error out because auth token should been here
|
2022-01-14 06:31:54 +00:00
|
|
|
log.error(OAUTH_APPSMITH_TOKEN_NOT_FOUND);
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(OAUTH_AUTHORIZATION_APPSMITH_ERROR, {
|
|
|
|
|
kind: "error",
|
2021-04-22 03:30:09 +00:00
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try {
|
2023-09-13 09:09:47 +00:00
|
|
|
// wait for envs to be fetched
|
|
|
|
|
yield call(waitForFetchEnvironments);
|
2021-04-22 03:30:09 +00:00
|
|
|
// Get access token for datasource
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
const response: ApiResponse<TokenResponse> = yield OAuthApi.getAccessToken(
|
2022-06-21 13:57:34 +00:00
|
|
|
datasourceId,
|
|
|
|
|
appsmithToken,
|
|
|
|
|
);
|
2023-05-30 11:49:35 +00:00
|
|
|
const plugin: Plugin = yield select(
|
|
|
|
|
getPlugin,
|
|
|
|
|
response.data.datasource?.pluginId,
|
|
|
|
|
);
|
2021-04-22 03:30:09 +00:00
|
|
|
if (validateResponse(response)) {
|
2023-07-03 13:06:05 +00:00
|
|
|
// Update the datasource storage object only since the token call only returns the storage object
|
2021-04-22 03:30:09 +00:00
|
|
|
yield put({
|
2023-07-03 13:06:05 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_STORAGE_SUCCESS,
|
|
|
|
|
payload: response.data.datasource, // This is the datasourceStorage object
|
2021-04-22 03:30:09 +00:00
|
|
|
});
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
|
|
|
|
|
if (!!response.data.token) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SET_GSHEET_TOKEN,
|
|
|
|
|
payload: {
|
|
|
|
|
gsheetToken: response.data.token,
|
2023-03-21 07:23:05 +00:00
|
|
|
gsheetProjectID: response.data.projectID,
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
2023-05-30 11:49:35 +00:00
|
|
|
AnalyticsUtil.logEvent("DATASOURCE_AUTH_COMPLETE", {
|
|
|
|
|
applicationId: applicationId,
|
|
|
|
|
datasourceId: datasourceId,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentId: currentEnvDetails.id,
|
|
|
|
|
environmentName: currentEnvDetails.name,
|
2023-05-30 11:49:35 +00:00
|
|
|
pageId: pageId,
|
|
|
|
|
oAuthPassOrFailVerdict: "success",
|
|
|
|
|
workspaceId: response.data.datasource?.workspaceId,
|
|
|
|
|
datasourceName: response.data.datasource?.name,
|
|
|
|
|
pluginName: plugin?.name,
|
|
|
|
|
});
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(OAUTH_AUTHORIZATION_SUCCESSFUL, {
|
|
|
|
|
kind: "success",
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
});
|
|
|
|
|
}
|
2021-04-22 03:30:09 +00:00
|
|
|
// Remove the token because it is supposed to be short lived
|
|
|
|
|
localStorage.removeItem(APPSMITH_TOKEN_STORAGE_KEY);
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(OAUTH_AUTHORIZATION_FAILED, {
|
|
|
|
|
kind: "error",
|
2021-04-22 03:30:09 +00:00
|
|
|
});
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
2021-02-11 12:28:06 +00:00
|
|
|
}
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
function* updateDatasourceNameSaga(
|
2020-08-26 05:24:44 +00:00
|
|
|
actionPayload: ReduxAction<{ id: string; name: string }>,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
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 response: ApiResponse<Datasource> =
|
|
|
|
|
yield DatasourcesApi.updateDatasource(
|
|
|
|
|
{
|
|
|
|
|
name: actionPayload.payload.name,
|
|
|
|
|
},
|
|
|
|
|
actionPayload.payload.id,
|
|
|
|
|
);
|
2020-08-26 05:24:44 +00:00
|
|
|
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2020-08-26 05:24:44 +00:00
|
|
|
if (isValidResponse) {
|
2022-11-30 05:59:45 +00:00
|
|
|
// update error state of datasourcename
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_NAME_SUCCESS,
|
|
|
|
|
payload: { ...response.data },
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// update name in the datasource Object as well
|
2020-08-26 05:24:44 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SAVE_DATASOURCE_NAME_SUCCESS,
|
|
|
|
|
payload: { ...response.data },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
2022-11-30 05:59:45 +00:00
|
|
|
type: ReduxActionErrorTypes.UPDATE_DATASOURCE_NAME_ERROR,
|
2020-08-26 05:24:44 +00:00
|
|
|
payload: { id: actionPayload.payload.id },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* handleDatasourceNameChangeFailureSaga(
|
|
|
|
|
action: ReduxAction<{ oldName: string }>,
|
|
|
|
|
) {
|
|
|
|
|
yield put(change(DATASOURCE_DB_FORM, "name", action.payload.oldName));
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
function* testDatasourceSaga(actionPayload: ReduxAction<Datasource>) {
|
2022-06-21 13:57:34 +00:00
|
|
|
let workspaceId: string = yield select(getCurrentWorkspaceId);
|
2022-03-17 10:28:54 +00:00
|
|
|
// test button within the import modal
|
2022-06-15 15:37:41 +00:00
|
|
|
if (!workspaceId) {
|
|
|
|
|
workspaceId = yield select(getWorkspaceIdForImport);
|
2022-03-17 10:28:54 +00:00
|
|
|
}
|
2023-07-21 05:53:17 +00:00
|
|
|
const { initialValues } = yield select(getFormData, DATASOURCE_DB_FORM);
|
2022-06-21 13:57:34 +00:00
|
|
|
const datasource = shouldBeDefined<Datasource>(
|
|
|
|
|
yield select(getDatasource, actionPayload.payload.id),
|
|
|
|
|
`Datasource not found for id - ${actionPayload.payload.id}`,
|
|
|
|
|
);
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvironment: string = yield select(
|
|
|
|
|
getCurrentEditingEnvironmentId,
|
|
|
|
|
);
|
2020-10-12 13:06:05 +00:00
|
|
|
const payload = {
|
|
|
|
|
...actionPayload.payload,
|
|
|
|
|
id: actionPayload.payload.id as any,
|
|
|
|
|
};
|
2023-05-22 08:44:06 +00:00
|
|
|
const plugin: Plugin = yield select(getPlugin, datasource?.pluginId);
|
2023-07-21 05:53:17 +00:00
|
|
|
let payloadWithoutDatasourceId: DatasourceStorage =
|
|
|
|
|
payload.datasourceStorages[currentEnvironment];
|
|
|
|
|
|
|
|
|
|
const initialDSStorage = initialValues.datasourceStorages[currentEnvironment];
|
2020-04-28 06:52:53 +00:00
|
|
|
|
2023-01-05 12:36:26 +00:00
|
|
|
// when datasource is not yet saved by user, datasource id is temporary
|
|
|
|
|
// for temporary datasource, we do not need to pass datasource id in test api call
|
2023-07-21 05:53:17 +00:00
|
|
|
if (
|
|
|
|
|
!equal(initialDSStorage, payloadWithoutDatasourceId) ||
|
|
|
|
|
payloadWithoutDatasourceId?.datasourceId === TEMP_DATASOURCE_ID
|
|
|
|
|
) {
|
|
|
|
|
// we have to do this so that the original object is not mutated
|
|
|
|
|
payloadWithoutDatasourceId = {
|
|
|
|
|
...payloadWithoutDatasourceId,
|
|
|
|
|
datasourceId: "",
|
|
|
|
|
};
|
2020-04-28 06:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
2020-04-28 06:52:53 +00:00
|
|
|
try {
|
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 response: ApiResponse<Datasource> =
|
2023-07-03 13:06:05 +00:00
|
|
|
yield DatasourcesApi.testDatasource(
|
2023-07-21 05:53:17 +00:00
|
|
|
payloadWithoutDatasourceId,
|
2023-07-03 13:06:05 +00:00
|
|
|
plugin.id,
|
2022-06-15 15:37:41 +00:00
|
|
|
workspaceId,
|
2023-07-03 13:06:05 +00:00
|
|
|
);
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2021-04-26 12:17:38 +00:00
|
|
|
let messages: Array<string> = [];
|
2020-04-28 06:52:53 +00:00
|
|
|
if (isValidResponse) {
|
|
|
|
|
const responseData = response.data;
|
2023-07-25 16:11:38 +00:00
|
|
|
if (responseData.messages && responseData.messages.length) {
|
|
|
|
|
messages = responseData.messages;
|
|
|
|
|
if (responseData.success) {
|
|
|
|
|
toast.show(createMessage(DATASOURCE_VALID, payload.name), {
|
|
|
|
|
kind: "success",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (responseData.invalids && responseData.invalids.length) {
|
2023-05-22 08:44:06 +00:00
|
|
|
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", {
|
|
|
|
|
datasoureId: datasource?.id,
|
2023-07-21 05:53:17 +00:00
|
|
|
environmentId: currentEnvironment,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentName: currentEnvDetails.name,
|
2023-05-22 08:44:06 +00:00
|
|
|
pluginName: plugin?.name,
|
|
|
|
|
errorMessages: responseData.invalids,
|
|
|
|
|
messages: responseData.messages,
|
|
|
|
|
});
|
2023-07-25 16:11:38 +00:00
|
|
|
responseData.invalids.forEach((message: string) => {
|
|
|
|
|
toast.show(message, {
|
|
|
|
|
kind: "error",
|
2021-04-26 12:17:38 +00:00
|
|
|
});
|
2023-07-25 16:11:38 +00:00
|
|
|
});
|
2020-10-12 13:37:18 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.TEST_DATASOURCE_ERROR,
|
2023-07-21 05:53:17 +00:00
|
|
|
payload: {
|
|
|
|
|
show: false,
|
|
|
|
|
id: datasource.id,
|
|
|
|
|
environmentId: currentEnvironment,
|
|
|
|
|
messages: messages,
|
|
|
|
|
},
|
2020-10-12 13:37:18 +00:00
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.error({
|
|
|
|
|
text: "Test Connection failed",
|
|
|
|
|
source: {
|
|
|
|
|
id: actionPayload.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
state: {
|
2021-04-26 13:48:13 +00:00
|
|
|
message:
|
|
|
|
|
responseData.invalids && responseData.invalids.length
|
|
|
|
|
? responseData.invalids[0]
|
|
|
|
|
: "",
|
2021-04-23 13:50:55 +00:00
|
|
|
},
|
|
|
|
|
});
|
2020-04-28 06:52:53 +00:00
|
|
|
} else {
|
2020-10-06 15:10:21 +00:00
|
|
|
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_SUCCESS", {
|
2023-05-22 08:44:06 +00:00
|
|
|
datasourceName: payload.name,
|
|
|
|
|
datasoureId: datasource?.id,
|
2023-07-21 05:53:17 +00:00
|
|
|
environmentId: currentEnvironment,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentName: currentEnvDetails.name,
|
2023-05-22 08:44:06 +00:00
|
|
|
pluginName: plugin?.name,
|
2020-10-06 15:10:21 +00:00
|
|
|
});
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(createMessage(DATASOURCE_VALID, payload.name), {
|
|
|
|
|
kind: "success",
|
2020-04-28 06:52:53 +00:00
|
|
|
});
|
2020-10-12 13:37:18 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.TEST_DATASOURCE_SUCCESS,
|
2023-07-21 05:53:17 +00:00
|
|
|
payload: {
|
|
|
|
|
show: false,
|
|
|
|
|
id: datasource.id,
|
|
|
|
|
environmentId: currentEnvironment,
|
2023-07-25 16:11:38 +00:00
|
|
|
messages: messages,
|
2023-07-21 05:53:17 +00:00
|
|
|
},
|
2020-10-12 13:37:18 +00:00
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.info({
|
|
|
|
|
text: "Test Connection successful",
|
|
|
|
|
source: {
|
|
|
|
|
id: actionPayload.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-04-28 06:52:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.TEST_DATASOURCE_ERROR,
|
2023-07-21 05:53:17 +00:00
|
|
|
payload: { error, show: false, environmentId: currentEnvironment },
|
2020-04-28 06:52:53 +00:00
|
|
|
});
|
2023-05-22 08:44:06 +00:00
|
|
|
AnalyticsUtil.logEvent("TEST_DATA_SOURCE_FAILED", {
|
|
|
|
|
datasoureId: datasource?.id,
|
2023-07-21 05:53:17 +00:00
|
|
|
environmentId: currentEnvironment,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentName: currentEnvDetails.name,
|
2023-05-22 08:44:06 +00:00
|
|
|
pluginName: plugin?.name,
|
|
|
|
|
errorMessages: (error as any)?.message,
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.error({
|
|
|
|
|
text: "Test Connection failed",
|
|
|
|
|
source: {
|
|
|
|
|
id: actionPayload.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
state: {
|
|
|
|
|
message: error,
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-04-28 06:52:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
function* createTempDatasourceFromFormSaga(
|
|
|
|
|
actionPayload: ReduxAction<CreateDatasourceConfig | Datasource>,
|
|
|
|
|
) {
|
|
|
|
|
yield call(checkAndGetPluginFormConfigsSaga, actionPayload.payload.pluginId);
|
|
|
|
|
const formConfig: Record<string, any>[] = yield select(
|
|
|
|
|
getPluginForm,
|
|
|
|
|
actionPayload.payload.pluginId,
|
|
|
|
|
);
|
|
|
|
|
const initialValues: unknown = yield call(getConfigInitialValues, formConfig);
|
|
|
|
|
|
|
|
|
|
const dsList: Datasource[] = yield select(getDatasources);
|
|
|
|
|
const sequence = getUntitledDatasourceSequence(dsList);
|
|
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
let datasourceType = actionPayload?.payload?.type;
|
|
|
|
|
|
|
|
|
|
if (!actionPayload?.payload.type) {
|
|
|
|
|
const plugin: Plugin = yield select(
|
|
|
|
|
getPlugin,
|
|
|
|
|
actionPayload?.payload.pluginId,
|
|
|
|
|
);
|
|
|
|
|
datasourceType = plugin?.type;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 13:06:05 +00:00
|
|
|
const defaultEnvId = getDefaultEnvId();
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
const initialPayload = {
|
|
|
|
|
id: TEMP_DATASOURCE_ID,
|
|
|
|
|
name: DATASOURCE_NAME_DEFAULT_PREFIX + sequence,
|
2023-05-19 18:37:06 +00:00
|
|
|
type: datasourceType,
|
2022-11-30 05:59:45 +00:00
|
|
|
pluginId: actionPayload.payload.pluginId,
|
|
|
|
|
new: false,
|
2023-07-03 13:06:05 +00:00
|
|
|
datasourceStorages: {
|
|
|
|
|
[defaultEnvId]: {
|
2023-07-21 05:53:17 +00:00
|
|
|
datasourceId: TEMP_DATASOURCE_ID,
|
2023-07-03 13:06:05 +00:00
|
|
|
environmentId: defaultEnvId,
|
2023-07-21 05:53:17 +00:00
|
|
|
isValid: false,
|
2023-07-03 13:06:05 +00:00
|
|
|
datasourceConfiguration: {
|
|
|
|
|
properties: [],
|
|
|
|
|
},
|
2023-07-21 05:53:17 +00:00
|
|
|
toastMessage: ToastMessageType.EMPTY_TOAST_MESSAGE,
|
2023-07-03 13:06:05 +00:00
|
|
|
},
|
2022-11-30 05:59:45 +00:00
|
|
|
},
|
|
|
|
|
};
|
2023-07-03 13:06:05 +00:00
|
|
|
const payload = merge(initialPayload, actionPayload.payload);
|
|
|
|
|
payload.datasourceStorages[defaultEnvId] = merge(
|
|
|
|
|
payload.datasourceStorages[defaultEnvId],
|
2022-11-30 05:59:45 +00:00
|
|
|
initialValues,
|
|
|
|
|
);
|
|
|
|
|
|
2023-11-20 11:00:26 +00:00
|
|
|
const currentApplicationIdForCreateNewApp: string | undefined = yield select(
|
|
|
|
|
getCurrentApplicationIdForCreateNewApp,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (currentApplicationIdForCreateNewApp) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SET_CURRENT_PLUGIN_ID_FOR_CREATE_NEW_APP,
|
|
|
|
|
payload: actionPayload.payload.pluginId,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
yield put(createDatasourceSuccess(payload as Datasource));
|
|
|
|
|
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SAVE_DATASOURCE_NAME,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2023-07-21 05:53:17 +00:00
|
|
|
yield put(
|
|
|
|
|
setDatasourceViewMode({
|
|
|
|
|
datasourceId: payload.id,
|
|
|
|
|
viewMode: false,
|
|
|
|
|
}),
|
|
|
|
|
);
|
2022-11-30 05:59:45 +00:00
|
|
|
}
|
|
|
|
|
|
2020-05-07 04:44:52 +00:00
|
|
|
function* createDatasourceFromFormSaga(
|
2022-11-30 05:59:45 +00:00
|
|
|
actionPayload: ReduxActionWithCallbacks<Datasource, unknown, unknown>,
|
2020-05-07 04:44:52 +00:00
|
|
|
) {
|
|
|
|
|
try {
|
2022-06-21 13:57:34 +00:00
|
|
|
const workspaceId: string = yield select(getCurrentWorkspaceId);
|
2022-11-30 05:59:45 +00:00
|
|
|
const actionRouteInfo: Partial<{
|
|
|
|
|
apiId: string;
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
pageId: string;
|
|
|
|
|
applicationId: string;
|
|
|
|
|
}> = yield select(getDatasourceActionRouteInfo);
|
2021-03-30 05:29:03 +00:00
|
|
|
yield call(
|
|
|
|
|
checkAndGetPluginFormConfigsSaga,
|
|
|
|
|
actionPayload.payload.pluginId,
|
|
|
|
|
);
|
2022-06-21 13:57:34 +00:00
|
|
|
const formConfig: Record<string, any>[] = yield select(
|
2021-03-30 05:29:03 +00:00
|
|
|
getPluginForm,
|
|
|
|
|
actionPayload.payload.pluginId,
|
|
|
|
|
);
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvironment: string = yield select(
|
|
|
|
|
getCurrentEditingEnvironmentId,
|
|
|
|
|
);
|
2020-05-07 04:44:52 +00:00
|
|
|
|
2022-06-21 13:57:34 +00:00
|
|
|
const initialValues: unknown = yield call(
|
|
|
|
|
getConfigInitialValues,
|
|
|
|
|
formConfig,
|
|
|
|
|
);
|
2023-07-21 05:53:17 +00:00
|
|
|
let datasourceStoragePayload =
|
|
|
|
|
actionPayload.payload.datasourceStorages[currentEnvironment];
|
|
|
|
|
|
|
|
|
|
datasourceStoragePayload = merge(initialValues, datasourceStoragePayload);
|
|
|
|
|
|
|
|
|
|
// in the datasourcestorages, we only need one key, the currentEnvironment
|
|
|
|
|
// we need to remove any other keys present
|
|
|
|
|
const datasourceStorages = {
|
|
|
|
|
[currentEnvironment]: datasourceStoragePayload,
|
|
|
|
|
};
|
2020-05-07 04:44:52 +00:00
|
|
|
|
2023-07-21 05:53:17 +00:00
|
|
|
const payload = omit(
|
|
|
|
|
{
|
|
|
|
|
...actionPayload.payload,
|
|
|
|
|
datasourceStorages,
|
|
|
|
|
},
|
|
|
|
|
["id", "new", "type", "datasourceConfiguration"],
|
|
|
|
|
);
|
2022-11-30 05:59:45 +00:00
|
|
|
|
2023-07-03 13:06:05 +00:00
|
|
|
if (payload.datasourceStorages)
|
2023-07-21 05:53:17 +00:00
|
|
|
datasourceStoragePayload.isConfigured = true;
|
|
|
|
|
|
|
|
|
|
// remove datasourceId from payload if it is equal to TEMP_DATASOURCE_ID
|
|
|
|
|
if (datasourceStoragePayload.datasourceId === TEMP_DATASOURCE_ID)
|
|
|
|
|
datasourceStoragePayload.datasourceId = "";
|
2020-05-07 04:44:52 +00:00
|
|
|
|
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 response: ApiResponse<Datasource> =
|
|
|
|
|
yield DatasourcesApi.createDatasource({
|
2020-06-17 10:19:56 +00:00
|
|
|
...payload,
|
2022-06-15 15:37:41 +00:00
|
|
|
workspaceId,
|
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
|
|
|
});
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
2020-05-07 04:44:52 +00:00
|
|
|
if (isValidResponse) {
|
2023-05-22 08:44:06 +00:00
|
|
|
const plugin: Plugin = yield select(getPlugin, response?.data?.pluginId);
|
|
|
|
|
const formName: string = getFormName(plugin);
|
|
|
|
|
const state: AppState = yield select();
|
|
|
|
|
const isFormValid = isValid(formName)(state);
|
|
|
|
|
const formData: GetFormData = yield select(getFormData, formName);
|
|
|
|
|
const formDiffPaths: string[] = getFormDiffPaths(
|
|
|
|
|
formData.initialValues,
|
|
|
|
|
formData.values,
|
|
|
|
|
);
|
|
|
|
|
AnalyticsUtil.logEvent("SAVE_DATA_SOURCE", {
|
|
|
|
|
datasourceId: response?.data?.id,
|
|
|
|
|
datasourceName: response?.data?.name,
|
2023-07-21 05:53:17 +00:00
|
|
|
environmentId: currentEnvironment,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentName: currentEnvDetails.name,
|
2023-05-22 08:44:06 +00:00
|
|
|
pluginName: plugin?.name || "",
|
|
|
|
|
pluginPackageName: plugin?.packageName || "",
|
|
|
|
|
isFormValid: isFormValid,
|
|
|
|
|
editedFields: formDiffPaths,
|
2023-10-05 00:31:56 +00:00
|
|
|
connectionMethod: getConnectionMethod(
|
|
|
|
|
datasourceStoragePayload,
|
|
|
|
|
plugin?.packageName,
|
|
|
|
|
),
|
2023-05-22 08:44:06 +00:00
|
|
|
});
|
2020-05-07 04:44:52 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_REFS,
|
|
|
|
|
payload: response.data,
|
|
|
|
|
});
|
2020-10-12 13:37:18 +00:00
|
|
|
yield put(
|
2022-11-30 05:59:45 +00:00
|
|
|
createDatasourceSuccess(response.data, true, !!actionRouteInfo.apiId),
|
2020-05-07 04:44:52 +00:00
|
|
|
);
|
2022-11-30 05:59:45 +00:00
|
|
|
|
2023-04-20 04:26:51 +00:00
|
|
|
// fetch the datasource structure.
|
|
|
|
|
yield put(fetchDatasourceStructure(response?.data?.id, true));
|
|
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(createMessage(DATASOURCE_CREATE, response.data.name), {
|
|
|
|
|
kind: "success",
|
2020-05-07 04:44:52 +00:00
|
|
|
});
|
2022-11-30 05:59:45 +00:00
|
|
|
|
|
|
|
|
if (actionPayload.onSuccess) {
|
|
|
|
|
if (
|
|
|
|
|
(actionPayload.onSuccess.payload as any).datasourceId ===
|
|
|
|
|
TEMP_DATASOURCE_ID
|
|
|
|
|
) {
|
|
|
|
|
(actionPayload.onSuccess.payload as any).datasourceId =
|
|
|
|
|
response.data.id;
|
|
|
|
|
}
|
|
|
|
|
yield put(actionPayload.onSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_DRAFT,
|
|
|
|
|
payload: {
|
|
|
|
|
id: TEMP_DATASOURCE_ID,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// for all datasources, except for REST and GraphQL, need to delete temp datasource data
|
|
|
|
|
// as soon as possible, for REST and GraphQL it is getting deleted in APIPaneSagas.ts
|
|
|
|
|
if (!actionRouteInfo.apiId) {
|
|
|
|
|
yield put(removeTempDatasource());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// updating form initial values to latest data, so that next time when form is opened
|
|
|
|
|
// isDirty will use updated initial values data to compare actual values with
|
|
|
|
|
yield put(initialize(DATASOURCE_DB_FORM, response.data));
|
2020-05-07 04:44:52 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.CREATE_DATASOURCE_ERROR,
|
|
|
|
|
payload: { error },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-07 09:45:18 +00:00
|
|
|
function* changeDatasourceSaga(
|
2022-04-11 11:23:52 +00:00
|
|
|
actionPayload: ReduxAction<{
|
|
|
|
|
datasource: Datasource;
|
|
|
|
|
shouldNotRedirect?: boolean;
|
|
|
|
|
}>,
|
2021-12-07 09:45:18 +00:00
|
|
|
) {
|
2022-04-11 11:23:52 +00:00
|
|
|
const { datasource, shouldNotRedirect } = actionPayload.payload;
|
2021-12-07 09:45:18 +00:00
|
|
|
const { id } = datasource;
|
2022-06-21 13:57:34 +00:00
|
|
|
const draft: Record<string, unknown> = yield select(getDatasourceDraft, id);
|
2023-12-04 11:02:29 +00:00
|
|
|
const currentApplicationIdForCreateNewApp: string | undefined = yield select(
|
|
|
|
|
getCurrentApplicationIdForCreateNewApp,
|
|
|
|
|
);
|
2022-07-11 04:06:29 +00:00
|
|
|
const pageId: string = yield select(getCurrentPageId);
|
2020-05-19 06:10:59 +00:00
|
|
|
let data;
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
if (isEmpty(draft)) {
|
2021-12-07 09:45:18 +00:00
|
|
|
data = datasource;
|
2020-05-19 06:10:59 +00:00
|
|
|
} else {
|
|
|
|
|
data = draft;
|
|
|
|
|
}
|
2023-05-19 18:37:06 +00:00
|
|
|
yield put(
|
|
|
|
|
initialize(
|
|
|
|
|
data?.type === PluginType.API
|
|
|
|
|
? DATASOURCE_REST_API_FORM
|
|
|
|
|
: DATASOURCE_DB_FORM,
|
|
|
|
|
omit(data, ["name"]),
|
|
|
|
|
),
|
|
|
|
|
);
|
2022-04-11 11:23:52 +00:00
|
|
|
// on reconnect modal, it shouldn't be redirected to datasource edit page
|
2023-12-04 11:02:29 +00:00
|
|
|
// on create new app onboarding flow, it shouldn't redirect either
|
|
|
|
|
if (shouldNotRedirect || currentApplicationIdForCreateNewApp) return;
|
2021-07-07 03:46:16 +00:00
|
|
|
// this redirects to the same route, so checking first.
|
2021-10-18 14:03:44 +00:00
|
|
|
const datasourcePath = trimQueryString(
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourcesEditorIdURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourceId: datasource.id,
|
|
|
|
|
}),
|
2021-10-18 14:03:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (history.location.pathname !== datasourcePath)
|
2021-07-07 03:46:16 +00:00
|
|
|
history.push(
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourcesEditorIdURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-03-25 10:43:26 +00:00
|
|
|
datasourceId: datasource.id,
|
|
|
|
|
params: getQueryParams(),
|
|
|
|
|
}),
|
2021-07-07 03:46:16 +00:00
|
|
|
);
|
2021-12-07 09:45:18 +00:00
|
|
|
yield put(
|
2022-06-21 13:57:34 +00:00
|
|
|
// @ts-expect-error: data is of type unknown
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
updateReplayEntity(data.id, omit(data, ["name"]), ENTITY_TYPE.DATASOURCE),
|
2021-12-07 09:45:18 +00:00
|
|
|
);
|
2020-05-19 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
2022-04-11 11:23:52 +00:00
|
|
|
function* switchDatasourceSaga(
|
|
|
|
|
action: ReduxAction<{
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
shouldNotRedirect: boolean;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
|
|
|
|
const { datasourceId, shouldNotRedirect } = action.payload;
|
2021-12-07 09:45:18 +00:00
|
|
|
const datasource: Datasource = yield select(getDatasource, datasourceId);
|
2021-01-27 06:56:19 +00:00
|
|
|
if (datasource) {
|
2022-04-11 11:23:52 +00:00
|
|
|
yield put(changeDatasource({ datasource, shouldNotRedirect }));
|
2021-01-27 06:56:19 +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-05-19 06:10:59 +00:00
|
|
|
function* formValueChangeSaga(
|
|
|
|
|
actionPayload: ReduxActionWithMeta<string, { field: string; form: string }>,
|
|
|
|
|
) {
|
2021-05-13 08:35:39 +00:00
|
|
|
const { field, form } = actionPayload.meta;
|
2021-12-07 09:45:18 +00:00
|
|
|
if (form === DATASOURCE_REST_API_FORM) {
|
|
|
|
|
const { values } = yield select(getFormData, DATASOURCE_REST_API_FORM);
|
2021-12-23 17:09:11 +00:00
|
|
|
if (values && values.datasourceId) {
|
|
|
|
|
yield put(
|
|
|
|
|
updateReplayEntity(values.datasourceId, values, ENTITY_TYPE.DATASOURCE),
|
|
|
|
|
);
|
|
|
|
|
}
|
2021-12-07 09:45:18 +00:00
|
|
|
}
|
2023-05-19 18:37:06 +00:00
|
|
|
if (form !== DATASOURCE_DB_FORM && form !== DATASOURCE_REST_API_FORM) return;
|
2020-08-26 05:24:44 +00:00
|
|
|
if (field === "name") return;
|
2023-05-31 09:06:58 +00:00
|
|
|
yield all([call(updateDraftsSaga, form)]);
|
2020-05-19 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
2023-05-31 09:06:58 +00:00
|
|
|
function* updateDraftsSaga(form: string) {
|
|
|
|
|
const values: Record<string, unknown> = yield select(getFormValues(form));
|
2022-11-30 05:59:45 +00:00
|
|
|
|
2023-05-17 01:48:18 +00:00
|
|
|
if (!values?.id) return;
|
2022-11-30 05:59:45 +00:00
|
|
|
const datasource: Datasource | undefined = yield select(
|
|
|
|
|
getDatasource,
|
|
|
|
|
// @ts-expect-error: values is of type unknown
|
|
|
|
|
values.id,
|
|
|
|
|
);
|
|
|
|
|
if (!equal(values, datasource)) {
|
|
|
|
|
// @ts-expect-error: values is of type unknown
|
|
|
|
|
yield put(updateReplayEntity(values.id, values, ENTITY_TYPE.DATASOURCE));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-03 05:40:48 +00:00
|
|
|
function* storeAsDatasourceSaga() {
|
|
|
|
|
const { values } = yield select(getFormData, API_EDITOR_FORM_NAME);
|
2022-06-21 13:57:34 +00:00
|
|
|
const applicationId: string = yield select(getCurrentApplicationId);
|
|
|
|
|
const pageId: string | undefined = yield select(getCurrentPageId);
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
let datasource = get(values, "datasource");
|
|
|
|
|
datasource = omit(datasource, ["name"]);
|
|
|
|
|
const originalHeaders = get(values, "actionConfiguration.headers", []);
|
2023-09-11 07:09:41 +00:00
|
|
|
|
|
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
|
|
|
|
const currentEnvironment = currentEnvDetails.id;
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
const [datasourceHeaders, actionHeaders] = partition(
|
2021-06-15 05:54:14 +00:00
|
|
|
originalHeaders,
|
|
|
|
|
({ key, value }: { key: string; value: string }) => {
|
|
|
|
|
return !(isDynamicValue(key) || isDynamicValue(value));
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
yield put(
|
|
|
|
|
setActionProperty({
|
|
|
|
|
actionId: values.id,
|
|
|
|
|
propertyName: "actionConfiguration.headers",
|
|
|
|
|
value: actionHeaders,
|
|
|
|
|
}),
|
|
|
|
|
);
|
2022-03-08 14:19:02 +00:00
|
|
|
|
|
|
|
|
// Empty Headers getting created so filtering out the empty headers before setting it to datasource
|
|
|
|
|
const filteredDatasourceHeaders = datasourceHeaders.filter(
|
|
|
|
|
(d) => !(d.key === "" && d.key === ""),
|
|
|
|
|
);
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
yield put(createTempDatasourceFromForm(datasource));
|
2022-06-21 13:57:34 +00:00
|
|
|
const createDatasourceSuccessAction: unknown = yield take(
|
2020-06-03 05:40:48 +00:00
|
|
|
ReduxActionTypes.CREATE_DATASOURCE_SUCCESS,
|
|
|
|
|
);
|
2022-06-21 13:57:34 +00:00
|
|
|
// @ts-expect-error: createDatasourceSuccessAction is of type unknown
|
2023-07-03 13:06:05 +00:00
|
|
|
let createdDatasource = createDatasourceSuccessAction.payload;
|
|
|
|
|
set(
|
|
|
|
|
createdDatasource,
|
|
|
|
|
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.headers`,
|
|
|
|
|
filteredDatasourceHeaders,
|
|
|
|
|
);
|
|
|
|
|
set(
|
|
|
|
|
createdDatasource,
|
|
|
|
|
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.url`,
|
|
|
|
|
datasource.datasourceConfiguration.url,
|
|
|
|
|
);
|
|
|
|
|
createdDatasource = omit(createdDatasource, ["datasourceConfiguration"]);
|
2020-11-19 11:30:22 +00:00
|
|
|
// Set datasource page to edit mode
|
2023-07-21 05:53:17 +00:00
|
|
|
yield put(
|
|
|
|
|
setDatasourceViewMode({
|
|
|
|
|
datasourceId: datasource.id,
|
|
|
|
|
viewMode: false,
|
|
|
|
|
}),
|
|
|
|
|
);
|
2020-11-19 11:30:22 +00:00
|
|
|
|
2020-06-03 05:40:48 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.STORE_AS_DATASOURCE_UPDATE,
|
|
|
|
|
payload: {
|
|
|
|
|
pageId,
|
|
|
|
|
applicationId,
|
|
|
|
|
apiId: values.id,
|
|
|
|
|
datasourceId: createdDatasource.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2021-12-07 09:45:18 +00:00
|
|
|
yield put(changeDatasource({ datasource: createdDatasource }));
|
2020-06-03 05:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-19 13:17:27 +00:00
|
|
|
function* updateDatasourceSuccessSaga(action: UpdateDatasourceSuccessAction) {
|
2022-06-21 13:57:34 +00:00
|
|
|
const state: AppState = yield select();
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
const actionRouteInfo = get(state, "ui.datasourcePane.actionRouteInfo");
|
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 generateCRUDSupportedPlugin: GenerateCRUDEnabledPluginMap =
|
|
|
|
|
yield select(getGenerateCRUDEnabledPluginMap);
|
2022-07-11 04:06:29 +00:00
|
|
|
const pageId: string = yield select(getCurrentPageId);
|
2020-06-03 05:40:48 +00:00
|
|
|
const updatedDatasource = action.payload;
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
const { queryParams = {} } = action;
|
|
|
|
|
|
|
|
|
|
const isGeneratePageInitiator = getIsGeneratePageInitiator(
|
|
|
|
|
queryParams.isGeneratePageMode,
|
|
|
|
|
);
|
2022-01-14 06:31:54 +00:00
|
|
|
|
2020-06-03 05:40:48 +00:00
|
|
|
if (
|
2021-07-29 08:13:10 +00:00
|
|
|
isGeneratePageInitiator &&
|
|
|
|
|
updatedDatasource.pluginId &&
|
|
|
|
|
generateCRUDSupportedPlugin[updatedDatasource.pluginId]
|
|
|
|
|
) {
|
|
|
|
|
history.push(
|
2022-03-25 10:43:26 +00:00
|
|
|
generateTemplateFormURL({
|
2022-07-11 04:06:29 +00:00
|
|
|
pageId,
|
2022-03-25 10:43:26 +00:00
|
|
|
params: {
|
|
|
|
|
datasourceId: updatedDatasource.id,
|
|
|
|
|
},
|
2021-10-18 14:03:44 +00:00
|
|
|
}),
|
2021-07-29 08:13:10 +00:00
|
|
|
);
|
|
|
|
|
} else if (
|
2020-06-03 05:40:48 +00:00
|
|
|
actionRouteInfo &&
|
2021-04-19 13:17:27 +00:00
|
|
|
updatedDatasource.id === actionRouteInfo.datasourceId &&
|
|
|
|
|
action.redirect
|
2020-06-03 05:40:48 +00:00
|
|
|
) {
|
2020-11-19 11:30:22 +00:00
|
|
|
history.push(
|
2022-03-25 10:43:26 +00:00
|
|
|
apiEditorIdURL({
|
2023-05-11 05:26:03 +00:00
|
|
|
pageId: actionRouteInfo.pageId!,
|
|
|
|
|
apiId: actionRouteInfo.apiId!,
|
2022-03-25 10:43:26 +00:00
|
|
|
}),
|
2020-11-19 11:30:22 +00:00
|
|
|
);
|
2020-06-03 05:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.STORE_AS_DATASOURCE_COMPLETE,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
function* fetchDatasourceStructureSaga(
|
2023-07-12 06:42:16 +00:00
|
|
|
action: ReduxAction<{
|
|
|
|
|
id: string;
|
|
|
|
|
ignoreCache: boolean;
|
|
|
|
|
schemaFetchContext: DatasourceStructureContext;
|
|
|
|
|
}>,
|
2021-07-29 08:13:10 +00:00
|
|
|
) {
|
2022-06-21 13:57:34 +00:00
|
|
|
const datasource = shouldBeDefined<Datasource>(
|
|
|
|
|
yield select(getDatasource, action.payload.id),
|
|
|
|
|
`Datasource not found for id - ${action.payload.id}`,
|
|
|
|
|
);
|
2023-05-22 08:44:06 +00:00
|
|
|
const plugin: Plugin = yield select(getPlugin, datasource?.pluginId);
|
2023-07-12 06:42:16 +00:00
|
|
|
let errorMessage = "";
|
|
|
|
|
let isSuccess = false;
|
2022-06-21 13:57:34 +00:00
|
|
|
|
2020-09-21 09:11:42 +00:00
|
|
|
try {
|
2022-06-21 13:57:34 +00:00
|
|
|
const response: ApiResponse = yield DatasourcesApi.fetchDatasourceStructure(
|
2020-09-21 09:11:42 +00:00
|
|
|
action.payload.id,
|
2021-07-29 08:13:10 +00:00
|
|
|
action.payload.ignoreCache,
|
2020-09-21 09:11:42 +00:00
|
|
|
);
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response, false);
|
2020-09-21 09:11:42 +00:00
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
data: response.data,
|
|
|
|
|
datasourceId: action.payload.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
|
|
|
|
|
if (isEmpty(response.data)) {
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage = createMessage(DATASOURCE_SCHEMA_NOT_AVAILABLE);
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.warning({
|
|
|
|
|
text: "Datasource structure could not be retrieved",
|
|
|
|
|
source: {
|
|
|
|
|
id: action.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-07-12 06:42:16 +00:00
|
|
|
isSuccess = true;
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.info({
|
|
|
|
|
text: "Datasource structure retrieved",
|
|
|
|
|
source: {
|
|
|
|
|
id: action.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-05-22 08:44:06 +00:00
|
|
|
if (!!(response.data as any)?.error) {
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage = (response.data as any).error?.message;
|
2023-05-22 08:44:06 +00:00
|
|
|
}
|
2020-09-21 09:11:42 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage = (error as any)?.message;
|
2020-09-21 09:11:42 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_DATASOURCE_STRUCTURE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
show: false,
|
2023-07-12 06:42:16 +00:00
|
|
|
datasourceId: action.payload.id,
|
2020-09-21 09:11:42 +00:00
|
|
|
},
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.error({
|
|
|
|
|
text: "Datasource structure could not be retrieved",
|
|
|
|
|
source: {
|
|
|
|
|
id: action.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-09-21 09:11:42 +00:00
|
|
|
}
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
2023-07-12 06:42:16 +00:00
|
|
|
AnalyticsUtil.logEvent("DATASOURCE_SCHEMA_FETCH", {
|
|
|
|
|
datasourceId: datasource?.id,
|
|
|
|
|
pluginName: plugin?.name,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentId: currentEnvDetails.id,
|
|
|
|
|
environmentName: currentEnvDetails.name,
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage: errorMessage,
|
|
|
|
|
isSuccess: isSuccess,
|
|
|
|
|
source: action.payload.schemaFetchContext,
|
|
|
|
|
});
|
2020-09-21 09:11:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-01 17:26:05 +00:00
|
|
|
function* addAndFetchDatasourceStructureSaga(
|
|
|
|
|
action: ReduxAction<MockDatasource>,
|
|
|
|
|
) {
|
|
|
|
|
const plugin: Plugin = yield select((state: AppState) =>
|
|
|
|
|
getPluginByPackageName(state, action.payload.packageName),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const workspaceId: string = yield select(getCurrentWorkspaceId);
|
|
|
|
|
|
|
|
|
|
yield put(
|
|
|
|
|
addMockDatasourceToWorkspace(
|
|
|
|
|
action.payload.name,
|
|
|
|
|
workspaceId,
|
|
|
|
|
plugin.id,
|
|
|
|
|
plugin.packageName,
|
|
|
|
|
"",
|
|
|
|
|
true,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const result: ReduxAction<Datasource> = yield take([
|
|
|
|
|
ReduxActionTypes.ADD_MOCK_DATASOURCES_SUCCESS,
|
|
|
|
|
ReduxActionErrorTypes.ADD_MOCK_DATASOURCES_ERROR,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (result.type === ReduxActionTypes.ADD_MOCK_DATASOURCES_SUCCESS) {
|
|
|
|
|
yield put(fetchDatasourceStructure(result.payload.id, true));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-12 06:42:16 +00:00
|
|
|
function* refreshDatasourceStructure(
|
|
|
|
|
action: ReduxAction<{
|
|
|
|
|
id: string;
|
|
|
|
|
schemaRefreshContext: DatasourceStructureContext;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
2022-06-21 13:57:34 +00:00
|
|
|
const datasource = shouldBeDefined<Datasource>(
|
|
|
|
|
yield select(getDatasource, action.payload.id),
|
|
|
|
|
`Datasource is not found for it - ${action.payload.id}`,
|
|
|
|
|
);
|
2023-05-22 08:44:06 +00:00
|
|
|
const plugin: Plugin = yield select(getPlugin, datasource?.pluginId);
|
2023-07-12 06:42:16 +00:00
|
|
|
let errorMessage = "";
|
|
|
|
|
let isSuccess = false;
|
2022-06-21 13:57:34 +00:00
|
|
|
|
2020-09-29 04:17:25 +00:00
|
|
|
try {
|
2022-06-21 13:57:34 +00:00
|
|
|
const response: ApiResponse = yield DatasourcesApi.fetchDatasourceStructure(
|
2020-09-29 04:17:25 +00:00
|
|
|
action.payload.id,
|
|
|
|
|
true,
|
|
|
|
|
);
|
2022-06-21 13:57:34 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
2020-09-29 04:17:25 +00:00
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
data: response.data,
|
|
|
|
|
datasourceId: action.payload.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
|
|
|
|
|
if (isEmpty(response.data)) {
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage = createMessage(DATASOURCE_SCHEMA_NOT_AVAILABLE);
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.warning({
|
|
|
|
|
text: "Datasource structure could not be retrieved",
|
|
|
|
|
source: {
|
|
|
|
|
id: action.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-07-12 06:42:16 +00:00
|
|
|
isSuccess = true;
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.info({
|
|
|
|
|
text: "Datasource structure retrieved",
|
|
|
|
|
source: {
|
|
|
|
|
id: action.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-05-22 08:44:06 +00:00
|
|
|
if (!!(response.data as any)?.error) {
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage = (response.data as any)?.message;
|
2023-05-22 08:44:06 +00:00
|
|
|
}
|
2020-09-29 04:17:25 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage = (error as any)?.message;
|
2020-09-29 04:17:25 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.REFRESH_DATASOURCE_STRUCTURE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
show: false,
|
2023-07-12 06:42:16 +00:00
|
|
|
datasourceId: action.payload.id,
|
2020-09-29 04:17:25 +00:00
|
|
|
},
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
AppsmithConsole.error({
|
|
|
|
|
text: "Datasource structure could not be retrieved",
|
|
|
|
|
source: {
|
|
|
|
|
id: action.payload.id,
|
|
|
|
|
name: datasource.name,
|
|
|
|
|
type: ENTITY_TYPE.DATASOURCE,
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-09-29 04:17:25 +00:00
|
|
|
}
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
2023-07-12 06:42:16 +00:00
|
|
|
|
|
|
|
|
AnalyticsUtil.logEvent("DATASOURCE_SCHEMA_FETCH", {
|
|
|
|
|
datasourceId: datasource?.id,
|
|
|
|
|
pluginName: plugin?.name,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentId: currentEnvDetails.id,
|
|
|
|
|
environmentName: currentEnvDetails.name,
|
2023-07-12 06:42:16 +00:00
|
|
|
errorMessage: errorMessage,
|
|
|
|
|
isSuccess: isSuccess,
|
|
|
|
|
source: action.payload.schemaRefreshContext,
|
|
|
|
|
});
|
2020-09-29 04:17:25 +00:00
|
|
|
}
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
function* executeDatasourceQuerySaga(
|
2021-08-20 06:57:01 +00:00
|
|
|
action: executeDatasourceQueryReduxAction<any>,
|
2021-07-29 08:13:10 +00:00
|
|
|
) {
|
|
|
|
|
try {
|
2023-08-30 07:14:14 +00:00
|
|
|
// isGeneratePage value is because we are reusing the same action which calls this saga for both generating the page and fetching preview data
|
|
|
|
|
// We use it to choose the appropriate API to call and the appropriate payload to pass to the API.
|
|
|
|
|
// We are reusing this saga because of its similar flow, and since we do not persist the data to redux state but instead trigger callbacks.
|
|
|
|
|
const response: ApiResponse = action.payload.isGeneratePage
|
|
|
|
|
? yield DatasourcesApi.executeGoogleSheetsDatasourceQuery(action.payload)
|
|
|
|
|
: yield DatasourcesApi.executeDatasourceQuery({
|
|
|
|
|
data: action.payload?.template,
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
});
|
2021-07-29 08:13:10 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_DATASOURCE_QUERY_SUCCESS,
|
|
|
|
|
payload: {
|
2023-08-30 07:14:14 +00:00
|
|
|
data: action.payload.isGeneratePage
|
|
|
|
|
? // @ts-expect-error: we don't know what the response will be
|
|
|
|
|
response.data?.trigger
|
|
|
|
|
: // @ts-expect-error: we don't know what the response will be
|
|
|
|
|
response.data?.body,
|
2021-07-29 08:13:10 +00:00
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (action.onSuccessCallback) {
|
2022-06-21 13:57:34 +00:00
|
|
|
// @ts-expect-error: type mismatch for response
|
2021-07-29 08:13:10 +00:00
|
|
|
action.onSuccessCallback(response);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.EXECUTE_DATASOURCE_QUERY_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
if (action.onErrorCallback) {
|
2023-11-07 10:57:19 +00:00
|
|
|
if (error instanceof Error) {
|
|
|
|
|
action.onErrorCallback(error.message);
|
|
|
|
|
} else {
|
|
|
|
|
// @ts-expect-error: onErrorCallback expects string
|
|
|
|
|
action.onErrorCallback(error);
|
|
|
|
|
}
|
2021-07-29 08:13:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-10 10:41:17 +00:00
|
|
|
function* initializeFormWithDefaults(
|
|
|
|
|
action: ReduxAction<{ pluginType: string }>,
|
|
|
|
|
) {
|
|
|
|
|
const formName =
|
|
|
|
|
action?.payload?.pluginType === "API"
|
|
|
|
|
? DATASOURCE_REST_API_FORM
|
|
|
|
|
: DATASOURCE_DB_FORM;
|
|
|
|
|
const initialValue: Datasource = yield select(getFormInitialValues(formName));
|
|
|
|
|
const defaultKeyValueArrayConfig: string[] = yield select(
|
|
|
|
|
(state) => state?.ui?.datasourcePane?.defaultKeyValueArrayConfig,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
defaultKeyValueArrayConfig &&
|
|
|
|
|
defaultKeyValueArrayConfig?.length > 0 &&
|
|
|
|
|
!!initialValue
|
|
|
|
|
) {
|
|
|
|
|
const restAPIFormData: Datasource = yield select(
|
|
|
|
|
getFormValues(DATASOURCE_REST_API_FORM),
|
|
|
|
|
);
|
|
|
|
|
const formData: Datasource = yield select(
|
|
|
|
|
getFormValues(DATASOURCE_DB_FORM),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const formDataObj: Datasource =
|
|
|
|
|
action?.payload?.pluginType === "API" ? restAPIFormData : formData;
|
|
|
|
|
for (const prop of defaultKeyValueArrayConfig) {
|
|
|
|
|
const propPath: string[] = prop.split("[*].");
|
|
|
|
|
const newValues = get(formDataObj, propPath[0], []);
|
|
|
|
|
set(initialValue, propPath[0], newValues);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yield put(resetDefaultKeyValPairFlag());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
function* filePickerActionCallbackSaga(
|
feat: Added file id mapping in datasource config (#21699)
## Description
This PR adds:
- File Id mapping of the google sheets selected by user, in datasource
configuration, so that when creating queries on top of such gsheet
datasource, only the selected spreadsheets can be seen in the
spreadsheet dropdown.
Changes done on client side:
- As soon as user selects file in file picker popup, the callback will
get the file ids and update the datasource to contain file ids as a part
of datasource configuration properties.
- If user cancels the file selection, file ids is sent as empty array
and datasource is updated.
Changes done on server side:
- In `GoogleSheetPlugin.java` where we have defined execute and trigger
methods for gsheet query, here I have added a new variable
allowedFileIds, which gets the list of authorised file ids from
datasource configuration object and the same list is passed to functions
like `transformTriggerResponse` and `transformExecutionResponse`, which
returns file list data based on the allowedFileIds. In FileListMethod
class, these methods contain the logic to send only authorised file
data.
- Since these two methods are a part of triggerMethod and
executionMethod interfaces, all gsheet query operation classes that
extend this method, their function definition needed to be updated with
this third allowedFileIds parameter.
- Similarly all gsheet query operations test classes were using these
two methods, and hence this third parameter needed to be added there as
well.
How to test:
- With this improvement, when we select `file1` and `file2` for one
datasource and `file3` and `file4` for another datasource, In the query
dropdown for first ds, we should only see `file1` and `file2`, for
second datasource, we should only see `file3` and `file4`.
- Please check following gsheet operations:
- Fetch Many
- Fetch Details
- Update One
- Update Many
- Insert Many
> Add a TL;DR when description is extra long (helps content team)
Fixes #21074
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- JUnit
### 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
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-04-04 08:13:49 +00:00
|
|
|
actionPayload: ReduxAction<{
|
|
|
|
|
action: FilePickerActionStatus;
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
fileIds: Array<string>;
|
|
|
|
|
}>,
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
) {
|
|
|
|
|
try {
|
feat: Added file id mapping in datasource config (#21699)
## Description
This PR adds:
- File Id mapping of the google sheets selected by user, in datasource
configuration, so that when creating queries on top of such gsheet
datasource, only the selected spreadsheets can be seen in the
spreadsheet dropdown.
Changes done on client side:
- As soon as user selects file in file picker popup, the callback will
get the file ids and update the datasource to contain file ids as a part
of datasource configuration properties.
- If user cancels the file selection, file ids is sent as empty array
and datasource is updated.
Changes done on server side:
- In `GoogleSheetPlugin.java` where we have defined execute and trigger
methods for gsheet query, here I have added a new variable
allowedFileIds, which gets the list of authorised file ids from
datasource configuration object and the same list is passed to functions
like `transformTriggerResponse` and `transformExecutionResponse`, which
returns file list data based on the allowedFileIds. In FileListMethod
class, these methods contain the logic to send only authorised file
data.
- Since these two methods are a part of triggerMethod and
executionMethod interfaces, all gsheet query operation classes that
extend this method, their function definition needed to be updated with
this third allowedFileIds parameter.
- Similarly all gsheet query operations test classes were using these
two methods, and hence this third parameter needed to be added there as
well.
How to test:
- With this improvement, when we select `file1` and `file2` for one
datasource and `file3` and `file4` for another datasource, In the query
dropdown for first ds, we should only see `file1` and `file2`, for
second datasource, we should only see `file3` and `file4`.
- Please check following gsheet operations:
- Fetch Many
- Fetch Details
- Update One
- Update Many
- Insert Many
> Add a TL;DR when description is extra long (helps content team)
Fixes #21074
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- JUnit
### 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
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-04-04 08:13:49 +00:00
|
|
|
const { action, datasourceId, fileIds } = actionPayload.payload;
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SET_GSHEET_TOKEN,
|
|
|
|
|
payload: {
|
|
|
|
|
gsheetToken: "",
|
2023-03-21 07:23:05 +00:00
|
|
|
gsheetProjectID: "",
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2023-08-06 11:52:27 +00:00
|
|
|
const datasourceFromState: Datasource = yield select(
|
|
|
|
|
getDatasource,
|
|
|
|
|
datasourceId,
|
|
|
|
|
);
|
|
|
|
|
const datasource: Datasource = klona(datasourceFromState);
|
2023-05-30 11:49:35 +00:00
|
|
|
const plugin: Plugin = yield select(getPlugin, datasource?.pluginId);
|
|
|
|
|
const applicationId: string = yield select(getCurrentApplicationId);
|
|
|
|
|
const pageId: string = yield select(getCurrentPageId);
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvDetails: { id: string; name: string } = yield select(
|
|
|
|
|
getCurrentEnvironmentDetails,
|
|
|
|
|
);
|
feat: Added file id mapping in datasource config (#21699)
## Description
This PR adds:
- File Id mapping of the google sheets selected by user, in datasource
configuration, so that when creating queries on top of such gsheet
datasource, only the selected spreadsheets can be seen in the
spreadsheet dropdown.
Changes done on client side:
- As soon as user selects file in file picker popup, the callback will
get the file ids and update the datasource to contain file ids as a part
of datasource configuration properties.
- If user cancels the file selection, file ids is sent as empty array
and datasource is updated.
Changes done on server side:
- In `GoogleSheetPlugin.java` where we have defined execute and trigger
methods for gsheet query, here I have added a new variable
allowedFileIds, which gets the list of authorised file ids from
datasource configuration object and the same list is passed to functions
like `transformTriggerResponse` and `transformExecutionResponse`, which
returns file list data based on the allowedFileIds. In FileListMethod
class, these methods contain the logic to send only authorised file
data.
- Since these two methods are a part of triggerMethod and
executionMethod interfaces, all gsheet query operation classes that
extend this method, their function definition needed to be updated with
this third allowedFileIds parameter.
- Similarly all gsheet query operations test classes were using these
two methods, and hence this third parameter needed to be added there as
well.
How to test:
- With this improvement, when we select `file1` and `file2` for one
datasource and `file3` and `file4` for another datasource, In the query
dropdown for first ds, we should only see `file1` and `file2`, for
second datasource, we should only see `file3` and `file4`.
- Please check following gsheet operations:
- Fetch Many
- Fetch Details
- Update One
- Update Many
- Insert Many
> Add a TL;DR when description is extra long (helps content team)
Fixes #21074
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- JUnit
### 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
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-04-04 08:13:49 +00:00
|
|
|
|
2023-04-07 02:01:27 +00:00
|
|
|
// update authentication status based on whether files were picked or not
|
|
|
|
|
const authStatus =
|
|
|
|
|
action === FilePickerActionStatus.PICKED
|
|
|
|
|
? AuthenticationStatus.SUCCESS
|
fix: gs authorisation status updates (#23890)
## Description
This PR fixes inconsistencies in the authenticationStatus property for
google sheets:
- In case of google sheets datasource, when we authorise the datasource,
but do not grant permissions, the authenticationStatus is being saved as
`IN_PROGRESS`, instead it should be `FAILURE` as user failed to give
permissions.
- This PR adds 3 new statuses in AuthenticationStatus Enum,
`IN_PROGRESS_PERMISSIONS_GRANTED`, `FAILURE_ACCESS_DENIED` and
`FAILURE_NO_FILES_SELECTED`.
- `IN_PROGRESS_PERMISSIONS_GRANTED` is used in case of specific sheets
scope, so that we would know that users have granted permissions and
selection of files is pending
- `FAILURE_ACCESS_DENIED` denotes, for any of the scope, if user does
not grant permissions.
- `FAILURE_NO_FILES_SELECTED` denotes, for specific scope, if user
grants permissions but files have not been selected yet.
#### PR fixes following issue(s)
Fixes #23877
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## 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
- [x] Manual
>
>
#### 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
- [ ] 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/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] 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
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-06-02 06:28:46 +00:00
|
|
|
: AuthenticationStatus.FAILURE_FILE_NOT_SELECTED;
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
|
2023-05-04 04:13:34 +00:00
|
|
|
// Once files are selected in case of import, set this flag
|
2023-07-03 13:06:05 +00:00
|
|
|
set(
|
|
|
|
|
datasource,
|
2023-09-11 07:09:41 +00:00
|
|
|
`datasourceStorages.${currentEnvDetails.id}.datasourceConfiguration.authentication.authenticationStatus`,
|
2023-07-03 13:06:05 +00:00
|
|
|
true,
|
|
|
|
|
);
|
2023-05-04 04:13:34 +00:00
|
|
|
|
2023-05-30 11:49:35 +00:00
|
|
|
// auth complete event once the files are selected/not selected
|
|
|
|
|
AnalyticsUtil.logEvent("DATASOURCE_AUTH_COMPLETE", {
|
|
|
|
|
applicationId: applicationId,
|
|
|
|
|
pageId: pageId,
|
|
|
|
|
datasourceId: datasource?.id,
|
2023-09-11 07:09:41 +00:00
|
|
|
environmentId: currentEnvDetails.id,
|
|
|
|
|
environmentName: currentEnvDetails.name,
|
2023-05-30 11:49:35 +00:00
|
|
|
oAuthPassOrFailVerdict:
|
fix: gs authorisation status updates (#23890)
## Description
This PR fixes inconsistencies in the authenticationStatus property for
google sheets:
- In case of google sheets datasource, when we authorise the datasource,
but do not grant permissions, the authenticationStatus is being saved as
`IN_PROGRESS`, instead it should be `FAILURE` as user failed to give
permissions.
- This PR adds 3 new statuses in AuthenticationStatus Enum,
`IN_PROGRESS_PERMISSIONS_GRANTED`, `FAILURE_ACCESS_DENIED` and
`FAILURE_NO_FILES_SELECTED`.
- `IN_PROGRESS_PERMISSIONS_GRANTED` is used in case of specific sheets
scope, so that we would know that users have granted permissions and
selection of files is pending
- `FAILURE_ACCESS_DENIED` denotes, for any of the scope, if user does
not grant permissions.
- `FAILURE_NO_FILES_SELECTED` denotes, for specific scope, if user
grants permissions but files have not been selected yet.
#### PR fixes following issue(s)
Fixes #23877
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## 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
- [x] Manual
>
>
#### 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
- [ ] 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/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] 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
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-06-02 06:28:46 +00:00
|
|
|
authStatus === AuthenticationStatus.FAILURE_FILE_NOT_SELECTED
|
2023-05-30 11:49:35 +00:00
|
|
|
? createMessage(FILES_NOT_SELECTED_EVENT)
|
|
|
|
|
: authStatus.toLowerCase(),
|
|
|
|
|
workspaceId: datasource?.workspaceId,
|
|
|
|
|
datasourceName: datasource?.name,
|
|
|
|
|
pluginName: plugin?.name,
|
|
|
|
|
});
|
2023-05-12 15:04:38 +00:00
|
|
|
|
feat: Added file id mapping in datasource config (#21699)
## Description
This PR adds:
- File Id mapping of the google sheets selected by user, in datasource
configuration, so that when creating queries on top of such gsheet
datasource, only the selected spreadsheets can be seen in the
spreadsheet dropdown.
Changes done on client side:
- As soon as user selects file in file picker popup, the callback will
get the file ids and update the datasource to contain file ids as a part
of datasource configuration properties.
- If user cancels the file selection, file ids is sent as empty array
and datasource is updated.
Changes done on server side:
- In `GoogleSheetPlugin.java` where we have defined execute and trigger
methods for gsheet query, here I have added a new variable
allowedFileIds, which gets the list of authorised file ids from
datasource configuration object and the same list is passed to functions
like `transformTriggerResponse` and `transformExecutionResponse`, which
returns file list data based on the allowedFileIds. In FileListMethod
class, these methods contain the logic to send only authorised file
data.
- Since these two methods are a part of triggerMethod and
executionMethod interfaces, all gsheet query operation classes that
extend this method, their function definition needed to be updated with
this third allowedFileIds parameter.
- Similarly all gsheet query operations test classes were using these
two methods, and hence this third parameter needed to be added there as
well.
How to test:
- With this improvement, when we select `file1` and `file2` for one
datasource and `file3` and `file4` for another datasource, In the query
dropdown for first ds, we should only see `file1` and `file2`, for
second datasource, we should only see `file3` and `file4`.
- Please check following gsheet operations:
- Fetch Many
- Fetch Details
- Update One
- Update Many
- Insert Many
> Add a TL;DR when description is extra long (helps content team)
Fixes #21074
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- JUnit
### 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
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-04-04 08:13:49 +00:00
|
|
|
// Once users selects/cancels the file selection,
|
|
|
|
|
// Sending sheet ids selected as part of datasource
|
|
|
|
|
// config properties in order to save it in database
|
2023-04-27 13:52:41 +00:00
|
|
|
// using the second index specifically for file ids.
|
2023-07-03 13:06:05 +00:00
|
|
|
set(
|
|
|
|
|
datasource,
|
2023-09-11 07:09:41 +00:00
|
|
|
`datasourceStorages.${currentEnvDetails.id}.datasourceConfiguration.properties[1]`,
|
2023-07-03 13:06:05 +00:00
|
|
|
{
|
|
|
|
|
key: createMessage(GSHEET_AUTHORISED_FILE_IDS_KEY),
|
|
|
|
|
value: fileIds,
|
|
|
|
|
},
|
|
|
|
|
);
|
2023-04-21 17:56:37 +00:00
|
|
|
yield put(updateDatasourceAuthState(datasource, authStatus));
|
feat: Added file id mapping in datasource config (#21699)
## Description
This PR adds:
- File Id mapping of the google sheets selected by user, in datasource
configuration, so that when creating queries on top of such gsheet
datasource, only the selected spreadsheets can be seen in the
spreadsheet dropdown.
Changes done on client side:
- As soon as user selects file in file picker popup, the callback will
get the file ids and update the datasource to contain file ids as a part
of datasource configuration properties.
- If user cancels the file selection, file ids is sent as empty array
and datasource is updated.
Changes done on server side:
- In `GoogleSheetPlugin.java` where we have defined execute and trigger
methods for gsheet query, here I have added a new variable
allowedFileIds, which gets the list of authorised file ids from
datasource configuration object and the same list is passed to functions
like `transformTriggerResponse` and `transformExecutionResponse`, which
returns file list data based on the allowedFileIds. In FileListMethod
class, these methods contain the logic to send only authorised file
data.
- Since these two methods are a part of triggerMethod and
executionMethod interfaces, all gsheet query operation classes that
extend this method, their function definition needed to be updated with
this third allowedFileIds parameter.
- Similarly all gsheet query operations test classes were using these
two methods, and hence this third parameter needed to be added there as
well.
How to test:
- With this improvement, when we select `file1` and `file2` for one
datasource and `file3` and `file4` for another datasource, In the query
dropdown for first ds, we should only see `file1` and `file2`, for
second datasource, we should only see `file3` and `file4`.
- Please check following gsheet operations:
- Fetch Many
- Fetch Details
- Update One
- Update Many
- Insert Many
> Add a TL;DR when description is extra long (helps content team)
Fixes #21074
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
- JUnit
### 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
- [ ] 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
- [ ] New and existing unit tests pass locally with my changes
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-04-04 08:13:49 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SET_GSHEET_TOKEN,
|
|
|
|
|
payload: {
|
|
|
|
|
gsheetToken: "",
|
|
|
|
|
gsheetProjectID: "",
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-13 11:09:24 +00:00
|
|
|
|
|
|
|
|
function* fetchGsheetSpreadhsheets(
|
|
|
|
|
action: ReduxAction<{
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
pluginId: string;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
|
|
|
|
let googleSheetEditorConfig: {
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
initialValue: string;
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}[] = yield select((state: AppState) =>
|
|
|
|
|
getEditorConfig(state, action.payload.pluginId),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (!googleSheetEditorConfig) {
|
|
|
|
|
yield put(
|
|
|
|
|
fetchPluginFormConfig({
|
|
|
|
|
pluginId: {
|
|
|
|
|
id: action.payload.pluginId,
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const fetchConfigAction: ReduxAction<unknown> = yield take([
|
|
|
|
|
ReduxActionTypes.FETCH_PLUGIN_FORM_SUCCESS,
|
|
|
|
|
ReduxActionErrorTypes.FETCH_PLUGIN_FORM_ERROR,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
fetchConfigAction.type === ReduxActionErrorTypes.FETCH_PLUGIN_FORM_ERROR
|
|
|
|
|
) {
|
|
|
|
|
throw new Error("Unable to fetch plugin form config");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
googleSheetEditorConfig = yield select((state: AppState) =>
|
|
|
|
|
getEditorConfig(state, action.payload.pluginId),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
const requestObject: Record<string, string> = {};
|
|
|
|
|
|
|
|
|
|
if (googleSheetEditorConfig && googleSheetEditorConfig[0]) {
|
|
|
|
|
const configs = googleSheetEditorConfig[0]?.children;
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(configs)) {
|
|
|
|
|
for (let index = 0; index < configs.length; index += 2) {
|
|
|
|
|
const keyConfig = configs[index];
|
|
|
|
|
const valueConfig = configs[index + 1];
|
|
|
|
|
if (keyConfig && valueConfig) {
|
|
|
|
|
const key = keyConfig?.initialValue;
|
|
|
|
|
const value = valueConfig?.initialValue;
|
|
|
|
|
if (key && value !== undefined) requestObject[key] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data = {
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
displayType: "DROP_DOWN",
|
|
|
|
|
pluginId: action.payload.pluginId,
|
|
|
|
|
requestType: "SPREADSHEET_SELECTOR",
|
|
|
|
|
...requestObject,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const response: ApiResponse =
|
|
|
|
|
yield DatasourcesApi.executeGoogleSheetsDatasourceQuery({
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
data,
|
|
|
|
|
});
|
|
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
|
|
|
|
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_GSHEET_SPREADSHEETS_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
id: action.payload.datasourceId,
|
|
|
|
|
// @ts-expect-error: type mismatch for response
|
|
|
|
|
data: response.data?.trigger,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_GSHEET_SPREADSHEETS_FAILURE,
|
|
|
|
|
payload: {
|
|
|
|
|
id: action.payload.datasourceId,
|
|
|
|
|
error: error.message,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* fetchGsheetSheets(
|
|
|
|
|
action: ReduxAction<{
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
pluginId: string;
|
|
|
|
|
sheetUrl: string;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const data = {
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
displayType: "DROP_DOWN",
|
|
|
|
|
parameters: {
|
|
|
|
|
sheetUrl: action.payload.sheetUrl,
|
|
|
|
|
},
|
|
|
|
|
pluginId: action.payload.pluginId,
|
|
|
|
|
requestType: "SHEET_SELECTOR",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const response: ApiResponse =
|
|
|
|
|
yield DatasourcesApi.executeGoogleSheetsDatasourceQuery({
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
data,
|
|
|
|
|
});
|
|
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
|
|
|
|
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_GSHEET_SHEETS_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
// @ts-expect-error: type mismatch for response
|
|
|
|
|
data: response.data?.trigger,
|
|
|
|
|
id: action.payload.sheetUrl,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_GSHEET_SHEETS_FAILURE,
|
|
|
|
|
payload: {
|
|
|
|
|
id: action.payload.sheetUrl,
|
|
|
|
|
error: error.message,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function* fetchGsheetColumns(
|
|
|
|
|
action: ReduxAction<{
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
pluginId: string;
|
|
|
|
|
sheetName: string;
|
|
|
|
|
sheetUrl: string;
|
|
|
|
|
headerIndex: number;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const data = {
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
displayType: "DROP_DOWN",
|
|
|
|
|
parameters: {
|
|
|
|
|
sheetName: action.payload.sheetName,
|
|
|
|
|
sheetUrl: action.payload.sheetUrl,
|
|
|
|
|
tableHeaderIndex: action.payload.headerIndex,
|
|
|
|
|
},
|
|
|
|
|
pluginId: action.payload.pluginId,
|
|
|
|
|
requestType: "COLUMNS_SELECTOR",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const response: ApiResponse =
|
|
|
|
|
yield DatasourcesApi.executeGoogleSheetsDatasourceQuery({
|
|
|
|
|
datasourceId: action.payload.datasourceId,
|
|
|
|
|
data,
|
|
|
|
|
});
|
|
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
|
|
|
|
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_GSHEET_COLUMNS_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
// @ts-expect-error: type mismatch for response
|
|
|
|
|
data: response.data?.trigger,
|
|
|
|
|
id: action.payload.sheetName + "_" + action.payload.sheetUrl,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_GSHEET_COLUMNS_FAILURE,
|
|
|
|
|
payload: {
|
|
|
|
|
id: action.payload.sheetName + "_" + action.payload.sheetUrl,
|
|
|
|
|
error: error.message,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 07:19:42 +00:00
|
|
|
function* loadFilePickerSaga() {
|
|
|
|
|
// This adds overlay on document body
|
|
|
|
|
// This is done for google sheets file picker, as file picker needs to be shown on blank page
|
|
|
|
|
// when overlay needs to be shown, we get showPicker search param in redirect url
|
|
|
|
|
const appsmithToken = localStorage.getItem(APPSMITH_TOKEN_STORAGE_KEY);
|
|
|
|
|
const search = new URLSearchParams(window.location.search);
|
2023-04-21 11:03:39 +00:00
|
|
|
const isShowFilePicker = search.get(SHOW_FILE_PICKER_KEY);
|
2023-04-27 06:24:38 +00:00
|
|
|
const gapiScriptLoaded = (window as any).googleAPIsLoaded;
|
2023-04-21 11:03:39 +00:00
|
|
|
const authStatus = search.get(RESPONSE_STATUS);
|
|
|
|
|
if (
|
|
|
|
|
!!isShowFilePicker &&
|
|
|
|
|
!!authStatus &&
|
|
|
|
|
authStatus === AuthorizationStatus.SUCCESS &&
|
2023-04-27 06:24:38 +00:00
|
|
|
!!appsmithToken &&
|
|
|
|
|
!!gapiScriptLoaded
|
2023-04-21 11:03:39 +00:00
|
|
|
) {
|
2023-06-08 09:28:29 +00:00
|
|
|
addClassToDocumentRoot(GOOGLE_SHEET_FILE_PICKER_OVERLAY_CLASS);
|
2023-04-14 07:19:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-21 17:56:37 +00:00
|
|
|
function* updateDatasourceAuthStateSaga(
|
|
|
|
|
actionPayload: ReduxAction<{
|
|
|
|
|
authStatus: AuthenticationStatus;
|
|
|
|
|
datasource: Datasource;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const { authStatus, datasource } = actionPayload.payload;
|
2023-09-11 07:09:41 +00:00
|
|
|
const currentEnvironment: string = yield select(
|
|
|
|
|
getCurrentEditingEnvironmentId,
|
|
|
|
|
);
|
fix: gs authorisation status updates (#23890)
## Description
This PR fixes inconsistencies in the authenticationStatus property for
google sheets:
- In case of google sheets datasource, when we authorise the datasource,
but do not grant permissions, the authenticationStatus is being saved as
`IN_PROGRESS`, instead it should be `FAILURE` as user failed to give
permissions.
- This PR adds 3 new statuses in AuthenticationStatus Enum,
`IN_PROGRESS_PERMISSIONS_GRANTED`, `FAILURE_ACCESS_DENIED` and
`FAILURE_NO_FILES_SELECTED`.
- `IN_PROGRESS_PERMISSIONS_GRANTED` is used in case of specific sheets
scope, so that we would know that users have granted permissions and
selection of files is pending
- `FAILURE_ACCESS_DENIED` denotes, for any of the scope, if user does
not grant permissions.
- `FAILURE_NO_FILES_SELECTED` denotes, for specific scope, if user
grants permissions but files have not been selected yet.
#### PR fixes following issue(s)
Fixes #23877
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## 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
- [x] Manual
>
>
#### 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
- [ ] 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/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] 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
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-06-02 06:28:46 +00:00
|
|
|
set(
|
|
|
|
|
datasource,
|
2023-07-03 13:06:05 +00:00
|
|
|
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.authentication.authenticationStatus`,
|
fix: gs authorisation status updates (#23890)
## Description
This PR fixes inconsistencies in the authenticationStatus property for
google sheets:
- In case of google sheets datasource, when we authorise the datasource,
but do not grant permissions, the authenticationStatus is being saved as
`IN_PROGRESS`, instead it should be `FAILURE` as user failed to give
permissions.
- This PR adds 3 new statuses in AuthenticationStatus Enum,
`IN_PROGRESS_PERMISSIONS_GRANTED`, `FAILURE_ACCESS_DENIED` and
`FAILURE_NO_FILES_SELECTED`.
- `IN_PROGRESS_PERMISSIONS_GRANTED` is used in case of specific sheets
scope, so that we would know that users have granted permissions and
selection of files is pending
- `FAILURE_ACCESS_DENIED` denotes, for any of the scope, if user does
not grant permissions.
- `FAILURE_NO_FILES_SELECTED` denotes, for specific scope, if user
grants permissions but files have not been selected yet.
#### PR fixes following issue(s)
Fixes #23877
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## 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
- [x] Manual
>
>
#### 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
- [ ] 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/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] 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
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-06-02 06:28:46 +00:00
|
|
|
authStatus,
|
|
|
|
|
);
|
2023-04-21 17:56:37 +00:00
|
|
|
const response: ApiResponse<Datasource> =
|
2023-07-03 13:06:05 +00:00
|
|
|
yield DatasourcesApi.updateDatasourceStorage(
|
|
|
|
|
datasource.datasourceStorages[currentEnvironment],
|
|
|
|
|
);
|
2023-04-21 17:56:37 +00:00
|
|
|
const isValidResponse: boolean = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS,
|
|
|
|
|
payload: response.data,
|
|
|
|
|
});
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(
|
|
|
|
|
authStatus === AuthenticationStatus.SUCCESS
|
|
|
|
|
? OAUTH_AUTHORIZATION_SUCCESSFUL
|
|
|
|
|
: OAUTH_AUTHORIZATION_FAILED,
|
|
|
|
|
{
|
|
|
|
|
kind:
|
|
|
|
|
authStatus === AuthenticationStatus.SUCCESS ? "success" : "error",
|
|
|
|
|
},
|
|
|
|
|
);
|
2023-04-21 17:56:37 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.UPDATE_DATASOURCE_ERROR,
|
|
|
|
|
payload: { error },
|
|
|
|
|
});
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.show(OAUTH_AUTHORIZATION_FAILED, {
|
|
|
|
|
kind: "error",
|
2023-04-21 17:56:37 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-22 08:44:06 +00:00
|
|
|
function* datasourceDiscardActionSaga(
|
|
|
|
|
actionPayload: ReduxAction<{
|
|
|
|
|
pluginId: string;
|
|
|
|
|
}>,
|
|
|
|
|
) {
|
|
|
|
|
const { pluginId } = actionPayload.payload;
|
|
|
|
|
const plugin: Plugin = yield select(getPlugin, pluginId);
|
|
|
|
|
const formName: string = getFormName(plugin);
|
|
|
|
|
const formData: GetFormData = yield select(getFormData, formName);
|
|
|
|
|
const formDiffPaths: string[] = getFormDiffPaths(
|
|
|
|
|
formData.initialValues,
|
|
|
|
|
formData.values,
|
|
|
|
|
);
|
|
|
|
|
AnalyticsUtil.logEvent("DISCARD_DATASOURCE_CHANGES", {
|
|
|
|
|
pluginName: plugin?.name,
|
|
|
|
|
editedFields: formDiffPaths,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 05:53:17 +00:00
|
|
|
function* setDatasourceViewModeSaga(
|
|
|
|
|
action: ReduxAction<{ datasourceId: string; viewMode: boolean }>,
|
|
|
|
|
) {
|
|
|
|
|
//Set the view mode flag in store
|
|
|
|
|
yield put(setDatasourceViewModeFlag(action.payload.viewMode));
|
|
|
|
|
//Reset the banner message for the datasource
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.RESET_DATASOURCE_BANNER_MESSAGE,
|
|
|
|
|
payload: action.payload.datasourceId,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-07 09:32:38 +00:00
|
|
|
export function* watchDatasourcesSagas() {
|
|
|
|
|
yield all([
|
|
|
|
|
takeEvery(ReduxActionTypes.FETCH_DATASOURCES_INIT, fetchDatasourcesSaga),
|
2021-07-07 03:46:16 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.FETCH_MOCK_DATASOURCES_INIT,
|
|
|
|
|
fetchMockDatasourcesSaga,
|
|
|
|
|
),
|
|
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.ADD_MOCK_DATASOURCES_INIT,
|
|
|
|
|
addMockDbToDatasources,
|
|
|
|
|
),
|
2020-05-07 04:44:52 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.CREATE_DATASOURCE_FROM_FORM_INIT,
|
|
|
|
|
createDatasourceFromFormSaga,
|
|
|
|
|
),
|
2022-11-30 05:59:45 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.CREATE_TEMP_DATASOURCE_FROM_FORM_SUCCESS,
|
|
|
|
|
createTempDatasourceFromFormSaga,
|
|
|
|
|
),
|
2020-04-28 06:52:53 +00:00
|
|
|
takeEvery(ReduxActionTypes.UPDATE_DATASOURCE_INIT, updateDatasourceSaga),
|
2020-08-26 05:24:44 +00:00
|
|
|
takeEvery(
|
2022-11-30 05:59:45 +00:00
|
|
|
ReduxActionTypes.UPDATE_DATASOURCE_NAME,
|
|
|
|
|
updateDatasourceNameSaga,
|
|
|
|
|
),
|
|
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionErrorTypes.UPDATE_DATASOURCE_NAME_ERROR,
|
2020-08-26 05:24:44 +00:00
|
|
|
handleDatasourceNameChangeFailureSaga,
|
|
|
|
|
),
|
2020-04-28 06:52:53 +00:00
|
|
|
takeEvery(ReduxActionTypes.TEST_DATASOURCE_INIT, testDatasourceSaga),
|
2020-04-29 10:03:56 +00:00
|
|
|
takeEvery(ReduxActionTypes.DELETE_DATASOURCE_INIT, deleteDatasourceSaga),
|
2020-05-19 06:10:59 +00:00
|
|
|
takeEvery(ReduxActionTypes.CHANGE_DATASOURCE, changeDatasourceSaga),
|
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
|
|
|
takeLatest(ReduxActionTypes.SWITCH_DATASOURCE, switchDatasourceSaga),
|
2020-06-03 05:40:48 +00:00
|
|
|
takeEvery(ReduxActionTypes.STORE_AS_DATASOURCE_INIT, storeAsDatasourceSaga),
|
|
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS,
|
|
|
|
|
updateDatasourceSuccessSaga,
|
|
|
|
|
),
|
2021-02-11 12:28:06 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.REDIRECT_AUTHORIZATION_CODE,
|
2021-04-22 03:30:09 +00:00
|
|
|
redirectAuthorizationCodeSaga,
|
|
|
|
|
),
|
2022-01-14 06:31:54 +00:00
|
|
|
takeEvery(ReduxActionTypes.GET_OAUTH_ACCESS_TOKEN, getOAuthAccessTokenSaga),
|
2020-09-21 09:11:42 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_INIT,
|
2021-04-22 03:30:09 +00:00
|
|
|
fetchDatasourceStructureSaga,
|
2020-09-21 09:11:42 +00:00
|
|
|
),
|
2020-09-29 04:17:25 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT,
|
2021-04-22 03:30:09 +00:00
|
|
|
refreshDatasourceStructure,
|
2020-09-29 04:17:25 +00:00
|
|
|
),
|
2021-07-29 08:13:10 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.EXECUTE_DATASOURCE_QUERY_INIT,
|
|
|
|
|
executeDatasourceQuerySaga,
|
|
|
|
|
),
|
2023-02-10 10:41:17 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.INITIALIZE_DATASOURCE_FORM_WITH_DEFAULTS,
|
|
|
|
|
initializeFormWithDefaults,
|
|
|
|
|
),
|
2021-12-07 09:45:18 +00:00
|
|
|
// Intercepting the redux-form change actionType to update drafts and track change history
|
2020-05-19 06:10:59 +00:00
|
|
|
takeEvery(ReduxFormActionTypes.VALUE_CHANGE, formValueChangeSaga),
|
2021-12-07 09:45:18 +00:00
|
|
|
takeEvery(ReduxFormActionTypes.ARRAY_PUSH, formValueChangeSaga),
|
|
|
|
|
takeEvery(ReduxFormActionTypes.ARRAY_REMOVE, formValueChangeSaga),
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### 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
- [ ] 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
- [x] 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: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.FILE_PICKER_CALLBACK_ACTION,
|
|
|
|
|
filePickerActionCallbackSaga,
|
|
|
|
|
),
|
2023-04-13 11:09:24 +00:00
|
|
|
takeLatest(
|
|
|
|
|
ReduxActionTypes.FETCH_GSHEET_SPREADSHEETS,
|
|
|
|
|
fetchGsheetSpreadhsheets,
|
|
|
|
|
),
|
|
|
|
|
takeLatest(ReduxActionTypes.FETCH_GSHEET_SHEETS, fetchGsheetSheets),
|
|
|
|
|
takeLatest(ReduxActionTypes.FETCH_GSHEET_COLUMNS, fetchGsheetColumns),
|
2023-04-14 07:19:42 +00:00
|
|
|
takeEvery(ReduxActionTypes.LOAD_FILE_PICKER_ACTION, loadFilePickerSaga),
|
2023-04-21 17:56:37 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.UPDATE_DATASOURCE_AUTH_STATE,
|
|
|
|
|
updateDatasourceAuthStateSaga,
|
|
|
|
|
),
|
2023-05-22 08:44:06 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.DATASOURCE_DISCARD_ACTION,
|
|
|
|
|
datasourceDiscardActionSaga,
|
|
|
|
|
),
|
2023-06-01 17:26:05 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.ADD_AND_FETCH_MOCK_DATASOURCE_STRUCTURE_INIT,
|
|
|
|
|
addAndFetchDatasourceStructureSaga,
|
|
|
|
|
),
|
2023-06-13 11:00:37 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.FETCH_DATASOURCES_SUCCESS,
|
|
|
|
|
handleFetchDatasourceStructureOnLoad,
|
|
|
|
|
),
|
2023-07-21 05:53:17 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.SOFT_REFRESH_DATASOURCE_STRUCTURE,
|
|
|
|
|
handleFetchDatasourceStructureOnLoad,
|
|
|
|
|
),
|
|
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
|
|
|
|
setDatasourceViewModeSaga,
|
|
|
|
|
),
|
2023-09-11 07:09:41 +00:00
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.SOFT_REFRESH_DATASOURCE_STRUCTURE,
|
|
|
|
|
handleFetchDatasourceStructureOnLoad,
|
|
|
|
|
),
|
|
|
|
|
takeEvery(
|
|
|
|
|
ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
|
|
|
|
setDatasourceViewModeSaga,
|
|
|
|
|
),
|
2019-11-07 09:32:38 +00:00
|
|
|
]);
|
|
|
|
|
}
|