2020-03-27 09:02:11 +00:00
|
|
|
import {
|
|
|
|
|
all,
|
|
|
|
|
call,
|
2023-01-28 02:17:06 +00:00
|
|
|
delay,
|
2020-03-27 09:02:11 +00:00
|
|
|
put,
|
2023-01-28 02:17:06 +00:00
|
|
|
select,
|
2020-03-27 09:02:11 +00:00
|
|
|
takeEvery,
|
2023-01-28 02:17:06 +00:00
|
|
|
takeLatest,
|
2020-03-27 09:02:11 +00:00
|
|
|
} from "redux-saga/effects";
|
|
|
|
|
|
|
|
|
|
import { generateReactKey } from "utils/generators";
|
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 { ModalWidgetResize, WidgetAddChild } from "actions/pageActions";
|
|
|
|
|
import { updateAndSaveLayout } from "actions/pageActions";
|
2021-09-20 17:06:13 +00:00
|
|
|
import {
|
|
|
|
|
GridDefaults,
|
|
|
|
|
MAIN_CONTAINER_WIDGET_ID,
|
|
|
|
|
} from "constants/WidgetConstants";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
|
2020-03-27 09:02:11 +00:00
|
|
|
import {
|
|
|
|
|
ReduxActionErrorTypes,
|
|
|
|
|
ReduxActionTypes,
|
2021-08-03 08:06:48 +00:00
|
|
|
WidgetReduxActionTypes,
|
2022-04-12 10:50:01 +00:00
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2020-03-27 09:02:11 +00:00
|
|
|
|
|
|
|
|
import {
|
2021-09-20 17:06:13 +00:00
|
|
|
getWidget,
|
2020-03-27 09:02:11 +00:00
|
|
|
getWidgetByName,
|
|
|
|
|
getWidgetIdsByType,
|
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
|
|
|
getWidgetMetaProps,
|
2023-01-28 02:17:06 +00:00
|
|
|
getWidgets,
|
|
|
|
|
getWidgetsMeta,
|
2020-03-27 09:02:11 +00:00
|
|
|
} from "sagas/selectors";
|
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 {
|
2021-09-20 17:06:13 +00:00
|
|
|
CanvasWidgetsReduxState,
|
|
|
|
|
FlattenedWidgetProps,
|
|
|
|
|
} from "reducers/entityReducers/canvasWidgetsReducer";
|
2022-05-25 09:46:14 +00:00
|
|
|
import { updateWidgetMetaPropAndEval } from "actions/metaActions";
|
2023-01-28 02:17:06 +00:00
|
|
|
import { focusWidget, showModal } from "actions/widgetActions";
|
2021-03-13 14:24:45 +00:00
|
|
|
import log from "loglevel";
|
2021-02-11 06:25:11 +00:00
|
|
|
import { flatten } from "lodash";
|
2023-09-06 12:15:04 +00:00
|
|
|
import WidgetFactory from "WidgetProvider/factory";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { WidgetProps } from "widgets/BaseWidget";
|
2023-01-28 02:17:06 +00:00
|
|
|
import { selectWidgetInitAction } from "actions/widgetSelectionActions";
|
|
|
|
|
import { SelectionRequestType } from "./WidgetSelectUtils";
|
2023-05-19 18:37:06 +00:00
|
|
|
import { toast } from "design-system";
|
2023-04-07 13:51:35 +00:00
|
|
|
import { getIsAutoLayout } from "selectors/editorSelectors";
|
|
|
|
|
import { recalculateAutoLayoutColumnsAndSave } from "./AutoLayoutUpdateSagas";
|
|
|
|
|
import {
|
|
|
|
|
FlexLayerAlignment,
|
|
|
|
|
LayoutDirection,
|
2023-10-02 19:41:05 +00:00
|
|
|
} from "layoutSystems/common/utils/constants";
|
2024-01-26 04:00:57 +00:00
|
|
|
import { getModalWidgetType } from "selectors/widgetSelectors";
|
|
|
|
|
import { AnvilReduxActionTypes } from "layoutSystems/anvil/integrations/actions/actionTypes";
|
2024-03-27 14:38:28 +00:00
|
|
|
import { getWidgetSelectionBlock } from "selectors/ui";
|
2024-04-12 17:24:04 +00:00
|
|
|
import { getIsAnvilLayout } from "layoutSystems/anvil/integrations/selectors";
|
2024-03-27 14:38:28 +00:00
|
|
|
|
2021-09-09 15:10:22 +00:00
|
|
|
const WidgetTypes = WidgetFactory.widgetTypes;
|
|
|
|
|
|
2020-04-03 09:32:13 +00:00
|
|
|
export function* createModalSaga(action: ReduxAction<{ modalName: string }>) {
|
2020-03-27 09:02:11 +00:00
|
|
|
try {
|
|
|
|
|
const modalWidgetId = generateReactKey();
|
2023-04-07 13:51:35 +00:00
|
|
|
const isAutoLayout: boolean = yield select(getIsAutoLayout);
|
2024-01-26 04:00:57 +00:00
|
|
|
const modalWidgetType: string = yield select(getModalWidgetType);
|
2024-04-12 17:24:04 +00:00
|
|
|
const isAnvilLayout: boolean = yield select(getIsAnvilLayout);
|
2023-04-07 13:51:35 +00:00
|
|
|
const newWidget: WidgetAddChild = {
|
2020-03-27 09:02:11 +00:00
|
|
|
widgetId: MAIN_CONTAINER_WIDGET_ID,
|
2020-04-03 09:32:13 +00:00
|
|
|
widgetName: action.payload.modalName,
|
2024-01-26 04:00:57 +00:00
|
|
|
type: modalWidgetType,
|
2020-03-27 09:02:11 +00:00
|
|
|
newWidgetId: modalWidgetId,
|
|
|
|
|
parentRowSpace: 1,
|
|
|
|
|
parentColumnSpace: 1,
|
|
|
|
|
leftColumn: 0,
|
|
|
|
|
topRow: 0,
|
|
|
|
|
columns: 0,
|
|
|
|
|
rows: 0,
|
2020-04-15 11:42:11 +00:00
|
|
|
tabId: "",
|
2020-03-27 09:02:11 +00:00
|
|
|
};
|
2023-04-07 13:51:35 +00:00
|
|
|
|
|
|
|
|
if (isAutoLayout) {
|
|
|
|
|
const dropPayload = {
|
|
|
|
|
alignment: FlexLayerAlignment.Center,
|
|
|
|
|
index: 0,
|
|
|
|
|
isNewLayer: true,
|
|
|
|
|
layerIndex: 0,
|
|
|
|
|
rowIndex: 0,
|
|
|
|
|
};
|
|
|
|
|
newWidget.props = {
|
|
|
|
|
alignment: FlexLayerAlignment.Center,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.AUTOLAYOUT_ADD_NEW_WIDGETS,
|
|
|
|
|
payload: {
|
|
|
|
|
dropPayload,
|
|
|
|
|
newWidget,
|
|
|
|
|
parentId: MAIN_CONTAINER_WIDGET_ID,
|
|
|
|
|
direction: LayoutDirection.Vertical,
|
|
|
|
|
addToBottom: true,
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-04-12 17:24:04 +00:00
|
|
|
} else if (isAnvilLayout) {
|
2024-01-26 04:00:57 +00:00
|
|
|
//TODO(#30604): Refactor to separate this logic from the anvil layout system
|
|
|
|
|
yield put({
|
|
|
|
|
type: AnvilReduxActionTypes.ANVIL_ADD_NEW_WIDGET,
|
|
|
|
|
payload: {
|
|
|
|
|
highlight: { alignment: "none", canvasId: "0" },
|
|
|
|
|
newWidget: { ...newWidget, detachFromLayout: true },
|
|
|
|
|
dragMeta: {
|
|
|
|
|
draggedWidgetTypes: "WIDGETS",
|
|
|
|
|
draggedOn: "MAIN_CANVAS",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
2023-04-07 13:51:35 +00:00
|
|
|
} else {
|
|
|
|
|
yield put({
|
|
|
|
|
type: WidgetReduxActionTypes.WIDGET_ADD_CHILD,
|
|
|
|
|
payload: newWidget,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-03-27 09:02:11 +00:00
|
|
|
} catch (error) {
|
2021-03-13 14:24:45 +00:00
|
|
|
log.error(error);
|
2020-03-27 09:02:11 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.CREATE_MODAL_ERROR,
|
|
|
|
|
payload: { error },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function* showModalByNameSaga(
|
|
|
|
|
action: ReduxAction<{ modalName: string }>,
|
|
|
|
|
) {
|
2023-10-11 07:14:38 +00:00
|
|
|
const widgets: { [widgetId: string]: FlattenedWidgetProps } =
|
|
|
|
|
yield select(getWidgets);
|
2020-03-27 09:02:11 +00:00
|
|
|
const modal: FlattenedWidgetProps | undefined = Object.values(widgets).find(
|
|
|
|
|
(widget: FlattenedWidgetProps) =>
|
|
|
|
|
widget.widgetName === action.payload.modalName,
|
|
|
|
|
);
|
|
|
|
|
if (modal) {
|
2023-01-28 02:17:06 +00:00
|
|
|
yield put(showModal(modal.widgetId));
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-23 04:18:23 +00:00
|
|
|
export function* showIfModalSaga(
|
|
|
|
|
action: ReduxAction<{ widgetId: string; type: string }>,
|
|
|
|
|
) {
|
|
|
|
|
if (action.payload.type === "MODAL_WIDGET") {
|
2023-01-28 02:17:06 +00:00
|
|
|
yield put(showModal(action.payload.widgetId));
|
2021-02-23 04:18:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-28 02:17:06 +00:00
|
|
|
export function* showModalSaga(action: ReduxAction<{ modalId: string }>) {
|
2020-03-27 09:02:11 +00:00
|
|
|
// First we close the currently open modals (if any)
|
|
|
|
|
// Notice the empty payload.
|
|
|
|
|
yield call(closeModalSaga, {
|
|
|
|
|
type: ReduxActionTypes.CLOSE_MODAL,
|
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
|
|
|
payload: {
|
|
|
|
|
exclude: action.payload.modalId,
|
|
|
|
|
},
|
2020-03-27 09:02:11 +00:00
|
|
|
});
|
|
|
|
|
|
2020-04-13 08:24:13 +00:00
|
|
|
yield put(focusWidget(action.payload.modalId));
|
2020-03-27 09:02:11 +00:00
|
|
|
|
2023-02-14 16:07:31 +00:00
|
|
|
const widgetLikeProps = {
|
|
|
|
|
widgetId: action.payload.modalId,
|
|
|
|
|
} as WidgetProps;
|
2022-06-21 13:57:34 +00:00
|
|
|
const metaProps: Record<string, unknown> = yield select(
|
|
|
|
|
getWidgetMetaProps,
|
2023-02-14 16:07:31 +00:00
|
|
|
widgetLikeProps,
|
2022-06-21 13:57:34 +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
|
|
|
if (!metaProps || !metaProps.isVisible) {
|
|
|
|
|
// Then show the modal we would like to show.
|
|
|
|
|
yield put(
|
2022-05-25 09:46:14 +00:00
|
|
|
updateWidgetMetaPropAndEval(action.payload.modalId, "isVisible", true),
|
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
|
|
|
);
|
|
|
|
|
yield delay(1000);
|
|
|
|
|
}
|
2020-03-27 09:02:11 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SHOW_PROPERTY_PANE,
|
|
|
|
|
payload: {
|
|
|
|
|
widgetId: action.payload.modalId,
|
|
|
|
|
callForDragOrResize: undefined,
|
|
|
|
|
force: true,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
export function* closeModalSaga(
|
|
|
|
|
action: ReduxAction<{ modalName?: string; exclude?: string }>,
|
|
|
|
|
) {
|
2020-03-27 09:02:11 +00:00
|
|
|
try {
|
|
|
|
|
const { modalName } = action.payload;
|
2024-01-26 04:00:57 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
let widgetIds: string[] = [];
|
|
|
|
|
// If modalName is provided, we just want to close this modal
|
|
|
|
|
if (modalName) {
|
2022-06-21 13:57:34 +00:00
|
|
|
const widget: FlattenedWidgetProps | undefined = yield select(
|
|
|
|
|
getWidgetByName,
|
|
|
|
|
modalName,
|
|
|
|
|
);
|
|
|
|
|
widgetIds = widget ? [widget.widgetId] : [];
|
2020-03-27 09:02:11 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SHOW_PROPERTY_PANE,
|
|
|
|
|
payload: {},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// If modalName is not provided, find all open modals
|
|
|
|
|
// Get all meta prop records
|
|
|
|
|
const metaProps: Record<string, any> = yield select(getWidgetsMeta);
|
fix: Anvil Widgets not accessible when widget has no content. (#30780)
> Pull Request Template
>
> Use this template to quickly create a well written pull request.
Delete all quotes before creating the pull request.
>
## Description
In this PR, we are fixing a few issues and also destructuring
AnvilFlexComponent for edit and view.
Issues Fixed
- Widgets without any content like a text widget without text are not
hoverable
- Modal once opened does not close when other widgets on the canvas are
selected via the enitty explorer.
Anvil Flex Component was common component inspired from
PositionedContainer of Fixed layout. It had all features of Edit and
View together in one place. This mean viewer was unnecessarily
interpreting more code.
Now AnvilFlexComponent has been broken into AnvilFlexComponent and
AnvilEditorFlexComponent.
AnvilEditorFlexComponent is a wrapper around AnvilFlexComponent with
abilities needed for Edit Mode.
Another issue addressed in the PR is removal of DraggableComponennt,
which was just making dragging possible and providing a few styles like
fading the widget when it is being dragged.
With this PR all the above mentioned functions will be taken care of by
AnvilEditorFlexComponent.
#### PR fixes following issue(s)
Fixes #30734
> 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)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- Chore (housekeeping or task changes that don't impact user perception)
- This change requires a documentation update
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Summary by CodeRabbit
- **New Features**
- Enhanced feature flag management with additional flags for better
control over application features.
- Introduced a new editor component for Anvil layout system, improving
layout and behavior management in edit mode.
- Added a custom hook for managing hover states on Anvil widgets,
enhancing user interaction.
- **Refactor**
- Updated AnvilFlexComponent to use `forwardRef` for better ref
management and optimized widget configuration and rendering logic.
- Modified selector logic to simplify the retrieval of layout system
type, enhancing code maintainability.
- Adjusted test methodologies to improve reliability and accuracy.
- **Bug Fixes**
- Corrected assertions in Cypress end-to-end tests to accurately locate
and interact with widgets in the Anvil canvas, ensuring test
reliability.
- **Chores**
- Updated common locators and assertion methods in Cypress support files
for consistency and clarity in test scripts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-05 12:30:50 +00:00
|
|
|
const modalWidgetType: string = yield select(getModalWidgetType);
|
2020-03-27 09:02:11 +00:00
|
|
|
|
|
|
|
|
// Get widgetIds of all widgets of type MODAL_WIDGET
|
2024-01-26 04:00:57 +00:00
|
|
|
// Note: Not updating this code path for WDS_MODAL_WIDGET, as the functionality
|
|
|
|
|
// may require us to keep existing modals open.
|
|
|
|
|
// In this, the flow of switching back and forth between multiple modals is to be tested.
|
2020-03-27 09:02:11 +00:00
|
|
|
const modalWidgetIds: string[] = yield select(
|
|
|
|
|
getWidgetIdsByType,
|
fix: Anvil Widgets not accessible when widget has no content. (#30780)
> Pull Request Template
>
> Use this template to quickly create a well written pull request.
Delete all quotes before creating the pull request.
>
## Description
In this PR, we are fixing a few issues and also destructuring
AnvilFlexComponent for edit and view.
Issues Fixed
- Widgets without any content like a text widget without text are not
hoverable
- Modal once opened does not close when other widgets on the canvas are
selected via the enitty explorer.
Anvil Flex Component was common component inspired from
PositionedContainer of Fixed layout. It had all features of Edit and
View together in one place. This mean viewer was unnecessarily
interpreting more code.
Now AnvilFlexComponent has been broken into AnvilFlexComponent and
AnvilEditorFlexComponent.
AnvilEditorFlexComponent is a wrapper around AnvilFlexComponent with
abilities needed for Edit Mode.
Another issue addressed in the PR is removal of DraggableComponennt,
which was just making dragging possible and providing a few styles like
fading the widget when it is being dragged.
With this PR all the above mentioned functions will be taken care of by
AnvilEditorFlexComponent.
#### PR fixes following issue(s)
Fixes #30734
> 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)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- Chore (housekeeping or task changes that don't impact user perception)
- This change requires a documentation update
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Summary by CodeRabbit
- **New Features**
- Enhanced feature flag management with additional flags for better
control over application features.
- Introduced a new editor component for Anvil layout system, improving
layout and behavior management in edit mode.
- Added a custom hook for managing hover states on Anvil widgets,
enhancing user interaction.
- **Refactor**
- Updated AnvilFlexComponent to use `forwardRef` for better ref
management and optimized widget configuration and rendering logic.
- Modified selector logic to simplify the retrieval of layout system
type, enhancing code maintainability.
- Adjusted test methodologies to improve reliability and accuracy.
- **Bug Fixes**
- Corrected assertions in Cypress end-to-end tests to accurately locate
and interact with widgets in the Anvil canvas, ensuring test
reliability.
- **Chores**
- Updated common locators and assertion methods in Cypress support files
for consistency and clarity in test scripts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-05 12:30:50 +00:00
|
|
|
modalWidgetType,
|
2020-03-27 09:02:11 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Loop through all modal widgetIds
|
|
|
|
|
modalWidgetIds.forEach((widgetId: string) => {
|
|
|
|
|
// Check if modal is open
|
|
|
|
|
if (metaProps[widgetId] && metaProps[widgetId].isVisible) {
|
|
|
|
|
// Add to our list of widgetIds
|
|
|
|
|
widgetIds.push(widgetId);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
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
|
|
|
widgetIds = action.payload.exclude
|
|
|
|
|
? widgetIds.filter((id: string) => id !== action.payload.exclude)
|
|
|
|
|
: widgetIds;
|
2020-03-27 09:02:11 +00:00
|
|
|
// If we have modals to close, set its isVisible to false to close.
|
|
|
|
|
if (widgetIds) {
|
|
|
|
|
yield all(
|
2021-02-11 06:25:11 +00:00
|
|
|
flatten(
|
|
|
|
|
widgetIds.map((widgetId: string) => {
|
|
|
|
|
return [
|
2022-05-25 09:46:14 +00:00
|
|
|
put(updateWidgetMetaPropAndEval(widgetId, "isVisible", false)),
|
2021-02-11 06:25:11 +00:00
|
|
|
];
|
|
|
|
|
}),
|
2020-03-27 09:02:11 +00:00
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2021-10-28 02:11:19 +00:00
|
|
|
if (modalName) {
|
2024-03-27 14:38:28 +00:00
|
|
|
const isWidgetSelectionBlocked: boolean = yield select(
|
|
|
|
|
getWidgetSelectionBlock,
|
|
|
|
|
);
|
|
|
|
|
if (!isWidgetSelectionBlocked) {
|
|
|
|
|
yield put(selectWidgetInitAction(SelectionRequestType.Empty));
|
|
|
|
|
yield put(focusWidget(MAIN_CONTAINER_WIDGET_ID));
|
|
|
|
|
}
|
2021-10-28 02:11:19 +00:00
|
|
|
}
|
2020-03-27 09:02:11 +00:00
|
|
|
} catch (error) {
|
2021-03-13 14:24:45 +00:00
|
|
|
log.error(error);
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-20 17:06:13 +00:00
|
|
|
export function* resizeModalSaga(resizeAction: ReduxAction<ModalWidgetResize>) {
|
|
|
|
|
try {
|
2023-05-19 18:37:06 +00:00
|
|
|
toast.dismiss();
|
2021-09-20 17:06:13 +00:00
|
|
|
const start = performance.now();
|
|
|
|
|
const { canvasWidgetId, height, widgetId, width } = resizeAction.payload;
|
|
|
|
|
|
|
|
|
|
const stateWidget: FlattenedWidgetProps = yield select(getWidget, widgetId);
|
2022-06-21 13:57:34 +00:00
|
|
|
const stateWidgets: CanvasWidgetsReduxState = yield select(getWidgets);
|
2023-04-07 13:51:35 +00:00
|
|
|
const isAutoLayout: boolean = yield select(getIsAutoLayout);
|
2021-09-20 17:06:13 +00:00
|
|
|
|
|
|
|
|
let widget = { ...stateWidget };
|
|
|
|
|
const widgets = { ...stateWidgets };
|
|
|
|
|
|
|
|
|
|
widget = { ...widget, height, width };
|
|
|
|
|
widgets[widgetId] = widget;
|
|
|
|
|
|
|
|
|
|
if (canvasWidgetId) {
|
|
|
|
|
const bottomRow = getModalCanvasBottomRow(
|
|
|
|
|
widgets,
|
|
|
|
|
canvasWidgetId,
|
|
|
|
|
height,
|
|
|
|
|
);
|
|
|
|
|
const stateModalContainerWidget: FlattenedWidgetProps = yield select(
|
|
|
|
|
getWidget,
|
|
|
|
|
canvasWidgetId,
|
|
|
|
|
);
|
|
|
|
|
let modalContainerWidget = { ...stateModalContainerWidget };
|
|
|
|
|
|
|
|
|
|
modalContainerWidget = {
|
|
|
|
|
...modalContainerWidget,
|
|
|
|
|
bottomRow,
|
|
|
|
|
minHeight: height,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
widgets[canvasWidgetId] = modalContainerWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.debug("resize computations took", performance.now() - start, "ms");
|
2022-08-19 10:10:36 +00:00
|
|
|
//TODO Identify the updated widgets and pass the values
|
2023-04-07 13:51:35 +00:00
|
|
|
if (isAutoLayout) {
|
|
|
|
|
yield call(recalculateAutoLayoutColumnsAndSave, widgets);
|
2023-06-01 03:39:23 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.PROCESS_AUTO_LAYOUT_DIMENSION_UPDATES,
|
|
|
|
|
});
|
2023-04-07 13:51:35 +00:00
|
|
|
} else {
|
|
|
|
|
yield put(updateAndSaveLayout(widgets));
|
|
|
|
|
}
|
2021-09-20 17:06:13 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.WIDGET_OPERATION_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
action: WidgetReduxActionTypes.WIDGET_RESIZE,
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Note: returns bottomRow of the lowest widget on the canvas
|
|
|
|
|
* @param finalWidgets
|
|
|
|
|
* @param parentId
|
|
|
|
|
* @param height
|
|
|
|
|
*/
|
|
|
|
|
const getModalCanvasBottomRow = (
|
|
|
|
|
finalWidgets: CanvasWidgetsReduxState,
|
|
|
|
|
parentId: string,
|
|
|
|
|
height: number,
|
|
|
|
|
): number => {
|
|
|
|
|
if (
|
|
|
|
|
!finalWidgets[parentId] ||
|
|
|
|
|
finalWidgets[parentId].type !== WidgetTypes.CANVAS_WIDGET
|
|
|
|
|
) {
|
|
|
|
|
return height;
|
|
|
|
|
}
|
|
|
|
|
const lowestBottomRowHeight =
|
|
|
|
|
height -
|
|
|
|
|
GridDefaults.CANVAS_EXTENSION_OFFSET *
|
|
|
|
|
GridDefaults.DEFAULT_GRID_ROW_HEIGHT -
|
|
|
|
|
GridDefaults.DEFAULT_GRID_ROW_HEIGHT;
|
|
|
|
|
|
|
|
|
|
let lowestBottomRow = Math.ceil(
|
|
|
|
|
lowestBottomRowHeight / GridDefaults.DEFAULT_GRID_ROW_HEIGHT,
|
|
|
|
|
);
|
|
|
|
|
const childIds = finalWidgets[parentId].children || [];
|
|
|
|
|
|
|
|
|
|
// find lowest row
|
|
|
|
|
childIds.forEach((cId: string) => {
|
|
|
|
|
const child = finalWidgets[cId];
|
|
|
|
|
|
|
|
|
|
if (child.bottomRow > lowestBottomRow) {
|
|
|
|
|
lowestBottomRow = child.bottomRow;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return (
|
|
|
|
|
(lowestBottomRow + GridDefaults.CANVAS_EXTENSION_OFFSET) *
|
|
|
|
|
GridDefaults.DEFAULT_GRID_ROW_HEIGHT
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export default function* modalSagas() {
|
|
|
|
|
yield all([
|
|
|
|
|
takeEvery(ReduxActionTypes.CLOSE_MODAL, closeModalSaga),
|
|
|
|
|
takeLatest(ReduxActionTypes.CREATE_MODAL_INIT, createModalSaga),
|
|
|
|
|
takeLatest(ReduxActionTypes.SHOW_MODAL, showModalSaga),
|
|
|
|
|
takeLatest(ReduxActionTypes.SHOW_MODAL_BY_NAME, showModalByNameSaga),
|
2021-08-03 08:06:48 +00:00
|
|
|
takeLatest(WidgetReduxActionTypes.WIDGET_CHILD_ADDED, showIfModalSaga),
|
2021-09-20 17:06:13 +00:00
|
|
|
takeLatest(WidgetReduxActionTypes.WIDGET_MODAL_RESIZE, resizeModalSaga),
|
2020-03-27 09:02:11 +00:00
|
|
|
]);
|
|
|
|
|
}
|