-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: Adding create permission check for the plus button on tabs list #39672
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
Changes from 10 commits
56ceaf6
d205485
b401fbc
4b6aa3a
3ef148c
582e567
65984cd
10f4a6d
1103ce8
6d8086b
b15dd32
eab2050
d0df6c6
0df8c33
f26e5f4
f26de0a
7bc2574
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import type { FocusEntityInfo } from "navigation/FocusEntity"; | ||
| import type { FocusEntity } from "navigation/FocusEntity"; | ||
| import type { FocusElementConfig } from "navigation/FocusElements"; | ||
| import type { AppsmithLocationState } from "utils/history"; | ||
|
|
||
| export interface FocusPath { | ||
| key: string; | ||
| entityInfo: FocusEntityInfo; | ||
| } | ||
|
|
||
| export type FocusElementsConfigList = { | ||
| [key in FocusEntity]?: FocusElementConfig[]; | ||
| }; | ||
|
|
||
| export interface FocusStrategy { | ||
| focusElements: FocusElementsConfigList; | ||
| /** based on the route change, what states need to be set in the upcoming route **/ | ||
| getEntitiesForSet: ( | ||
| previousPath: string, | ||
| currentPath: string, | ||
| state: AppsmithLocationState, | ||
| // TODO: Fix this the next time the file is edited | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| ) => Generator<any, Array<FocusPath>, any>; | ||
| /** based on the route change, what states need to be stored for the previous route **/ | ||
| getEntitiesForStore: ( | ||
| path: string, | ||
| currentPath: string, | ||
| // TODO: Fix this the next time the file is edited | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| ) => Generator<any, Array<FocusPath>, any>; | ||
| /** For entities with hierarchy, return the parent entity path for storing its state **/ | ||
| getEntityParentUrl: ( | ||
| entityInfo: FocusEntityInfo, | ||
| parentEntity: FocusEntity, | ||
| ) => string; | ||
| /** Define a wait (saga) before we start setting states **/ | ||
| waitForPathLoad: ( | ||
| currentPath: string, | ||
| previousPath: string, | ||
| // TODO: Fix this the next time the file is edited | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| ) => Generator<any, void, any>; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from "ce/navigation/AppIDEFocusSetters"; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from "ce/navigation/FocusStrategy/types"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,46 +22,10 @@ import { getIDETypeByUrl } from "ee/entities/IDE/utils"; | |
| import { getIDEFocusStrategy } from "ee/navigation/FocusStrategy"; | ||
| import { IDE_TYPE } from "ee/IDE/Interfaces/IDETypes"; | ||
| import { selectGitApplicationCurrentBranch } from "selectors/gitModSelectors"; | ||
|
|
||
| export interface FocusPath { | ||
| key: string; | ||
| entityInfo: FocusEntityInfo; | ||
| } | ||
|
|
||
| export type FocusElementsConfigList = { | ||
| [key in FocusEntity]?: FocusElementConfig[]; | ||
| }; | ||
|
|
||
| export interface FocusStrategy { | ||
| focusElements: FocusElementsConfigList; | ||
| /** based on the route change, what states need to be set in the upcoming route **/ | ||
| getEntitiesForSet: ( | ||
| previousPath: string, | ||
| currentPath: string, | ||
| state: AppsmithLocationState, | ||
| // TODO: Fix this the next time the file is edited | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| ) => Generator<any, Array<FocusPath>, any>; | ||
| /** based on the route change, what states need to be stored for the previous route **/ | ||
| getEntitiesForStore: ( | ||
| path: string, | ||
| currentPath: string, | ||
| // TODO: Fix this the next time the file is edited | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| ) => Generator<any, Array<FocusPath>, any>; | ||
| /** For entities with hierarchy, return the parent entity path for storing its state **/ | ||
| getEntityParentUrl: ( | ||
| entityInfo: FocusEntityInfo, | ||
| parentEntity: FocusEntity, | ||
| ) => string; | ||
| /** Define a wait (saga) before we start setting states **/ | ||
| waitForPathLoad: ( | ||
| currentPath: string, | ||
| previousPath: string, | ||
| // TODO: Fix this the next time the file is edited | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| ) => Generator<any, void, any>; | ||
| } | ||
| import type { | ||
| FocusPath, | ||
| FocusStrategy, | ||
| } from "ee/navigation/FocusStrategy/types"; | ||
|
|
||
| /** | ||
| * Context switching works by restoring the states of ui elements to as they were | ||
|
|
@@ -139,7 +103,11 @@ class FocusRetention { | |
| parentElement, | ||
| ); | ||
|
|
||
| removeKeys.push(`${parentPath}#${branch}`); | ||
| if (focusEntityInfo.params.basePageId) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a implicit configuration which does something separately for AppIDE vs other IDEs. Since other IDEs could also have git, we should find a better way to identify this. I this the |
||
| removeKeys.push(`${parentPath}#${branch}`); | ||
| } else { | ||
| removeKeys.push(parentPath); | ||
| } | ||
| } | ||
|
|
||
| for (const key of removeKeys) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Interface methods are well-documented.
The FocusStrategy interface methods are clearly documented with comments explaining their purpose. The TODO comments for fixing ESLint disables should be addressed in a future update.
Keep track of these TODOs for future updates:
🌐 Web query:
💡 Result:
To avoid
@typescript-eslint/no-explicit-anyin generator function signatures while maintaining type safety, consider these best practices:Use Precise Type Annotations
Replace
anywith specific types in generator parameters and yield expressions:This specifies:
numbervoidnext():stringLeverage
unknownfor Unknown TypesWhen types aren't immediately known:
Use Interface Contracts
Define explicit interfaces for complex parameters:
Enable Complementary ESLint Rules
Strengthen type safety with these related rules:
no-unsafe-argumentanyto functionsno-unsafe-returnanyfrom generatorsno-unsafe-assignmentanyassignmentsGenerator-Specific Patterns
Migration Strategy
@typescript-eslint/no-explicit-anywith strict mode--fixwithfixToUnknown: trueoption[1]unknownwith specific typesReturnTypeandYieldTypehelpers:By combining these techniques, you maintain generator flexibility while eliminating unsafe
anyusage. The TypeScript 3.6+Generatortype provides strict type checking for yield/return/next interactions[14], and when combined with proper ESLint configuration, ensures comprehensive type safety across generator lifecycle operations.Citations:
anytypescript-eslint/typescript-eslint#1071Action Required: Update Generator Signatures for Strict Typing
The interface is well-documented; however, both generator methods currently use explicit
anytypes (temporarily suppressed by ESLint) that could be improved. In light of best practices, please consider updating the signatures forgetEntitiesForSetandgetEntitiesForStoreas follows:Replace
anywith precise types:Instead of using
Generator<any, Array<FocusPath>, any>, annotate the generator with clear types for the yielded value, the return value, and the value accepted by.next(). For example, if the generator yields values of typeYieldType, returns anArray<FocusPath>, and accepts inputs of typeNextType, use:Consider using
unknownwhen appropriate:If a type isn’t immediately known or can vary, using
unknownin place ofanycan preserve type safety until a more specific type can be determined.Plan for a gradual refactor:
Address these TODO comments by replacing the ESLint suppressions with proper type annotations based on your generator’s logic. This will improve maintainability and enforce stricter type checking.
Please keep track of these TODOs for a future update.