From 6f87a7a3d726591610f1d1afa260226eb2943650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 14 Oct 2024 10:15:10 +0200 Subject: [PATCH] Repository finder & context parsing improvements (#20296) --- .../dashboard/src/components/podkit/combobox/Combobox.tsx | 5 ++++- components/server/src/workspace/context-parser-service.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/dashboard/src/components/podkit/combobox/Combobox.tsx b/components/dashboard/src/components/podkit/combobox/Combobox.tsx index 84231b95a21c5a..2f057a3b2106fa 100644 --- a/components/dashboard/src/components/podkit/combobox/Combobox.tsx +++ b/components/dashboard/src/components/podkit/combobox/Combobox.tsx @@ -84,11 +84,14 @@ export const Combobox: FunctionComponent = ({ const setActiveElement = useCallback( (element: string) => { + if (!filteredOptions.find((el) => element === el.id)?.isSelectable) { + return; + } setSelectedElementTemp(element); const el = document.getElementById(element); el?.scrollIntoView({ block: "nearest" }); }, - [setSelectedElementTemp], + [filteredOptions], ); const handleOpenChange = useCallback( diff --git a/components/server/src/workspace/context-parser-service.ts b/components/server/src/workspace/context-parser-service.ts index f25cef37a85a84..cf76f8b775c0b5 100644 --- a/components/server/src/workspace/context-parser-service.ts +++ b/components/server/src/workspace/context-parser-service.ts @@ -11,6 +11,7 @@ import { IPrefixContextParser, IContextParser } from "./context-parser"; import { TraceContext } from "@gitpod/gitpod-protocol/lib/util/tracing"; import { ConfigProvider } from "./config-provider"; import { InvalidGitpodYMLError } from "@gitpod/public-api-common/lib/public-api-errors"; +import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error"; @injectable() export class ContextParser { @@ -83,7 +84,10 @@ export class ContextParser { } } if (!result) { - throw new Error(`Couldn't parse context '${nonPrefixedContextURL}'.`); + throw new ApplicationError( + ErrorCodes.BAD_REQUEST, + `Couldn't parse context '${nonPrefixedContextURL}'.`, + ); } // TODO: Make the parsers return the context with normalizedContextURL set