From 99a7eff6ab846ee8d3b1b3299ba6d3dd7c691b09 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 12 Jul 2022 09:58:27 +0200 Subject: [PATCH] fix: GitLab search fields --- .../configuration/_GitlabRepositories.svelte | 34 +++--------- .../[id]/configuration/source.svelte | 52 +++++++++++++++++-- 2 files changed, 53 insertions(+), 33 deletions(-) diff --git a/apps/ui/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte b/apps/ui/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte index 00f6af70d..c527ca4fb 100644 --- a/apps/ui/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte +++ b/apps/ui/src/routes/applications/[id]/configuration/_GitlabRepositories.svelte @@ -44,10 +44,7 @@ project: undefined, branch: undefined }; - let search = { - project: '', - branch: '' - }; + onMount(async () => { if (!$appSession.tokens.gitlab) { await getGitlabToken(); @@ -68,16 +65,11 @@ selected.project = null; selected.branch = null; showSave = false; + + // Clear out projects + projects = []; loadProjects(); } - async function searchProjects(searchText: any) { - if (!selected.group) { - return; - } - search.project = searchText; - await loadProjects(); - return projects; - } function selectProject(event: any) { selected.project = event.detail; selected.branch = null; @@ -137,9 +129,6 @@ per_page: perPage, archived: false }); - if (search.project) { - params.append('search', search.project); - } loading.projects = true; if (username === selected.group.name) { try { @@ -178,14 +167,6 @@ } } } - async function searchBranches(searchText: any) { - if (!selected.project) { - return; - } - search.branch = searchText; - await loadBranches(); - return branches; - } function selectBranch(event: any) { selected.branch = event.detail; isBranchAlreadyUsed(); @@ -197,9 +178,6 @@ page, per_page: perPage }); - if (search.branch) { - params.append('search', search.branch); - } loading.branches = true; try { const newBranches = await get( @@ -401,9 +379,9 @@ value={selected.project} isClearable={false} items={projects} - loadOptions={searchProjects} labelIdentifier="name" optionIdentifier="id" + isSearchable={true} />
@@ -424,7 +402,7 @@ value={selected.branch} isClearable={false} items={branches} - loadOptions={searchBranches} + isSearchable={true} labelIdentifier="name" optionIdentifier="web_url" /> diff --git a/apps/ui/src/routes/applications/[id]/configuration/source.svelte b/apps/ui/src/routes/applications/[id]/configuration/source.svelte index 1eba2c5ef..030ba86fe 100644 --- a/apps/ui/src/routes/applications/[id]/configuration/source.svelte +++ b/apps/ui/src/routes/applications/[id]/configuration/source.svelte @@ -33,7 +33,7 @@ import { appSession } from '$lib/store'; const { id } = $page.params; - const from = $page.url.searchParams.get('from') + const from = $page.url.searchParams.get('from'); export let sources: any; const filteredSources = sources.filter( @@ -74,9 +74,14 @@
{#if !filteredSources || ownSources.length === 0}
-
{$t('application.configuration.no_configurable_git')}
+
+ {$t('application.configuration.no_configurable_git')} +
{:else} -
+
{#each ownSources as source} -
+
+
+ {#if source?.type === 'gitlab'} + + + + {:else if source?.type === 'github'} + + + + {/if} +
handleSubmit(source.id)}>