This commit is contained in:
IDONTSUDO 2024-07-25 11:50:43 +03:00
parent 9120729d41
commit 6003cfde04
9 changed files with 29 additions and 184 deletions

View file

@ -6,7 +6,7 @@
"Количество", "Количество",
"может", "может",
"навык", "навык",
"Навыки", "модели",
"Новое", "Новое",
"отрицательное", "отрицательное",
"принимать", "принимать",

View file

@ -1,174 +0,0 @@
{
"scene": [
{
"type": "ROBOT",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"name": "ARM0",
"nDOF": 6,
"toolType": "RBS_GRIPPER",
"jointPosition": [
1.1,
2.2,
2.1,
3.1,
4.4
]
},
{
"type": "CAMERA",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"parent": "WORLD",
"fixed": "null/true",
"topic": "123",
"name": "CAMERA1",
"cameraType": "RGB",
"width": 100,
"updateRate": 100,
"fov": 10.0,
"near": 10,
"far": 10,
"height": 10
},
{
"type": "SOLID",
"name":"21341qd",
"solidType": "ENV",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"inertia": 1,
"mass": 1,
"mesh": "",
"collisionMesh": ""
},
{
"type": "SOLID",
"solidType": "ACTIVE",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"inertia": 1,
"mass": 1,
"mesh": "",
"collisionMesh": "",
"spawn": {
"type": "POINT",
"name": "123"
}
},
{
"type": "POINT",
"name": "123",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
}
},
{
"type": "SOLID",
"solidType": "ACTIVE",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"inertia": 1,
"mass": 1,
"visualMesh": "",
"collisionMesh": "",
"spawn": {
"type": "DEFAULT"
}
},
{
"type": "SOLID",
"solidType": "ACTIVE",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"inertia": 1,
"mass": 1,
"visualMesh": 100,
"collisionMesh": 100,
"spawn": {
"type": "ZONE",
"name": "111"
}
},
{
"type": "ZONE",
"name": "111",
"vector3": {
"x": 1.0,
"y": 1,
"z": 1
},
"quaternion": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
},
"width": 100,
"height": 100,
"length": 100
}
]
}

View file

