diff --git a/.vscode/settings.json b/.vscode/settings.json index 6581d96..e076189 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,6 +15,18 @@ "*ui": false, "*ui.*": false }, - "cSpell.words": ["antd", "Collada", "Contolls", "fileupload", "lerp", "metadatas", "undici", "uuidv"], + "cSpell.words": [ + "запущен", + "процесс", + "antd", + "Collada", + "Contolls", + "fileupload", + "lerp", + "metadatas", + "Skils", + "undici", + "uuidv" + ], "editor.rulers": [100] } diff --git a/p.ts b/p.ts new file mode 100644 index 0000000..07ed50a --- /dev/null +++ b/p.ts @@ -0,0 +1,2 @@ +console.log([1, 2, 3, 4, 5, 6].reduce((element, acc) => (acc += element))); +console.log(["1", "2", "3", "4", "5", "6"].reduce((element, acc) => (acc += element))); diff --git a/server/src/core/services/executor_program_service.ts b/server/src/core/services/executor_program_service.ts index f6ed534..847915f 100644 --- a/server/src/core/services/executor_program_service.ts +++ b/server/src/core/services/executor_program_service.ts @@ -49,18 +49,21 @@ export class ExecutorProgramService if (spawnError instanceof SpawnError) { this.emit(Result.error(spawnError)); + this.worker = undefined; return; } const execError = ExecError.isExecError(e); if (execError instanceof ExecError) { this.emit(Result.error(execError)); + this.worker = undefined; return; } const executorResult = ExecutorResult.isExecutorResult(e); if (executorResult instanceof ExecutorResult) { this.emit(Result.ok(executorResult)); + this.worker = undefined; return; } }); @@ -78,7 +81,10 @@ export class ExecutorProgramService console.log(error); } } - + public deleteWorker() { + if (this.worker) this.worker.kill(); + this.worker = undefined; + } public async call(type: EXEC_TYPE, command: string, args: Array | undefined = undefined): Promise { if (type == EXEC_TYPE.EXEC) { this.workerExecuted(command, WorkerType.EXEC); diff --git a/server/src/core/usecases/exec_process_usecase.ts b/server/src/core/usecases/exec_process_usecase.ts index 0b6f032..6626c79 100644 --- a/server/src/core/usecases/exec_process_usecase.ts +++ b/server/src/core/usecases/exec_process_usecase.ts @@ -1,9 +1,27 @@ +import { CallbackStrategyWithEmpty } from "../controllers/http_controller"; import { Result } from "../helpers/result"; import { TypedEvent } from "../helpers/typed_event"; import { EXEC_TYPE, ExecError, SpawnError } from "../models/exec_error_model"; import { ExecutorResult } from "../models/executor_result"; import { ExecutorProgramService } from "../services/executor_program_service"; +const executorProgramService = new ExecutorProgramService(""); +export class KillLastProcessUseCase extends CallbackStrategyWithEmpty { + call = async (): Promise> => { + executorProgramService.deleteWorker(); + return Result.ok("ok"); + }; +} + +export class IsHaveActiveProcessUseCase extends CallbackStrategyWithEmpty { + call = async (): Promise> => { + if (executorProgramService.worker === undefined) { + return Result.ok("process not work"); + } + return Result.error("process is exists"); + }; +} + export class ExecProcessUseCase { call = async ( path: string, @@ -11,11 +29,11 @@ export class ExecProcessUseCase { watcher?: TypedEvent> ): Promise> => { try { - const executorProgramService = new ExecutorProgramService(path); - if (watcher) - executorProgramService.on((event) => { - watcher.emit(event); - }); + executorProgramService.execPath = path; + executorProgramService.on((event) => { + console.log(event); + if (watcher) watcher.emit(event); + }); executorProgramService.call(EXEC_TYPE.EXEC, command); return Result.ok("ok"); diff --git a/server/src/features/_triggers/triggers_presentation.ts b/server/src/features/_triggers/triggers_presentation.ts index 0300f15..b401373 100644 --- a/server/src/features/_triggers/triggers_presentation.ts +++ b/server/src/features/_triggers/triggers_presentation.ts @@ -11,4 +11,3 @@ export class TriggerPresentation extends CrudController(ProjectDBModel).call({ isActive: true }, "no active projects") ).map(async (project) => { - model.processStatus = "exec"; + model.processStatus = "new"; model.local_path = project.rootDir; model.projectId = project._id; const d = new DatasetDBModel(); Object.assign(d, model); await d.save(); - await new ExecProcessUseCase().call( - `${project.rootDir}/`, - `python3 $PYTHON_BLENDER_PROC --path '${project.rootDir}/${model.name}' --cfg '${JSON.stringify(model)}'`, - new ProcessWatcherAndDatabaseUpdateService(d._id as unknown as ObjectId) - ); return Result.ok("create dataset ok"); }); }; } -// сохрнать formbuilder result и передать его в python -// { -// "typedataset": ${typedataset:Enum:"ObjectDetection"}, -// "dataset_path": ${DATASET_PATH:string:""}, -// "models":${models:Array:[]}, -// "models_randomization":{ -// "loc_range_low": [${LOC_RANGE_LOW_1:number:-1}, ${LOC_RANGE_LOW_2:number:-1},/${LOC_RANGE_LOW_3:number:0}], -// "loc_range_high": [${LOC_RANGE_HIGH_1:number:1}, ${LOC_RANGE_HIGH_2:number:1},/${LOC_RANGE_HIGH_3:number:2}] -// }, -// "scene":{ -// "objects": ${OBJECTS_SCENE:Array:[]}, -// "lights": ${LIGHTS:Array:[]}, -// }, -// "camera_position":{ -// "center_shell": [${CENTER_SHELL_1:number:0}, ${CENTER_SHELL_2:number:0}, ${CENTER_SHELL_3:number:0}], -// "radius_range": [${RADIUS_RANGE_1:number:0.4}, ${RADIUS_RANGE_2:number:1.4}], -// "elevation_range": [${ELEVATION_RANGE_1:number:10}, ${ELEVATION_RANGE_2:number:90}] -// }, -// "generation":{ -// "n_cam_pose": ${N_CAM_POSE:number:5}, -// "n_sample_on_pose": ${N_SAMPLE_ON_POSE:number:3}, -// "n_series": ${N_SERIES:number:100}, -// "image_format": ${image_format:Enum:"jpg"}, -// "image_size_wh": [${IMAGE_SIZE_WH_1:number:640}, ${IMAGE_SIZE_WH_2:number:480}] -// } -// } diff --git a/server/src/features/datasets/domain/exec_process_scenario.ts b/server/src/features/datasets/domain/exec_process_scenario.ts new file mode 100644 index 0000000..8dad2b9 --- /dev/null +++ b/server/src/features/datasets/domain/exec_process_scenario.ts @@ -0,0 +1,24 @@ +import { ObjectId } from "mongoose"; +import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller"; +import { ExecProcessUseCase, IsHaveActiveProcessUseCase } from "../../../core/usecases/exec_process_usecase"; +import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase"; +import { MongoIdValidation } from "../../../core/validations/mongo_id_validation"; +import { DatasetDBModel } from "../models/dataset_database_model"; +import { IDatasetModel } from "../models/dataset_validation_model"; +import { ProcessWatcherAndDatabaseUpdateService } from "./create_dataset_scanario"; + +export class ExecDatasetProcessScenario extends CallbackStrategyWithIdQuery { + idValidationExpression = new MongoIdValidation(); + + call = async (id: string): ResponseBase => { + return (await new ReadByIdDataBaseModelUseCase(DatasetDBModel).call(id)).map(async (model) => { + return (await new IsHaveActiveProcessUseCase().call()).map(() => { + return new ExecProcessUseCase().call( + `${model.project.rootDir}/`, + `python3 $PYTHON_BLENDER_PROC --cfg '${JSON.stringify(model)}' `, + new ProcessWatcherAndDatabaseUpdateService(id as unknown as ObjectId) + ); + }); + }); + }; +} diff --git a/server/src/features/datasets/domain/get_dataset_active_project_scenario.ts b/server/src/features/datasets/domain/get_dataset_active_project_scenario.ts index 081df22..d5cd6c7 100644 --- a/server/src/features/datasets/domain/get_dataset_active_project_scenario.ts +++ b/server/src/features/datasets/domain/get_dataset_active_project_scenario.ts @@ -9,7 +9,7 @@ export class GetDatasetActiveProjectScenario extends CallbackStrategyWithEmpty { return ( await new SearchDataBaseModelUseCase(ProjectDBModel).call({ isActive: true }, "no active projects") ).map(async (project) => { - return Result.ok(await DatasetDBModel.find({ projectId: project._id })); + return Result.ok(await DatasetDBModel.find({ project: project._id })); }); }; } diff --git a/server/src/features/datasets/models/dataset_database_model.ts b/server/src/features/datasets/models/dataset_database_model.ts index 27ec312..a169a3d 100644 --- a/server/src/features/datasets/models/dataset_database_model.ts +++ b/server/src/features/datasets/models/dataset_database_model.ts @@ -17,19 +17,32 @@ export const DatasetSchema = new Schema({ type: Schema.Types.Mixed, of: String, }, + unixTime: { + type: Number, + default: Date.now(), + }, + neuralNetworkAction: { + type: String, + }, + neuralNetworkName: { + type: String, + }, processStatus: { type: String, default: "none", }, - projectId: { + project: { type: Schema.Types.ObjectId, ref: projectSchema, - autopopulate: false, - default: null, + autopopulate: true, + require: true, }, processLogs: { type: String, }, + datasetType: { + type: String, + }, }).plugin(require("mongoose-autopopulate")); export const datasetSchema = "Dataset"; diff --git a/server/src/features/datasets/models/dataset_validation_model.ts b/server/src/features/datasets/models/dataset_validation_model.ts index e9a365d..b57b32f 100644 --- a/server/src/features/datasets/models/dataset_validation_model.ts +++ b/server/src/features/datasets/models/dataset_validation_model.ts @@ -1,5 +1,6 @@ import { Type } from "class-transformer"; import { IsArray, IsString, ValidateNested } from "class-validator"; +import { IProjectModel } from "../../_projects/models/project_database_model"; export class FormBuilderValidationModel { @IsString() @@ -17,6 +18,7 @@ export interface IDatasetModel { formBuilder: FormBuilderValidationModel; processLogs: string; processStatus: string; + project?: IProjectModel; } export class DatasetValidationModel implements IDatasetModel { diff --git a/server/src/features/projects/domain/upload_file_to_to_project_scenario.ts b/server/src/features/projects/domain/upload_file_to_to_project_scenario.ts index ada5d73..826ee25 100644 --- a/server/src/features/projects/domain/upload_file_to_to_project_scenario.ts +++ b/server/src/features/projects/domain/upload_file_to_to_project_scenario.ts @@ -1,15 +1,8 @@ -import { App } from "../../../core/controllers/app"; import { CallbackStrategyWithFileUpload, ResponseBase } from "../../../core/controllers/http_controller"; -import { Result } from "../../../core/helpers/result"; import { IFile } from "../../../core/interfaces/file"; -import { CreateDataBaseModelUseCase } from "../../../core/usecases/create_database_model_usecase"; import { CreateFileUseCase } from "../../../core/usecases/create_file_usecase"; -import { CreateFolderUseCase } from "../../../core/usecases/create_folder_usecase"; import { MongoIdValidation } from "../../../core/validations/mongo_id_validation"; -import { IProjectInstanceModel, ProjectInstanceDbModel } from "../models/project_instance_database_model"; -import { ProjectInstanceValidationModel } from "../models/project_instance_validation_model"; -import { v4 as uuidv4 } from "uuid"; -import { SetActiveProjectScenario } from "./set_active_project_use_scenario"; +import { IProjectInstanceModel } from "../models/project_instance_database_model"; import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_by_id_database_model_usecase"; import { ProjectDBModel } from "../../_projects/models/project_database_model"; import { ExecProcessUseCase } from "../../../core/usecases/exec_process_usecase"; diff --git a/ui/public/index.html b/ui/public/index.html index 2371e57..8f9e2e3 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -17,5 +17,8 @@
+ \ No newline at end of file diff --git a/ui/src/core/assets/images/logo.svg b/ui/src/core/assets/images/logo.svg deleted file mode 100644 index 58b91d4..0000000 --- a/ui/src/core/assets/images/logo.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/ui/src/core/assets/images/pose_estemation.jpg b/ui/src/core/assets/images/pose_estemation.jpg new file mode 100644 index 0000000..85ed898 Binary files /dev/null and b/ui/src/core/assets/images/pose_estemation.jpg differ diff --git a/ui/src/core/extensions/extensions.ts b/ui/src/core/extensions/extensions.ts index 1612cad..5f6f963 100644 --- a/ui/src/core/extensions/extensions.ts +++ b/ui/src/core/extensions/extensions.ts @@ -22,7 +22,10 @@ declare global { } interface Number { fromArray(): number[]; + toPx(): string; + unixFromDate(): string; } + interface String { isEmpty(): boolean; isNotEmpty(): boolean; diff --git a/ui/src/core/extensions/number.ts b/ui/src/core/extensions/number.ts index 565ced6..27e4a69 100644 --- a/ui/src/core/extensions/number.ts +++ b/ui/src/core/extensions/number.ts @@ -5,4 +5,17 @@ export const NumberExtensions = () => { return Array.from(this.toString()).map((el) => Number(el)); }; } + if (Number().toPx === undefined) { + // eslint-disable-next-line no-extend-native + Number.prototype.toPx = function () { + return String(this) + "px"; + }; + } + if (Number().unixFromDate === undefined) { + // eslint-disable-next-line no-extend-native + Number.prototype.unixFromDate = function () { + const date = new Date(Number(this) * 1000); + return `${date.getUTCFullYear()}.${date.getMonth()}.${date.getDay()} ${date.getHours()}:${date.getMinutes()}`; + }; + } }; diff --git a/ui/src/core/routers/routers.tsx b/ui/src/core/routers/routers.tsx index ab308e5..ccc7d24 100644 --- a/ui/src/core/routers/routers.tsx +++ b/ui/src/core/routers/routers.tsx @@ -15,8 +15,12 @@ import { import { StickObjectsMarkingScreen, StickObjectsMarkingScreenPath, -} from "../../features/stick_objects_marking/stick_objects_marking_screen"; +} from "../../features/_stick_objects_marking/stick_objects_marking_screen"; import { DataSetScreen, DatasetsScreenPath } from "../../features/dataset/dataset_screen"; +import DetailsScreen, { DetailsScreenPath } from "../../features/details/details_screen"; +import { AssemblesScreen, AssemblesScreenPath } from "../../features/assembles/assembles_screen"; +import SimulationScreen, { SimulationScreenPath } from "../../features/simulations/simulations_screen"; +import { EstimateScreen, EstimateScreenPath } from "../../features/estimate/estimate_screen"; const idURL = ":id"; @@ -51,4 +55,21 @@ export const router = createBrowserRouter([ path: DatasetsScreenPath, element: , }, + { + path: DetailsScreenPath, + element: , + }, + { + path: AssemblesScreenPath, + element: , + }, + { + path: SimulationScreenPath, + element: , + }, + + { + path: EstimateScreenPath, + element: , + }, ]); diff --git a/ui/src/core/ui/button/button.tsx b/ui/src/core/ui/button/button.tsx new file mode 100644 index 0000000..cf2e424 --- /dev/null +++ b/ui/src/core/ui/button/button.tsx @@ -0,0 +1,32 @@ +import * as React from "react"; +import { CoreText, CoreTextType } from "../text/text"; + +export interface IButtonProps { + block?: boolean; + filled?: boolean; + text?: string; + onClick?: any; +} + +export function CoreButton(props: IButtonProps) { + return ( +
props.onClick?.call()} + style={{ + backgroundColor: props.filled ? "rgba(103, 80, 164, 1)" : "", + paddingRight: 20, + paddingLeft: 20, + paddingTop: 10, + paddingBottom: 10, + borderRadius: 24, + border: props.block ? "1px solid rgba(29, 27, 32, 0.12)" : props.filled ? "" : "1px solid black", + }} + > + +
+ ); +} diff --git a/ui/src/core/ui/card/card_dataset.tsx b/ui/src/core/ui/card/card_dataset.tsx new file mode 100644 index 0000000..dd557f6 --- /dev/null +++ b/ui/src/core/ui/card/card_dataset.tsx @@ -0,0 +1,97 @@ +import { Spin } from "antd"; +import { LoadingOutlined } from "@ant-design/icons"; +import poseIMG from "../../assets/images/pose_estemation.jpg"; +import { Icon } from "../icons/icons"; +import { CoreText, CoreTextType } from "../text/text"; +import { CoreButton } from "../button/button"; + +export const enum CardDataSetType { + EMPTY = "EMPTY", + COMPLETED = "COMPLETED", +} + +interface ICardDataSetProps { + type: CardDataSetType; + neuralNetworkAction?: string; + neuralNetworkName?: string; + objects?: string[]; + unixDate?: number; + processStatus?: string; + onClickButton?: (id: string) => void; + onClickEmptyCard?: Function; + id?: string; +} + +export const CardDataSet = (props: ICardDataSetProps) => { + return ( +
{ + if (props.type.isEqual(CardDataSetType.EMPTY) && props.onClickEmptyCard) { + props.onClickEmptyCard(); + } + }} + > +
+ {props.type.isEqual(CardDataSetType.EMPTY) ? null : ( +
+
+
+ + +
+
+ +
+
+ )} +
+ pose +
+ {props.type === CardDataSetType.EMPTY ? ( + + ) : ( +
+ + +
+
+ +
+
+ {props.processStatus === "exec" ? ( + } /> + ) : null} +
+ {props.processStatus === "new" ? ( + { + if (props.type.isEqual(CardDataSetType.COMPLETED) && props.onClickButton && props.id) { + props.onClickButton(props.id); + } + }} + filled={true} + text="Старт" + /> + ) : ( + + )} +
+
+ )} +
+
+ ); +}; diff --git a/ui/src/core/ui/form_builder/form_builder.tsx b/ui/src/core/ui/form_builder/form_builder.tsx index be91d15..fbe14da 100644 --- a/ui/src/core/ui/form_builder/form_builder.tsx +++ b/ui/src/core/ui/form_builder/form_builder.tsx @@ -3,9 +3,7 @@ import { Input, Select, Button } from "antd"; import { InputBuilderViewModel, InputType } from "./form_view_model"; import { observer } from "mobx-react-lite"; import { FormBuilderStore } from "./form_builder_store"; -import { extensions } from "../../extensions/extensions"; -import { FormBuilderValidationModel } from "../../../features/dataset/dataset_store"; -extensions(); +import { FormBuilderValidationModel } from "../../../features/dataset/dataset_model"; export interface IFormBuilder { context: string; diff --git a/ui/src/core/ui/form_builder/form_builder_store.ts b/ui/src/core/ui/form_builder/form_builder_store.ts index 484ade0..caefca0 100644 --- a/ui/src/core/ui/form_builder/form_builder_store.ts +++ b/ui/src/core/ui/form_builder/form_builder_store.ts @@ -1,7 +1,7 @@ import { makeAutoObservable } from "mobx"; import { FormViewModel } from "./form_view_model"; import { TypedEvent } from "../../helper/typed_event"; -import { FormBuilderValidationModel } from "../../../features/dataset/dataset_store"; +import { FormBuilderValidationModel } from "../../../features/dataset/dataset_model"; export class ChangerForm extends TypedEvent {} diff --git a/ui/src/core/ui/form_builder/form_view_model.ts b/ui/src/core/ui/form_builder/form_view_model.ts index 5ea410c..c895a2f 100644 --- a/ui/src/core/ui/form_builder/form_view_model.ts +++ b/ui/src/core/ui/form_builder/form_view_model.ts @@ -1,7 +1,7 @@ import { makeAutoObservable, observable } from "mobx"; import { Result } from "../../helper/result"; import { v4 as uuidv4 } from "uuid"; -import { FormBuilderValidationModel } from "../../../features/dataset/dataset_store"; +import { FormBuilderValidationModel } from "../../../features/dataset/dataset_model"; export enum InputType { NUMBER = "number", @@ -48,16 +48,16 @@ export class FormViewModel { this.inputs = inputs; makeAutoObservable(this); } + public fromFormBuilderValidationModel() { - console.log(this.toResult()); return new FormBuilderValidationModel( this.context, this.result, this.inputs.map((el) => el.toJson()), - this.toResult() + JSON.parse(this.toResult().replaceAll("\n", "").replaceAll("\\", "").replaceAll("/", "")) ); } - public toResult() { + public toResult(): string { let result = this.result; this.inputs.forEach((element) => { @@ -97,6 +97,7 @@ export class FormViewModel { if (inputResult instanceof Array) inputResult = JSON.stringify(inputResult); result = result.replace(new RegExp("\\${" + element.name + ".*?}"), inputResult); }); + return result; } static fromString(result: string, context: string): Result { diff --git a/ui/src/core/ui/icons/icons.tsx b/ui/src/core/ui/icons/icons.tsx new file mode 100644 index 0000000..e7f3527 --- /dev/null +++ b/ui/src/core/ui/icons/icons.tsx @@ -0,0 +1,89 @@ +import * as React from "react"; +import { Result } from "../../helper/result"; + +export interface IIconsProps { + type: string; + style?: React.CSSProperties; +} + +export function Icon(props: IIconsProps) { + const icon = getIconSvg(props.type); + return icon.fold( + (node) => { + return
{node}
; + }, + () => ( +
+ + + +
+ ) + ); +} +const getIconSvg = (type: string): Result => { + switch (type) { + case "PlusCircle": + return Result.ok( + + + + ); + case "Pencil": + return Result.ok( + + + + ); + case "MenuFab": + return Result.ok( + + + + + + + + + + + ); + case "Settings": + return Result.ok( + + + + + + + + + + + ); + } + return Result.error(undefined); +}; diff --git a/ui/src/core/ui/pages/main_page.tsx b/ui/src/core/ui/pages/main_page.tsx new file mode 100644 index 0000000..f21ff14 --- /dev/null +++ b/ui/src/core/ui/pages/main_page.tsx @@ -0,0 +1,126 @@ +import { DatasetsScreenPath } from "../../../features/dataset/dataset_screen"; +import { Icon } from "../icons/icons"; +import { useNavigate } from "react-router-dom"; +import { Spin } from "antd"; +import { LoadingOutlined } from "@ant-design/icons"; +import React from "react"; +import { SceneManagerPath } from "../../../features/scene_manager/presentation/scene_manager"; +import { AssemblesScreenPath } from "../../../features/assembles/assembles_screen"; +import { DetailsScreenPath } from "../../../features/details/details_screen"; +import { SimulationScreenPath } from "../../../features/simulations/simulations_screen"; +import { EstimateScreenPath } from "../../../features/estimate/estimate_screen"; +import { BehaviorTreeBuilderPath } from "../../../features/behavior_tree_builder/presentation/behavior_tree_builder_screen"; +export interface IBlockProps { + name: string; + isActive: boolean; + path: string; +} +const Block = (props: IBlockProps) => { + const navigate = useNavigate(); + + return ( +
navigate(props.path)} style={{ height: 56, cursor: "pointer" }}> +
+ +
+
{props.name}
+
+ ); +}; +export interface IMainPageProps { + page: string; + bodyChildren?: JSX.Element; + isLoading?: boolean; +} +export const MainPage = (props: IMainPageProps) => { + const blocksNames = [ + { name: "Детали", path: DetailsScreenPath }, + { name: "Сборки", path: AssemblesScreenPath }, + { name: "Датасеты", path: DatasetsScreenPath }, + { name: "Сцена", path: SceneManagerPath }, + { name: "Навыки", path: BehaviorTreeBuilderPath }, + { name: "Симуляция", path: SimulationScreenPath }, + { name: "Оценка", path: EstimateScreenPath }, + ]; + const blocks: IBlockProps[] = blocksNames + .map((el) => { + return { name: el.name, isActive: false, path: el.path }; + }) + .map((el) => { + if (el.name.isEqual(props.page)) { + el.isActive = true; + return el; + } + return el; + }); + React.useEffect(() => { + document.body.style.overflow = "hidden"; + return () => { + document.body.style.overflow = "scroll"; + }; + }); + return ( +
+
+
+
+ +
+
+ +
+
+
+ {blocks.map((el) => ( + + ))} +
+
+ +
+
+ {props.isLoading ? ( +
+ } /> +
+ ) : ( + <> +
+ {props.bodyChildren} + + )} +
+ ); +}; diff --git a/ui/src/core/ui/text/text.tsx b/ui/src/core/ui/text/text.tsx index 3b455e6..a98f8b0 100644 --- a/ui/src/core/ui/text/text.tsx +++ b/ui/src/core/ui/text/text.tsx @@ -2,14 +2,63 @@ import * as React from "react"; export enum CoreTextType { header, + medium, + large, } export interface ITextProps { text: string; type: CoreTextType; + color?: string; } export function CoreText(props: ITextProps) { - if (props.type === CoreTextType.header) return
{props.text}
; + if (props.type === CoreTextType.large) { + return ( +
+ {props.text} +
+ ); + } + if (props.type === CoreTextType.medium) + return ( +
+ {props.text} +
+ ); + if (props.type === CoreTextType.header) + return ( +
+ {props.text} +
+ ); return
{props.text}
; } diff --git a/ui/src/features/stick_objects_marking/model/stick_objects_marking_store_mode.ts b/ui/src/features/_stick_objects_marking/model/stick_objects_marking_store_mode.ts similarity index 100% rename from ui/src/features/stick_objects_marking/model/stick_objects_marking_store_mode.ts rename to ui/src/features/_stick_objects_marking/model/stick_objects_marking_store_mode.ts diff --git a/ui/src/features/stick_objects_marking/model/sticky_helper.ts b/ui/src/features/_stick_objects_marking/model/sticky_helper.ts similarity index 100% rename from ui/src/features/stick_objects_marking/model/sticky_helper.ts rename to ui/src/features/_stick_objects_marking/model/sticky_helper.ts diff --git a/ui/src/features/stick_objects_marking/model/sticky_loader_mode.ts b/ui/src/features/_stick_objects_marking/model/sticky_loader_mode.ts similarity index 100% rename from ui/src/features/stick_objects_marking/model/sticky_loader_mode.ts rename to ui/src/features/_stick_objects_marking/model/sticky_loader_mode.ts diff --git a/ui/src/features/stick_objects_marking/stick_objects_marking_screen.tsx b/ui/src/features/_stick_objects_marking/stick_objects_marking_screen.tsx similarity index 100% rename from ui/src/features/stick_objects_marking/stick_objects_marking_screen.tsx rename to ui/src/features/_stick_objects_marking/stick_objects_marking_screen.tsx diff --git a/ui/src/features/stick_objects_marking/stick_objects_marking_store.tsx b/ui/src/features/_stick_objects_marking/stick_objects_marking_store.tsx similarity index 100% rename from ui/src/features/stick_objects_marking/stick_objects_marking_store.tsx rename to ui/src/features/_stick_objects_marking/stick_objects_marking_store.tsx diff --git a/ui/src/features/stick_objects_marking/stick_objects_marking_three_repository.ts b/ui/src/features/_stick_objects_marking/stick_objects_marking_three_repository.ts similarity index 100% rename from ui/src/features/stick_objects_marking/stick_objects_marking_three_repository.ts rename to ui/src/features/_stick_objects_marking/stick_objects_marking_three_repository.ts diff --git a/ui/src/features/all_projects/data/project_repository.ts b/ui/src/features/all_projects/data/project_repository.ts index fc69f18..237d4f4 100644 --- a/ui/src/features/all_projects/data/project_repository.ts +++ b/ui/src/features/all_projects/data/project_repository.ts @@ -1,4 +1,3 @@ -import { ActivePipeline } from "../../../core/model/active_pipeline"; import { HttpMethod, HttpRepository } from "../../../core/repository/http_repository"; import { IProjectModel } from "../model/project_model"; diff --git a/ui/src/features/assembles/assembles_screen.tsx b/ui/src/features/assembles/assembles_screen.tsx new file mode 100644 index 0000000..f0ff83d --- /dev/null +++ b/ui/src/features/assembles/assembles_screen.tsx @@ -0,0 +1,8 @@ +import * as React from "react"; +import { MainPage } from "../../core/ui/pages/main_page"; + +export interface IAssemblesScreenProps {} +export const AssemblesScreenPath = "/assembles"; +export function AssemblesScreen(props: IAssemblesScreenProps) { + return ; +} diff --git a/ui/src/features/behavior_tree_builder/presentation/behavior_tree_builder_screen.tsx b/ui/src/features/behavior_tree_builder/presentation/behavior_tree_builder_screen.tsx index 936041e..dd46685 100644 --- a/ui/src/features/behavior_tree_builder/presentation/behavior_tree_builder_screen.tsx +++ b/ui/src/features/behavior_tree_builder/presentation/behavior_tree_builder_screen.tsx @@ -6,6 +6,7 @@ import { useRete } from "rete-react-plugin"; import { createEditor } from "./ui/editor/editor"; import { SkillTree } from "./ui/skill_tree/skill_tree"; import { BehaviorTreeBuilderStore } from "./behavior_tree_builder_store"; +import { MainPage } from "../../../core/ui/pages/main_page"; export const behaviorTreeBuilderScreenPath = "behavior/tree/screen/path"; @@ -53,56 +54,24 @@ export function BehaviorTreeBuilderScreen() { }, [store, ref]); return ( -
-
- -
-
-
-
- -
-
-
-
-
- -
-
+ +
+ {/* */} -
-
-
+
+
+ + } + /> ); } diff --git a/ui/src/features/behavior_tree_builder/presentation/ui/skill_tree/skill_tree.tsx b/ui/src/features/behavior_tree_builder/presentation/ui/skill_tree/skill_tree.tsx index 0acb353..b314948 100644 --- a/ui/src/features/behavior_tree_builder/presentation/ui/skill_tree/skill_tree.tsx +++ b/ui/src/features/behavior_tree_builder/presentation/ui/skill_tree/skill_tree.tsx @@ -16,10 +16,10 @@ interface IRefListerProps { } export const RefListener = (props: IRefListerProps) => { - const canvasRef = React.useRef(null); + const ref = React.useRef(null); React.useEffect(() => { - if (canvasRef.current) { - canvasRef.current.addEventListener("dragend", (e) => { + if (ref.current) { + ref.current.addEventListener("dragend", (e) => { // @ts-expect-error if (e.target.innerHTML) { // @ts-expect-error @@ -27,7 +27,7 @@ export const RefListener = (props: IRefListerProps) => { } }); } - }, [canvasRef, props]); + }, [ref, props]); return (
@@ -36,7 +36,7 @@ export const RefListener = (props: IRefListerProps) => { props.handleSelect(e); }} /> - + {props.element.name}
diff --git a/ui/src/features/dataset/dataset_form_mock.ts b/ui/src/features/dataset/dataset_form_mock.ts deleted file mode 100644 index 0277a82..0000000 --- a/ui/src/features/dataset/dataset_form_mock.ts +++ /dev/null @@ -1,75 +0,0 @@ -export const datasetTypes = ["Object Detection - YOLOv8", "Pose Estimation - DOPE"]; - -export const datasetFormMockResult = `{ - "typedataset": \${typedataset:Enum:"ObjectDetection"}, - "dataset_path": \${ПУТЬ ДАТАСЕТА:string:""}, - "models":\${models:Array:[]}, - "models_randomization":{ - "loc_range_low": [\${LOC_RANGE_LOW_1:number:-1}, \${LOC_RANGE_LOW_2:number:-1},/\${LOC_RANGE_LOW_3:number:0}], - "loc_range_high": [\${LOC_RANGE_HIGH_1:number:1}, \${LOC_RANGE_HIGH_2:number:1},/\${LOC_RANGE_HIGH_3:number:2}] - }, - "scene":{ - "objects": \${OBJECTS_SCENE:Array:[]}, - "lights": \${LIGHTS:Array:[]}, - }, - "camera_position":{ - "center_shell": [\${CENTER_SHELL_1:number:0}, \${CENTER_SHELL_2:number:0}, \${CENTER_SHELL_3:number:0}], - "radius_range": [\${RADIUS_RANGE_1:number:0.4}, \${RADIUS_RANGE_2:number:1.4}], - "elevation_range": [\${ELEVATION_RANGE_1:number:10}, \${ELEVATION_RANGE_2:number:90}] - }, - "generation":{ - "n_cam_pose": \${N_CAM_POSE:number:5}, - "n_sample_on_pose": \${N_SAMPLE_ON_POSE:number:3}, - "n_series": \${N_SERIES:number:100}, - "image_format": \${image_format:Enum:"jpg"}, - "image_size_wh": [\${IMAGE_SIZE_WH_1:number:640}, \${IMAGE_SIZE_WH_2:number:480}] - } - } -`; - -export const datasetFormMockContext = ` -ENUM T = "ObjectDetection","PoseEstimation"; -ENUM L = "POINT","SUN"; -ENUM F = "JPEG","PNG"; -ENUM COLLISION_SHAPE = "SHAPE","COLLISION"; - -type MODELS = { - "id": \${ID:number:1}, - "name": \${NAME:string:""}, - "model": \${MODEL:string:"models/1.fbx"} -}; -type OBJECTS_SCENE = { -"name": \${NAME:string:""}, -"collision_shape": \${collision_shape:Enum:"BOX"}, -"loc_xyz": [\${LOC_XYZ_1:number:0}, \${LOC_XYZ_2:number:0}, \${LOC_XYZ_3:number:0}], -"rot_euler": [\${ROT_EULER_1:number:0},\${ROT_EULER_2:number:0}, \${ROT_EULER_3:number:0}], -"material_randomization": { - "specular": [\${SPECULAR_1:number:0}, \${SPECULAR_2:number:1}], - "roughness": [\${ROUGHNESS_1:number:0}, \${ROUGHNESS_2:number:1}], - "metallic": [\${METALLIC_1:number:0}, \${METALLIC_2:number:1}], - "base_color": [ - [ - \${BASE_COLOR_1:number:0}, - \${BASE_COLOR_2:number:0}, - \${BASE_COLOR_3:number:0}, - \${BASE_COLOR_4:number:1} - ], - [ - \${BASE_COLOR_5:number:1}, - \${BASE_COLOR_6:number:1}, - \${BASE_COLOR_7:number:1}, - \${BASE_COLOR_8:number:1} - ] - ] -} -}; -type LIGHTS = { -"id": \${ID:number:1}, -"type": \${type:Enum:"POINT"}, -"loc_xyz": [\${LOC_XYZ_1:number:5}, \${LOC_XYZ_2:number:5}, \${LOC_XYZ_3:number:5}], -"rot_euler": [\${ROT_EULER_1:number:-0.06}, \${ROT_EULER_2:number:0.61}, \${ROT_EULER_3:number:-0.19}], -"color_range_low": [\${COLOR_RANGE_LOW_1:number:0.5}, \${COLOR_RANGE_LOW_2:number:0.5}, \${COLOR_RANGE_LOW_3:number:0.5}], -"color_range_high":[\${COLOR_RANGE_HIGH_1:number:1}, \${COLOR_RANGE_HIGH_2:number:1}, $\{COLOR_RANGE_HIGH_3:number:1}], -"energy_range":[\${ENERGY_RANGE_1:number:400},\${ENERGY_RANGE_2:number:900}] -}; -`; diff --git a/ui/src/features/dataset/dataset_model.ts b/ui/src/features/dataset/dataset_model.ts index 2ce19fb..389725a 100644 --- a/ui/src/features/dataset/dataset_model.ts +++ b/ui/src/features/dataset/dataset_model.ts @@ -1,4 +1,20 @@ import { InputBuilderViewModel } from "../../core/ui/form_builder/form_view_model"; +import { Result } from "../../core/helper/result"; +import makeAutoObservable from "mobx-store-inheritance"; + +export interface IDatasetModel { + _id: string; + dataSetObjects: string[]; + processStatus: string; + projectId: string; + name: string; + formBuilder: FormBuilder; + unixTime: number; + datasetType: string; + local_path: string; + __v: number; + processLogs: string; +} export interface Dataset { name: string; @@ -23,3 +39,128 @@ export interface Asset { mesh: string; image: string; } +export class FormBuilderValidationModel { + public result: string; + public context: string; + public form: string[]; + public output: string; + constructor(context: string, result: string, form: string[], output: string) { + this.context = context; + this.result = result; + this.form = form; + this.output = output; + } + static empty() { + return new FormBuilderValidationModel(datasetFormMockContext, datasetFormMockResult, [], ""); + } +} + +export class DataSetModel { + dataSetObjects: string[]; + datasetType: string; + name: string; + formBuilder: FormBuilderValidationModel = FormBuilderValidationModel.empty(); + project?: string; + constructor(dataSetObjects: string[], datasetType = datasetTypes[0], datasetName: string) { + this.dataSetObjects = dataSetObjects; + this.datasetType = datasetType; + this.name = datasetName; + makeAutoObservable(this); + } + + static empty() { + return new DataSetModel([], "", ""); + } + + isValid(): Result { + if (this.project === undefined) { + return Result.error("project is unknow"); + } + if (this.dataSetObjects.isEmpty()) { + return Result.error("not selected details"); + } + if (this.datasetType.isEmpty()) { + return Result.error("dataset type is empty"); + } + if (this.name.isEmpty()) { + return Result.error("dataset name is empty"); + } + return Result.ok(); + } +} + +export const datasetTypes = ["Object Detection - YOLOv8", "Pose Estimation - DOPE"]; + +export const datasetFormMockResult = `{ + "typedataset": \${typedataset:Enum:ObjectDetection}, + "dataset_path": \${ПУТЬ ДАТАСЕТА:string:none}, + "models":\${models:Array:[]}, + "models_randomization":{ + "loc_range_low": [\${LOC_RANGE_LOW_1:number:-1}, \${LOC_RANGE_LOW_2:number:-1},/\${LOC_RANGE_LOW_3:number:0}], + "loc_range_high": [\${LOC_RANGE_HIGH_1:number:1}, \${LOC_RANGE_HIGH_2:number:1},/\${LOC_RANGE_HIGH_3:number:2}] + }, + "scene":{ + "objects": \${OBJECTS_SCENE:Array:[]}, + "lights": \${LIGHTS:Array:[]} + }, + "camera_position":{ + "center_shell": [\${CENTER_SHELL_1:number:0}, \${CENTER_SHELL_2:number:0}, \${CENTER_SHELL_3:number:0}], + "radius_range": [\${RADIUS_RANGE_1:number:0.4}, \${RADIUS_RANGE_2:number:1.4}], + "elevation_range": [\${ELEVATION_RANGE_1:number:10}, \${ELEVATION_RANGE_2:number:90}] + }, + "generation":{ + "n_cam_pose": \${N_CAM_POSE:number:5}, + "n_sample_on_pose": \${N_SAMPLE_ON_POSE:number:3}, + "n_series": \${N_SERIES:number:100}, + "image_format": \${image_format:Enum:jpg}, + "image_size_wh": [\${IMAGE_SIZE_WH_1:number:640}, \${IMAGE_SIZE_WH_2:number:480}] + } + } +`; + +export const datasetFormMockContext = ` +ENUM T = "ObjectDetection","PoseEstimation"; +ENUM L = "POINT","SUN"; +ENUM F = "JPEG","PNG"; +ENUM COLLISION_SHAPE = "SHAPE","COLLISION"; + +type MODELS = { + "id": \${ID:number:1}, + "name": \${NAME:string:none}, + "model": \${MODEL:string:models/1.fbx} +}; +type OBJECTS_SCENE = { +"name": \${NAME:string:default}, +"collision_shape": \${collision_shape:Enum:BOX}, +"loc_xyz": [\${LOC_XYZ_1:number:0}, \${LOC_XYZ_2:number:0}, \${LOC_XYZ_3:number:0}], +"rot_euler": [\${ROT_EULER_1:number:0},\${ROT_EULER_2:number:0}, \${ROT_EULER_3:number:0}], +"material_randomization": { + "specular": [\${SPECULAR_1:number:0}, \${SPECULAR_2:number:1}], + "roughness": [\${ROUGHNESS_1:number:0}, \${ROUGHNESS_2:number:1}], + "metallic": [\${METALLIC_1:number:0}, \${METALLIC_2:number:1}], + "base_color": [ + [ + \${BASE_COLOR_1:number:0}, + \${BASE_COLOR_2:number:0}, + \${BASE_COLOR_3:number:0}, + \${BASE_COLOR_4:number:1} + ], + [ + \${BASE_COLOR_5:number:1}, + \${BASE_COLOR_6:number:1}, + \${BASE_COLOR_7:number:1}, + \${BASE_COLOR_8:number:1} + ] + ] +} +}; +type LIGHTS = { +"id": \${ID:number:1}, +"type": \${type:Enum:"POINT"}, +"loc_xyz": [\${LOC_XYZ_1:number:5}, \${LOC_XYZ_2:number:5}, \${LOC_XYZ_3:number:5}], +"rot_euler": [\${ROT_EULER_1:number:-0.06}, \${ROT_EULER_2:number:0.61}, \${ROT_EULER_3:number:-0.19}], +"color_range_low": [\${COLOR_RANGE_LOW_1:number:0.5}, \${COLOR_RANGE_LOW_2:number:0.5}, \${COLOR_RANGE_LOW_3:number:0.5}], +"color_range_high":[\${COLOR_RANGE_HIGH_1:number:1}, \${COLOR_RANGE_HIGH_2:number:1}, $\{COLOR_RANGE_HIGH_3:number:1}], +"energy_range":[\${ENERGY_RANGE_1:number:400},\${ENERGY_RANGE_2:number:900}] +}; +`; diff --git a/ui/src/features/dataset/dataset_repository.ts b/ui/src/features/dataset/dataset_repository.ts index 14f8b2d..e015de5 100644 --- a/ui/src/features/dataset/dataset_repository.ts +++ b/ui/src/features/dataset/dataset_repository.ts @@ -1,9 +1,12 @@ import { Result } from "../../core/helper/result"; import { HttpError, HttpMethod, HttpRepository } from "../../core/repository/http_repository"; -import { Assets, Dataset } from "./dataset_model"; -import { DataSetModel, IDatasetModel } from "./dataset_store"; +import { UUID } from "../all_projects/data/project_repository"; +import { Assets, DataSetModel, Dataset, IDatasetModel } from "./dataset_model"; export class DataSetRepository extends HttpRepository { + getActiveProjectId(): Promise> { + return this._jsonRequest(HttpMethod.GET, "/projects/get/active/project/id"); + } getAssetsActiveProject = async (): Promise> => { return this._jsonRequest(HttpMethod.GET, "/projects/assets"); }; @@ -13,4 +16,13 @@ export class DataSetRepository extends HttpRepository { getDatasetsActiveProject = async (): Promise> => { return this._jsonRequest(HttpMethod.GET, "/datasets"); }; + execDatasetProcess = async (id: string) => { + return this._jsonRequest(HttpMethod.POST, `/datasets/exec?id=${id}`); + }; + isRunningProcess = async () => { + return this._jsonRequest(HttpMethod.GET, "/datasets/is/running"); + }; + deleteProcess = async () => { + return this._jsonRequest(HttpMethod.GET, "/datasets/delete/process"); + }; } diff --git a/ui/src/features/dataset/dataset_screen.tsx b/ui/src/features/dataset/dataset_screen.tsx index 3cc8ff6..c1a851c 100644 --- a/ui/src/features/dataset/dataset_screen.tsx +++ b/ui/src/features/dataset/dataset_screen.tsx @@ -1,9 +1,11 @@ import * as React from "react"; import { Drawer, Button, Radio, Card, Checkbox, Input } from "antd"; import { FormBuilder } from "../../core/ui/form_builder/form_builder"; -import { datasetFormMockContext, datasetFormMockResult, datasetTypes } from "./dataset_form_mock"; import { DataSetStore } from "./dataset_store"; import { observer } from "mobx-react-lite"; +import { datasetTypes } from "./dataset_model"; +import { MainPage } from "../../core/ui/pages/main_page"; +import { CardDataSet, CardDataSetType } from "../../core/ui/card/card_dataset"; export const DatasetsScreenPath = "/dataset"; @@ -18,7 +20,96 @@ export const DataSetScreen: React.FunctionComponent = observer(() => { const [open1, setOpen1] = React.useState(false); return ( <> - + + {store.datasets?.map((el) => { + console.log(el); + return ( + store.runProcess(id)} + /> + ); + })} + { + setOpen(true); + }} + /> + + setOpen1(false)} open={open1}> + { + if (el) store.dataSetModel.formBuilder = el; + }} + /> + + setOpen(false)} open={open}> + (store.dataSetModel.name = e.target.value)} /> + + + + { + store.dataSetModel.datasetType = e.target.value; + }} + > + {datasetTypes.map((el) => ( + <> + {el} + + ))} + + + {store.assets?.assets.map((el) => { + return ( + <> + { + store.dataSetModel.dataSetObjects.push(el.name); + }} + defaultChecked={store.dataSetModel.dataSetObjects.includes(el.name)} + > + include? + + + error + + + ); + })} + +
+ } + /> + + ); +}); +{ + /* {store.datasets?.isEmpty() ? (
empty dataset
) : ( @@ -42,53 +133,6 @@ export const DataSetScreen: React.FunctionComponent = observer(() => { })}
- )} - setOpen(false)} open={open}> - (store.dataSetModel.name = e.target.value)} /> - - - - { - store.dataSetModel.datasetType = e.target.value; - }} - > - {datasetTypes.map((el) => ( - <> - {el} - - ))} - - - {store.assets?.assets.map((el) => { - return ( - <> - { - store.dataSetModel.dataSetObjects.push(el.name); - }} - defaultChecked={store.dataSetModel.dataSetObjects.includes(el.name)} - > - include? - - - error - - - ); - })} - - - setOpen1(false)} open={open1}> - { - if (el) store.dataSetModel.formBuilder = el; - }} - /> - - - ); -}); + )} + */ +} diff --git a/ui/src/features/dataset/dataset_store.ts b/ui/src/features/dataset/dataset_store.ts index b5e59f9..7ef699f 100644 --- a/ui/src/features/dataset/dataset_store.ts +++ b/ui/src/features/dataset/dataset_store.ts @@ -2,75 +2,46 @@ import makeAutoObservable from "mobx-store-inheritance"; import { DataSetRepository } from "./dataset_repository"; import { UiErrorState } from "../../core/store/base_store"; import { HttpError } from "../../core/repository/http_repository"; -import { Assets } from "./dataset_model"; -import { datasetFormMockContext, datasetFormMockResult, datasetTypes } from "./dataset_form_mock"; -import { Result } from "../../core/helper/result"; +import { Assets, DataSetModel, IDatasetModel } from "./dataset_model"; import { message } from "antd"; - -export class FormBuilderValidationModel { - public result: string; - public context: string; - public form: string[]; - public output: string; - constructor(context: string, result: string, form: string[], output: string) { - this.context = context; - this.result = result; - this.form = form; - this.output = output; - } - static empty() { - return new FormBuilderValidationModel(datasetFormMockContext, datasetFormMockResult, [], ""); - } -} - -export class DataSetModel { - dataSetObjects: string[]; - datasetType: string; - name: string; - formBuilder: FormBuilderValidationModel = FormBuilderValidationModel.empty(); - - constructor(dataSetObjects: string[], datasetType = datasetTypes[0], datasetName: string) { - this.dataSetObjects = dataSetObjects; - this.datasetType = datasetType; - this.name = datasetName; - makeAutoObservable(this); - } - - static empty() { - return new DataSetModel([], "", ""); - } - - isValid(): Result { - if (this.dataSetObjects.isEmpty()) { - return Result.error("not selected details"); - } - if (this.datasetType.isEmpty()) { - return Result.error("dataset type is empty"); - } - if (this.name.isEmpty()) { - return Result.error("dataset name is empty"); - } - return Result.ok(); - } -} +import { UUID } from "../all_projects/data/project_repository"; export class DataSetStore extends UiErrorState { dataSetRepository: DataSetRepository; assets?: Assets; datasets?: IDatasetModel[]; + activeProject: UUID; dataSetModel = DataSetModel.empty(); + constructor() { super(); this.dataSetRepository = new DataSetRepository(); makeAutoObservable(this); } - errorHandingStrategy = (error: HttpError) => {}; + runProcess = async (id: string): Promise => { + (await this.dataSetRepository.isRunningProcess()).fold( + async (s) => { + (await this.dataSetRepository.execDatasetProcess(id)).fold( + () => { + message.success("процесс запущен"); + }, + (e) => message.error(e.message) + ); + }, + async (e) => message.error(e.message) + ); + }; + errorHandingStrategy = (error: HttpError) => { + message.error(error.message); + }; + saveDataset(): void { + this.dataSetModel.project = this.activeProject.id; this.dataSetModel.isValid().fold( async () => { (await this.dataSetRepository.saveDataSet(this.dataSetModel)).fold( () => { - message.success("save dataset"); + message.success("датасет сохранен"); }, (error) => message.error(error.message) ); @@ -78,25 +49,10 @@ export class DataSetStore extends UiErrorState { async (error) => message.error(error) ); } + init = async () => { await this.mapOk("assets", this.dataSetRepository.getAssetsActiveProject()); await this.mapOk("datasets", this.dataSetRepository.getDatasetsActiveProject()); + await this.mapOk("activeProject", this.dataSetRepository.getActiveProjectId()); }; } -export interface IDatasetModel { - _id: string; - dataSetObjects: string[]; - processStatus: string; - projectId: string; - name: string; - formBuilder: FormBuilder; - local_path: string; - __v: number; - processLogs: string; -} - -export interface FormBuilder { - result: string; - context: string; - form: any[]; -} diff --git a/ui/src/features/details/details_screen.tsx b/ui/src/features/details/details_screen.tsx new file mode 100644 index 0000000..2f9d9e2 --- /dev/null +++ b/ui/src/features/details/details_screen.tsx @@ -0,0 +1,8 @@ +import * as React from "react"; +import { MainPage } from "../../core/ui/pages/main_page"; + +export interface IDetailsScreenProps {} +export const DetailsScreenPath = "/detail"; +export default function DetailsScreen(props: IDetailsScreenProps) { + return ; +} diff --git a/ui/src/features/estimate/estimate_screen.tsx b/ui/src/features/estimate/estimate_screen.tsx new file mode 100644 index 0000000..842e683 --- /dev/null +++ b/ui/src/features/estimate/estimate_screen.tsx @@ -0,0 +1,8 @@ +import * as React from "react"; +import { MainPage } from "../../core/ui/pages/main_page"; + +export interface IEstimateScreenProps {} +export const EstimateScreenPath = "/estimate"; +export function EstimateScreen(props: IEstimateScreenProps) { + return ; +} diff --git a/ui/src/features/pipeline_instance_main_screen/pipeline_instance_screen.tsx b/ui/src/features/pipeline_instance_main_screen/pipeline_instance_screen.tsx index 655b400..2987fde 100644 --- a/ui/src/features/pipeline_instance_main_screen/pipeline_instance_screen.tsx +++ b/ui/src/features/pipeline_instance_main_screen/pipeline_instance_screen.tsx @@ -1,32 +1,27 @@ import * as React from "react"; -import { LoadPage } from "../../core/ui/pages/load_page"; import { PipelineInstanceStore } from "./pipeline_instance_store"; -import { Button } from "antd"; import { useNavigate } from "react-router-dom"; -import { BehaviorTreeBuilderPath } from "../behavior_tree_builder/presentation/behavior_tree_builder_screen"; -import { SceneManagerPath } from "../scene_manager/presentation/scene_manager"; -import { StickObjectsMarkingScreenPath } from "../stick_objects_marking/stick_objects_marking_screen"; -import { DatasetsScreenPath } from "../dataset/dataset_screen"; +import { Icon } from "../../core/ui/icons/icons"; +import { CardDataSet, CardDataSetType } from "../../core/ui/card/card_dataset"; +import { MainPage } from "../../core/ui/pages/main_page"; + export const PipelineInstanceScreenPath = "/pipeline_instance/"; + export const PipelineInstanceScreen: React.FunctionComponent = () => { - const [pipelineInstanceStore] = React.useState(() => new PipelineInstanceStore()); - React.useEffect(() => {}, [pipelineInstanceStore]); + const [store] = React.useState(() => { + new PipelineInstanceStore(); + }); + React.useEffect(() => { + document.body.style.overflow = "hidden"; + return () => { + document.body.style.overflow = "scroll"; + }; + }, [store]); const navigate = useNavigate(); return ( - - - - - - - } - /> + <> + + ); }; diff --git a/ui/src/features/scene_manager/presentation/components/scene_widget.tsx b/ui/src/features/scene_manager/presentation/components/scene_widget.tsx index 9cf137b..65d23b1 100644 --- a/ui/src/features/scene_manager/presentation/components/scene_widget.tsx +++ b/ui/src/features/scene_manager/presentation/components/scene_widget.tsx @@ -57,7 +57,6 @@ export const SceneWidget = () => {

{ event.stopPropagation(); - console.log(201); }} > HYO diff --git a/ui/src/features/scene_manager/presentation/scene_manager.tsx b/ui/src/features/scene_manager/presentation/scene_manager.tsx index f3eec84..62267a4 100644 --- a/ui/src/features/scene_manager/presentation/scene_manager.tsx +++ b/ui/src/features/scene_manager/presentation/scene_manager.tsx @@ -8,6 +8,7 @@ import { Button } from "antd"; import { Form, Input, ResetButton, SubmitButton } from "formik-antd"; import { Formik } from "formik"; import { CameraViewModel } from "../model/scene_assets"; +import { MainPage } from "../../../core/ui/pages/main_page"; export const SceneManagerPath = "/scene/manager/"; @@ -33,141 +34,150 @@ export const SceneManger = observer(() => { }); return ( -
- -
-
- {sceneIcons.map((el) => { - return ( -
{ - el.clickHandel(); - }} - > - {el.name} -
- ); - })} + +
-
Scene manager
- {store.isVisibleSaveButton ? ( - <> - - - ) : ( - <> - )} - {store.isLoading ? <>Loading... : <>} - {store.sceneMode === SceneMode.ADD_CAMERA ? ( -
- { - store.addNewCamera(model); - actions.setSubmitting(false); - actions.resetForm(); - }} - validate={(model) => { - return model.validate(store.getCameraLinkNames()); - }} - render={() => ( -
-
- - - - - - Reset - Submit -
-
- )} - /> -
- ) : ( - <> - )} - {store.sceneMode === SceneMode.MOVING || SceneMode.ROTATE ? ( - <> - {store.robossemblerAssets?.assets.map((el) => { - return ( -
-
- {el.name} - {store.isRenderedAsset(el.name) ? ( - <> - ) : ( - + + ) : ( + <> + )} + {store.isLoading ? <>Loading... : <>} + {store.sceneMode === SceneMode.ADD_CAMERA ? ( +
+ { + store.addNewCamera(model); + actions.setSubmitting(false); + actions.resetForm(); + }} + validate={(model) => { + return model.validate(store.getCameraLinkNames()); + }} + render={() => ( +
+
- add scene - - )} -
-
- ); - })} + + + + + + Reset + Submit +
+ + )} + /> +
+ ) : ( + <> + )} + {store.sceneMode === SceneMode.MOVING || SceneMode.ROTATE ? ( + <> + {store.robossemblerAssets?.assets.map((el) => { + return ( +
+
+ {el.name} + {store.isRenderedAsset(el.name) ? ( + <> + ) : ( + + )} +
+
+ ); + })} + + ) : ( + <> + )} +
+
+
+ {store.sceneModels.map((el) => { + return store.deleteSceneItem(el)} model={el} />; + })} +
+ + {store.sceneMode === SceneMode.MAGNETISM_MARKING ? ( + <> +
+
completion of objects
+
+ {store.objectMagnetism ? ( + <>{store.objectMagnetism} + ) : ( + + )} + {store.objectForMagnetism ? ( + <>{store.objectForMagnetism} + ) : ( + + )} +
+
) : ( <> - )} -
-
-
- {store.sceneModels.map((el) => { - return store.deleteSceneItem(el)} model={el} />; - })} -
- - {store.sceneMode === SceneMode.MAGNETISM_MARKING ? ( - <> -
-
completion of objects
-
- {store.objectMagnetism ? ( - <>{store.objectMagnetism} - ) : ( - - )} - {store.objectForMagnetism ? <>{store.objectForMagnetism} : } -
-
- - ) : ( - <> - )} - - + )} */} + {/* */} + + } + /> ); }); diff --git a/ui/src/features/simulations/simulations_screen.tsx b/ui/src/features/simulations/simulations_screen.tsx new file mode 100644 index 0000000..b0fd134 --- /dev/null +++ b/ui/src/features/simulations/simulations_screen.tsx @@ -0,0 +1,11 @@ +import * as React from "react"; +import { MainPage } from "../../core/ui/pages/main_page"; + +export interface ISimulationScreenProps {} +export const SimulationScreenPath = "/simulation"; + +export default class SimulationScreen extends React.Component { + public render() { + return ; + } +}