@@ -3,7 +3,6 @@ import type { ToModelEditorMessage } from "../../common/interface-types";
33import {
44 VSCodeButton ,
55 VSCodeCheckbox ,
6- VSCodeProgressRing ,
76 VSCodeTag ,
87} from "@vscode/webview-ui-toolkit/react" ;
98import { styled } from "styled-components" ;
@@ -21,7 +20,7 @@ import { getLanguageDisplayName } from "../../common/query-language";
2120import { INITIAL_HIDE_MODELED_METHODS_VALUE } from "../../model-editor/shared/hide-modeled-methods" ;
2221import type { AccessPathSuggestionOptions } from "../../model-editor/suggestions" ;
2322import type { ModelEvaluationRunState } from "../../model-editor/shared/model-evaluation-run-state" ;
24- import { modelEvaluationRunIsRunning } from "../../model-editor/shared/model-evaluation-run-state " ;
23+ import { ModelEvaluation } from "./ModelEvaluation " ;
2524
2625const LoadingContainer = styled . div `
2726 text-align: center;
@@ -77,57 +76,6 @@ const ButtonsContainer = styled.div`
7776 margin-top: 1rem;
7877` ;
7978
80- const ProgressRing = styled ( VSCodeProgressRing ) `
81- width: 16px;
82- height: 16px;
83- margin-right: 5px;
84- ` ;
85-
86- const ModelEvaluation = ( {
87- viewState,
88- modeledMethods,
89- modifiedSignatures,
90- onStartEvaluation,
91- onStopEvaluation,
92- evaluationRun,
93- } : {
94- viewState : ModelEditorViewState ;
95- modeledMethods : Record < string , ModeledMethod [ ] > ;
96- modifiedSignatures : Set < string > ;
97- onStartEvaluation : ( ) => void ;
98- onStopEvaluation : ( ) => void ;
99- evaluationRun : ModelEvaluationRunState | undefined ;
100- } ) => {
101- if ( ! viewState . showEvaluationUi ) {
102- return null ;
103- }
104-
105- if ( ! evaluationRun || ! modelEvaluationRunIsRunning ( evaluationRun ) ) {
106- const customModelsExist = Object . values ( modeledMethods ) . some (
107- ( methods ) => methods . filter ( ( m ) => m . type !== "none" ) . length > 0 ,
108- ) ;
109-
110- const unsavedChanges = modifiedSignatures . size > 0 ;
111-
112- return (
113- < VSCodeButton
114- onClick = { onStartEvaluation }
115- appearance = "secondary"
116- disabled = { ! customModelsExist || unsavedChanges }
117- >
118- Evaluate
119- </ VSCodeButton >
120- ) ;
121- } else {
122- return (
123- < VSCodeButton onClick = { onStopEvaluation } appearance = "secondary" >
124- < ProgressRing />
125- Stop evaluation
126- </ VSCodeButton >
127- ) ;
128- }
129- } ;
130-
13179type Props = {
13280 initialViewState ?: ModelEditorViewState ;
13381 initialMethods ?: Method [ ] ;
0 commit comments