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

fix: In the search results we can see the list of applicaions but not the workspaces which it belongs too #36367

Closed
Show file tree
Hide file tree
Changes from all 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
46 changes: 26 additions & 20 deletions app/client/src/pages/common/SearchBar/ApplicationSearchItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ const CircleAppIcon = styled(AppIcon)`
interface Props {
applicationsList: ApplicationPayload[] | undefined;
navigateToApplication: (id: string) => void;
selectedWorkspaceId: string;
}

const ApplicationSearchItem = (props: Props) => {
const { applicationsList, navigateToApplication } = props;
const { applicationsList, navigateToApplication, selectedWorkspaceId } =
props;

if (!applicationsList || applicationsList?.length === 0) return null;

Expand All @@ -34,25 +36,29 @@ const ApplicationSearchItem = (props: Props) => {
<Text className="!mb-2 !block" kind="body-s">
Applications
</Text>
{applicationsList.map((application: ApplicationPayload) => (
<SearchListItem
data-testId={application.name}
key={application.id}
onClick={() => navigateToApplication(application.id)}
>
<CircleAppIcon
className="!mr-1"
name={
(application?.icon ||
getApplicationIcon(application.id)) as AppIconName
}
size={Size.xxs}
/>
<Text className="truncate" kind="body-m">
{application.name}
</Text>
</SearchListItem>
))}
{applicationsList.map((application: ApplicationPayload) => {
a6hishekpandey marked this conversation as resolved.
Show resolved Hide resolved
return (
application.workspaceId === selectedWorkspaceId && (
<SearchListItem
data-testId={application.name}
key={application.id}
onClick={() => navigateToApplication(application.id)}
>
<CircleAppIcon
className="!mr-1"
name={
(application?.icon ||
getApplicationIcon(application.id)) as AppIconName
}
size={Size.xxs}
/>
<Text className="truncate" kind="body-m">
{application.name}
</Text>
</SearchListItem>
)
);
})}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const DesktopEntitySearchField = (props: any) => {
setIsDropdownOpen,
workflowsList,
workspacesList,
selectedWorkspaceId,
} = props;

const isHomePage = useRouteMatch("/applications")?.isExact;
Expand Down Expand Up @@ -97,6 +98,7 @@ const DesktopEntitySearchField = (props: any) => {
<ApplicationSearchItem
applicationsList={applicationsList}
navigateToApplication={navigateToApplication}
selectedWorkspaceId={selectedWorkspaceId}
/>
<PackageSearchItem searchedPackages={searchedPackages} />
<WorkflowSearchItem workflowsList={workflowsList} />
Expand Down
4 changes: 4 additions & 0 deletions app/client/src/pages/common/SearchBar/EntitySearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
getSearchedWorkflows,
getSearchedWorkspaces,
} from "ee/selectors/workspaceSelectors";
import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors";
import DesktopEntitySearchField from "pages/common/SearchBar/DesktopEntitySearchField";
import MobileEntitySearchField from "pages/common/SearchBar/MobileEntitySearchField";
import { getPackagesList } from "ee/selectors/packageSelectors";
Expand Down Expand Up @@ -81,6 +82,7 @@ function EntitySearchBar(props: any) {
const location = useLocation();
const searchListContainerRef = useRef(null);
const searchInputRef = useRef(null);
const selectedWorkspaceId = useSelector(getCurrentWorkspaceId);

useEffect(() => {
if (searchInput.trim().length > 0) {
Expand Down Expand Up @@ -194,6 +196,7 @@ function EntitySearchBar(props: any) {
setShowMobileSearchBar={setShowMobileSearchBar}
workflowsList={workflowsList}
workspacesList={workspacesList}
selectedWorkspaceId={selectedWorkspaceId}
/>
) : (
<>
Expand Down Expand Up @@ -255,6 +258,7 @@ function EntitySearchBar(props: any) {
setIsDropdownOpen={setIsDropdownOpen}
workflowsList={workflowsList}
workspacesList={workspacesList}
selectedWorkspaceId={selectedWorkspaceId}
/>
))}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function MobileEntitySearchField(props: any) {
setShowMobileSearchBar,
workflowsList,
workspacesList,
selectedWorkspaceId,
} = props;

const isHomePage = useRouteMatch("/applications")?.isExact;
Expand Down Expand Up @@ -106,6 +107,7 @@ function MobileEntitySearchField(props: any) {
<ApplicationSearchItem
applicationsList={applicationsList}
navigateToApplication={navigateToApplication}
selectedWorkspaceId={selectedWorkspaceId}
/>
<PackageSearchItem searchedPackages={searchedPackages} />
<WorkflowSearchItem workflowsList={workflowsList} />
Expand Down