new widget types 3
This commit is contained in:
@@ -2,47 +2,46 @@
|
||||
migrate((app) => {
|
||||
const col = app.findCollectionByNameOrId("home_filter_widgets");
|
||||
|
||||
if (!col.fields.getByName("widget_type")) {
|
||||
col.fields.add(new TextField({
|
||||
name: "widget_type",
|
||||
required: false,
|
||||
max: 40,
|
||||
}));
|
||||
}
|
||||
if (!col.fields.getByName("icon_id")) {
|
||||
col.fields.add(new TextField({
|
||||
name: "icon_id",
|
||||
required: false,
|
||||
max: 40,
|
||||
}));
|
||||
}
|
||||
if (!col.fields.getByName("chart_style")) {
|
||||
col.fields.add(new TextField({
|
||||
name: "chart_style",
|
||||
required: false,
|
||||
max: 40,
|
||||
}));
|
||||
}
|
||||
if (!col.fields.getByName("budget_cap_mode")) {
|
||||
col.fields.add(new TextField({
|
||||
name: "budget_cap_mode",
|
||||
required: false,
|
||||
max: 40,
|
||||
}));
|
||||
}
|
||||
if (!col.fields.getByName("budget_fixed_amount")) {
|
||||
col.fields.add(new NumberField({
|
||||
name: "budget_fixed_amount",
|
||||
required: false,
|
||||
}));
|
||||
}
|
||||
if (!col.fields.getByName("budget_average_months")) {
|
||||
col.fields.add(new NumberField({
|
||||
name: "budget_average_months",
|
||||
required: false,
|
||||
onlyInt: true,
|
||||
}));
|
||||
}
|
||||
const addIfMissing = (config) => {
|
||||
if (col.fields.getByName(config.name)) return;
|
||||
col.fields.add(new Field(config));
|
||||
};
|
||||
|
||||
addIfMissing({
|
||||
type: "text",
|
||||
name: "widget_type",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
addIfMissing({
|
||||
type: "text",
|
||||
name: "icon_id",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
addIfMissing({
|
||||
type: "text",
|
||||
name: "chart_style",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
addIfMissing({
|
||||
type: "text",
|
||||
name: "budget_cap_mode",
|
||||
required: false,
|
||||
max: 40,
|
||||
});
|
||||
addIfMissing({
|
||||
type: "number",
|
||||
name: "budget_fixed_amount",
|
||||
required: false,
|
||||
});
|
||||
addIfMissing({
|
||||
type: "number",
|
||||
name: "budget_average_months",
|
||||
required: false,
|
||||
onlyInt: true,
|
||||
});
|
||||
|
||||
app.save(col);
|
||||
}, (app) => {
|
||||
|
||||
Reference in New Issue
Block a user