Show a loading state in the strategy dropdown

While the strategy list is being fetched the dropdown now shows a disabled
"Loading strategies…" option instead of an empty select, and "No strategies
available" once loading finishes with no results. Applies to the strategy,
backtest and sweep panels via a loading prop. Adds tests.
This commit is contained in:
matitos committed 2026-09-21 18:26:01 +00:00
1 parent def86d7f56
commit 5a8c7ecc58
6 files changed
+72 -5

No files matched your search

+10 -3
View File
@@ -29,6 +29,7 @@ const status = ref({
})
const strategies = ref([])
const strategiesLoading = ref(true)
const presets = ref([])
const positions = ref([])
const orders = ref([])
@@ -71,7 +72,12 @@ async function refreshAll() {
}
async function loadStrategies() {
strategies.value = await api.getStrategies()
strategiesLoading.value = true
try {
strategies.value = await api.getStrategies()
} finally {
strategiesLoading.value = false
}
}
async function loadPresets() {
@@ -265,6 +271,7 @@ onUnmounted(() => {
:status="status"
:busy="busy"
:presets="presets"
:loading="strategiesLoading"
@start="handleStart"
@stop="handleStop"
@kill="handleKill"
@@ -272,8 +279,8 @@ onUnmounted(() => {
@delete-preset="handleDeletePreset"
/>
<BacktestPanel :strategies="strategies" :status="status" />
<SweepPanel :strategies="strategies" :status="status" />
<BacktestPanel :strategies="strategies" :status="status" :loading="strategiesLoading" />
<SweepPanel :strategies="strategies" :status="status" :loading="strategiesLoading" />
<div class="grid gap-4 lg:grid-cols-2">
<EquityChart :points="equityPoints" />