* Added a new type of UIComponent for DB editor forms * Added a new state for UQI evals and connected it to the rendering form * Added sagas to init and run the UQI eval * Exporting fetch function as a selector * Moved selector code to the formSelector file * Added type to state config holder, removed custom diff function and fixed imports * Fixed path, added the type for plugin in selector * Created new enum, abstracted function for render and fixed var names Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import Api from "api/Api";
|
|
import { AxiosPromise } from "axios";
|
|
import { GenericApiResponse } from "api/ApiResponses";
|
|
import { PluginType } from "entities/Action";
|
|
import { DependencyMap } from "utils/DynamicBindingUtils";
|
|
|
|
export type PluginId = string;
|
|
export type PluginPackageName = string;
|
|
export type GenerateCRUDEnabledPluginMap = Record<PluginId, PluginPackageName>;
|
|
|
|
export enum UIComponentTypes {
|
|
DbEditorForm = "DbEditorForm",
|
|
UQIDbEditorForm = "UQIDbEditorForm",
|
|
ApiEditorForm = "ApiEditorForm",
|
|
RapidApiEditorForm = "RapidApiEditorForm",
|
|
}
|
|
|
|
export enum DatasourceComponentTypes {
|
|
RestAPIDatasourceForm = "RestAPIDatasourceForm",
|
|
AutoForm = "AutoForm",
|
|
}
|
|
export interface Plugin {
|
|
id: string;
|
|
name: string;
|
|
type: PluginType;
|
|
packageName: string;
|
|
iconLocation?: string;
|
|
uiComponent: UIComponentTypes;
|
|
datasourceComponent: DatasourceComponentTypes;
|
|
allowUserDatasources?: boolean;
|
|
templates: Record<string, string>;
|
|
responseType?: "TABLE" | "JSON";
|
|
documentationLink?: string;
|
|
generateCRUDPageComponent?: string;
|
|
}
|
|
|
|
export interface PluginFormPayload {
|
|
form: any[];
|
|
editor: any[];
|
|
setting: any[];
|
|
dependencies: DependencyMap;
|
|
}
|
|
|
|
class PluginsApi extends Api {
|
|
static url = "v1/plugins";
|
|
static fetchPlugins(
|
|
orgId: string,
|
|
): AxiosPromise<GenericApiResponse<Plugin[]>> {
|
|
return Api.get(PluginsApi.url, { organizationId: orgId });
|
|
}
|
|
|
|
static fetchFormConfig(
|
|
id: string,
|
|
): AxiosPromise<GenericApiResponse<PluginFormPayload>> {
|
|
return Api.get(PluginsApi.url + `/${id}/form`);
|
|
}
|
|
}
|
|
|
|
export default PluginsApi;
|