PromucFlow_constructor/app/client/src/actions/autoLayoutActions.ts
rahulramesha 801c4f3cae
chore: Change to Call fetch snapshot API call only from edit mode (#25342)
## Description
This PR contains changes to call fetch snapshot API only in Edit mode

Fixes #24715 

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing

#### How Has This Been Tested?
- [ ] Manual

#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-19 10:52:07 +05:30

108 lines
2.5 KiB
TypeScript

import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
import type { AppPositioningTypes } from "reducers/entityReducers/pageListReducer";
import type {
CONVERSION_STATES,
SnapShotDetails,
} from "reducers/uiReducers/layoutConversionReducer";
/**
* Calculate size and position changes owing to minSizes and flex wrap.
* This function is triggered the first time mobile viewport (480px) is encountered.
* It is also called when increasing viewport size from mobile to desktop.
*/
export const updateLayoutForMobileBreakpointAction = (
parentId: string,
isMobile: boolean,
canvasWidth: number,
widgets?: CanvasWidgetsReduxState,
) => {
return {
type: ReduxActionTypes.RECALCULATE_COLUMNS,
payload: {
parentId,
isMobile,
canvasWidth,
widgets,
},
};
};
export const updateLayoutPositioning = (
positioningType: AppPositioningTypes,
) => {
return {
type: ReduxActionTypes.UPDATE_LAYOUT_POSITIONING,
payload: positioningType,
};
};
export const setLayoutConversionStateAction = (
conversionState: CONVERSION_STATES,
error?: Error,
) => {
return {
type: ReduxActionTypes.SET_LAYOUT_CONVERSION_STATE,
payload: { conversionState, error },
};
};
export const updateSnapshotDetails = (
snapShotDetails: SnapShotDetails | undefined,
) => {
return {
type: ReduxActionTypes.UPDATE_SNAPSHOT_DETAILS,
payload: snapShotDetails,
};
};
export function updateWidgetDimensionAction(
widgetId: string,
width: number,
height: number,
) {
return {
type: ReduxActionTypes.UPDATE_WIDGET_DIMENSIONS,
payload: {
widgetId,
width,
height,
},
};
}
export const fetchSnapshotDetailsAction = () => {
return {
type: ReduxActionTypes.FETCH_LAYOUT_SNAPSHOT_DETAILS,
};
};
export const setConversionStart = (conversionState: CONVERSION_STATES) => {
return {
type: ReduxActionTypes.START_CONVERSION_FLOW,
payload: conversionState,
};
};
export const setConversionStop = () => {
return {
type: ReduxActionTypes.STOP_CONVERSION_FLOW,
};
};
export const setAutoCanvasResizing = (isAutoCanvasResizing: boolean) => {
return {
type: ReduxActionTypes.SET_AUTO_CANVAS_RESIZING,
payload: isAutoCanvasResizing,
};
};
export const updatePositionsOnTabChange = (
widgetId: string,
selectedTabWidgetId: string,
) => {
return {
type: ReduxActionTypes.UPDATE_POSITIONS_ON_TAB_CHANGE,
payload: { selectedTabWidgetId, widgetId },
};
};