From 07100258cdaa009512ef0f3516ef69fd7d0f84db Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Mon, 6 Mar 2023 09:13:22 +0200 Subject: [PATCH] fix(git): file path background [EE-5114] (#8573) * fix(git): file path background [EE-5114] also disabled url check on CE because the http handler wasn't available and raised errors * fix(git): highlight hovered path option * feat(git): hide path options when choosing --- .../gitops/ComposePathField/PathSelector.tsx | 13 +++++++++---- app/react/portainer/gitops/GitFormUrlField.tsx | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/react/portainer/gitops/ComposePathField/PathSelector.tsx b/app/react/portainer/gitops/ComposePathField/PathSelector.tsx index e3ee21978..935edcd87 100644 --- a/app/react/portainer/gitops/ComposePathField/PathSelector.tsx +++ b/app/react/portainer/gitops/ComposePathField/PathSelector.tsx @@ -7,6 +7,7 @@ import { } from '@reach/combobox'; import '@reach/combobox/styles.css'; import { ChangeEvent } from 'react'; +import clsx from 'clsx'; import { useSearch } from '@/react/portainer/gitops/queries/useSearch'; import { useDebounce } from '@/react/hooks/useDebounce'; @@ -41,7 +42,7 @@ export function PathSelector({ const enabled = Boolean( model.RepositoryURL && model.RepositoryURLValid && searchTerm ); - const { data: searchResult } = useSearch(payload, enabled); + const { data: searchResults } = useSearch(payload, enabled); const { ref, updateCaret } = useCaretPosition(); return ( @@ -58,14 +59,18 @@ export function PathSelector({ placeholder={placeholder} value={value} /> - {searchResult && searchResult.length > 0 && searchTerm !== '' && ( + {searchResults && searchResults.length > 0 && ( - {searchResult.map((result: string, index: number) => ( + {searchResults.map((result: string, index: number) => ( ))} diff --git a/app/react/portainer/gitops/GitFormUrlField.tsx b/app/react/portainer/gitops/GitFormUrlField.tsx index 100b22de4..9d322789e 100644 --- a/app/react/portainer/gitops/GitFormUrlField.tsx +++ b/app/react/portainer/gitops/GitFormUrlField.tsx @@ -16,6 +16,8 @@ import { TextTip } from '@@/Tip/TextTip'; import { Button } from '@@/buttons'; import { useCachedValidation } from '@@/form-components/useCachedTest'; +import { isBE } from '../feature-flags/feature-flags.service'; + import { GitFormModel } from './types'; import { getAuthentication } from './utils'; @@ -43,6 +45,8 @@ export function GitFormUrlField({ onChangeRepositoryValid(!!isValid); setForce(false); }, + // disabled check on CE since it's not supported + enabled: isBE, }); const [debouncedValue, debouncedOnChange] = useDebounce(value, onChange);