Commit 2bdfd851 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: pipelines setting

parent 834bdf46
...@@ -10,10 +10,12 @@ ...@@ -10,10 +10,12 @@
getPipelineValves, getPipelineValves,
getPipelineValvesSpec, getPipelineValvesSpec,
updatePipelineValves, updatePipelineValves,
getPipelines getPipelines,
getModels
} from '$lib/apis'; } from '$lib/apis';
import Spinner from '$lib/components/common/Spinner.svelte'; import Spinner from '$lib/components/common/Spinner.svelte';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import { models } from '$lib/stores';
const i18n: Writable<i18nType> = getContext('i18n'); const i18n: Writable<i18nType> = getContext('i18n');
...@@ -39,6 +41,7 @@ ...@@ -39,6 +41,7 @@
if (res) { if (res) {
toast.success('Valves updated successfully'); toast.success('Valves updated successfully');
setPipelines(); setPipelines();
models.set(await getModels(localStorage.token));
saveHandler(); saveHandler();
} }
} else { } else {
...@@ -46,11 +49,17 @@ ...@@ -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 () => { const setPipelines = async () => {
pipelines = await getPipelines(localStorage.token); pipelines = await getPipelines(localStorage.token);
if (pipelines.length > 0) { if (pipelines.length > 0) {
selectedPipelineIdx = 0; selectedPipelineIdx = 0;
await getValves(selectedPipelineIdx);
} }
}; };
...@@ -82,14 +91,7 @@ ...@@ -82,14 +91,7 @@
placeholder={$i18n.t('Select a pipeline')} placeholder={$i18n.t('Select a pipeline')}
on:change={async () => { on:change={async () => {
await tick(); await tick();
valves_spec = await getPipelineValvesSpec( await getValves(selectedPipelineIdx);
localStorage.token,
pipelines[selectedPipelineIdx].id
);
valves = await getPipelineValves(
localStorage.token,
pipelines[selectedPipelineIdx].id
);
}} }}
> >
{#each pipelines as pipeline, idx} {#each pipelines as pipeline, idx}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment