Skip to content

Commit 17fad68

Browse files
committed
chore: cluster termonal node issue fix
1 parent 8868536 commit 17fad68

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/components/ClusterNodes/ClusterTerminal.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,14 +861,34 @@ node-details-full-screen
861861

862862
const fullScreenClassWrapper = isFullScreen ? 'cluster-full_screen' : 'cluster-terminal-view-container'
863863

864+
const getNodeGroupOptions = () => {
865+
const nodeGroupOptions = nodeGroups.reduce((acc, group) => {
866+
if (group.label) {
867+
acc.push({
868+
label: group.label,
869+
options: group.options,
870+
})
871+
} else {
872+
const options = group.options.map((option) => ({
873+
label: option.label,
874+
value: option.value,
875+
}))
876+
acc.push(...options) // Flatten the array into the accumulator
877+
}
878+
return acc
879+
}, [])
880+
881+
return nodeGroupOptions
882+
}
883+
864884
const selectionListData: TerminalSelectionListDataType = {
865885
firstRow: [
866886
{
867887
type: TerminalWrapperType.REACT_SELECT,
868888
classNamePrefix: 'cluster-terminal-node',
869889
title: SELECT_TITLE.NODE,
870890
placeholder: 'Select node',
871-
options: nodeGroups,
891+
options: getNodeGroupOptions(),
872892
defaultValue: selectedNodeName,
873893
value: selectedNodeName,
874894
onChange: onChangeNodes,

0 commit comments

Comments
 (0)