Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Move entities/IDE/constants #39064

Merged
merged 13 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ankitakinger marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
16 changes: 16 additions & 0 deletions app/client/src/IDE/Interfaces/EditorTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export enum EditorEntityTab {
QUERIES = "queries",
JS = "js",
UI = "ui",
}

export enum EditorEntityTabState {
List = "List",
Edit = "Edit",
Add = "Add",
}

export enum EditorViewMode {
FullScreen = "FullScreen",
SplitScreen = "SplitScreen",
}
8 changes: 8 additions & 0 deletions app/client/src/IDE/Interfaces/UseRoutes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ComponentType } from "react";

export type UseRoutes = Array<{
key: string;
component: ComponentType;
path: string[];
exact: boolean;
}>;
41 changes: 41 additions & 0 deletions app/client/src/IDE/constants/SidebarButtons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type { IDESidebarButton } from "@appsmith/ads";
import { EditorState } from "../enums";

const SidebarButtonTitles = {
EDITOR: "Editor",
DATA: "Datasources",
SETTINGS: "Settings",
LIBRARIES: "Libraries",
};

export const EditorButton = (urlSuffix: string): IDESidebarButton => ({
state: EditorState.EDITOR,
icon: "editor-v3",
title: SidebarButtonTitles.EDITOR,
testId: SidebarButtonTitles.EDITOR,
urlSuffix,
});

export const DataButton = (urlSuffix: string): IDESidebarButton => ({
state: EditorState.DATA,
icon: "datasource-v3",
tooltip: SidebarButtonTitles.DATA,
testId: SidebarButtonTitles.DATA,
urlSuffix,
});

export const LibrariesButton = (urlSuffix: string): IDESidebarButton => ({
state: EditorState.LIBRARIES,
icon: "packages-v3",
tooltip: SidebarButtonTitles.LIBRARIES,
testId: SidebarButtonTitles.LIBRARIES,
urlSuffix,
});

export const SettingsButton = (urlSuffix: string): IDESidebarButton => ({
state: EditorState.SETTINGS,
icon: "settings-v3",
tooltip: SidebarButtonTitles.SETTINGS,
testId: SidebarButtonTitles.SETTINGS,
urlSuffix,
});
7 changes: 7 additions & 0 deletions app/client/src/IDE/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ export enum Condition {
// Error = "Error",
// Success = "Success",
}

export enum EditorState {
DATA = "DATA",
EDITOR = "EDITOR",
SETTINGS = "SETTINGS",
LIBRARIES = "LIBRARIES",
}
2 changes: 1 addition & 1 deletion app/client/src/IDE/hooks/useIsInSideBySideEditor.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { renderHook, act } from "@testing-library/react-hooks/dom";
import { Provider } from "react-redux";
import { EditorViewMode } from "ee/entities/IDE/constants";
import { EditorViewMode } from "IDE/Interfaces/EditorTypes";
import { useIsInSideBySideEditor } from "./useIsInSideBySideEditor";
import { getIDETestState } from "test/factories/AppIDEFactoryUtils";
import type { AppState } from "ee/reducers";
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/actions/ideActions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EditorViewMode } from "ee/entities/IDE/constants";
import type { EditorViewMode } from "IDE/Interfaces/EditorTypes";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import type { ParentEntityIDETabs } from "../reducers/uiReducers/ideReducer";

Expand Down
13 changes: 13 additions & 0 deletions app/client/src/ce/IDE/Interfaces/EntityItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { PluginType } from "../../../entities/Plugin";
import type { ReactNode } from "react";

export interface EntityItem {
title: string;
type: PluginType;
key: string;
icon?: ReactNode;
group?: string;
userPermissions?: string[];
}

export interface GenericEntityItem extends Omit<EntityItem, "type"> {}
6 changes: 6 additions & 0 deletions app/client/src/ce/IDE/Interfaces/IDETypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const IDE_TYPE = {
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved
None: "None",
App: "App",
} as const;

export type IDEType = keyof typeof IDE_TYPE;
44 changes: 44 additions & 0 deletions app/client/src/ce/IDE/constants/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
ADD_PATH,
API_EDITOR_ID_ADD_PATH,
API_EDITOR_ID_PATH,
BUILDER_CUSTOM_PATH,
BUILDER_PATH,
BUILDER_PATH_DEPRECATED,
DATA_SOURCES_EDITOR_ID_PATH,
ENTITY_PATH,
INTEGRATION_EDITOR_PATH,
JS_COLLECTION_ID_ADD_PATH,
JS_COLLECTION_ID_PATH,
QUERIES_EDITOR_ID_ADD_PATH,
QUERIES_EDITOR_ID_PATH,
WIDGETS_EDITOR_ID_PATH,
} from "ee/constants/routes/appRoutes";
import {
SAAS_EDITOR_API_ID_ADD_PATH,
SAAS_EDITOR_API_ID_PATH,
SAAS_EDITOR_DATASOURCE_ID_PATH,
} from "pages/Editor/SaaSEditor/constants";

import { IDE_TYPE, type IDEType } from "../Interfaces/IDETypes";

export const EntityPaths: string[] = [
API_EDITOR_ID_ADD_PATH,
API_EDITOR_ID_PATH,
QUERIES_EDITOR_ID_ADD_PATH,
QUERIES_EDITOR_ID_PATH,
DATA_SOURCES_EDITOR_ID_PATH,
INTEGRATION_EDITOR_PATH,
SAAS_EDITOR_DATASOURCE_ID_PATH,
SAAS_EDITOR_API_ID_ADD_PATH,
SAAS_EDITOR_API_ID_PATH,
JS_COLLECTION_ID_PATH,
JS_COLLECTION_ID_ADD_PATH,
WIDGETS_EDITOR_ID_PATH,
WIDGETS_EDITOR_ID_PATH + ADD_PATH,
ENTITY_PATH,
];
export const IDEBasePaths: Readonly<Record<IDEType, string[]>> = {
[IDE_TYPE.None]: [],
[IDE_TYPE.App]: [BUILDER_PATH, BUILDER_PATH_DEPRECATED, BUILDER_CUSTOM_PATH],
};
2 changes: 1 addition & 1 deletion app/client/src/ce/IDE/hooks/useParentEntityInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionParentEntityType } from "ee/entities/Engine/actionHelpers";
import type { IDEType } from "ee/entities/IDE/constants";
import type { IDEType } from "ee/IDE/Interfaces/IDETypes";
import { useSelector } from "react-redux";
import {
getCurrentApplicationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { usePluginActionContext } from "PluginActionEditor/PluginActionContext";
import type { BottomTab } from "components/editorComponents/EntityBottomTabs";
import { getIDEViewMode } from "selectors/ideSelectors";
import { useSelector } from "react-redux";
import { EditorViewMode, IDE_TYPE } from "ee/entities/IDE/constants";
import { EditorViewMode } from "IDE/Interfaces/EditorTypes";
import { IDE_TYPE } from "ee/IDE/Interfaces/IDETypes";
import { DEBUGGER_TAB_KEYS } from "components/editorComponents/Debugger/constants";
import {
createMessage,
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/ce/actions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
saveActionName,
} from "actions/pluginActionActions";
import { saveJSObjectName } from "actions/jsActionActions";
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants";
import { IDE_TYPE, type IDEType } from "ee/IDE/Interfaces/IDETypes";

export const createNewQueryBasedOnParentEntity = (
entityId: string,
Expand Down
141 changes: 0 additions & 141 deletions app/client/src/ce/entities/IDE/constants.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants";
import { IDE_TYPE, type IDEType } from "ee/IDE/Interfaces/IDETypes";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { useSelector } from "react-redux";
import { getPagePermissions } from "selectors/editorSelectors";
Expand Down
8 changes: 5 additions & 3 deletions app/client/src/ce/entities/IDE/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { IDEType, EditorState } from "ee/entities/IDE/constants";
import { IDE_TYPE, IDEBasePaths } from "ee/entities/IDE/constants";
import type { EditorState } from "IDE/enums";
import { IDE_TYPE, type IDEType } from "ee/IDE/Interfaces/IDETypes";
import { IDEBasePaths } from "ee/IDE/constants/routes";
import { matchPath } from "react-router";
import { identifyEntityFromPath } from "navigation/FocusEntity";
import {
Expand All @@ -9,7 +10,8 @@ import {
} from "ee/constants/routes/appRoutes";
import { saveActionName } from "actions/pluginActionActions";
import { saveJSObjectName } from "actions/jsActionActions";
import { EditorEntityTab, type EntityItem } from "ee/entities/IDE/constants";
import { EditorEntityTab } from "IDE/Interfaces/EditorTypes";
import type { EntityItem } from "ee/IDE/Interfaces/EntityItem";
import { getHasManageActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";

export interface SaveEntityName {
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/ce/hooks/datasourceEditorHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { isEnabledForPreviewData } from "utils/editorContextUtils";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
import { openGeneratePageModal } from "pages/Editor/GeneratePage/store/generatePageActions";
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants";
import { IDE_TYPE, type IDEType } from "ee/IDE/Interfaces/IDETypes";

export interface HeaderActionProps {
datasource: Datasource | ApiDatasourceForm | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
FocusStoreHierarchy,
identifyEntityFromPath,
} from "navigation/FocusEntity";
import { EditorState } from "ee/entities/IDE/constants";
import { EditorState } from "IDE/enums";
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import {
datasourcesEditorURL,
Expand Down
3 changes: 1 addition & 2 deletions app/client/src/ce/navigation/FocusStrategy/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { IDEType } from "ee/entities/IDE/constants";
import { IDE_TYPE } from "ee/entities/IDE/constants";
import { IDE_TYPE, type IDEType } from "ee/IDE/Interfaces/IDETypes";
import { AppIDEFocusStrategy } from "./AppIDEFocusStrategy";
import { NoIDEFocusStrategy } from "./NoIDEFocusStrategy";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import type { EntityItem } from "ee/entities/IDE/constants";
import type { EntityItem } from "ee/IDE/Interfaces/EntityItem";
import { JSEntityItem } from "pages/Editor/IDE/EditorPane/JS/EntityItem/JSEntityItem";

export const JSEntity = (props: { item: EntityItem }) => {
Expand Down
Loading
Loading