PromucFlow_constructor/app/client/src/selectors/entitiesSelector.ts

433 lines
12 KiB
TypeScript
Raw Normal View History

2020-02-18 10:41:52 +00:00
import { AppState } from "reducers";
import {
ActionData,
ActionDataState,
} from "reducers/entityReducers/actionsReducer";
2020-01-30 13:23:04 +00:00
import { ActionResponse } from "api/ActionAPI";
import { createSelector } from "reselect";
[Feature] Generate template page from datasource (#5513) - 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>
2021-07-29 08:13:10 +00:00
import {
Datasource,
MockDatasource,
DatasourceStructure,
} from "entities/Datasource";
import { Action, PluginType } from "entities/Action";
import { find } from "lodash";
import ImageAlt from "assets/images/placeholder-image.svg";
import { CanvasWidgetsReduxState } from "../reducers/entityReducers/canvasWidgetsReducer";
2021-03-08 08:24:12 +00:00
import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
2021-03-24 05:09:47 +00:00
import { AppStoreState } from "reducers/entityReducers/appReducer";
[Feature] Generate template page from datasource (#5513) - 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>
2021-07-29 08:13:10 +00:00
import { GenerateCRUDEnabledPluginMap } from "../api/PluginApi";
import { PLUGIN_PACKAGE_NAME } from "../pages/Editor/GeneratePage/components/constants";
2019-11-14 09:28:51 +00:00
2020-02-18 10:41:52 +00:00
export const getEntities = (state: AppState): AppState["entities"] =>
state.entities;
2020-12-30 07:31:20 +00:00
export const getDatasources = (state: AppState): Datasource[] => {
return state.entities.datasources.list;
};
[Feature] Generate template page from datasource (#5513) - 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>
2021-07-29 08:13:10 +00:00
export const getDatasourcesStructure = (
state: AppState,
): Record<string, DatasourceStructure> => {
return state.entities.datasources.structure;
};
export const getIsFetchingDatasourceStructure = (state: AppState): boolean => {
return state.entities.datasources.fetchingDatasourceStructure;
};
[Feature] Unified New Nav (#5558) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Added slash commands button * Adjust styles for better ui * Ordered the action entries under integrations * Added new datasource command * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * Show connect data cta in property pane * Styling fixes * Fix margin * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * Insert binding command UI change * More UI changes * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * not routing to integrations on create query/api * Hide actions from suggestions in action pages * removed the query/datasource/api home pages * Changes widget.data to widget in slash commands * Show dependencies in property pane * Fix warning * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * Fix dropdown not showing up * Minor refactoring. Changed commands * added a way to list data sources in action creators * Update query page url * cam show icons for datasources * Removed unused code * Feature/slash commands (#5002) * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * Added slash commands button * Adjust styles for better ui * Added new datasource command * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * Insert binding command UI change * More UI changes * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * Hide actions from suggestions in action pages * Changes widget.data to widget in slash commands * Minor refactoring. Changed commands * Removed unused code * remove more unusued code * Added support to generate new api from a datasource in quick commands * Code correction to use types * Refactored commands code * Minor bug fixes * Remove new integrations command for actions. Fixed autocomplete not showing up * Changes to prevent autocomplete trigger for navigation commands * Prevent hinter execution when show hint is open already. * Show hinter on focus * Update text to be called in the omnibar * updated the copy for empty active datasources * Update url * Fix text decoration * updated the redirection for back btns * Use themes * Add cypress test * fixed back btn nav * fetching form configs for datasources * a callback fixed * Fix slash command not executed on click (#5540) * Replace the value if not a string else append * Log commands menu events * updated mock data base navigation * updated mock data base navigation * updated the close editors and back buttons * All back btns from editors will go back to data sources and back from data source will go back to canvas * fixed bg colors * minor styled updates * removed margin from header of generic datasource * warnings fixes * If user is already on the location not redirecting em * when editing, will check if the coming from data source and redirect accordingly * updated redirection for newly created api/queries * updated back btn for newly created datasources * back for new curl goes to data sources * Revert "[Fix] revert new nav (#5533)" This reverts commit 1647815d * remaining original reverted chagnes * fixed the width of incoming/outgoing entity bar in property pane * removing residue from resolved merge conflicts * Fix widget icons not visible in dropdown menu * minor fix to use proper integration URL * updated the URLs for unified datasources * converted back and close to btns from banners * on accessing data source from sidebar, it'll always go to view mode * updated the edit path for saas editors * Added saved state for google sheet * on google sheet delete redirecting to create new * minor fix * fixed the redirection call on saving a datasource * removed save and test cmd as it wasn't needed * Removing test cases to be fixed by Arun * commenting more tests to be fixed by Arun * updated call api cy command * Fix extra margin issue * fixed the update datasource saga * fixed video spec * Revert "commenting more tests to be fixed by Arun" This reverts commit 42087a95ad77107401a1619e4c2d4c541a81d6c3. * Revert "Removing test cases to be fixed by Arun" This reverts commit f6fad67e558d22045114a90409428ef9b737478f. * fixed the entity explorer query datasource spec * cautious fix * update widget locators * fixed leave org test * fixes for FormWidgets * updated the image spec * Use memo * Fix debugger url checks * for copy and delete widget pointing directly to svgs * Fix entity text * Fix styling and show tooltip for property pane dependencies * removed the unnecessary callback * added a separate saga to to redirect to new integrations using onSuccess * Bug Fixes - New nav (#5629) * will show scrollbar only on hover * made mock data cards clickable * fixed the grid view * fixed the cursor position when clicking on / btn * updated the hint for `/` command * binding prompt will close on focus change * hiding / command for api body * hiding / command for query pane * Added 2 new icons * Fix cursor position on selecting a binding and clicking on the slash menu button * trying out fix to copyWidget cy command * removing zero width space characters from the property pane text Co-authored-by: arunvjn <arun@appsmith.com> Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: arunvjn <32433245+arunvjn@users.noreply.github.com> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-07-07 03:46:16 +00:00
export const getMockDatasources = (state: AppState): MockDatasource[] => {
return state.entities.datasources.mockDatasourceList;
};
[Feature] Generate template page from datasource (#5513) - 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>
2021-07-29 08:13:10 +00:00
export const getIsDeletingDatasource = (state: AppState): boolean => {
return state.entities.datasources.isDeleting;
};
export const getPluginIdsOfNames = (
state: AppState,
names: Array<string>,
): Array<string> | undefined => {
2020-12-24 04:32:25 +00:00
const plugins = state.entities.plugins.list.filter((plugin) =>
names.includes(plugin.name),
);
2020-12-24 04:32:25 +00:00
const pluginIds = plugins.map((plugin) => plugin.id);
if (!pluginIds.length) return undefined;
return pluginIds;
};
export const getPluginIdsOfPackageNames = (
state: AppState,
names: Array<string>,
): Array<string> | undefined => {
2020-12-24 04:32:25 +00:00
const plugins = state.entities.plugins.list.filter((plugin) =>
names.includes(plugin.packageName),
);
2020-12-24 04:32:25 +00:00
const pluginIds = plugins.map((plugin) => plugin.id);
if (!pluginIds.length) return undefined;
return pluginIds;
};
export const getPluginNameFromDatasourceId = (
state: AppState,
datasourceId: string,
): string | undefined => {
const datasource = state.entities.datasources.list.find(
2020-12-24 04:32:25 +00:00
(datasource) => datasource.id === datasourceId,
);
const plugin = state.entities.plugins.list.find(
2020-12-24 04:32:25 +00:00
(plugin) => plugin.id === datasource?.pluginId,
);
if (!plugin) return undefined;
return plugin.name;
};
export const getPluginPackageFromDatasourceId = (
state: AppState,
datasourceId: string,
): string | undefined => {
const datasource = state.entities.datasources.list.find(
2020-12-24 04:32:25 +00:00
(datasource) => datasource.id === datasourceId,
);
const plugin = state.entities.plugins.list.find(
2020-12-24 04:32:25 +00:00
(plugin) => plugin.id === datasource?.pluginId,
);
if (!plugin) return undefined;
return plugin.packageName;
};
export const getPluginNameFromId = (
state: AppState,
pluginId: string,
): string => {
const plugin = state.entities.plugins.list.find(
2020-12-24 04:32:25 +00:00
(plugin) => plugin.id === pluginId,
);
if (!plugin) return "";
return plugin.name;
};
export const getPluginForm = (state: AppState, pluginId: string): any[] => {
2020-04-29 09:23:23 +00:00
return state.entities.plugins.formConfigs[pluginId];
};
[Feature] Generate template page from datasource (#5513) - 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>
2021-07-29 08:13:10 +00:00
export const getIsFetchingSinglePluginForm = (
state: AppState,
pluginId: string,
): boolean => {
return !!state.entities.plugins.fetchingSinglePluginForm[pluginId];
};
2020-04-29 09:23:23 +00:00
export const getEditorConfig = (state: AppState, pluginId: string): any[] => {
return state.entities.plugins.editorConfigs[pluginId];
};
export const getSettingConfig = (state: AppState, pluginId: string): any[] => {
return state.entities.plugins.settingConfigs[pluginId];
};
2020-01-30 13:23:04 +00:00
export const getActions = (state: AppState): ActionDataState =>
state.entities.actions;
2020-05-19 06:10:59 +00:00
export const getDatasource = (
state: AppState,
datasourceId: string,
2020-08-26 05:24:44 +00:00
): Datasource | undefined =>
2020-05-19 06:10:59 +00:00
state.entities.datasources.list.find(
2020-12-24 04:32:25 +00:00
(datasource) => datasource.id === datasourceId,
2020-05-19 06:10:59 +00:00
);
export const getDatasourceDraft = (state: AppState, id: string) => {
const drafts = state.ui.datasourcePane.drafts;
if (id in drafts) return drafts[id];
return {};
};
Introducing Google Sheets Plugin (#3517) * cherry pick -make new * revert to enable fix from release * attempt to hook into existing datasource editor * gSheets plugin skeleton from Rest API * Changes for database migration * fix for auth code * separate it out * action page loads! * add to explorer * create action from datasource * Editor JSON WIP * working query form * Editor JSON WIP * import to * fix toast message * redirect from datasource and editor pages * fix onboarding * fix imports and constants * refactor form out * refactor queryForm * Merge branch 'release' into feature/google-sheets * Merge branch 'release' into feature/google-sheets * initial values from settings, editor and form * Check * remove dangling code around lightTheme * Safety net * remove class * try mouseover solve * force click * changes from review * fix action form name on import * Merge branch 'release' into feature/google-sheets * minor cleanup * Merge branch 'release' into feature/google-sheets * WIP * Google sheets changes * Merge conflicts * Merging and fixes, needs refactoring * Check * Merge branch 'release' into feature/google-sheets * Fixed tests * Add cloud services env variable * Clean up saga * Clean up * Refactoring * Deleted svg file * Minor fixes * Modified design to allow behaviour in google sheets methods (#3486) * Modified design to allow behaviour in google sheets methods * Review changes * Removed sysout * Added handling of edge cases with table data * Merge branch 'release' into feature/google-sheets * Fixes * Fixes * Added validations * Improved tests * Removed extraneous injected bean * Review changes * Fixed bug with method * Changes to Google sheets plugin's request and response structures (#3692) * Method changes * Removed logging * Renaming options * Reverting pom version * Modified type of collection variables, fixed errors * Converted row offset field to one that supports dynamic bindings * Review changes * List SAAS plugin type actions under lightning menu apis (#3820) * list saas plugin type actions under lightning menu apis * combine saas plugin type actions in the other sub menu of lightning menu Co-authored-by: Hetu Nandu <hetunandu@gmail.com> * Fix merge issues * Prettified query editor and a few fixes w/ ux * Test fixes * Reformatting request * code for REST added (#3876) Co-authored-by: hetunandu <hetu@appsmith.com> * Renamed body to row object * Renamed placeholder for range * Renamed range heading * Modifications to handle range semantics * Use spreadsheet Url instead of id * Ordering of methods * Removed logging * Add tests for Dynamic text controls * Add tests for url helpers * Fix coverage config * Nevermind * Interface changes * There is no body here * Yay to hints * Delete row field is separately handled as row index * placeholder support (#4001) * Fixed tests, typos and creating new sheets with random rows * Switched to using 'rowIndex' throughout * binding path added for query input field (#4016) * - Fixed QA bugs (#4032) - Split delete sheet into two - Removed dynamic query input types from hidden keys * Proper exceptions * Removed extra logging * Throw exception if update method does not match any of the columns * Same for bulk update * Zero-indexed delete row * I'm a space bound rocket ship * Logic to register installations with cs (#4062) * Logic to register installations with cs * Clean up * Casting to string * Checking to see if this makes the test pass * Added an extra null check Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-04-22 03:30:09 +00:00
export const getDatasourcesByPluginId = (
state: AppState,
id: string,
): Datasource[] => {
return state.entities.datasources.list.filter((d) => d.pluginId === id);
};
export const getPlugins = (state: AppState) => state.entities.plugins.list;
Introducing Google Sheets Plugin (#3517) * cherry pick -make new * revert to enable fix from release * attempt to hook into existing datasource editor * gSheets plugin skeleton from Rest API * Changes for database migration * fix for auth code * separate it out * action page loads! * add to explorer * create action from datasource * Editor JSON WIP * working query form * Editor JSON WIP * import to * fix toast message * redirect from datasource and editor pages * fix onboarding * fix imports and constants * refactor form out * refactor queryForm * Merge branch 'release' into feature/google-sheets * Merge branch 'release' into feature/google-sheets * initial values from settings, editor and form * Check * remove dangling code around lightTheme * Safety net * remove class * try mouseover solve * force click * changes from review * fix action form name on import * Merge branch 'release' into feature/google-sheets * minor cleanup * Merge branch 'release' into feature/google-sheets * WIP * Google sheets changes * Merge conflicts * Merging and fixes, needs refactoring * Check * Merge branch 'release' into feature/google-sheets * Fixed tests * Add cloud services env variable * Clean up saga * Clean up * Refactoring * Deleted svg file * Minor fixes * Modified design to allow behaviour in google sheets methods (#3486) * Modified design to allow behaviour in google sheets methods * Review changes * Removed sysout * Added handling of edge cases with table data * Merge branch 'release' into feature/google-sheets * Fixes * Fixes * Added validations * Improved tests * Removed extraneous injected bean * Review changes * Fixed bug with method * Changes to Google sheets plugin's request and response structures (#3692) * Method changes * Removed logging * Renaming options * Reverting pom version * Modified type of collection variables, fixed errors * Converted row offset field to one that supports dynamic bindings * Review changes * List SAAS plugin type actions under lightning menu apis (#3820) * list saas plugin type actions under lightning menu apis * combine saas plugin type actions in the other sub menu of lightning menu Co-authored-by: Hetu Nandu <hetunandu@gmail.com> * Fix merge issues * Prettified query editor and a few fixes w/ ux * Test fixes * Reformatting request * code for REST added (#3876) Co-authored-by: hetunandu <hetu@appsmith.com> * Renamed body to row object * Renamed placeholder for range * Renamed range heading * Modifications to handle range semantics * Use spreadsheet Url instead of id * Ordering of methods * Removed logging * Add tests for Dynamic text controls * Add tests for url helpers * Fix coverage config * Nevermind * Interface changes * There is no body here * Yay to hints * Delete row field is separately handled as row index * placeholder support (#4001) * Fixed tests, typos and creating new sheets with random rows * Switched to using 'rowIndex' throughout * binding path added for query input field (#4016) * - Fixed QA bugs (#4032) - Split delete sheet into two - Removed dynamic query input types from hidden keys * Proper exceptions * Removed extra logging * Throw exception if update method does not match any of the columns * Same for bulk update * Zero-indexed delete row * I'm a space bound rocket ship * Logic to register installations with cs (#4062) * Logic to register installations with cs * Clean up * Casting to string * Checking to see if this makes the test pass * Added an extra null check Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-04-22 03:30:09 +00:00
export const getPluginByPackageName = (state: AppState, name: string) =>
state.entities.plugins.list.find((p) => p.packageName === name);
export const getPluginEditorConfigs = (state: AppState) =>
state.entities.plugins.editorConfigs;
export const getPluginDependencyConfig = (state: AppState) =>
state.entities.plugins.dependencies;
export const getPluginSettingConfigs = (state: AppState, pluginId: string) =>
state.entities.plugins.settingConfigs[pluginId];
2020-12-24 04:32:25 +00:00
export const getDBPlugins = createSelector(getPlugins, (plugins) =>
plugins.filter((plugin) => plugin.type === PluginType.DB),
);
Introducing Google Sheets Plugin (#3517) * cherry pick -make new * revert to enable fix from release * attempt to hook into existing datasource editor * gSheets plugin skeleton from Rest API * Changes for database migration * fix for auth code * separate it out * action page loads! * add to explorer * create action from datasource * Editor JSON WIP * working query form * Editor JSON WIP * import to * fix toast message * redirect from datasource and editor pages * fix onboarding * fix imports and constants * refactor form out * refactor queryForm * Merge branch 'release' into feature/google-sheets * Merge branch 'release' into feature/google-sheets * initial values from settings, editor and form * Check * remove dangling code around lightTheme * Safety net * remove class * try mouseover solve * force click * changes from review * fix action form name on import * Merge branch 'release' into feature/google-sheets * minor cleanup * Merge branch 'release' into feature/google-sheets * WIP * Google sheets changes * Merge conflicts * Merging and fixes, needs refactoring * Check * Merge branch 'release' into feature/google-sheets * Fixed tests * Add cloud services env variable * Clean up saga * Clean up * Refactoring * Deleted svg file * Minor fixes * Modified design to allow behaviour in google sheets methods (#3486) * Modified design to allow behaviour in google sheets methods * Review changes * Removed sysout * Added handling of edge cases with table data * Merge branch 'release' into feature/google-sheets * Fixes * Fixes * Added validations * Improved tests * Removed extraneous injected bean * Review changes * Fixed bug with method * Changes to Google sheets plugin's request and response structures (#3692) * Method changes * Removed logging * Renaming options * Reverting pom version * Modified type of collection variables, fixed errors * Converted row offset field to one that supports dynamic bindings * Review changes * List SAAS plugin type actions under lightning menu apis (#3820) * list saas plugin type actions under lightning menu apis * combine saas plugin type actions in the other sub menu of lightning menu Co-authored-by: Hetu Nandu <hetunandu@gmail.com> * Fix merge issues * Prettified query editor and a few fixes w/ ux * Test fixes * Reformatting request * code for REST added (#3876) Co-authored-by: hetunandu <hetu@appsmith.com> * Renamed body to row object * Renamed placeholder for range * Renamed range heading * Modifications to handle range semantics * Use spreadsheet Url instead of id * Ordering of methods * Removed logging * Add tests for Dynamic text controls * Add tests for url helpers * Fix coverage config * Nevermind * Interface changes * There is no body here * Yay to hints * Delete row field is separately handled as row index * placeholder support (#4001) * Fixed tests, typos and creating new sheets with random rows * Switched to using 'rowIndex' throughout * binding path added for query input field (#4016) * - Fixed QA bugs (#4032) - Split delete sheet into two - Removed dynamic query input types from hidden keys * Proper exceptions * Removed extra logging * Throw exception if update method does not match any of the columns * Same for bulk update * Zero-indexed delete row * I'm a space bound rocket ship * Logic to register installations with cs (#4062) * Logic to register installations with cs * Clean up * Casting to string * Checking to see if this makes the test pass * Added an extra null check Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-04-22 03:30:09 +00:00
export const getDatasourceByPluginId = (state: AppState, pluginId: string) =>
state.entities.datasources.list.filter((d) => d.pluginId === pluginId);
export const getDBDatasources = createSelector(
getDBPlugins,
getEntities,
(dbPlugins, entities) => {
const datasources = entities.datasources.list;
2020-12-24 04:32:25 +00:00
const dbPluginIds = dbPlugins.map((plugin) => plugin.id);
2020-12-24 04:32:25 +00:00
return datasources.filter((datasource) =>
dbPluginIds.includes(datasource.pluginId),
);
},
);
export const getQueryName = (state: AppState, actionId: string): string => {
const action = state.entities.actions.find((action: ActionData) => {
return action.config.id === actionId;
});
return action?.config.name ?? "";
};
const getCurrentPageId = (state: AppState) =>
state.entities.pageList.currentPageId;
2020-12-24 04:32:25 +00:00
export const getDatasourcePlugins = createSelector(getPlugins, (plugins) => {
return plugins.filter((plugin) => plugin?.allowUserDatasources ?? true);
});
2020-05-05 09:03:03 +00:00
2020-12-24 04:32:25 +00:00
export const getPluginImages = createSelector(getPlugins, (plugins) => {
const pluginImages: Record<string, string> = {};
2020-12-24 04:32:25 +00:00
plugins.forEach((plugin) => {
pluginImages[plugin.id] = plugin?.iconLocation ?? ImageAlt;
});
return pluginImages;
});
2020-12-24 04:32:25 +00:00
export const getPluginTemplates = createSelector(getPlugins, (plugins) => {
const pluginTemplates: Record<string, any> = {};
2020-12-24 04:32:25 +00:00
plugins.forEach((plugin) => {
pluginTemplates[plugin.id] = plugin.templates;
});
return pluginTemplates;
});
2020-12-24 04:32:25 +00:00
export const getPluginResponseTypes = createSelector(getPlugins, (plugins) => {
const pluginResponseTypes: Record<string, any> = {};
2020-12-24 04:32:25 +00:00
plugins.forEach((plugin) => {
pluginResponseTypes[plugin.id] = plugin.responseType;
});
return pluginResponseTypes;
});
export const getPluginDocumentationLinks = createSelector(
getPlugins,
2020-12-24 04:32:25 +00:00
(plugins) => {
const pluginDocumentationLinks: Record<string, string | undefined> = {};
2020-12-24 04:32:25 +00:00
plugins.forEach((plugin) => {
pluginDocumentationLinks[plugin.id] = plugin.documentationLink;
});
return pluginDocumentationLinks;
},
);
[Feature] Generate template page from datasource (#5513) - 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>
2021-07-29 08:13:10 +00:00
export const getGenerateCRUDEnabledPluginMap = createSelector(
getPlugins,
(plugins) => {
const pluginIdGenerateCRUDPageEnabled: GenerateCRUDEnabledPluginMap = {};
// Disable google sheet plugin
plugins.map((plugin) => {
if (
plugin.generateCRUDPageComponent &&
plugin.packageName !== PLUGIN_PACKAGE_NAME.GOOGLE_SHEETS &&
plugin.packageName !== PLUGIN_PACKAGE_NAME.S3
) {
pluginIdGenerateCRUDPageEnabled[plugin.id] = plugin.packageName;
}
});
return pluginIdGenerateCRUDPageEnabled;
},
);
export const getActionsForCurrentPage = createSelector(
getCurrentPageId,
getActions,
(pageId, actions) => {
if (!pageId) return [];
2020-12-24 04:32:25 +00:00
return actions.filter((a) => a.config.pageId === pageId);
},
);
export const getQueryActionsForCurrentPage = createSelector(
getActionsForCurrentPage,
2020-12-24 04:32:25 +00:00
(actions) => {
return actions.filter((action) => {
Introducing Google Sheets Plugin (#3517) * cherry pick -make new * revert to enable fix from release * attempt to hook into existing datasource editor * gSheets plugin skeleton from Rest API * Changes for database migration * fix for auth code * separate it out * action page loads! * add to explorer * create action from datasource * Editor JSON WIP * working query form * Editor JSON WIP * import to * fix toast message * redirect from datasource and editor pages * fix onboarding * fix imports and constants * refactor form out * refactor queryForm * Merge branch 'release' into feature/google-sheets * Merge branch 'release' into feature/google-sheets * initial values from settings, editor and form * Check * remove dangling code around lightTheme * Safety net * remove class * try mouseover solve * force click * changes from review * fix action form name on import * Merge branch 'release' into feature/google-sheets * minor cleanup * Merge branch 'release' into feature/google-sheets * WIP * Google sheets changes * Merge conflicts * Merging and fixes, needs refactoring * Check * Merge branch 'release' into feature/google-sheets * Fixed tests * Add cloud services env variable * Clean up saga * Clean up * Refactoring * Deleted svg file * Minor fixes * Modified design to allow behaviour in google sheets methods (#3486) * Modified design to allow behaviour in google sheets methods * Review changes * Removed sysout * Added handling of edge cases with table data * Merge branch 'release' into feature/google-sheets * Fixes * Fixes * Added validations * Improved tests * Removed extraneous injected bean * Review changes * Fixed bug with method * Changes to Google sheets plugin's request and response structures (#3692) * Method changes * Removed logging * Renaming options * Reverting pom version * Modified type of collection variables, fixed errors * Converted row offset field to one that supports dynamic bindings * Review changes * List SAAS plugin type actions under lightning menu apis (#3820) * list saas plugin type actions under lightning menu apis * combine saas plugin type actions in the other sub menu of lightning menu Co-authored-by: Hetu Nandu <hetunandu@gmail.com> * Fix merge issues * Prettified query editor and a few fixes w/ ux * Test fixes * Reformatting request * code for REST added (#3876) Co-authored-by: hetunandu <hetu@appsmith.com> * Renamed body to row object * Renamed placeholder for range * Renamed range heading * Modifications to handle range semantics * Use spreadsheet Url instead of id * Ordering of methods * Removed logging * Add tests for Dynamic text controls * Add tests for url helpers * Fix coverage config * Nevermind * Interface changes * There is no body here * Yay to hints * Delete row field is separately handled as row index * placeholder support (#4001) * Fixed tests, typos and creating new sheets with random rows * Switched to using 'rowIndex' throughout * binding path added for query input field (#4016) * - Fixed QA bugs (#4032) - Split delete sheet into two - Removed dynamic query input types from hidden keys * Proper exceptions * Removed extra logging * Throw exception if update method does not match any of the columns * Same for bulk update * Zero-indexed delete row * I'm a space bound rocket ship * Logic to register installations with cs (#4062) * Logic to register installations with cs * Clean up * Casting to string * Checking to see if this makes the test pass * Added an extra null check Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-04-22 03:30:09 +00:00
return action.config.pluginType === PluginType.DB;
});
},
);
export const getPlugin = (state: AppState, pluginId: string) => {
2020-12-24 04:32:25 +00:00
return state.entities.plugins.list.find((plugin) => plugin.id === pluginId);
};
2020-12-24 04:32:25 +00:00
export const getActionResponses = createSelector(getActions, (actions) => {
2020-01-30 13:23:04 +00:00
const responses: Record<string, ActionResponse | undefined> = {};
2020-12-24 04:32:25 +00:00
actions.forEach((a) => {
2020-01-30 13:23:04 +00:00
responses[a.config.id] = a.data;
});
return responses;
});
export const getAction = (
state: AppState,
actionId: string,
): Action | undefined => {
2020-12-24 04:32:25 +00:00
const action = find(state.entities.actions, (a) => a.config.id === actionId);
return action ? action.config : undefined;
};
export function getCurrentPageNameByActionId(
state: AppState,
actionId: string,
): string {
2020-12-24 04:32:25 +00:00
const action = state.entities.actions.find((action) => {
return action.config.id === actionId;
});
const pageId = action ? action.config.pageId : "";
return getPageNameByPageId(state, pageId);
}
export function getPageNameByPageId(state: AppState, pageId: string): string {
const page = state.entities.pageList.pages.find(
2020-12-24 04:32:25 +00:00
(page) => page.pageId === pageId,
);
return page ? page.pageName : "";
}
const getQueryPaneSavingMap = (state: AppState) => state.ui.queryPane.isSaving;
const getApiPaneSavingMap = (state: AppState) => state.ui.apiPane.isSaving;
const getActionDirtyState = (state: AppState) => state.ui.apiPane.isDirty;
export const isActionSaving = (id: string) =>
createSelector(
[getQueryPaneSavingMap, getApiPaneSavingMap],
(querySavingMap, apiSavingsMap) => {
return (
(id in querySavingMap && querySavingMap[id]) ||
(id in apiSavingsMap && apiSavingsMap[id])
);
},
);
export const isActionDirty = (id: string) =>
2020-12-24 04:32:25 +00:00
createSelector([getActionDirtyState], (actionDirtyMap) => {
return id in actionDirtyMap && actionDirtyMap[id];
});
export const getAppData = (state: AppState) => state.entities.app;
2021-03-24 05:09:47 +00:00
export const getAppStoreData = (state: AppState): AppStoreState =>
state.entities.app.store;
export const getCanvasWidgets = (state: AppState): CanvasWidgetsReduxState =>
state.entities.canvasWidgets;
2021-03-08 08:24:12 +00:00
const getPageWidgets = (state: AppState) => state.ui.pageWidgets;
export const getCurrentPageWidgets = createSelector(
getPageWidgets,
getCurrentPageId,
(widgetsByPage, currentPageId) =>
currentPageId ? widgetsByPage[currentPageId] : {},
);
2021-03-08 08:24:12 +00:00
export const getAllWidgetsMap = createSelector(
getPageWidgets,
(widgetsByPage) => {
return Object.entries(widgetsByPage).reduce(
(res: any, [pageId, pageWidgets]: any) => {
const widgetsMap = Object.entries(pageWidgets).reduce(
(res, [widgetId, widget]: any) => {
let parentModalId;
let { parentId } = widget;
let parentWidget = pageWidgets[parentId];
while (parentId && parentId !== MAIN_CONTAINER_WIDGET_ID) {
if (parentWidget?.type === "MODAL_WIDGET") {
parentModalId = parentId;
break;
}
parentId = parentWidget?.parentId;
parentWidget = pageWidgets[parentId];
}
return {
...res,
[widgetId]: { ...widget, pageId, parentModalId },
};
},
{},
);
return {
...res,
...widgetsMap,
};
},
{},
);
},
);
export const getAllPageWidgets = createSelector(
getAllWidgetsMap,
(widgetsMap) => {
return Object.entries(widgetsMap).reduce(
(res: any[], [, widget]: any) => [...res, widget],
[],
);
},
);
export const getPageListAsOptions = createSelector(
(state: AppState) => state.entities.pageList.pages,
(pages) =>
pages.map((page) => ({
label: page.pageName,
id: page.pageId,
value: `'${page.pageName}'`,
})),
);
export const getExistingPageNames = createSelector(
(state: AppState) => state.entities.pageList.pages,
(pages) => pages.map((page) => page.pageName),
);
export const getExistingWidgetNames = createSelector(
(state: AppState) => state.entities.canvasWidgets,
(widgets) => Object.values(widgets).map((widget) => widget.pageName),
);
export const getExistingActionNames = createSelector(
(state: AppState) => state.entities.actions,
(actions) =>
actions.map((action: { config: { name: string } }) => action.config.name),
);
export const getAppMode = (state: AppState) => state.entities.app.mode;