mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 09:04:27 +00:00
Auto-select first node in InstanceSettingsCard if none is selected
This commit is contained in:
@@ -35,6 +35,12 @@ const InstanceSettingsCard: React.FC<InstanceSettingsCardProps> = ({
|
||||
try {
|
||||
const fetchedNodes = await nodesApi.list()
|
||||
setNodes(fetchedNodes)
|
||||
|
||||
// Auto-select first node if none selected
|
||||
const nodeNames = Object.keys(fetchedNodes)
|
||||
if (nodeNames.length > 0 && (!formData.nodes || formData.nodes.length === 0)) {
|
||||
onChange('nodes', [nodeNames[0]])
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch nodes:', error)
|
||||
} finally {
|
||||
@@ -43,6 +49,7 @@ const InstanceSettingsCard: React.FC<InstanceSettingsCardProps> = ({
|
||||
}
|
||||
|
||||
void fetchNodes()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
const nodeOptions = Object.keys(nodes).map(nodeName => ({
|
||||
|
||||
Reference in New Issue
Block a user