2019-11-29 05:22:49 +00:00
|
|
|
import {
|
2021-03-30 05:29:03 +00:00
|
|
|
ReduxAction,
|
2019-11-29 05:22:49 +00:00
|
|
|
ReduxActionTypes,
|
2021-08-03 08:06:48 +00:00
|
|
|
ReduxActionErrorTypes,
|
2019-11-29 05:22:49 +00:00
|
|
|
ReduxActionWithoutPayload,
|
2022-04-12 10:50:01 +00:00
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2021-03-30 05:29:03 +00:00
|
|
|
import { PluginFormPayload } from "api/PluginApi";
|
2021-04-26 05:41:32 +00:00
|
|
|
import { DependencyMap } from "utils/DynamicBindingUtils";
|
2019-11-29 05:22:49 +00:00
|
|
|
|
2022-03-17 10:28:54 +00:00
|
|
|
export const fetchPlugins = (payload?: {
|
|
|
|
|
orgId?: string;
|
|
|
|
|
}): ReduxAction<{ orgId?: string } | undefined> => ({
|
2019-11-29 05:22:49 +00:00
|
|
|
type: ReduxActionTypes.FETCH_PLUGINS_REQUEST,
|
2022-03-17 10:28:54 +00:00
|
|
|
payload,
|
2019-11-29 05:22:49 +00:00
|
|
|
});
|
2020-04-29 09:23:23 +00:00
|
|
|
|
2021-03-30 05:29:03 +00:00
|
|
|
export const fetchPluginFormConfigs = (): ReduxActionWithoutPayload => ({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_REQUEST,
|
|
|
|
|
});
|
2020-10-20 09:00:02 +00:00
|
|
|
|
2021-03-30 05:29:03 +00:00
|
|
|
export type PluginFormsPayload = {
|
|
|
|
|
formConfigs: Record<string, any[]>;
|
|
|
|
|
editorConfigs: Record<string, any[]>;
|
|
|
|
|
settingConfigs: Record<string, any[]>;
|
2021-04-26 05:41:32 +00:00
|
|
|
dependencies: Record<string, DependencyMap>;
|
2022-03-30 13:11:25 +00:00
|
|
|
datasourceFormButtonConfigs: Record<string, string[]>;
|
2020-10-20 09:00:02 +00:00
|
|
|
};
|
2021-03-30 05:29:03 +00:00
|
|
|
|
|
|
|
|
export const fetchPluginFormConfigsSuccess = (
|
|
|
|
|
payload: PluginFormsPayload,
|
|
|
|
|
): ReduxAction<PluginFormsPayload> => ({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export interface PluginFormPayloadWithId extends PluginFormPayload {
|
|
|
|
|
id: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const fetchPluginFormConfigSuccess = (
|
|
|
|
|
payload: PluginFormPayloadWithId,
|
|
|
|
|
): ReduxAction<PluginFormPayloadWithId> => ({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PLUGIN_FORM_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
2021-07-29 08:13:10 +00:00
|
|
|
|
|
|
|
|
export const fetchPluginFormConfigError = (
|
|
|
|
|
payload: GetPluginFormConfigRequest,
|
|
|
|
|
): ReduxAction<GetPluginFormConfigRequest> => ({
|
2021-08-03 08:06:48 +00:00
|
|
|
type: ReduxActionErrorTypes.FETCH_PLUGIN_FORM_ERROR,
|
2021-07-29 08:13:10 +00:00
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export interface GetPluginFormConfigRequest {
|
|
|
|
|
id: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// To fetch plugin form config for individual plugin
|
|
|
|
|
export const fetchPluginFormConfig = ({
|
|
|
|
|
pluginId: id,
|
|
|
|
|
}: {
|
|
|
|
|
pluginId: GetPluginFormConfigRequest;
|
|
|
|
|
}) => ({
|
|
|
|
|
type: ReduxActionTypes.GET_PLUGIN_FORM_CONFIG_INIT,
|
|
|
|
|
payload: id,
|
|
|
|
|
});
|
2022-03-03 10:56:53 +00:00
|
|
|
|
|
|
|
|
export const fetchDefaultPlugins = (): ReduxActionWithoutPayload => ({
|
|
|
|
|
type: ReduxActionTypes.GET_DEFAULT_PLUGINS_REQUEST,
|
|
|
|
|
});
|