2023-11-09 11:40:36 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2024-01-24 06:44:16 +00:00
|
|
|
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
|
2023-11-09 11:40:36 +00:00
|
|
|
import {
|
|
|
|
|
ReduxActionErrorTypes,
|
|
|
|
|
ReduxActionTypes,
|
|
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
|
|
|
|
import type { DependentFeatureFlags } from "@appsmith/selectors/engineSelectors";
|
|
|
|
|
import { fetchDatasources } from "actions/datasourceActions";
|
|
|
|
|
import { fetchPageDSLs } from "actions/pageActions";
|
|
|
|
|
import { fetchPlugins } from "actions/pluginActions";
|
2024-01-23 07:46:43 +00:00
|
|
|
import type { Plugin } from "api/PluginApi";
|
2024-01-24 06:44:16 +00:00
|
|
|
import type { EditConsolidatedApi } from "sagas/InitSagas";
|
2023-11-09 11:40:36 +00:00
|
|
|
|
2023-12-21 04:52:54 +00:00
|
|
|
export const CreateNewActionKey = {
|
|
|
|
|
PAGE: "pageId",
|
|
|
|
|
} as const;
|
|
|
|
|
|
2023-12-26 06:08:00 +00:00
|
|
|
export const ActionParentEntityType = {
|
2023-12-21 04:52:54 +00:00
|
|
|
PAGE: "PAGE",
|
|
|
|
|
} as const;
|
2023-12-13 17:43:43 +00:00
|
|
|
|
2024-01-15 08:23:00 +00:00
|
|
|
export const getPageDependencyActions = (
|
|
|
|
|
currentWorkspaceId: string = "",
|
|
|
|
|
featureFlags: DependentFeatureFlags = {},
|
2024-01-24 06:44:16 +00:00
|
|
|
allResponses: EditConsolidatedApi,
|
2024-01-15 08:23:00 +00:00
|
|
|
) => {
|
2024-01-24 06:44:16 +00:00
|
|
|
const { datasources, pagesWithMigratedDsl, plugins } = allResponses || {};
|
|
|
|
|
const initActions = [
|
|
|
|
|
fetchPlugins({ plugins }),
|
|
|
|
|
fetchDatasources({ datasources }),
|
|
|
|
|
fetchPageDSLs({ pagesWithMigratedDsl }),
|
|
|
|
|
] as Array<ReduxAction<unknown>>;
|
2023-11-09 11:40:36 +00:00
|
|
|
|
|
|
|
|
const successActions = [
|
|
|
|
|
ReduxActionTypes.FETCH_PLUGINS_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_DATASOURCES_SUCCESS,
|
|
|
|
|
ReduxActionTypes.FETCH_PAGE_DSLS_SUCCESS,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const errorActions = [
|
|
|
|
|
ReduxActionErrorTypes.FETCH_PLUGINS_ERROR,
|
|
|
|
|
ReduxActionErrorTypes.FETCH_DATASOURCES_ERROR,
|
|
|
|
|
ReduxActionErrorTypes.POPULATE_PAGEDSLS_ERROR,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
initActions,
|
|
|
|
|
successActions,
|
|
|
|
|
errorActions,
|
|
|
|
|
};
|
|
|
|
|
};
|
2024-01-23 07:46:43 +00:00
|
|
|
|
|
|
|
|
export const doesPluginRequireDatasource = (plugin: Plugin | undefined) => {
|
|
|
|
|
return !!plugin && plugin.hasOwnProperty("requiresDatasource")
|
|
|
|
|
? plugin.requiresDatasource
|
|
|
|
|
: true;
|
|
|
|
|
};
|
2024-03-04 14:26:47 +00:00
|
|
|
|
|
|
|
|
export enum APPSMITH_NAMESPACED_FUNCTIONS {}
|