fix: Removed Datasources from Execute Query Action List.

This commit is contained in:
Arsalan 2022-02-23 17:28:50 +05:30
parent 64a9fd451b
commit 5b892ec3fa

View File

@ -1,13 +1,10 @@
import { createActionRequest } from "actions/pluginActionActions";
import { createModalAction } from "actions/widgetActions"; import { createModalAction } from "actions/widgetActions";
import { TreeDropdownOption } from "components/ads/TreeDropdown"; import { TreeDropdownOption } from "components/ads/TreeDropdown";
import TreeStructure from "components/utils/TreeStructure"; import TreeStructure from "components/utils/TreeStructure";
import { PluginType } from "entities/Action"; import { PluginType } from "entities/Action";
import { Datasource } from "entities/Datasource";
import { isString, keyBy } from "lodash"; import { isString, keyBy } from "lodash";
import { getActionConfig } from "pages/Editor/Explorer/Actions/helpers"; import { getActionConfig } from "pages/Editor/Explorer/Actions/helpers";
import { import {
getPluginIcon,
JsFileIconV2, JsFileIconV2,
jsFunctionIcon, jsFunctionIcon,
} from "pages/Editor/Explorer/ExplorerIcons"; } from "pages/Editor/Explorer/ExplorerIcons";
@ -21,7 +18,6 @@ import {
} from "selectors/editorSelectors"; } from "selectors/editorSelectors";
import { import {
getActionsForCurrentPage, getActionsForCurrentPage,
getDBDatasources,
getJSCollectionsForCurrentPage, getJSCollectionsForCurrentPage,
getPageListAsOptions, getPageListAsOptions,
} from "selectors/entitiesSelector"; } from "selectors/entitiesSelector";
@ -29,7 +25,6 @@ import {
getModalDropdownList, getModalDropdownList,
getNextModalName, getNextModalName,
} from "selectors/widgetSelectors"; } from "selectors/widgetSelectors";
import { createNewQueryName } from "utils/AppsmithUtils";
import Fields, { import Fields, {
ACTION_ANONYMOUS_FUNC_REGEX, ACTION_ANONYMOUS_FUNC_REGEX,
ACTION_TRIGGER_REGEX, ACTION_TRIGGER_REGEX,
@ -416,7 +411,6 @@ function getIntegrationOptionsWithChildren(
options: TreeDropdownOption[], options: TreeDropdownOption[],
actions: ActionDataState, actions: ActionDataState,
jsActions: Array<JSCollectionData>, jsActions: Array<JSCollectionData>,
datasources: Datasource[],
createIntegrationOption: TreeDropdownOption, createIntegrationOption: TreeDropdownOption,
dispatch: any, dispatch: any,
) { ) {
@ -475,34 +469,6 @@ function getIntegrationOptionsWithChildren(
), ),
} as TreeDropdownOption); } as TreeDropdownOption);
}); });
datasources.forEach((dataSource: Datasource) => {
(option.children as TreeDropdownOption[]).push({
label: dataSource.name,
id: dataSource.id,
value: dataSource.name,
type: option.value,
icon: getPluginIcon(plugins[dataSource.pluginId]) as React.ReactNode,
onSelect: () => {
const newQueryName = createNewQueryName(actions, pageId);
dispatch(
createActionRequest({
name: newQueryName,
pageId,
datasource: {
id: dataSource.id,
},
eventData: {
actionType: "Query",
from: "home-screen",
dataSource: dataSource.name,
},
pluginId: dataSource.pluginId,
actionConfiguration: {},
}),
);
},
} as TreeDropdownOption);
});
} }
if (isJSEditorEnabled && jsOption) { if (isJSEditorEnabled && jsOption) {
jsOption.children = [createJSObject]; jsOption.children = [createJSObject];
@ -561,7 +527,6 @@ function getIntegrationOptionsWithChildren(
function useIntegrationsOptionTree() { function useIntegrationsOptionTree() {
const pageId = useSelector(getCurrentPageId) || ""; const pageId = useSelector(getCurrentPageId) || "";
const applicationId = useSelector(getCurrentApplicationId) as string; const applicationId = useSelector(getCurrentApplicationId) as string;
const datasources: Datasource[] = useSelector(getDBDatasources);
const dispatch = useDispatch(); const dispatch = useDispatch();
const plugins = useSelector((state: AppState) => { const plugins = useSelector((state: AppState) => {
return state.entities.plugins.list; return state.entities.plugins.list;
@ -577,7 +542,6 @@ function useIntegrationsOptionTree() {
getBaseOptions(), getBaseOptions(),
actions, actions,
jsActions, jsActions,
datasources,
{ {
label: "New Query", label: "New Query",
value: "datasources", value: "datasources",