@ -182,7 +182,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
public put(usecase: any) { public put(usecase: any) {
this.routes["PUT"] = usecase; this.routes["PUT"] = usecase;
} }
public delete(usecase: CallbackStrategyWithValidationModel<V>) { public delete(usecase: any) {
this.routes["DELETE"] = usecase; this.routes["DELETE"] = usecase;
} }
public async requestResponseController<T>( public async requestResponseController<T>(

View file

@ -1,16 +1,31 @@
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../core/controllers/http_controller"; import { CallbackStrategyWithIdQuery, ResponseBase } from "../../core/controllers/http_controller";
import { Result } from "../../core/helpers/result"; import { Result } from "../../core/helpers/result";
import { StaticFiles } from "../../core/models/static_files";
import { DeleteDataBaseModelUseCase } from "../../core/usecases/delete_database_model_usecase"; import { DeleteDataBaseModelUseCase } from "../../core/usecases/delete_database_model_usecase";
import { DeleteFileUseCase } from "../../core/usecases/delete_file_usecase";
import { ReadByIdDataBaseModelUseCase } from "../../core/usecases/read_by_id_database_model_usecase"; import { ReadByIdDataBaseModelUseCase } from "../../core/usecases/read_by_id_database_model_usecase";
import { SearchManyDataBaseModelUseCase } from "../../core/usecases/search_many_database_model_usecase";
import { CoreValidation } from "../../core/validations/core_validation"; import { CoreValidation } from "../../core/validations/core_validation";
import { MongoIdValidation } from "../../core/validations/mongo_id_validation"; import { MongoIdValidation } from "../../core/validations/mongo_id_validation";
import { IProjectModel, ProjectDBModel } from "../projects/models/project_model_database_model";
import { SceneModel } from "./create_new_scene_scenario"; import { SceneModel } from "./create_new_scene_scenario";
export class DeleteSceneScenario extends CallbackStrategyWithIdQuery { export class DeleteSceneScenario extends CallbackStrategyWithIdQuery {
idValidationExpression: CoreValidation = new MongoIdValidation(); idValidationExpression: CoreValidation = new MongoIdValidation();
call = async (id: string): ResponseBase => call = async (id: string): ResponseBase =>
(await new ReadByIdDataBaseModelUseCase<SceneModel>(SceneModel).call(id)).map((sceneModel) => Result.ok() (await new ReadByIdDataBaseModelUseCase<SceneModel>(SceneModel).call(id)).map(async (sceneModel) =>
// (await new DeleteDataBaseModelUseCase(SceneModel).call(id)).map(() => DeleteF ) (await new DeleteDataBaseModelUseCase(SceneModel).call(id)).map(async () =>
(
await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call(
{ isActive: true },
"is dont active projects"
)
).map(async (projectModel) => {
const { rootDir } = projectModel[0];
(await new DeleteFileUseCase()).call(`${rootDir}${StaticFiles.scenes}${sceneModel.name}.json`);
return Result.ok("Delete scene");
})
)
); );
} }

View file

@ -16,6 +16,7 @@ export class ScenePresentation extends CrudController<SceneValidationModel, type
validationModel: SceneValidationModel, validationModel: SceneValidationModel,
databaseModel: SceneDBModel, databaseModel: SceneDBModel,
}); });
super.post(new CreateNewSceneScenario().call); super.post(new CreateNewSceneScenario().call);
super.put(new EditSceneScenario().call); super.put(new EditSceneScenario().call);
this.subRoutes.push({ this.subRoutes.push({

View file

@ -64,7 +64,7 @@ export const MainPage = (props: IMainPageProps) => {
{ name: "Сборки", path: AssemblesScreenPath, icon: "Assembly" }, { name: "Сборки", path: AssemblesScreenPath, icon: "Assembly" },
{ name: "Датасеты", path: DatasetsScreenPath, icon: "Datasets" }, { name: "Датасеты", path: DatasetsScreenPath, icon: "Datasets" },
{ name: "Сцена", path: SceneManagerPath, icon: "Scene" }, { name: "Сцена", path: SceneManagerPath, icon: "Scene" },
{ name: "Навыки", path: SkillScreenPath, icon: "Layers" }, { name: "модели", path: SkillScreenPath, icon: "Layers" },
{ name: "Поведение", path: BehaviorTreeBuilderPath, icon: "Rocket" }, { name: "Поведение", path: BehaviorTreeBuilderPath, icon: "Rocket" },
{ name: "Симуляция", path: SimulationScreenPath, icon: "Simulation" }, { name: "Симуляция", path: SimulationScreenPath, icon: "Simulation" },
{ name: "Оценка", path: EstimateScreenPath, icon: "Grade" }, { name: "Оценка", path: EstimateScreenPath, icon: "Grade" },

View file

@ -97,7 +97,7 @@ export const BehaviorTreeBuilderScreen = observer(() => {
> >
<div> <div>
<div style={{ height: 58, alignContent: "center" }}> <div style={{ height: 58, alignContent: "center" }}>
<CoreText text="Навыки" type={CoreTextType.medium} /> <CoreText text="модели" type={CoreTextType.medium} />
</div> </div>
{store.skillTemplates ? <SkillTree skills={store.skillTree} dragEnd={store.dragEnd} /> : null} {store.skillTemplates ? <SkillTree skills={store.skillTree} dragEnd={store.dragEnd} /> : null}
</div> </div>

View file

@ -193,14 +193,17 @@ export class SceneMangerStore extends UiDrawerFormState<SceneViewModel, HttpErro
hiddenMenu = () => (this.isSceneMenuShow = false); hiddenMenu = () => (this.isSceneMenuShow = false);
init = async () => {}; init = async () => {
this.storeMode
.isEqualR(StoreMode.allScenes)
.map(() => this.mapOk("scenes", this.sceneHttpRepository.getAllScenes()));
};
initParam = (id: string | undefined) => { initParam = (id: string | undefined) => {
if (id) { if (id) {
this.activeSceneId = id; this.activeSceneId = id;
this.storeMode = StoreMode.sceneInstance; this.storeMode = StoreMode.sceneInstance;
} else { } else {
this.storeMode = StoreMode.allScenes; this.storeMode = StoreMode.allScenes;
this.mapOk("scenes", this.sceneHttpRepository.getAllScenes());
} }
}; };
errorHandingStrategy = (error: HttpError) => errorHandingStrategy = (error: HttpError) =>

View file

@ -27,7 +27,7 @@ export const SkillScreen = observer(() => {
return ( return (
<> <>
<MainPage <MainPage
page={"Навыки"} page={"модели"}
panelChildren={ panelChildren={
<div style={{ justifyContent: "center", display: "flex", padding: 10 }}> <div style={{ justifyContent: "center", display: "flex", padding: 10 }}>
{skills.map((el) => ( {skills.map((el) => (