From 2bdfd85137eef397a0b049f44662de2422688065 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 28 May 2024 16:12:54 -0700 Subject: [PATCH] fix: pipelines setting --- .../admin/Settings/Pipelines.svelte | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib/components/admin/Settings/Pipelines.svelte b/src/lib/components/admin/Settings/Pipelines.svelte index 303710a05..6a6d9a40e 100644 --- a/src/lib/components/admin/Settings/Pipelines.svelte +++ b/src/lib/components/admin/Settings/Pipelines.svelte @@ -10,10 +10,12 @@ getPipelineValves, getPipelineValvesSpec, updatePipelineValves, - getPipelines + getPipelines, + getModels } from '$lib/apis'; import Spinner from '$lib/components/common/Spinner.svelte'; import { toast } from 'svelte-sonner'; + import { models } from '$lib/stores'; const i18n: Writable = getContext('i18n'); @@ -39,6 +41,7 @@ if (res) { toast.success('Valves updated successfully'); setPipelines(); + models.set(await getModels(localStorage.token)); saveHandler(); } } else { @@ -46,11 +49,17 @@ } }; + const getValves = async (idx) => { + valves_spec = await getPipelineValvesSpec(localStorage.token, pipelines[idx].id); + valves = await getPipelineValves(localStorage.token, pipelines[idx].id); + }; + const setPipelines = async () => { pipelines = await getPipelines(localStorage.token); if (pipelines.length > 0) { selectedPipelineIdx = 0; + await getValves(selectedPipelineIdx); } }; @@ -82,14 +91,7 @@ placeholder={$i18n.t('Select a pipeline')} on:change={async () => { await tick(); - valves_spec = await getPipelineValvesSpec( - localStorage.token, - pipelines[selectedPipelineIdx].id - ); - valves = await getPipelineValves( - localStorage.token, - pipelines[selectedPipelineIdx].id - ); + await getValves(selectedPipelineIdx); }} > {#each pipelines as pipeline, idx}