fixed launch
This commit is contained in:
parent
c0a23c31f7
commit
e2cd7af032
4 changed files with 42 additions and 10 deletions
|
@ -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<ISkillsModel>(skillsSchema, SkillsSchema);
|
||||
|
|
@ -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<void, SkillModel> {
|
||||
|
@ -477,4 +488,4 @@ export class Skills {
|
|||
() => Result.error(false)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -100,10 +100,19 @@ export const SkillsScreen = observer(() => {
|
|||
label={"Module name"}
|
||||
onChange={(text) => store.updateForm({ Module: Object.assign(store.viewModel.Module, { name: text }) })}
|
||||
/>
|
||||
<CoreInput
|
||||
label="Module node name"
|
||||
<CoreInput
|
||||
label={"Module node name"}
|
||||
onChange={(text) => store.updateForm({ Module: Object.assign(store.viewModel.Module, { node_name: text }) })}
|
||||
/>
|
||||
<CoreInput
|
||||
label="Launch package"
|
||||
onChange={(text) => store.updateForm({ Launch: Object.assign(store.viewModel.Launch, { package: text }) })}
|
||||
/>
|
||||
<CoreInput
|
||||
label="Launch executable"
|
||||
onChange={(text) => store.updateForm({ Launch: Object.assign(store.viewModel.Launch, { executable: text }) })}
|
||||
/>
|
||||
|
||||
<CoreText
|
||||
text={`Topics ${store.viewModel.topicsOut.length}`}
|
||||
type={CoreTextType.large}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue