progress
This commit is contained in:
parent
40eebf9dd8
commit
d7e8c825cb
12 changed files with 77 additions and 23 deletions
|
@ -9,6 +9,9 @@ import { dirname } from "path";
|
||||||
import { CheckAndCreateStaticFilesFolderUseCase } from "../usecases/check_and_create_static_files_folder_usecase";
|
import { CheckAndCreateStaticFilesFolderUseCase } from "../usecases/check_and_create_static_files_folder_usecase";
|
||||||
import { DataBaseConnectUseCase } from "../usecases/database_connect_usecase";
|
import { DataBaseConnectUseCase } from "../usecases/database_connect_usecase";
|
||||||
import { TypedEvent } from "../helpers/typed_event";
|
import { TypedEvent } from "../helpers/typed_event";
|
||||||
|
import { CalculationInstanceDBModel } from "../../features/calculations_instance/models/calculations_instance_database_model";
|
||||||
|
import * as fs from "fs";
|
||||||
|
import { WriteFileSystemFileUseCase } from "../usecases/write_file_system_file_usecase";
|
||||||
|
|
||||||
export enum ServerStatus {
|
export enum ServerStatus {
|
||||||
init = "init",
|
init = "init",
|
||||||
|
@ -85,7 +88,25 @@ export class App extends TypedEvent<ServerStatus> {
|
||||||
this.app.use(express.json());
|
this.app.use(express.json());
|
||||||
this.app.use(express.urlencoded({ extended: true }));
|
this.app.use(express.urlencoded({ extended: true }));
|
||||||
this.app.use(express.static(App.staticFilesStoreDir()));
|
this.app.use(express.static(App.staticFilesStoreDir()));
|
||||||
|
this.app.get('/logs', async (req, res) => {
|
||||||
|
const id = req.query.id;
|
||||||
|
|
||||||
|
if (id === undefined) {
|
||||||
|
return res.status(400).json('need req query id?=')
|
||||||
|
}
|
||||||
|
|
||||||
|
const calculationInstanceDBModel = await CalculationInstanceDBModel.findById(id)
|
||||||
|
if (calculationInstanceDBModel === null) {
|
||||||
|
return res.status(400).json("calcultaion db model is null");
|
||||||
|
}
|
||||||
|
const p = App.staticFilesStoreDir() + '/log.txt';
|
||||||
|
|
||||||
|
(await new WriteFileSystemFileUseCase().call(p, calculationInstanceDBModel.lastProcessLogs)).map(() => {
|
||||||
|
return res.sendFile(p);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
this.app.use(
|
this.app.use(
|
||||||
fileUpload({
|
fileUpload({
|
||||||
createParentPath: true,
|
createParentPath: true,
|
||||||
|
|
|
@ -65,12 +65,12 @@ interface ISubSetFeatureRouter<A> {
|
||||||
method: HttpMethodType;
|
method: HttpMethodType;
|
||||||
subUrl: string;
|
subUrl: string;
|
||||||
fn:
|
fn:
|
||||||
| CallbackStrategyWithValidationModel<A>
|
| CallbackStrategyWithValidationModel<A>
|
||||||
| CallbackStrategyWithEmpty
|
| CallbackStrategyWithEmpty
|
||||||
| CallbackStrategyWithIdQuery
|
| CallbackStrategyWithIdQuery
|
||||||
| CallBackStrategyWithQueryPage
|
| CallBackStrategyWithQueryPage
|
||||||
| CallbackStrategyWithFileUpload
|
| CallbackStrategyWithFileUpload
|
||||||
| CallbackStrategyWithFilesUploads;
|
| CallbackStrategyWithFilesUploads;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ICoreHttpController {
|
abstract class ICoreHttpController {
|
||||||
|
@ -234,6 +234,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
||||||
return res.json(ok);
|
return res.json(ok);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
|
|
||||||
return res.status(400).json({ error: String(err) });
|
return res.status(400).json({ error: String(err) });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { CallbackStrategyWithIdQuery, ResponseBase } from "../../../core/controllers/http_controller";
|
||||||
|
import { ReadByIdDataBaseModelUseCase } from "../../../core/usecases/read_database_model_usecase";
|
||||||
|
import { CoreValidation } from "../../../core/validations/core_validation";
|
||||||
|
import { MongoIdValidation } from "../../../core/validations/mongo_id_validation";
|
||||||
|
import { ICalculationInstance, CalculationInstanceDBModel } from "../models/calculations_instance_database_model";
|
||||||
|
|
||||||
|
// export class LogToProcessUseCase extends CallbackStrategyWithIdQuery {
|
||||||
|
// idValidationExpression: CoreValidation = new MongoIdValidation();
|
||||||
|
// call = async (id: string): ResponseBase => (await new ReadByIdDataBaseModelUseCase<ICalculationInstance>(CalculationInstanceDBModel).call(id)).map((model) => );
|
||||||
|
|
||||||
|
// }
|
|
@ -4,7 +4,6 @@ import { SocketSubscriber } from "./core/controllers/socket_controller";
|
||||||
import { extensions } from "./core/extensions/extensions";
|
import { extensions } from "./core/extensions/extensions";
|
||||||
import { httpRoutes } from "./core/controllers/routes";
|
import { httpRoutes } from "./core/controllers/routes";
|
||||||
import { executorProgramService } from "./core/usecases/exec_process_usecase";
|
import { executorProgramService } from "./core/usecases/exec_process_usecase";
|
||||||
// import { main } from "./p";
|
|
||||||
import { executorProgramServiceV2 } from "./core/scenarios/exec_process_scenario_v2";
|
import { executorProgramServiceV2 } from "./core/scenarios/exec_process_scenario_v2";
|
||||||
|
|
||||||
extensions();
|
extensions();
|
||||||
|
@ -12,4 +11,3 @@ extensions();
|
||||||
const socketSubscribers = [new SocketSubscriber(executorProgramService, "realtime"), new SocketSubscriber(executorProgramServiceV2, 'realtimeV2',)];
|
const socketSubscribers = [new SocketSubscriber(executorProgramService, "realtime"), new SocketSubscriber(executorProgramServiceV2, 'realtimeV2',)];
|
||||||
|
|
||||||
new App(httpRoutes, socketSubscribers).listen();
|
new App(httpRoutes, socketSubscribers).listen();
|
||||||
// main()
|
|
|
@ -7,14 +7,15 @@ export const DrawerV2: React.FC<{
|
||||||
title?: string;
|
title?: string;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}> = ({ isOpen, onClose, children, title }) => {
|
width?: number;
|
||||||
|
}> = ({ isOpen, onClose, children, title, width }) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
top: 0,
|
top: 0,
|
||||||
right: isOpen ? 0 : -300,
|
right: isOpen ? 0 : (width ?? 300) * -1,
|
||||||
width: 300,
|
width: width ?? 300,
|
||||||
height: "100%",
|
height: "100%",
|
||||||
backgroundColor: "#880ef8",
|
backgroundColor: "#880ef8",
|
||||||
boxShadow: "-2px 0 5px rgba(0, 0, 0, 0.5)",
|
boxShadow: "-2px 0 5px rgba(0, 0, 0, 0.5)",
|
||||||
|
|
|
@ -16,7 +16,6 @@ export const ListItem = (props: IListItemProps) => {
|
||||||
backgroundColor: "rgba(254, 247, 255, 1)",
|
backgroundColor: "rgba(254, 247, 255, 1)",
|
||||||
border: "1px #6750a4 solid",
|
border: "1px #6750a4 solid",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: 110,
|
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
|
|
@ -186,8 +186,17 @@ export const BehaviorTreeBuilderScreen = observer(() => {
|
||||||
title={store.titleDrawer}
|
title={store.titleDrawer}
|
||||||
onClose={() => store.editDrawer(DrawerState.editThreadBehaviorTree, false)}
|
onClose={() => store.editDrawer(DrawerState.editThreadBehaviorTree, false)}
|
||||||
isOpen={store.drawers.find((el) => el.name === DrawerState.editThreadBehaviorTree)?.status}
|
isOpen={store.drawers.find((el) => el.name === DrawerState.editThreadBehaviorTree)?.status}
|
||||||
|
width={window.innerWidth / 2}
|
||||||
>
|
>
|
||||||
<div style={{ display: "flex", flexDirection: "column", justifyContent: "space-between", height: "100%" }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
height: "100%",
|
||||||
|
overflow: "auto",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div style={{ height: "100%" }}>
|
<div style={{ height: "100%" }}>
|
||||||
{store.skillTemplates?.getForms(store.selected ?? "").map((formType, index) =>
|
{store.skillTemplates?.getForms(store.selected ?? "").map((formType, index) =>
|
||||||
forms(
|
forms(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { BehaviorTreeManagerStore } from "./behavior_tree_manager_store";
|
import { BehaviorTreeManagerStore } from "./behavior_tree_manager_store";
|
||||||
import React from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useStore } from "../../core/helper/use_store";
|
import { useStore } from "../../core/helper/use_store";
|
||||||
import { ButtonV2, ButtonV2Type } from "../../core/ui/button/button_v2";
|
import { ButtonV2, ButtonV2Type } from "../../core/ui/button/button_v2";
|
||||||
import { CoreCard } from "../../core/ui/card/card";
|
import { CoreCard } from "../../core/ui/card/card";
|
||||||
|
@ -16,13 +16,13 @@ export const BehaviorTreeManagerScreenPath = "/behavior/tree/manager";
|
||||||
|
|
||||||
export const BehaviorTreeManagerScreen = observer(() => {
|
export const BehaviorTreeManagerScreen = observer(() => {
|
||||||
const store = useStore(BehaviorTreeManagerStore);
|
const store = useStore(BehaviorTreeManagerStore);
|
||||||
|
useEffect(() => {}, []);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MainPageV2
|
<MainPageV2
|
||||||
children={
|
children={
|
||||||
<>
|
<>
|
||||||
<div style={{ height: "100%", overflowY: "auto", overflowX: "hidden" }}>
|
<div style={{ height: "100%", }}>
|
||||||
<div style={{ height: 20 }} />
|
<div style={{ height: 20 }} />
|
||||||
<ButtonV2
|
<ButtonV2
|
||||||
icon={<Icon type={"Plus"} style={{ alignSelf: "center", marginLeft: 10, marginRight: 10 }} />}
|
icon={<Icon type={"Plus"} style={{ alignSelf: "center", marginLeft: 10, marginRight: 10 }} />}
|
||||||
|
@ -65,9 +65,13 @@ export const BehaviorTreeManagerScreen = observer(() => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div style={{ height: 20 }} />
|
<div style={{ height: 20 }} />
|
||||||
<InputV2 trim={true} label={"Название"} onChange={(text) => store.updateForm({ name: text })} />
|
<InputV2 trim={true} label={"Название"} onChange={(text) => store.updateForm({ name: text })} />
|
||||||
<div style={{ height: 20 }} />
|
<div style={{ height: 20 }} />
|
||||||
<InputV2 trim={true} label={"Описание"} onChange={(text) => store.updateForm({ description: text })} />
|
<InputV2
|
||||||
|
trim={true}
|
||||||
|
label={"Описание"}
|
||||||
|
onChange={(text) => store.updateForm({ description: text })}
|
||||||
|
/>
|
||||||
<div style={{ height: 20 }} />
|
<div style={{ height: 20 }} />
|
||||||
<SelectV2
|
<SelectV2
|
||||||
items={store.scenes?.map((el) => ({ name: el.name, value: el._id })) ?? []}
|
items={store.scenes?.map((el) => ({ name: el.name, value: el._id })) ?? []}
|
||||||
|
|
|
@ -14,7 +14,13 @@ export interface ISkils {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CalculationHttpRepository extends CoreHttpRepository {
|
export class CalculationHttpRepository extends CoreHttpRepository {
|
||||||
|
async getLogs(id: string) {
|
||||||
|
|
||||||
|
await this._request(HttpMethod.GET, `/logs?id=${id}`)
|
||||||
|
window.location.href = 'http://localhost:4001/log.txt';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
featureApi = `/calculations/instances`;
|
featureApi = `/calculations/instances`;
|
||||||
subFeatureApi = `/calculations/template`;
|
subFeatureApi = `/calculations/template`;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ export const CalculationInstanceScreen = observer(() => {
|
||||||
() => store.deleteInstance(el._id ?? ""),
|
() => store.deleteInstance(el._id ?? ""),
|
||||||
() => store.execSkill(el._id ?? ""),
|
() => store.execSkill(el._id ?? ""),
|
||||||
() => store.execSkill(el._id ?? ""),
|
() => store.execSkill(el._id ?? ""),
|
||||||
() => store.changeProcessStatus(el._id ?? "")
|
() => store.changeProcessStatus(el._id ?? ""),
|
||||||
|
() => store.getTxtLog(el._id ?? "")
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,7 @@ export enum StoreTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CalculationInstanceStore extends UiDrawerFormState<calculationModel, HttpError> {
|
export class CalculationInstanceStore extends UiDrawerFormState<calculationModel, HttpError> {
|
||||||
|
getTxtLog = (id: string) => this.calculationHttpRepository.getLogs(id);
|
||||||
calculationHttpRepository: CalculationHttpRepository = new CalculationHttpRepository();
|
calculationHttpRepository: CalculationHttpRepository = new CalculationHttpRepository();
|
||||||
calculationSocketRepository: CalculationSocketRepository = new CalculationSocketRepository();
|
calculationSocketRepository: CalculationSocketRepository = new CalculationSocketRepository();
|
||||||
activeProjectId?: UUID;
|
activeProjectId?: UUID;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { match } from "ts-pattern";
|
import { match } from "ts-pattern";
|
||||||
import { PoseEstimateCard } from "./pose_estimate_card/model_card";
|
import { PoseEstimateCard } from "./pose_estimate_card/model_card";
|
||||||
import { Checkbox, Dropdown, MenuProps, message } from "antd";
|
import { Dropdown, MenuProps, } from "antd";
|
||||||
import { CoreText, CoreTextType } from "../../../../../core/ui/text/text";
|
import { CoreText, CoreTextType } from "../../../../../core/ui/text/text";
|
||||||
import { IMenuItem } from "../../../../dataset/card_dataset";
|
import { IMenuItem } from "../../../../dataset/card_dataset";
|
||||||
import { Icon } from "../../../../../core/ui/icons/icons";
|
import { Icon } from "../../../../../core/ui/icons/icons";
|
||||||
|
@ -16,7 +16,8 @@ export const getModelCard = (
|
||||||
onDelete: Function,
|
onDelete: Function,
|
||||||
onPlay: Function,
|
onPlay: Function,
|
||||||
onPause: Function,
|
onPause: Function,
|
||||||
onChangeProcessIsEnd: Function
|
onChangeProcessIsEnd: Function,
|
||||||
|
onLog: Function
|
||||||
) => {
|
) => {
|
||||||
const menu: IMenuItem[] = [
|
const menu: IMenuItem[] = [
|
||||||
{
|
{
|
||||||
|
@ -68,7 +69,8 @@ export const getModelCard = (
|
||||||
<Icon
|
<Icon
|
||||||
type="Log"
|
type="Log"
|
||||||
onClick={async () =>
|
onClick={async () =>
|
||||||
window.prompt("Copy to clipboard: Ctrl+C, Enter", calculationModel.lastProcessLogs ?? "Not found logs")
|
// window.prompt("Copy to clipboard: Ctrl+C, Enter", calculationModel.lastProcessLogs ?? "Not found logs")
|
||||||
|
onLog()
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue