Skip to content

Commit 714373a

Browse files
author
VuXfi
committed
feat: add settings model with fields and display modifiers for enhanced configuration
1 parent db48c46 commit 714373a

File tree

3 files changed

+201
-0
lines changed

3 files changed

+201
-0
lines changed

libs/adminpanel/models/bind.d.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,66 @@ export declare const models: {
124124
};
125125
};
126126
};
127+
settings: {
128+
title: string;
129+
model: string;
130+
icon: string;
131+
fields: {
132+
id: boolean;
133+
key: string;
134+
name: string;
135+
description: string;
136+
tooltip: string;
137+
value: string;
138+
defaultValue: string;
139+
type: string;
140+
jsonSchema: string;
141+
readOnly: string;
142+
uiSchema: string;
143+
module: string;
144+
createdAt: boolean;
145+
updatedAt: boolean;
146+
isRequired: string;
147+
};
148+
list: {
149+
fields: {
150+
id: boolean;
151+
defaultValue: boolean;
152+
description: boolean;
153+
tooltip: boolean;
154+
uiSchema: boolean;
155+
readOnly: boolean;
156+
isRequired: boolean;
157+
jsonSchema: boolean;
158+
type: boolean;
159+
value: {
160+
displayModifier(v: any): any;
161+
};
162+
};
163+
};
164+
add: {
165+
fields: {
166+
value: {
167+
title: string;
168+
type: string;
169+
};
170+
};
171+
};
172+
edit: {
173+
fields: {
174+
description: {
175+
title: string;
176+
type: string;
177+
disabled: boolean;
178+
};
179+
key: {
180+
disabled: boolean;
181+
};
182+
value: {
183+
title: string;
184+
type: string;
185+
};
186+
};
187+
};
188+
};
127189
};

libs/adminpanel/models/bind.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,73 @@ exports.models = {
124124
stopDate: "End Time"
125125
}
126126
}
127+
},
128+
settings: {
129+
title: "Settings",
130+
model: "settings",
131+
icon: "settings",
132+
fields: {
133+
id: false,
134+
key: "Key",
135+
name: "Name",
136+
description: "Description",
137+
tooltip: "Tooltip",
138+
value: "Value",
139+
defaultValue: "Default value",
140+
type: "Type",
141+
jsonSchema: "JSON Schema",
142+
readOnly: "Read only",
143+
uiSchema: "UI Schema",
144+
module: "Module",
145+
createdAt: false,
146+
updatedAt: false,
147+
isRequired: "Is required"
148+
},
149+
list: {
150+
fields: {
151+
id: false,
152+
defaultValue: false,
153+
description: false,
154+
tooltip: false,
155+
uiSchema: false,
156+
readOnly: false,
157+
isRequired: false,
158+
jsonSchema: false,
159+
type: false,
160+
value: {
161+
displayModifier(v) {
162+
sails.log.debug(v);
163+
if (typeof v === "object" && v !== null && Object.keys(v).length > 5) {
164+
return "long object";
165+
}
166+
return v;
167+
},
168+
}
169+
},
170+
},
171+
add: {
172+
fields: {
173+
value: {
174+
title: "Key",
175+
type: "json",
176+
},
177+
},
178+
},
179+
edit: {
180+
fields: {
181+
description: {
182+
title: "Описание",
183+
type: "longtext",
184+
disabled: true,
185+
},
186+
key: {
187+
disabled: true,
188+
},
189+
value: {
190+
title: "Value",
191+
type: "json",
192+
}
193+
}
194+
}
127195
}
128196
};

libs/adminpanel/models/bind.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,76 @@ export const models = {
122122
stopDate: "End Time"
123123
}
124124
}
125+
},
126+
settings: {
127+
title: "Settings",
128+
model: "settings",
129+
icon: "settings",
130+
fields: {
131+
id: false,
132+
key: "Key",
133+
name: "Name",
134+
description: "Description",
135+
tooltip: "Tooltip",
136+
value: "Value",
137+
defaultValue: "Default value",
138+
type: "Type",
139+
jsonSchema: "JSON Schema",
140+
readOnly: "Read only",
141+
uiSchema: "UI Schema",
142+
module: "Module",
143+
createdAt: false,
144+
updatedAt: false,
145+
isRequired: "Is required"
146+
},
147+
148+
list: {
149+
fields: {
150+
id: false,
151+
defaultValue: false,
152+
description: false,
153+
tooltip: false,
154+
uiSchema: false,
155+
readOnly: false,
156+
isRequired: false,
157+
jsonSchema: false,
158+
type: false,
159+
value: {
160+
displayModifier(v) {
161+
sails.log.debug(v)
162+
if(typeof v === "object" && v !== null && Object.keys(v).length > 5) {
163+
return "long object"
164+
}
165+
return v
166+
},
167+
}
168+
},
169+
},
170+
171+
add: {
172+
fields: {
173+
value: {
174+
title: "Key",
175+
type: "json",
176+
},
177+
},
178+
},
179+
180+
edit: {
181+
fields: {
182+
description: {
183+
title: "Описание",
184+
type: "longtext",
185+
disabled: true,
186+
},
187+
key: {
188+
disabled: true,
189+
},
190+
value: {
191+
title: "Value",
192+
type: "json",
193+
}
194+
}
195+
}
125196
}
126197
};

0 commit comments

Comments
 (0)