fix: show message on model composition fail (#457)

* fix: show message on fail

* fix: - forgoten log
This commit is contained in:
alex-krasn 2020-07-27 17:46:48 -07:00 коммит произвёл GitHub
Родитель 27f60df561
Коммит 84f8285912
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -26,6 +26,7 @@ export const constants = {
statusCodeSucceeded: "succeeded",
statusCodeReady: "ready",
statusCodeFailed: "failed",
statusCodeInvalid: "invalid",
apiKeyHeader: "Ocp-Apim-Subscription-Key",
maxRetry: 8,
initialRetryInterval: 500, // ms

Просмотреть файл

@ -180,6 +180,9 @@ export const english: IAppStrings = {
checkButtonAria: "Select model check button",
checkAllButtonAria: "Select all models check button",
},
errors: {
failedCompose: "Something went wrong composed model was not created!"
}
},
predict: {

Просмотреть файл

@ -180,7 +180,9 @@ export const spanish: IAppStrings = {
headerAria: "Lista de encabezado de modelos",
checkButtonAria: "Seleccionar botón de verificación del modelo",
checkAllButtonAria: "Botón de verificación Seleccionar todos los modelos",
},
errors: {
failedCompose: "¡Algo salió mal, el modelo compuesto no fue creado!"
}
},
predict: {

Просмотреть файл

@ -180,6 +180,9 @@ export interface IAppStrings {
checkButtonAria: string,
checkAllButtonAria: string,
},
errors: {
failedCompose: string,
}
}
predict: {
title: string;

Просмотреть файл

@ -40,6 +40,7 @@ import ComposeModelView from "./composeModelView";
import { ViewSelection } from "./viewSelection";
import PreventLeaving from "../../common/preventLeaving/preventLeaving";
import allSettled from "promise.allsettled";
import { toast } from 'react-toastify';
export interface IModelComposePageProps extends RouteComponentProps, React.Props<ModelComposePage> {
recentProjects: IProject[];
@ -392,7 +393,7 @@ export default class ModelComposePage extends React.Component<IModelComposePageP
composedTrainResults: composedModel["composedTrainResults"]
} as IRecentModel;
const recentModelRecords: IRecentModel[] = this.props.project.recentModelRecords ?
[...this.props.project.recentModelRecords] : [];
[...this.props.project.recentModelRecords] : [];
recentModelRecords.unshift(newTrainRecord);
if (recentModelRecords.length > constants.recentModelRecordsCount) {
recentModelRecords.pop();
@ -610,6 +611,10 @@ export default class ModelComposePage extends React.Component<IModelComposePageP
ajax.then((response) => {
if (response.data.modelInfo.status.toLowerCase() === constants.statusCodeReady) {
resolve(response.data);
} else if (response.data.modelInfo.status.toLowerCase() === constants.statusCodeInvalid) {
toast.error(strings.modelCompose.errors.failedCompose, { autoClose: false });
this.setState({ isComposing: false });
return;
} else if (Number(new Date()) < endTime) {
// If the request isn't succeeded and the timeout hasn't elapsed, go again
setTimeout(checkSucceeded, interval, resolve, reject);