@@ -24,6 +24,7 @@ import { ModelInputDropdown } from "./ModelInputDropdown";
2424import { ModelOutputDropdown } from "./ModelOutputDropdown" ;
2525import { ModelEditorViewState } from "../../model-editor/shared/view-state" ;
2626import { Codicon } from "../common" ;
27+ import { canAddNewModeledMethod } from "../../model-editor/shared/multiple-modeled-methods" ;
2728
2829const MultiModelColumn = styled ( VSCodeDataGridCell ) `
2930 display: flex;
@@ -132,6 +133,8 @@ const ModelableMethodRow = forwardRef<HTMLElement | undefined, MethodRowProps>(
132133
133134 const modelingStatus = getModelingStatus ( modeledMethods , methodIsUnsaved ) ;
134135
136+ const addModelButtonDisabled = ! canAddNewModeledMethod ( modeledMethods ) ;
137+
135138 return (
136139 < DataGridRow
137140 data-testid = "modelable-method-row"
@@ -219,15 +222,21 @@ const ModelableMethodRow = forwardRef<HTMLElement | undefined, MethodRowProps>(
219222 </ MultiModelColumn >
220223 { viewState . showMultipleModels && (
221224 < MultiModelColumn gridColumn = { 6 } >
222- { modeledMethods . map ( ( _ , index ) => (
223- < CodiconRow key = { index } appearance = "icon" disabled = { false } >
224- { index === modeledMethods . length - 1 ? (
225+ { modeledMethods . map ( ( _ , index ) =>
226+ index === modeledMethods . length - 1 ? (
227+ < CodiconRow
228+ key = { index }
229+ appearance = "icon"
230+ disabled = { addModelButtonDisabled }
231+ >
225232 < Codicon name = "add" label = "Add new model" />
226- ) : (
233+ </ CodiconRow >
234+ ) : (
235+ < CodiconRow key = { index } appearance = "icon" >
227236 < Codicon name = "trash" label = "Remove model" />
228- ) }
229- </ CodiconRow >
230- ) ) }
237+ </ CodiconRow >
238+ ) ,
239+ ) }
231240 </ MultiModelColumn >
232241 ) }
233242 </ >
0 commit comments