2021-02-11 12:28:06 +00:00
|
|
|
import {
|
|
|
|
|
ReduxAction,
|
|
|
|
|
ReduxActionTypes,
|
|
|
|
|
ReduxActionWithCallbacks,
|
2022-04-12 10:50:01 +00:00
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2021-01-12 04:17:28 +00:00
|
|
|
import { CreateDatasourceConfig } from "api/DatasourcesApi";
|
|
|
|
|
import { Datasource } from "entities/Datasource";
|
2021-04-22 03:30:09 +00:00
|
|
|
import { PluginType } from "entities/Action";
|
2022-04-12 10:50:01 +00:00
|
|
|
import { executeDatasourceQueryRequest } from "api/DatasourcesApi";
|
|
|
|
|
import { ResponseMeta } from "api/ApiResponses";
|
2022-11-30 05:59:45 +00:00
|
|
|
import { TEMP_DATASOURCE_ID } from "constants/Datasource";
|
2020-04-28 06:52:53 +00:00
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
export const createDatasourceFromForm = (
|
|
|
|
|
payload: CreateDatasourceConfig & Datasource,
|
|
|
|
|
onSuccess?: ReduxAction<unknown>,
|
|
|
|
|
onError?: ReduxAction<unknown>,
|
|
|
|
|
) => {
|
2020-05-07 04:44:52 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CREATE_DATASOURCE_FROM_FORM_INIT,
|
|
|
|
|
payload,
|
2022-11-30 05:59:45 +00:00
|
|
|
onSuccess,
|
|
|
|
|
onError,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const createTempDatasourceFromForm = (
|
|
|
|
|
payload: CreateDatasourceConfig | Datasource,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CREATE_TEMP_DATASOURCE_FROM_FORM_SUCCESS,
|
|
|
|
|
payload,
|
2020-05-07 04:44:52 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-11 12:28:06 +00:00
|
|
|
export const updateDatasource = (
|
|
|
|
|
payload: Datasource,
|
|
|
|
|
onSuccess?: ReduxAction<unknown>,
|
|
|
|
|
onError?: ReduxAction<unknown>,
|
|
|
|
|
): ReduxActionWithCallbacks<Datasource, unknown, unknown> => {
|
2020-04-28 06:52:53 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_INIT,
|
2020-09-02 06:07:18 +00:00
|
|
|
payload,
|
2021-02-11 12:28:06 +00:00
|
|
|
onSuccess,
|
|
|
|
|
onError,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-19 13:17:27 +00:00
|
|
|
export type UpdateDatasourceSuccessAction = {
|
|
|
|
|
type: string;
|
|
|
|
|
payload: Datasource;
|
|
|
|
|
redirect: boolean;
|
2021-07-29 08:13:10 +00:00
|
|
|
queryParams?: Record<string, string>;
|
2021-04-19 13:17:27 +00:00
|
|
|
};
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
export type CreateDatasourceSuccessAction = {
|
|
|
|
|
type: string;
|
|
|
|
|
payload: Datasource;
|
|
|
|
|
isDBCreated: boolean;
|
|
|
|
|
redirect: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-19 13:17:27 +00:00
|
|
|
export const updateDatasourceSuccess = (
|
|
|
|
|
payload: Datasource,
|
|
|
|
|
redirect = true,
|
2021-07-29 08:13:10 +00:00
|
|
|
queryParams = {},
|
2021-04-19 13:17:27 +00:00
|
|
|
): UpdateDatasourceSuccessAction => ({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
redirect,
|
2021-07-29 08:13:10 +00:00
|
|
|
queryParams,
|
2021-04-19 13:17:27 +00:00
|
|
|
});
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
export const createDatasourceSuccess = (
|
|
|
|
|
payload: Datasource,
|
|
|
|
|
isDBCreated = false,
|
|
|
|
|
redirect = false,
|
|
|
|
|
): CreateDatasourceSuccessAction => ({
|
|
|
|
|
type: ReduxActionTypes.CREATE_DATASOURCE_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
isDBCreated,
|
|
|
|
|
redirect,
|
|
|
|
|
});
|
|
|
|
|
|
2021-02-16 12:28:03 +00:00
|
|
|
export const redirectAuthorizationCode = (
|
|
|
|
|
pageId: string,
|
|
|
|
|
datasourceId: string,
|
2021-04-22 03:30:09 +00:00
|
|
|
pluginType: PluginType,
|
2021-02-16 12:28:03 +00:00
|
|
|
) => {
|
2021-02-11 12:28:06 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.REDIRECT_AUTHORIZATION_CODE,
|
|
|
|
|
payload: {
|
2021-02-16 12:28:03 +00:00
|
|
|
pageId,
|
|
|
|
|
datasourceId,
|
2021-04-22 03:30:09 +00:00
|
|
|
pluginType,
|
2021-02-11 12:28:06 +00:00
|
|
|
},
|
2020-04-28 06:52:53 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
export const fetchDatasourceStructure = (id: string, ignoreCache?: boolean) => {
|
2020-09-21 09:11:42 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_INIT,
|
|
|
|
|
payload: {
|
|
|
|
|
id,
|
2021-07-29 08:13:10 +00:00
|
|
|
ignoreCache,
|
2020-09-21 09:11:42 +00:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-12 12:43:35 +00:00
|
|
|
export const expandDatasourceEntity = (id: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.EXPAND_DATASOURCE_ENTITY,
|
|
|
|
|
payload: id,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-29 04:17:25 +00:00
|
|
|
export const refreshDatasourceStructure = (id: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT,
|
|
|
|
|
payload: {
|
|
|
|
|
id,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-26 05:24:44 +00:00
|
|
|
export const saveDatasourceName = (payload: { id: string; name: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.SAVE_DATASOURCE_NAME,
|
|
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
export const updateDatasourceName = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}) => ({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_DATASOURCE_NAME,
|
|
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-04-11 11:23:52 +00:00
|
|
|
export const changeDatasource = (payload: {
|
|
|
|
|
datasource?: Datasource;
|
|
|
|
|
shouldNotRedirect?: boolean;
|
|
|
|
|
}) => {
|
2020-05-19 06:10:59 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CHANGE_DATASOURCE,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-11 11:23:52 +00:00
|
|
|
export const switchDatasource = (id: string, shouldNotRedirect: boolean) => {
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SWITCH_DATASOURCE,
|
2022-04-11 11:23:52 +00:00
|
|
|
payload: {
|
|
|
|
|
datasourceId: id,
|
|
|
|
|
shouldNotRedirect,
|
|
|
|
|
},
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
export const testDatasource = (payload: Partial<Datasource>) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.TEST_DATASOURCE_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-22 03:30:09 +00:00
|
|
|
export const deleteDatasource = (
|
|
|
|
|
payload: Partial<Datasource>,
|
|
|
|
|
onSuccess?: ReduxAction<unknown>,
|
|
|
|
|
onError?: ReduxAction<unknown>,
|
2021-07-29 08:13:10 +00:00
|
|
|
onSuccessCallback?: () => void,
|
2021-04-22 03:30:09 +00:00
|
|
|
): ReduxActionWithCallbacks<Partial<Datasource>, unknown, unknown> => {
|
2020-04-29 10:03:56 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_INIT,
|
|
|
|
|
payload,
|
2021-04-22 03:30:09 +00:00
|
|
|
onSuccess,
|
|
|
|
|
onError,
|
2021-07-29 08:13:10 +00:00
|
|
|
onSuccessCallback,
|
2020-04-29 10:03:56 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-02 03:06:22 +00:00
|
|
|
export const setDatasourceViewMode = (payload: boolean) => {
|
2020-10-12 13:37:18 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DATASOURCE_EDITOR_MODE,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-05 05:58:17 +00:00
|
|
|
export const setAllDatasourceCollapsible = (payload: {
|
|
|
|
|
[key: string]: boolean;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_ALL_DATASOURCE_COLLAPSIBLE_STATE,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const setDatasourceCollapsible = (key: string, isOpen: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DATASOURCE_COLLAPSIBLE_STATE,
|
|
|
|
|
payload: { key, isOpen },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
export const fetchDatasources = (payload?: { workspaceId?: string }) => {
|
2020-04-28 06:52:53 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_DATASOURCES_INIT,
|
2022-03-17 10:28:54 +00:00
|
|
|
payload,
|
2020-04-28 06:52:53 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-07 03:46:16 +00:00
|
|
|
export const fetchMockDatasources = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_INIT,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
export interface addMockRequest
|
|
|
|
|
extends ReduxAction<{
|
|
|
|
|
name: string;
|
2022-06-15 15:37:41 +00:00
|
|
|
workspaceId: string;
|
2021-07-29 08:13:10 +00:00
|
|
|
pluginId: string;
|
|
|
|
|
packageName: string;
|
|
|
|
|
isGeneratePageMode?: string;
|
|
|
|
|
}> {
|
|
|
|
|
extraParams?: any;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
export const addMockDatasourceToWorkspace = (
|
2021-07-08 05:59:11 +00:00
|
|
|
name: string,
|
2022-06-15 15:37:41 +00:00
|
|
|
workspaceId: string,
|
2021-07-08 05:59:11 +00:00
|
|
|
pluginId: string,
|
2021-07-08 10:33:41 +00:00
|
|
|
packageName: string,
|
2021-07-29 08:13:10 +00:00
|
|
|
isGeneratePageMode?: string,
|
|
|
|
|
): addMockRequest => {
|
2021-07-07 03:46:16 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.ADD_MOCK_DATASOURCES_INIT,
|
2022-06-15 15:37:41 +00:00
|
|
|
payload: { name, packageName, pluginId, workspaceId },
|
2021-07-29 08:13:10 +00:00
|
|
|
extraParams: { isGeneratePageMode },
|
2021-07-07 03:46:16 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
export const initDatasourcePane = (
|
|
|
|
|
pluginType: string,
|
|
|
|
|
urlId?: string,
|
|
|
|
|
): ReduxAction<{ pluginType: string; id?: string }> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.INIT_DATASOURCE_PANE,
|
|
|
|
|
payload: { id: urlId, pluginType },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-03 05:40:48 +00:00
|
|
|
export const storeAsDatasource = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.STORE_AS_DATASOURCE_INIT,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-22 03:30:09 +00:00
|
|
|
export const getOAuthAccessToken = (datasourceId: string) => {
|
|
|
|
|
return {
|
2022-01-14 06:31:54 +00:00
|
|
|
type: ReduxActionTypes.GET_OAUTH_ACCESS_TOKEN,
|
2021-04-22 03:30:09 +00:00
|
|
|
payload: { datasourceId },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-20 06:57:01 +00:00
|
|
|
export type executeDatasourceQuerySuccessPayload<T> = {
|
2021-07-29 08:13:10 +00:00
|
|
|
responseMeta: ResponseMeta;
|
|
|
|
|
data: {
|
2021-08-20 06:57:01 +00:00
|
|
|
body: T;
|
feat: Simplified Google Sheets queries (#14869)
* Client changes 1
* add DSL functionality
* Temp commit for refactoring changes
* Do I even know what I'm doing here?
* chore: Second GS layout
* Update: Visibility conditional outputs for schemas
- Added the output from conditional outputs for schema children too
* Update: Entity selector visibility control
- Added logic for controlling visibility of sub components via the JS expressions system
* Update: Passing disabled prop to toggle button
* Update: Passing disabled prop to toggle btn
* Update: Styled component for toggle button
- Added disabled styles based on the disabled prop sent to the toggle form view JSON button
* Update: configProperty role in Entity Selector
- Removed dependance of the configProperty of the entity selector children to it's parent component
* Update: type of placeholder key
- Made placeholder key from form config JSON to accept either string or an object
- Earlier only string was accepted
- This is for pagination component
* Update: Added placeholder control for pagination
* Client changes 1
* add DSL functionality
* Do I even know what I'm doing here?
* fix: updated uqi forms ui, clubbed JS switch button to ads, updated tooltip design
* fix: updated tooltip component for wrong ui on entity explore
* temp triggers
* fix: updated uqi forms ui, clubbed JS switch button to ads, updated tooltip design (#12395)
* fix: updated uqi forms ui, clubbed JS switch button to ads, updated tooltip design
* fix: updated tooltip component for wrong ui on entity explore
* fix: updated tooltip ui, where condition placement, sort by ui
* temp form data access logic
* fix: updated sorting type width ui
* fix: updated ui for spacing, width and text issues
* Update: Type for tooltip of UQI forms
- Added option to send an object to the tooltipText object.
- This allows for composite components like pagination to have tooltips for each sub component
* Update: tooltip for pagination component
- Added handling to parse the tooltip for multiple components.
- This allows for composite components like pagination to have tooltips for each sub component
* Update: Type cast for tooltip component
- Made the content passed to tooltip component as a string only
* Update: Fixed tooltip component CSS
* Update: Dropdown option component
- Added a tooltip wrapper to each option
- This is to show on hover text like disabled state
* fix: updated ẇhere clause broken ui for condition
* Add: functions to check and extract expressions
- Loop through the formConfig and find any keys that have a value that is bindable
- Used pre defined regex to check if value is a moustache binding
* Add: Types for evaluated form configs
- Added types for the form configs to be evaluated and their output post eval
* Add: Flow to run the form config
- Run the form config and update the result to the redux state
* Update: Name of the type for formconfigs
- Updated since it was clashing with a component of the same name
* Add: Function to enforce config type checks
- This is done so that the improper configs can be weeded out and the rest of the form can be shown
* Add: Function to update evaluated config
- Added option to update the config if it's values needed evaluation
* Add: Type check for schema sections
* Update: Error handling for invalid control type
- We were throwing an exception till now, changed it to a warning text
* Add: Exposed tooltip for dropdown option disabled state
* Update: switch to json mode functionality
- Added logic to convert data to a string rather than an object when the first switch to JSON mode happens
* Update: Added key to tooltip for dropdown options
* Trigger API modification
* Add: function to fetch default trigger URL
* Update: Made URL optional in dynamic trigger config
* Update: Dynamic trigger API call
- Made the API call for dynamic triggers have URL as optional field
- Added type check to the response of the API call
* Update: resp type for trigger APIs
* Update: Moved code to utils folder
- Moved functions for UQI form eval processing to utils file
* Update: passing original controltype to JS switch
* Update: config for JSON editor mode
- Updated the config to have different options for JSON mode depending on the original control type
* Update: Connected line numbers flag to config
* Revert: CSS changes for tooltip
* Refactor: Removed consle
* Add: type for the config of dynamic values
* Add: Feature to evaluate config for triggers
* Refactor: fix type check errors
* fix: dropdown ui width with text alignment
* Update: fixed selector for dynamic values
* Update: selector call for fetchDynamicValues
* Add table header index prop for columns selector
* migration partial commit
* migration partial commit
* Refactor: removed unused import
* Update: reused function for checking dynamic value
* Update: removed unused import
* Fix format JSON issues
* Retrieve binding paths from entity selector components
* Fixes 6 remaining issues with UQI implementation
* Fix dropdown issues
* Fix dropdown height issues and fixes triggering of APIs when option is deselected
* Migration changes
* Fix QA generated UQI issues
* Fix projection component height and route change logic
* Fix multi select dropdown placeholder text issue and json stringify issue with switching view types
* Reset entity type value when command value changes
* Test changes
* Review comments
* Moved migrations around
* Corrected import statement
* Added JSON schema migration
* Updated schema version
* perf improvements and filter dropdown options feature
* Fix Code mirror component config for toggleComponentToJson input fields.
* Fix prettier issues
* fix prettier issues
* Fix style issues as a result of the merged conflicts
* Fix failing test case
* Fixed a few other flows (#14225)
* Fixed a few other flows
* Review comments
* Fix generate CRUD, fix evaluation of dynamic bindings and fix various styling issues.
* More fixes (#14367)
* Factor in the root formconfig parent key.
* Fix flickering issues, and evaluatedFormConfig issues
* fix: Teeny bugs (#14455)
* Teeny bugs
* Added previous functionality as is
* Improvements in the way we fetch dynamic values
* Fix stringiification issue and cyclic dependency issues
* Resolve projection component values deletion
* Resolve merge conflicts and fix prettier issues
* fix: Tsc issues
* Fix property pane connection navigation
* updating ee locator
* updating inputfield locator
* dropdown locator update
* Merge conflict not properly resolved.
* Fix s3 spec
* Fix Mongo Spec
* Fix some more tests
* fix: prevent cyclic dependency when switching to js mode (#14668)
* add delete events for change from array to string in diff
* add test to assert absence of cyclic dependency error when switching to js in switchgroup widget
* Assert that evaluation is not disabled when no cyclic dependency happens
* Cypress test preparations for google sheets and form controls
* Fixed a few test errors (#14874)
* Add: unit tests for uqi UI updates
- view type tests
- conditional output extraction
- processing conditional output to handle view/enabled state of the component
* Add: completed isValidFormConfig test
* Update: improved tests for update config
- These tests cover the functionality to update a section config after it's components are done evaluating
* Fix failing cypress tests and cyclic dependency issue
* Fixes some more tests
* Fixed migration of row objects (#14896)
* Bumped the version of design system package
* Update: reverted change to EE selector
* Fix deletion pointer
* Update: selector for js on load spec
- Synced with changes related to ADS dropdown
* Fix mongoDBShoppingCart spec
* Remove comments
* Fix: mongo shopping cart test failures
* fix: mongo shopping cart spec
* Dummy push to retrigger vercel
* fix: mongo shopping cart spec
* Update MongoDBShoppingCart_spec.js
* fix: removed unused click away
* dummy commit
* Update: moved helper functions to separate file
* Add: added tests for saga functions
- Worked on testing for
- extractFetchDynamicValueFormConfigs
- extractQueueOfValuesToBeFetched
* Add if check for queueOfValuesToBeFetched
* Resolve review comments
* Empty-Commit
Co-authored-by: Irongade <adeoluayangade@yahoo.com>
Co-authored-by: Ayush Pahwa <ayush@appsmith.com>
Co-authored-by: Aman Agarwal <aman@appsmith.com>
Co-authored-by: Ayangade Adeoluwa <37867493+Irongade@users.noreply.github.com>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
Co-authored-by: Favour Ohanekwu <fohanekwu@gmail.com>
Co-authored-by: Albin <albin@appsmith.com>
2022-07-04 05:43:27 +00:00
|
|
|
trigger: T;
|
2021-07-29 08:13:10 +00:00
|
|
|
headers: Record<string, string[]>;
|
|
|
|
|
statusCode: string;
|
|
|
|
|
isExecutionSuccess: boolean;
|
|
|
|
|
};
|
|
|
|
|
};
|
2021-08-20 09:55:59 +00:00
|
|
|
type errorPayload = string;
|
2021-07-29 08:13:10 +00:00
|
|
|
|
2021-08-20 06:57:01 +00:00
|
|
|
export type executeDatasourceQueryReduxAction<T> = ReduxActionWithCallbacks<
|
2021-07-29 08:13:10 +00:00
|
|
|
executeDatasourceQueryRequest,
|
2021-08-20 06:57:01 +00:00
|
|
|
executeDatasourceQuerySuccessPayload<T>,
|
2021-07-29 08:13:10 +00:00
|
|
|
errorPayload
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
export const executeDatasourceQuery = ({
|
|
|
|
|
onErrorCallback,
|
|
|
|
|
onSuccessCallback,
|
|
|
|
|
payload,
|
|
|
|
|
}: {
|
|
|
|
|
onErrorCallback?: (payload: errorPayload) => void;
|
2021-08-20 06:57:01 +00:00
|
|
|
onSuccessCallback?: (
|
|
|
|
|
payload: executeDatasourceQuerySuccessPayload<any>,
|
|
|
|
|
) => void;
|
2021-07-29 08:13:10 +00:00
|
|
|
payload: executeDatasourceQueryRequest;
|
2021-08-20 06:57:01 +00:00
|
|
|
}): executeDatasourceQueryReduxAction<any> => {
|
2021-07-29 08:13:10 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_DATASOURCE_QUERY_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
onErrorCallback,
|
|
|
|
|
onSuccessCallback,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-17 10:28:54 +00:00
|
|
|
export const setUnconfiguredDatasourcesDuringImport = (
|
|
|
|
|
payload?: Array<Datasource>,
|
|
|
|
|
) => ({
|
|
|
|
|
type: ReduxActionTypes.SET_UNCONFIGURED_DATASOURCES,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-11-30 05:59:45 +00:00
|
|
|
export const removeTempDatasource = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.REMOVE_TEMP_DATASOURCE_SUCCESS,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const deleteTempDSFromDraft = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.DELETE_DATASOURCE_DRAFT,
|
|
|
|
|
payload: {
|
|
|
|
|
id: TEMP_DATASOURCE_ID,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const toggleSaveActionFlag = (isDSSaved: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DATASOURCE_SAVE_ACTION_FLAG,
|
|
|
|
|
payload: {
|
|
|
|
|
isDSSaved: isDSSaved,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const toggleSaveActionFromPopupFlag = (isDSSavedFromPopup: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DATASOURCE_SAVE_ACTION_FROM_POPUP_FLAG,
|
|
|
|
|
payload: {
|
|
|
|
|
isDSSavedFromPopup: isDSSavedFromPopup,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-30 10:23:24 +00:00
|
|
|
// This function stores the config property for key value pairs in
|
|
|
|
|
// datasource form which are initialized by default
|
|
|
|
|
export const setDefaultKeyValPairFlag = (defaultKeyValArrayConfig: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DATASOURCE_DEFAULT_KEY_VALUE_PAIR_SET,
|
|
|
|
|
payload: defaultKeyValArrayConfig,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// This function resets the config property stored in redux for key value pairs in
|
|
|
|
|
// datasource form which are initialized by default, once these key value pairs are initialized
|
|
|
|
|
// in the datasource config form, store needs to reset those values
|
|
|
|
|
export const resetDefaultKeyValPairFlag = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.RESET_DATASOURCE_DEFAULT_KEY_VALUE_PAIR_SET,
|
|
|
|
|
payload: [],
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-10 10:41:17 +00:00
|
|
|
export const initializeDatasourceFormDefaults = (pluginType: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.INITIALIZE_DATASOURCE_FORM_WITH_DEFAULTS,
|
|
|
|
|
payload: {
|
|
|
|
|
pluginType: pluginType,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
feat: file picker added and access token generation (#20778)
## Description
This PR includes following changes:
- In case of limiting google sheet access project, when user selects specific sheets as an option, they should be shown file picker UI once the authorisation is complete, In this file picker UI, users can select the google sheet files that they want to use with appsmith application and allow access to only those files.
- This PR contains the changes for file picker UI and updating datasource auth state based on the files selected by user.
TL;DR
Steps to test this PR:
- Create Google Sheet datasource
- In the datasource config form, select specific sheets as an option from the scope dropdown.
- Click on save and authorise
- This will take you to google oauth process
<img width="467" alt="Screenshot 2023-02-20 at 1 24 24 PM" src="https://user-images.githubusercontent.com/30018882/220045493-57b0ca6c-3f08-4963-af55-d603cf79bc43.png">
- Select the google account
- This will take you to google oauth2 consent screen
<img width="451" alt="Screenshot 2023-02-20 at 1 24 55 PM" src="https://user-images.githubusercontent.com/30018882/220045641-9f70dd29-6664-489a-b77b-df65445491df.png">
- Click on allow for all requested permissions
- This will take you back to appsmith's datasource config page in view mode and load the file picker UI
<img width="425" alt="Screenshot 2023-02-20 at 1 25 47 PM" src="https://user-images.githubusercontent.com/30018882/220045828-8b3e3e46-4ddc-4e30-b2f8-f12865395817.png">
- Select the files that you want to share with appsmith app
- Click on select
- You should see the new query button in enabled state, as datasource authorisation is complete
<img width="800" alt="Screenshot 2023-02-20 at 1 27 28 PM" src="https://user-images.githubusercontent.com/30018882/220046131-6ce99a85-cddc-4529-ae45-f9833aefd71b.png">
- In case you select cancel on google oauth2 consent screen, you should error message on datasource config page with new query button being disabled
<img width="810" alt="Screenshot 2023-02-20 at 1 28 49 PM" src="https://user-images.githubusercontent.com/30018882/220046385-6b8d636c-b517-44c3-a596-b52bc0084b94.png">
- In case you do give all the permissions but do not select any files in google file picker, then also you should see error message on datasource config page with new query button disabled.
Fixes #20163, #20290, #20160, #20162
Media
> A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video
## Type of change
> Please delete options that are not relevant.
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [x] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or manual QA
- [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2023-03-08 05:25:17 +00:00
|
|
|
// In case of access to specific sheets in google sheet datasource, this action
|
|
|
|
|
// is used for handling file picker callback, when user selects files/cancels the selection
|
|
|
|
|
// this callback action will be triggered
|
|
|
|
|
export const filePickerCallbackAction = (data: {
|
|
|
|
|
action: string;
|
|
|
|
|
datasourceId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FILE_PICKER_CALLBACK_ACTION,
|
|
|
|
|
payload: data,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 06:52:53 +00:00
|
|
|
export default {
|
|
|
|
|
fetchDatasources,
|
|
|
|
|
initDatasourcePane,
|
|
|
|
|
};
|