-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat: IDE tab list search view #34759
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c6b51da
fix: Removed searchable files list
albinAppsmith 9ec92b4
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 86bc62e
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 4d8516e
feat: Added searchbar to the overflow list
albinAppsmith ac04312
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith aa4c87a
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 9600269
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 4569848
fix: cypress failures
albinAppsmith bd1a481
fix: updated test descriptions
albinAppsmith 557a0b4
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 4f17e33
chore: renamed handler as per naming convention
albinAppsmith ff0355b
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 215c162
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 257eb48
fix: code review comment
albinAppsmith b93b2e8
fix: removed unnecessary comment
albinAppsmith 7755e3a
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
albinAppsmith 126197d
fix: jest test failure
albinAppsmith c09ae9f
fix: JS render unit test
albinAppsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ | |
"d3-geo": "^3.1.0", | ||
"dayjs": "^1.10.6", | ||
"deep-diff": "^1.0.2", | ||
"design-system": "npm:@appsmithorg/[email protected].42", | ||
"design-system": "npm:@appsmithorg/[email protected].43", | ||
"design-system-old": "npm:@appsmithorg/[email protected]", | ||
"downloadjs": "^1.4.7", | ||
"echarts": "^5.4.2", | ||
|
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
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
29 changes: 29 additions & 0 deletions
29
app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx
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,29 @@ | ||
import React from "react"; | ||
import { Flex, Button, SearchInput } from "design-system"; | ||
|
||
interface Props { | ||
onAddClick: () => void; | ||
hasAddPermission: boolean; | ||
onSearch: (value: string) => void; | ||
} | ||
|
||
const AddAndSearchbar = ({ hasAddPermission, onAddClick, onSearch }: Props) => { | ||
return ( | ||
<Flex alignItems="center" flexDirection="row" gap="spaces-3" px="spaces-3"> | ||
<SearchInput onChange={onSearch} size="sm" /> | ||
{hasAddPermission ? ( | ||
<Button | ||
className="t--add-item !min-w-[24px]" | ||
data-testid="t--add-item" | ||
isIconButton | ||
kind={"secondary"} | ||
onClick={onAddClick} | ||
size={"sm"} | ||
startIcon={"add-line"} | ||
/> | ||
) : null} | ||
</Flex> | ||
); | ||
}; | ||
|
||
export { AddAndSearchbar }; |
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
47 changes: 47 additions & 0 deletions
47
app/client/src/pages/Editor/IDE/EditorPane/fuzzySearchInFiles.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,47 @@ | ||
import type { EditorSegmentList } from "@appsmith/selectors/appIDESelectors"; | ||
import { fuzzySearchInFiles } from "./utils"; | ||
import { PluginType } from "entities/Action"; | ||
|
||
const sampleFiles: EditorSegmentList = [ | ||
{ | ||
group: "Group 1", | ||
items: [ | ||
{ title: "file1.js", type: PluginType.API, key: "file1" }, | ||
{ title: "file2.js", type: PluginType.API, key: "file2" }, | ||
], | ||
}, | ||
{ | ||
group: "Group 2", | ||
items: [ | ||
{ title: "file3.js", type: PluginType.API, key: "file3" }, | ||
{ title: "file4.js", type: PluginType.API, key: "file4" }, | ||
], | ||
}, | ||
]; | ||
|
||
describe("fuzzySearchInFiles", () => { | ||
sagar-qa007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
it("should return all files when the search string is empty", () => { | ||
const result = fuzzySearchInFiles("", sampleFiles); | ||
expect(result).toEqual(sampleFiles); | ||
}); | ||
|
||
it("should return the correct file when the search string exactly matches a file title", () => { | ||
const result = fuzzySearchInFiles("file1", sampleFiles); | ||
expect(result).toEqual([ | ||
{ | ||
group: "Group 1", | ||
items: [{ title: "file1.js", type: PluginType.API, key: "file1" }], | ||
}, | ||
]); | ||
}); | ||
|
||
it("should return an empty array when no files match the search string", () => { | ||
const result = fuzzySearchInFiles("nonexistentfile", sampleFiles); | ||
expect(result).toEqual([]); | ||
}); | ||
|
||
it("should return all files containing the common substring in their titles", () => { | ||
const result = fuzzySearchInFiles("file", sampleFiles); | ||
expect(result).toEqual(sampleFiles); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,3 +1,30 @@ | ||
import Fuse from "fuse.js"; | ||
import type { EditorSegmentList } from "@appsmith/selectors/appIDESelectors"; | ||
|
||
export const createAddClassName = (name: string) => { | ||
return "t--datasoucre-create-option-" + name.toLowerCase().replace(/ /g, "_"); | ||
}; | ||
|
||
const FUSE_OPTIONS = { | ||
shouldSort: true, | ||
threshold: 0.1, | ||
keys: ["title"], | ||
}; | ||
|
||
export const fuzzySearchInFiles = ( | ||
searchStr: string, | ||
files: EditorSegmentList, | ||
) => { | ||
if (searchStr && searchStr !== "") { | ||
const newFiles = files | ||
.map((group) => { | ||
const fuse = new Fuse(group.items, FUSE_OPTIONS); | ||
const resultItems = fuse.search(searchStr); | ||
return { ...group, items: resultItems }; | ||
}) | ||
.filter((group) => group.items.length > 0); | ||
return newFiles; | ||
} | ||
|
||
return files; | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Use
data-testid
fort--add-item
instead ofclassName
.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.
Will take this up in a separate PR since this change is not introduced by this PR rather this is a change in location. Also, this update will cause updates in some cypress files as well.