forked from appsmithorg/appsmith
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring usage of editorType to ideType to remove code duplication
- Loading branch information
1 parent
2ca5993
commit dfe8f5c
Showing
60 changed files
with
303 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ActionParentEntityType } from "ee/entities/Engine/actionHelpers"; | ||
import type { IDEType } from "ee/entities/IDE/constants"; | ||
import { useSelector } from "react-redux"; | ||
import { | ||
getCurrentApplicationId, | ||
getCurrentBasePageId, | ||
} from "selectors/editorSelectors"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export const useParentEntityInfo = (ideType: IDEType) => { | ||
const appId = useSelector(getCurrentApplicationId); | ||
const basePageId = useSelector(getCurrentBasePageId); | ||
|
||
return { | ||
editorId: appId || "", | ||
parentEntityId: basePageId || "", | ||
parentEntityType: ActionParentEntityType.PAGE, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/client/src/ce/entities/IDE/hooks/useCreateActionsPermissions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; | ||
import { IDE_TYPE, type IDEType } from "ee/entities/IDE/constants"; | ||
import { FEATURE_FLAG } from "ee/entities/FeatureFlag"; | ||
import { useSelector } from "react-redux"; | ||
import { getPagePermissions } from "selectors/editorSelectors"; | ||
import { getHasCreateActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers"; | ||
|
||
export const useCreateActionsPermissions = (ideType: IDEType) => { | ||
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled); | ||
const pagePermissions = useSelector(getPagePermissions); | ||
|
||
switch (ideType) { | ||
case IDE_TYPE.App: { | ||
return getHasCreateActionPermission(isFeatureEnabled, pagePermissions); | ||
} | ||
default: { | ||
return true; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSEntityItemUrl.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { getJSEntityItemUrl } from "./getJSEntityItemUrl"; | ||
import urlBuilder from "ee/entities/URLRedirect/URLAssembly"; | ||
import { PluginType } from "entities/Plugin"; | ||
|
||
describe("getJSEntityItemUrl", () => { | ||
urlBuilder.setCurrentBasePageId("0123456789abcdef00000000"); | ||
it("returns a JS url", () => { | ||
const url = getJSEntityItemUrl( | ||
{ | ||
title: "TestTitle", | ||
key: "abc", | ||
type: PluginType.JS, | ||
}, | ||
"0123456789abcdef00000000", | ||
); | ||
|
||
expect(url).toEqual( | ||
"/app/application/page-0123456789abcdef00000000/edit/jsObjects/abc", | ||
); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/utils/getJSEntityItemUrl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { EntityItem } from "ee/entities/IDE/constants"; | ||
import { jsCollectionIdURL } from "ee/RouteBuilder"; | ||
|
||
export const getJSEntityItemUrl = ( | ||
item: EntityItem, | ||
basePageId: string, | ||
): string => { | ||
return jsCollectionIdURL({ | ||
baseCollectionId: item.key, | ||
basePageId, | ||
}); | ||
}; |
21 changes: 1 addition & 20 deletions
21
...es/Editor/IDE/EditorPane/JS/utils.test.ts → .../IDE/EditorPane/JS/utils/getJSUrl.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...e/pages/Editor/IDE/EditorPane/JS/utils.ts → ...ditor/IDE/EditorPane/JS/utils/getJSUrl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.