Skip to content

Commit

Permalink
fix: reset model name after train (microsoft#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-krasn authored Jul 21, 2020
1 parent fc4cb96 commit ed919a0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/react/components/pages/train/trainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface ITrainPageState {
showTrainingFailedWarning: boolean;
trainingFailedMessage: string;
hasCheckbox: boolean;
modelName: string;
}

interface ITrainApiResponse {
Expand Down Expand Up @@ -74,8 +75,6 @@ function mapDispatchToProps(dispatch) {
@connect(mapStateToProps, mapDispatchToProps)
export default class TrainPage extends React.Component<ITrainPageProps, ITrainPageState> {

private modelName: string = "";

constructor(props) {
super(props);

Expand All @@ -88,6 +87,7 @@ export default class TrainPage extends React.Component<ITrainPageProps, ITrainPa
showTrainingFailedWarning: false,
trainingFailedMessage: "",
hasCheckbox: false,
modelName: ""
};
}

Expand Down Expand Up @@ -162,6 +162,7 @@ export default class TrainPage extends React.Component<ITrainPageProps, ITrainPa
autoComplete="off"
onChange={this.onTextChanged}
disabled={this.state.isTraining}
value={this.state.modelName}
>
</TextField>
{!this.state.isTraining ? (
Expand Down Expand Up @@ -229,7 +230,7 @@ export default class TrainPage extends React.Component<ITrainPageProps, ITrainPa
}

private onTextChanged = (ev: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, text: string) => {
this.modelName = text;
this.setState({modelName: text});
}

private handleTrainClick = () => {
Expand All @@ -243,6 +244,7 @@ export default class TrainPage extends React.Component<ITrainPageProps, ITrainPa
isTraining: false,
trainMessage: this.getTrainMessage(trainResult),
currTrainRecord: this.getProjectTrainRecord(),
modelName: "",
}));
}).catch((err) => {
this.setState({
Expand Down Expand Up @@ -299,7 +301,7 @@ export default class TrainPage extends React.Component<ITrainPageProps, ITrainPa
includeSubFolders: false,
},
useLabelFile: true,
modelName: this.modelName,
modelName: this.state.modelName,
};
try {
return await ServiceHelper.postWithAutoRetry(
Expand Down

0 comments on commit ed919a0

Please sign in to comment.