Skip to content
34 changes: 34 additions & 0 deletions app/client/src/actions/copyToAppActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import type {
CopyEntityToAppPayload,
CopyToAppModalEntity,
} from "pages/Editor/Explorer/CopyToApp/types";

export const openCopyToAppModal = (payload: CopyToAppModalEntity) => ({
type: ReduxActionTypes.OPEN_COPY_ENTITY_TO_APP_MODAL,
payload,
});

export const closeCopyToAppModal = () => ({
type: ReduxActionTypes.CLOSE_COPY_ENTITY_TO_APP_MODAL,
});

export const copyActionToApp = (payload: CopyEntityToAppPayload) => ({
type: ReduxActionTypes.COPY_ACTION_TO_APP_INIT,
payload,
});

export const copyJSActionToApp = (payload: CopyEntityToAppPayload) => ({
type: ReduxActionTypes.COPY_JS_ACTION_TO_APP_INIT,
payload,
});

export const fetchAppsForCopyTarget = (workspaceId: string) => ({
type: ReduxActionTypes.FETCH_COPY_TARGET_APPLICATIONS_INIT,
payload: { workspaceId },
});

export const fetchPagesForCopyTarget = (applicationId: string) => ({
type: ReduxActionTypes.FETCH_COPY_TARGET_PAGES_INIT,
payload: { applicationId },
});
15 changes: 15 additions & 0 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ const ImportExportActionTypes = {
PARTIAL_EXPORT_MODAL_OPEN: "PARTIAL_EXPORT_MODAL_OPEN",
PARTIAL_EXPORT_INIT: "PARTIAL_EXPORT_INIT",
PARTIAL_EXPORT_SUCCESS: "PARTIAL_EXPORT_SUCCESS",
OPEN_COPY_ENTITY_TO_APP_MODAL: "OPEN_COPY_ENTITY_TO_APP_MODAL",
CLOSE_COPY_ENTITY_TO_APP_MODAL: "CLOSE_COPY_ENTITY_TO_APP_MODAL",
COPY_ACTION_TO_APP_INIT: "COPY_ACTION_TO_APP_INIT",
COPY_ACTION_TO_APP_SUCCESS: "COPY_ACTION_TO_APP_SUCCESS",
COPY_JS_ACTION_TO_APP_INIT: "COPY_JS_ACTION_TO_APP_INIT",
COPY_JS_ACTION_TO_APP_SUCCESS: "COPY_JS_ACTION_TO_APP_SUCCESS",
FETCH_COPY_TARGET_APPLICATIONS_INIT: "FETCH_COPY_TARGET_APPLICATIONS_INIT",
FETCH_COPY_TARGET_APPLICATIONS_SUCCESS:
"FETCH_COPY_TARGET_APPLICATIONS_SUCCESS",
FETCH_COPY_TARGET_PAGES_INIT: "FETCH_COPY_TARGET_PAGES_INIT",
FETCH_COPY_TARGET_PAGES_SUCCESS: "FETCH_COPY_TARGET_PAGES_SUCCESS",
IMPORT_APPLICATION_INIT: "IMPORT_APPLICATION_INIT",
IMPORT_APPLICATION_FROM_GIT_INIT: "IMPORT_APPLICATION_FROM_GIT_INIT",
IMPORT_APPLICATION_SUCCESS: "IMPORT_APPLICATION_SUCCESS",
Expand All @@ -233,6 +244,10 @@ const ImportExportActionErrorTypes = {
IMPORT_APPLICATION_ERROR: "IMPORT_APPLICATION_ERROR",
PARTIAL_IMPORT_ERROR: "PARTIAL_IMPORT_ERROR",
PARTIAL_EXPORT_ERROR: "PARTIAL_EXPORT_ERROR",
COPY_ACTION_TO_APP_ERROR: "COPY_ACTION_TO_APP_ERROR",
COPY_JS_ACTION_TO_APP_ERROR: "COPY_JS_ACTION_TO_APP_ERROR",
FETCH_COPY_TARGET_APPLICATIONS_ERROR: "FETCH_COPY_TARGET_APPLICATIONS_ERROR",
FETCH_COPY_TARGET_PAGES_ERROR: "FETCH_COPY_TARGET_PAGES_ERROR",
};

const ImportGitActionTypes = {
Expand Down
27 changes: 27 additions & 0 deletions app/client/src/ce/constants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1841,6 +1841,7 @@ export const CONTEXT_RENAME = () => "Rename";
export const CONTEXT_SHOW_BINDING = () => "Show bindings";
export const CONTEXT_MOVE = () => "Move to page";
export const CONTEXT_COPY = () => "Copy to page";
export const CONTEXT_COPY_TO_APP = () => "Copy to application";
export const CONTEXT_DUPLICATE = () => "Duplicate";
export const CONTEXT_DELETE = () => "Delete";
export const CONFIRM_CONTEXT_DELETE = () => "Are you sure?";
Expand Down Expand Up @@ -1924,6 +1925,32 @@ export const FORK_APP_MODAL_SUCCESS_TITLE = () =>
"Choose where to fork the app";
export const FORK = () => `Fork`;

export const COPY_ENTITY_TO_APP_MODAL_TITLE = () => "Copy to application";
export const COPY_ENTITY_TO_APP_WORKSPACE_LABEL = () => "Workspace";
export const COPY_ENTITY_TO_APP_APPLICATION_LABEL = () => "Application";
export const COPY_ENTITY_TO_APP_PAGE_LABEL = () => "Page";
export const COPY_ENTITY_TO_APP_WORKSPACE_PLACEHOLDER = () =>
"Select a workspace";
export const COPY_ENTITY_TO_APP_APPLICATION_PLACEHOLDER = () =>
"Select an application";
export const COPY_ENTITY_TO_APP_PAGE_PLACEHOLDER = () => "Select a page";
export const COPY_ENTITY_TO_APP_CONFIRM = () => "Copy";
export const COPY_ENTITY_TO_APP_NO_WORKSPACES = () =>
"No workspaces available to copy to";
export const COPY_ENTITY_TO_APP_NO_APPS = () =>
"No applications available in this workspace";
export const COPY_ENTITY_TO_APP_NO_PAGES = () =>
"No pages available in this application";
export const COPY_ENTITY_TO_APP_SUCCESS = (
entityName: string,
appName: string,
pageName: string,
) => `Copied ${entityName} to ${appName} / ${pageName}`;
export const COPY_ENTITY_TO_APP_ERROR = () =>
"Failed to copy to the selected application";
export const COPY_ENTITY_TO_APP_NOTE = () =>
"Datasources and any referenced queries aren't copied — you may need to reconfigure them in the target application.";
Comment thread
salevine marked this conversation as resolved.

export const CLEAN_URL_UPDATE = {
name: () => "Update URLs",
shortDesc: () =>
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/ce/pages/AppIDE/components/AppIDEModals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { PartialExportModal } from "components/editorComponents/PartialImportExp
import { PartialImportModal } from "components/editorComponents/PartialImportExport/PartialImportModal";
import { AppCURLImportModal } from "ee/pages/Editor/CurlImport";
import GeneratePageModal from "pages/Editor/GeneratePage";
import CopyEntityToAppModal from "pages/Editor/Explorer/CopyToApp/CopyEntityToAppModal";

export function AppIDEModals() {
return (
Expand All @@ -21,6 +22,7 @@ export function AppIDEModals() {
<PartialImportModal />
<AppCURLImportModal />
<GeneratePageModal />
<CopyEntityToAppModal />
</>
);
}
2 changes: 2 additions & 0 deletions app/client/src/ce/reducers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import type { LayoutElementPositionsReduxState } from "layoutSystems/anvil/integ
import type { ActiveField } from "reducers/uiReducers/activeFieldEditorReducer";
import type { SelectedWorkspaceReduxState } from "ee/reducers/uiReducers/selectedWorkspaceReducer";
import type { ConsolidatedPageLoadState } from "reducers/uiReducers/consolidatedPageLoadReducer";
import type { CopyEntityToAppReduxState } from "reducers/uiReducers/copyEntityToAppReducer";
import type { BuildingBlocksReduxState } from "reducers/uiReducers/buildingBlockReducer";
import type {
GitArtifactRootReduxState,
Expand Down Expand Up @@ -149,6 +150,7 @@ export interface AppState {
ide: IDEState;
pluginActionEditor: PluginActionEditorState;
windowDimensions: WindowDimensionsState;
copyEntityToApp: CopyEntityToAppReduxState;
};
entities: {
canvasWidgetsStructure: CanvasWidgetStructure;
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/ce/reducers/uiReducers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import activeFieldReducer from "reducers/uiReducers/activeFieldEditorReducer";
import selectedWorkspaceReducer from "ee/reducers/uiReducers/selectedWorkspaceReducer";
import ideReducer from "reducers/uiReducers/ideReducer";
import consolidatedPageLoadReducer from "reducers/uiReducers/consolidatedPageLoadReducer";
import copyEntityToAppReducer from "reducers/uiReducers/copyEntityToAppReducer";
import { pluginActionReducer } from "PluginActionEditor/store";

export const uiReducerObject = {
Expand Down Expand Up @@ -100,4 +101,5 @@ export const uiReducerObject = {
ide: ideReducer,
consolidatedPageLoad: consolidatedPageLoadReducer,
pluginActionEditor: pluginActionReducer,
copyEntityToApp: copyEntityToAppReducer,
};
Loading
Loading