Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitakinger committed Jan 20, 2025
1 parent dad304b commit 5aa02b8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import type { IDEType, EditorState } from "ee/entities/IDE/constants";
import {
defaultActionMenuItems,
Expand All @@ -16,9 +15,6 @@ import { saveActionName } from "actions/pluginActionActions";
import { saveJSObjectName } from "actions/jsActionActions";
import { EditorEntityTab, type EntityItem } from "ee/entities/IDE/constants";
import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
import type { Action } from "entities/Action";
import EntityContextMenu from "pages/Editor/IDE/EditorPane/Query/ListItem/EntityContextMenu";
import { AppQueryContextMenuItems } from "pages/Editor/IDE/EditorPane/Query/ListItem/AppQueryContextMenuItems";

export interface SaveEntityName {
params: {
Expand Down Expand Up @@ -90,18 +86,3 @@ export const getMenuItemsForActionEntityByIdeType = (ideType: IDEType) => {
return defaultActionMenuItems;
}
};

export const getActionContextMenuByIdeType = (
ideType: IDEType,
action: Action,
) => {
switch (ideType) {
case IDE_TYPE.App: {
return (
<EntityContextMenu
menuContent={<AppQueryContextMenuItems action={action} />}
/>
);
}
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { EntityItem } from "ee/entities/IDE/constants";
import React from "react";
import {
IDE_TYPE,
type EntityItem,
type IDEType,
} from "ee/entities/IDE/constants";
import { getActionConfig } from "pages/Editor/Explorer/Actions/helpers";
import type { FocusEntityInfo } from "navigation/FocusEntity";
import {
Expand All @@ -8,8 +13,9 @@ import {
queryListURL,
saasEditorApiIdURL,
} from "ee/RouteBuilder";
import type { ActionParentEntityTypeInterface } from "ee/entities/Engine/actionHelpers";
import { ActionEntityContextMenuItemsEnum } from "pages/Editor/Explorer/Files/FilesContextProvider";
import type { Action } from "entities/Action";
import EntityContextMenu from "pages/Editor/IDE/EditorPane/Query/ListItem/EntityContextMenu";
import { AppQueryContextMenuItems } from "pages/Editor/IDE/EditorPane/Query/ListItem/AppQueryContextMenuItems";

export const getQueryEntityItemUrl = (
item: EntityItem,
Expand Down Expand Up @@ -57,22 +63,17 @@ export const getQueryUrl = (
: queryListURL({ basePageId: item.params.basePageId });
};

export const getMenuItemsForActionEntityByParentType = (
parentEntityType: ActionParentEntityTypeInterface,
export const getQueryContextMenuByIdeType = (
ideType: IDEType,
action: Action,
) => {
const defaultMenuItems = [
ActionEntityContextMenuItemsEnum.RENAME,
ActionEntityContextMenuItemsEnum.DELETE,
ActionEntityContextMenuItemsEnum.SHOW_BINDING,
ActionEntityContextMenuItemsEnum.COPY,
ActionEntityContextMenuItemsEnum.MOVE,
ActionEntityContextMenuItemsEnum.CONVERT_QUERY_MODULE_INSTANCE,
];

switch (parentEntityType) {
case "PAGE":
return defaultMenuItems;
default:
return defaultMenuItems;
switch (ideType) {
case IDE_TYPE.App: {
return (
<EntityContextMenu
menuContent={<AppQueryContextMenuItems action={action} />}
/>
);
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ import { saveActionNameBasedOnIdeType } from "ee/actions/helpers";
import { useNameEditorState } from "pages/Editor/IDE/EditorPane/hooks/useNameEditorState";
import { useValidateEntityName } from "IDE";
import { useLocation } from "react-router";
import {
getActionContextMenuByIdeType,
getIDETypeByUrl,
} from "ee/entities/IDE/utils";
import { getIDETypeByUrl } from "ee/entities/IDE/utils";
import { getActionConfig } from "pages/Editor/Explorer/Actions/helpers";
import { useActiveActionBaseId } from "ee/pages/Editor/Explorer/hooks";
import { PluginType } from "entities/Plugin";
import { useParentEntityInfo } from "ee/IDE/hooks/useParentEntityInfo";
import { getQueryContextMenuByIdeType } from "ee/pages/Editor/IDE/EditorPane/Query/utils";

export const QueryEntityItem = ({ item }: { item: EntityItemProps }) => {
const action = useSelector((state: AppState) =>
Expand All @@ -48,7 +46,7 @@ export const QueryEntityItem = ({ item }: { item: EntityItemProps }) => {

const validateName = useValidateEntityName({});
const dispatch = useDispatch();
const contextMenu = getActionContextMenuByIdeType(ideType, action);
const contextMenu = getQueryContextMenuByIdeType(ideType, action);

const actionPermissions = action.userPermissions || [];

Expand Down

0 comments on commit 5aa02b8

Please sign in to comment.