- Add Generate CRUD page feature
- Modify the Datasource card UI in the `INTEGRATION.ACTIVE` tab to directly delete and edit.
- Add `renderOption` , `errorMsg`, `isLoading` props in Dropdown component.
If `renderOption` prop is not defined, it will show default option UI.
- Add getDatasourcesStructure [new entity Selector]
( This will provide all fetched structure of datasources)
> Commit Messages ⬇️
* Show disabled GenPage Button for unsupported DS
* Add Icon in Select Table and Column dropdown
* Add Error message when datasource config has error
* Fix the continous loading state issue
* Add Not supported datasource in select Table
* Add ignoreCache when fetching DS struct
* Go to generate page if initiator=generate-page
* Fix connect new datasource button disabled
* Modify error message for invalid datasource struct
* Add snowflake to supported plugin for template
* Fix Show More option width
* Fix incorrect error msg for valid dS config
* Generate page UI improvements
* Refactor navigation
* Fix Datasource Card UX
* Remove semi-colon from Icon loader
* Refactor contants
* Add executeDatasourceQuery & fetchPluginForm API
- WIP google sheet form UI and functionality
- Implemented fetch all spreadsheet with mock data
* disable S3 and google sheet for generate page
* Update yarn.lock
* Resolve review comments
- Add Messages to `constants/messages`
- Add default value for `fetchActionsForPage` 2nd param
- Add comment
- Remove `onFinishCallback` from `handleFetchedPage`
* move string literal to constants/messages
* Remove hardcoded pluginId implementation
* Refactor getGenerateCRUDEnabledPluginMap selector
* Fix CreateAppInFirstListedOrg test command
* Add getIsGeneratePageInitiator helper func
* Fix Entity explorer Edit option test
* Fix CreateAppForOrg test command
- Add click on build from scratch in generatePage
* Fix deleteDatasource command test
- Click on Datasource Name to Edit, Datasource Card handles the click
* Fix DynamicLayout spec test issue
* Fix pageLoadSpec test
* Disable google plugin & Refactor
- Add useDatasourceOptions hook
* Add datasourceCardMenu in DatasourceEditor.json
* Fix issues
- Add Icon hover clickable control
- Auth API click handler
* Fix Createpage test command
* Add cypress test for generate page flow
* Fix cypress test
* Add Analytics
* Add comments in CloseEditor
* Rename initiator to isGeneratePageMode
* Disable S3 for generate CRUD page
* Fix generate page from existing datasource issue
* Enhance test to verify if data is fetched properly
* Wait for get Actions before execute actions
* Change the cypress route for excute api
Co-authored-by: Pranav Kanade <pranav@appsmith.com>
240 lines
5.4 KiB
TypeScript
240 lines
5.4 KiB
TypeScript
import {
|
|
ReduxAction,
|
|
ReduxActionTypes,
|
|
ReduxActionWithCallbacks,
|
|
} from "constants/ReduxActionConstants";
|
|
import { CreateDatasourceConfig } from "api/DatasourcesApi";
|
|
import { Datasource } from "entities/Datasource";
|
|
import { PluginType } from "entities/Action";
|
|
import { executeDatasourceQueryRequest } from "../api/DatasourcesApi";
|
|
import { ResponseMeta } from "../api/ApiResponses";
|
|
|
|
export const createDatasourceFromForm = (payload: CreateDatasourceConfig) => {
|
|
return {
|
|
type: ReduxActionTypes.CREATE_DATASOURCE_FROM_FORM_INIT,
|
|
payload,
|
|
};
|
|
};
|
|
|
|
export const updateDatasource = (
|
|
payload: Datasource,
|
|
onSuccess?: ReduxAction<unknown>,
|
|
onError?: ReduxAction<unknown>,
|
|
): ReduxActionWithCallbacks<Datasource, unknown, unknown> => {
|
|
return {
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_INIT,
|
|
payload,
|
|
onSuccess,
|
|
onError,
|
|
};
|
|
};
|
|
|
|
export type UpdateDatasourceSuccessAction = {
|
|
type: string;
|
|
payload: Datasource;
|
|
redirect: boolean;
|
|
queryParams?: Record<string, string>;
|
|
};
|
|
|
|
export const updateDatasourceSuccess = (
|
|
payload: Datasource,
|
|
redirect = true,
|
|
queryParams = {},
|
|
): UpdateDatasourceSuccessAction => ({
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS,
|
|
payload,
|
|
redirect,
|
|
queryParams,
|
|
});
|
|
|
|
export const redirectAuthorizationCode = (
|
|
pageId: string,
|
|
datasourceId: string,
|
|
pluginType: PluginType,
|
|
) => {
|
|
return {
|
|
type: ReduxActionTypes.REDIRECT_AUTHORIZATION_CODE,
|
|
payload: {
|
|
pageId,
|
|
datasourceId,
|
|
pluginType,
|
|
},
|
|
};
|
|
};
|
|
|
|
export const fetchDatasourceStructure = (id: string, ignoreCache?: boolean) => {
|
|
return {
|
|
type: ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_INIT,
|
|
payload: {
|
|
id,
|
|
ignoreCache,
|
|
},
|
|
};
|
|
};
|
|
|
|
export const expandDatasourceEntity = (id: string) => {
|
|
return {
|
|
type: ReduxActionTypes.EXPAND_DATASOURCE_ENTITY,
|
|
payload: id,
|
|
};
|
|
};
|
|
|
|
export const refreshDatasourceStructure = (id: string) => {
|
|
return {
|
|
type: ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT,
|
|
payload: {
|
|
id,
|
|
},
|
|
};
|
|
};
|
|
|
|
export const saveDatasourceName = (payload: { id: string; name: string }) => ({
|
|
type: ReduxActionTypes.SAVE_DATASOURCE_NAME,
|
|
payload: payload,
|
|
});
|
|
|
|
export const changeDatasource = (payload: Datasource) => {
|
|
return {
|
|
type: ReduxActionTypes.CHANGE_DATASOURCE,
|
|
payload,
|
|
};
|
|
};
|
|
|
|
export const switchDatasource = (id: string) => {
|
|
return {
|
|
type: ReduxActionTypes.SWITCH_DATASOURCE,
|
|
payload: { datasourceId: id },
|
|
};
|
|
};
|
|
|
|
export const testDatasource = (payload: Partial<Datasource>) => {
|
|
return {
|
|
type: ReduxActionTypes.TEST_DATASOURCE_INIT,
|
|
payload,
|
|
};
|
|
};
|
|
|
|
export const deleteDatasource = (
|
|
payload: Partial<Datasource>,
|
|
onSuccess?: ReduxAction<unknown>,
|
|
onError?: ReduxAction<unknown>,
|
|
onSuccessCallback?: () => void,
|
|
): ReduxActionWithCallbacks<Partial<Datasource>, unknown, unknown> => {
|
|
return {
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_INIT,
|
|
payload,
|
|
onSuccess,
|
|
onError,
|
|
onSuccessCallback,
|
|
};
|
|
};
|
|
|
|
export const setDatsourceEditorMode = (payload: {
|
|
id: string;
|
|
viewMode: boolean;
|
|
}) => {
|
|
return {
|
|
type: ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
|
payload,
|
|
};
|
|
};
|
|
|
|
export const fetchDatasources = () => {
|
|
return {
|
|
type: ReduxActionTypes.FETCH_DATASOURCES_INIT,
|
|
};
|
|
};
|
|
|
|
export const fetchMockDatasources = () => {
|
|
return {
|
|
type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_INIT,
|
|
};
|
|
};
|
|
|
|
export interface addMockRequest
|
|
extends ReduxAction<{
|
|
name: string;
|
|
organizationId: string;
|
|
pluginId: string;
|
|
packageName: string;
|
|
isGeneratePageMode?: string;
|
|
}> {
|
|
extraParams?: any;
|
|
}
|
|
|
|
export const addMockDatasourceToOrg = (
|
|
name: string,
|
|
organizationId: string,
|
|
pluginId: string,
|
|
packageName: string,
|
|
isGeneratePageMode?: string,
|
|
): addMockRequest => {
|
|
return {
|
|
type: ReduxActionTypes.ADD_MOCK_DATASOURCES_INIT,
|
|
payload: { name, packageName, pluginId, organizationId },
|
|
extraParams: { isGeneratePageMode },
|
|
};
|
|
};
|
|
|
|
export const initDatasourcePane = (
|
|
pluginType: string,
|
|
urlId?: string,
|
|
): ReduxAction<{ pluginType: string; id?: string }> => {
|
|
return {
|
|
type: ReduxActionTypes.INIT_DATASOURCE_PANE,
|
|
payload: { id: urlId, pluginType },
|
|
};
|
|
};
|
|
|
|
export const storeAsDatasource = () => {
|
|
return {
|
|
type: ReduxActionTypes.STORE_AS_DATASOURCE_INIT,
|
|
};
|
|
};
|
|
|
|
export const getOAuthAccessToken = (datasourceId: string) => {
|
|
return {
|
|
type: ReduxActionTypes.SAAS_GET_OAUTH_ACCESS_TOKEN,
|
|
payload: { datasourceId },
|
|
};
|
|
};
|
|
|
|
export type executeDatasourceQuerySuccessPayload = {
|
|
responseMeta: ResponseMeta;
|
|
data: {
|
|
body: Array<{ id: string; name: string }>;
|
|
headers: Record<string, string[]>;
|
|
statusCode: string;
|
|
isExecutionSuccess: boolean;
|
|
};
|
|
};
|
|
type errorPayload = unknown;
|
|
|
|
export type executeDatasourceQueryReduxAction = ReduxActionWithCallbacks<
|
|
executeDatasourceQueryRequest,
|
|
executeDatasourceQuerySuccessPayload,
|
|
errorPayload
|
|
>;
|
|
|
|
export const executeDatasourceQuery = ({
|
|
onErrorCallback,
|
|
onSuccessCallback,
|
|
payload,
|
|
}: {
|
|
onErrorCallback?: (payload: errorPayload) => void;
|
|
onSuccessCallback?: (payload: executeDatasourceQuerySuccessPayload) => void;
|
|
payload: executeDatasourceQueryRequest;
|
|
}): executeDatasourceQueryReduxAction => {
|
|
return {
|
|
type: ReduxActionTypes.EXECUTE_DATASOURCE_QUERY_INIT,
|
|
payload,
|
|
onErrorCallback,
|
|
onSuccessCallback,
|
|
};
|
|
};
|
|
|
|
export default {
|
|
fetchDatasources,
|
|
initDatasourcePane,
|
|
};
|