diference

This commit is contained in:
IDONTSUDO 2024-08-21 16:31:41 +03:00
parent 7063e93c75
commit e748debd2f
5 changed files with 34 additions and 12 deletions

View file

@ -11,22 +11,23 @@ import { ITopicModel } from "../../topics/topic_database_model";
import { ExecInstanceTwinsProcessService } from "../services/exec_instance_twins_process_service";
export interface Topics {
topics: ITopicModel[];
topics: ITopicModel[];
}
export class ExecInstanceScenario extends CallbackStrategyWithIdQuery {
idValidationExpression: CoreValidation = new MongoIdValidation();
call = async (id: string): ResponseBase =>
(
await new ReadByIdDataBaseModelUseCase<IDigitalTwinsInstanceModel>(DigitalTwinsInstanceDatabaseModel).call(id)
).map((document) =>
new ExecProcessUseCase().call(
document.instancePath,
`python3 $GET_INTERFACES --path ${document.instancePath}`,
"",
new ExecInstanceTwinsProcessService(document.instancePath, document)
).map(
(document) => (
console.log(JSON.stringify(document)),
new ExecProcessUseCase().call(
document.instancePath,
`python3 $GET_INTERFACES --path ${document.instancePath} --package ${JSON.stringify(document)}`,
"",
new ExecInstanceTwinsProcessService(document.instancePath, document)
)
)
);
}

View file

@ -20,6 +20,12 @@ export const DigitalTwinsInstanceSchema = new Schema({
instancePath: {
type: String,
},
package: {
type: String,
},
executable: {
type: String,
},
formBuilder: {
type: Schema.Types.Mixed,
},

View file

@ -8,12 +8,18 @@ export const DigitalTwinsTemplateSchema = new Schema({
entity: String,
description: String,
command: String,
package: {
type: String,
},
executable: {
type: String,
},
interfaces: {
cmd: String,
},
formBuilder:{
formBuilder: {
type: Schema.Types.Mixed,
}
},
}).plugin(require("mongoose-autopopulate"));
export const digitalTwinsTemplateSchema = "digital_twins_templates";

View file

@ -1,6 +1,6 @@
import { ValidationModel } from "../../core/model/validation_model";
import { Type } from "class-transformer";
import { IsEnum, IsString } from "class-validator";
import { IsEnum, IsNotEmpty, IsString } from "class-validator";
import { FormBuilderValidationModel } from "../dataset/dataset_model";
export enum DigitalTwinsTypes {
@ -25,6 +25,12 @@ export class DigitalTwinsModel extends ValidationModel {
command: string;
@Type(() => Interfaces)
interfaces: Interfaces;
@IsNotEmpty()
@IsString()
package: string;
@IsNotEmpty()
@IsString()
executable: string;
formBuilder = FormBuilderValidationModel.empty();
static empty() {
return new DigitalTwinsModel();

View file

@ -106,6 +106,9 @@ export const DigitalTwinsScreen = observer(() => {
<CoreInput onChange={(text) => store.updateForm({ description: text })} label={"Описание"} />
<CoreInput onChange={(text) => store.updateForm({ command: text })} label={"Команда"} />
<CoreInput onChange={(text) => store.updateForm({ interfaces: { cmd: text } })} label={"Cmd"} />
<CoreInput onChange={(text) => store.updateForm({ executable: text })} label={"executable"} />
<CoreInput onChange={(text) => store.updateForm({ package: text })} label={"package"} />
<CoreInput
label="FormBuilder Result"
onChange={(text) => (store.viewModel.formBuilder.result = text)}