progress
This commit is contained in:
parent
f11dfa7e57
commit
e85dc14fc8
5 changed files with 22 additions and 13 deletions
|
@ -16,7 +16,7 @@ export class ExecDatasetProcessScenario extends CallbackStrategyWithIdQuery {
|
|||
await DatasetDBModel.findById(id).updateOne({ processStatus: "RUN" });
|
||||
return new ExecProcessUseCase().call(
|
||||
`${model.project.rootDir}/`,
|
||||
`python3 $PYTHON_BLENDER_PROC --path '${model.project.rootDir}/${model.name}/'`,
|
||||
`blenderproc run $PYTHON_BLENDER_PROC --cfg '${JSON.stringify(model)}'`,
|
||||
id,
|
||||
new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId)
|
||||
);
|
||||
|
|
|
@ -24,7 +24,7 @@ export const FormBuilder = observer((props: IFormBuilder) => {
|
|||
props.formBuilder.context,
|
||||
props.formBuilder.result
|
||||
);
|
||||
console.log(props.formBuilder.form.map((el) => InputBuilderViewModel.fromJSON(el)));
|
||||
props.formBuilder.form.map((el) => InputBuilderViewModel.fromJSON(el));
|
||||
}
|
||||
store.changerForm.on((event) => {
|
||||
if (event) props.onChange(event);
|
||||
|
|
|
@ -10,6 +10,11 @@ export enum InputType {
|
|||
ENUM = "Enum",
|
||||
}
|
||||
|
||||
interface IOperation {
|
||||
regExp: RegExp;
|
||||
result: any;
|
||||
}
|
||||
|
||||
export class InputBuilderViewModel {
|
||||
id: string;
|
||||
constructor(
|
||||
|
@ -44,8 +49,6 @@ export class InputBuilderViewModel {
|
|||
}
|
||||
public toJson(): string {
|
||||
try {
|
||||
console.log(this.id);
|
||||
console.log(this.totalValue);
|
||||
return JSON.stringify(this);
|
||||
} catch (error) {
|
||||
console.log("InputBuilderViewModel.toJson(): " + this.id);
|
||||
|
@ -74,10 +77,14 @@ export class FormViewModel {
|
|||
}
|
||||
public json() {
|
||||
const result = this.toResult();
|
||||
if (result.isEmpty()) {
|
||||
console.log("result is Empty error");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(result).replaceAll("\n", "").replaceAll("\\", "").replaceAll("/", "");
|
||||
return JSON.parse(result.replaceAll("\n", "").replaceAll("\\", "").replaceAll("/", ""))
|
||||
} catch (error) {
|
||||
console.log(result);
|
||||
console.log("ERROR: FormViewModel json() " + result);
|
||||
}
|
||||
}
|
||||
public fromFormBuilderValidationModel() {
|
||||
|
@ -89,7 +96,7 @@ export class FormViewModel {
|
|||
);
|
||||
}
|
||||
public toResult(): string {
|
||||
let result = "";
|
||||
const operations: IOperation[] = [];
|
||||
|
||||
this.inputs.forEach((element) => {
|
||||
let inputResult = element.totalValue ?? element.defaultValue;
|
||||
|
@ -127,7 +134,14 @@ export class FormViewModel {
|
|||
}
|
||||
}
|
||||
if (inputResult instanceof Array) inputResult = JSON.stringify(inputResult);
|
||||
result = result.replace(new RegExp("\\${" + element.name + ".*?}"), inputResult);
|
||||
|
||||
operations.push({ regExp: new RegExp("\\${" + element.name + ".*?}"), result: inputResult });
|
||||
});
|
||||
|
||||
let result = this.result;
|
||||
|
||||
operations.forEach((el) => {
|
||||
result = result.replace(el.regExp, el.result);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { InputBuilderViewModel } from "../../core/ui/form_builder/form_view_model";
|
||||
import { Result } from "../../core/helper/result";
|
||||
import makeAutoObservable from "mobx-store-inheritance";
|
||||
|
||||
|
|
|
@ -8,12 +8,8 @@ import { CardDataSet, CardDataSetType } from "./card_dataset";
|
|||
import { CoreInput } from "../../core/ui/input/input";
|
||||
import { CoreButton } from "../../core/ui/button/button";
|
||||
import { ListItem } from "./list_item";
|
||||
import { datasetTypes } from "./dataset_model";
|
||||
import { CoreText, CoreTextType } from "../../core/ui/text/text";
|
||||
|
||||
export const DatasetsScreenPath = "/dataset";
|
||||
|
||||
|
||||
|
||||
export const DataSetScreen: React.FunctionComponent = observer(() => {
|
||||
const [store] = React.useState(() => new DataSetStore());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue