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