Skip to content

Commit dddc6f1

Browse files
authored
chore: Adding permission check for the plus button in tabs list (#39694)
## Description Adding permission check for the plus button in tabs list to handle the edge case in GAC where we see a new query tab with no datasource options in the page to create one. Fixes [#39673](#39673) ## Automation /ok-to-test tags="@tag.IDE" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13811690526> > Commit: 6501918 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13811690526&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 12 Mar 2025 13:19:18 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced the editor’s tab behavior so the "Add" button is only displayed when files are present and the user has the appropriate permissions. - **Style** - Refined the display styling of push failure warnings for a cleaner appearance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 998f890 commit dddc6f1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

app/client/src/pages/AppIDE/layouts/components/EditorTabs/index.tsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import { ScreenModeToggle } from "./ScreenModeToggle";
2828
import { EditableTab } from "./EditableTab";
2929
import { TabSelectors } from "./constants";
3030
import { AddTab } from "./AddTab";
31+
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
32+
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
33+
import { getPagePermissions } from "selectors/editorSelectors";
34+
import { getHasCreateActionPermission } from "ee/utils/BusinessFeatures/permissionPageHelpers";
3135

3236
const EditorTabs = () => {
3337
const location = useLocation();
@@ -42,9 +46,19 @@ const EditorTabs = () => {
4246
const [showNudge, dismissNudge] = useShowSideBySideNudge();
4347
const { addClickHandler } = useIDETabClickHandlers();
4448
const isJSLoading = useIsJSAddLoading();
45-
const hideAdd = segmentMode === EditorEntityTabState.Add || !files.length;
4649

4750
const currentEntity = identifyEntityFromPath(location.pathname);
51+
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
52+
const pagePermissions = useSelector(getPagePermissions);
53+
const canCreateActions = getHasCreateActionPermission(
54+
isFeatureEnabled,
55+
pagePermissions,
56+
);
57+
const hideAdd =
58+
segmentMode === EditorEntityTabState.Add ||
59+
!files.length ||
60+
!canCreateActions;
61+
4862
const showEntityListButton =
4963
ideViewMode === EditorViewMode.SplitScreen && files.length > 0;
5064

app/client/src/pages/Editor/gitSync/components/PushFailedWarning.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Container = styled.div`
1111
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1212
export default function PushFailedWarning({ closeHandler, error }: any) {
1313
return (
14-
<Container className="ankita">
14+
<Container>
1515
<Callout isClosable kind="error" onClose={closeHandler}>
1616
<>
1717
<Text type={TextType.H5}>{error.errorType}</Text>

0 commit comments

Comments
 (0)