2023-11-09 11:40:36 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
|
|
|
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";
|
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-16 04:46:48 +00:00
|
|
|
const initActions = [fetchPlugins(), fetchDatasources(), fetchPageDSLs()];
|
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;
|
|
|
|
|
};
|