diff --git a/server/src/features/skills/model/skills_database_model.ts b/server/src/features/skills/model/skills_database_model.ts index b4ae4d2..ce9651a 100644 --- a/server/src/features/skills/model/skills_database_model.ts +++ b/server/src/features/skills/model/skills_database_model.ts @@ -1,4 +1,5 @@ import { Schema, model } from "mongoose"; +import { Launch } from "../../../core/models/skill_model"; export interface ISkillsModel {} @@ -12,6 +13,9 @@ export const SkillsSchema = new Schema({ BTAction: { type: Schema.Types.Mixed, }, + Launch: { + type: Schema.Types.Mixed, + }, topicsOut: { type: Schema.Types.Mixed, }, @@ -19,13 +23,14 @@ export const SkillsSchema = new Schema({ type: Schema.Types.Mixed, }, bgColor: { - type:Schema.Types.String, + type: Schema.Types.String, + }, + borderColor: { + type: Schema.Types.String, }, - borderColor:{ - type:Schema.Types.String - } }).plugin(require("mongoose-autopopulate")); export const skillsSchema = "skills"; export const SkillsDBModel = model(skillsSchema, SkillsSchema); + \ No newline at end of file diff --git a/ui/src/core/model/skill_model.ts b/ui/src/core/model/skill_model.ts index a4bd75d..083b20b 100644 --- a/ui/src/core/model/skill_model.ts +++ b/ui/src/core/model/skill_model.ts @@ -177,6 +177,14 @@ export class BTAction implements IBTAction { export class Launch implements ILaunch { @IsString() executable: string; + + @IsString() + package: string; + constructor(executable: string, plage: string) { + this.executable = executable; + this.package = plage; + } + static empty = () => new Launch("", ""); } export class Ros2 implements IRos2 { @IsString() @@ -224,11 +232,14 @@ export class SkillModel extends ValidationModel implements ISkill { @Type(() => BtActionViewModel) BTAction: BtActionViewModel[]; topicsOut: TopicViewModel[] = []; + @Type(() => Launch) + Launch: Launch; static empty() { const skillModel = new SkillModel(); skillModel.BTAction = []; skillModel.SkillPackage = SkillPackage.empty(); skillModel.Module = Module.empty(); + skillModel.Launch = Launch.empty(); return skillModel; } public static isEmpty(skill: SkillModel): Result { @@ -477,4 +488,4 @@ export class Skills { () => Result.error(false) ); } - \ No newline at end of file + diff --git a/ui/src/core/model/validation_model.ts b/ui/src/core/model/validation_model.ts index 7603fa6..eaffc01 100644 --- a/ui/src/core/model/validation_model.ts +++ b/ui/src/core/model/validation_model.ts @@ -11,10 +11,17 @@ export class ValidationModel { if (errors.isNotEmpty()) { const message = errors.map((error: ValidationError) => { - if (error.constraints) return Object.values(error.constraints).join(", "); - return ""; + let result = ""; + if (error.children) + error.children.map((el) => { + if (el.constraints) { + result += Object.values(el.constraints).join(", "); + } + }); + if (error.constraints) result += Object.values(error.constraints).join(", "); + return result; }); - + console.log(message); return Result.error(message.join(", \n")); } else { return Result.ok(this as unknown as T); diff --git a/ui/src/features/skills/skills_screen.tsx b/ui/src/features/skills/skills_screen.tsx index 386f019..fb92dfb 100644 --- a/ui/src/features/skills/skills_screen.tsx +++ b/ui/src/features/skills/skills_screen.tsx @@ -100,10 +100,19 @@ export const SkillsScreen = observer(() => { label={"Module name"} onChange={(text) => store.updateForm({ Module: Object.assign(store.viewModel.Module, { name: text }) })} /> - store.updateForm({ Module: Object.assign(store.viewModel.Module, { node_name: text }) })} /> + store.updateForm({ Launch: Object.assign(store.viewModel.Launch, { package: text }) })} + /> + store.updateForm({ Launch: Object.assign(store.viewModel.Launch, { executable: text }) })} + /> +