Syncing with actual files from host

This commit is contained in:
2026-10-23 11:28:43 +02:00
parent 685a1406c8
commit 30fb1a6493
7 changed files with 161 additions and 129 deletions

View File

@@ -6,36 +6,36 @@ const prices = {
users: [0.66,1.16,1.76,2.16],
options: {
lxc: {
basePrice: 31,
factor: 1.217
basePrice: 17,
factor: 1.131
},
dedicated: {
basePrice: 64,
factor: 1.753
},
onprem: {
basePrice: 111,
factor: 1.498
},
vol: [75,90,105,120]
// dedicated: {
// basePrice: 64,
// factor: 1.753
// },
// onprem: {
// basePrice: 111,
// factor: 1.498
// },
vol: [45,70,95,110]
}
},
wh: {
storage: storage_price,
sites: [3.6,4.7,6.9,9.1],
sites: [2.6,3.7,4.9,6.1],
options: {
preinstall: {
basePrice: 3.773,
basePrice: 2.773,
factor: 1.168
}
}
},
mail: {
storage: storage_price,
users: [2.1,4.2,7.3,11.4],
users: [2.1,4.2,7.3,9.4],
options: {
catchall: {
basePrice: 3.787,
basePrice: 2.787,
factor: 1.196
}
}
@@ -88,7 +88,7 @@ const ConfigurationManager = {
min: 0,
max: 250,
step: 1,
restrictedLabels: [0, 5, 10, 25, 50, 75, 100, 250]
restrictedLabels: [0, 5, 10, 25, 50, 75, 125, 250]
},
sites: {
id: 'wh_sites_source',
@@ -104,9 +104,9 @@ const ConfigurationManager = {
id: 'mail_stockage_source',
displayId: 'mail_stockage_display',
min: 0,
max: 500,
max: 250,
step: 1,
restrictedLabels: [0, 5, 10, 25, 50, 75, 150, 250, 500]
restrictedLabels: [0, 5, 10, 25, 50, 75, 125, 250]
},
users: {
id: 'mail_users_source',
@@ -154,21 +154,21 @@ const ConfigurationManager = {
lxc: {
id: 'nc_opt_lxc',
class: 'nc_opt_lxc',
enables: ['dedicated'],
enables: [], // ['dedicated'],
defaultDisabled: false
},
dedicated: {
id: 'nc_opt_decicated',
class: 'nc_opt_decicated',
enables: ['onprem'],
defaultDisabled: true
},
onprem: {
id: 'nc_opt_onprem',
class: 'nc_opt_onprem',
enables: [],
defaultDisabled: true
},
// dedicated: {
// id: 'nc_opt_decicated',
// class: 'nc_opt_decicated',
// enables: ['onprem'],
// defaultDisabled: true
// },
// onprem: {
// id: 'nc_opt_onprem',
// class: 'nc_opt_onprem',
// enables: [],
// defaultDisabled: true
// },
vol: {
id: 'nc_opt_vol',
class: 'nc_opt_vol',
@@ -238,8 +238,8 @@ const StateManager = {
storage: 0,
users: 0,
opt_lxc: false,
opt_dedicated: false,
opt_onprem: false,
// opt_dedicated: false,
// opt_onprem: false,
opt_vol: false,
opt_vol_val: 1
},
@@ -384,7 +384,7 @@ const StateManager = {
field = fieldMapping[field];
}
// Gérer les options (qui ne sont pas dans le mapping)
else if (['lxc', 'dedicated', 'onprem', 'vol', 'preinstall', 'catchall', 'ip4'].includes(field)) {
else if (['lxc', /* 'dedicated', 'onprem', */ 'vol', 'preinstall', 'catchall', 'ip4'].includes(field)) {
field = 'opt_' + field;
}
// Gérer vol_val spécifiquement
@@ -428,19 +428,19 @@ const PriceEngine = {
if (ncState.opt_lxc) {
optionMultiplier = prices.nc.options.lxc;
}
if (ncState.opt_lxc && ncState.opt_dedicated) {
optionMultiplier = prices.nc.options.dedicated;
}
if (ncState.opt_lxc && ncState.opt_dedicated && ncState.opt_onprem) {
optionMultiplier = prices.nc.options.onprem;
}
// if (ncState.opt_lxc && ncState.opt_dedicated) {
// optionMultiplier = prices.nc.options.dedicated;
// }
// if (ncState.opt_lxc && ncState.opt_dedicated && ncState.opt_onprem) {
// optionMultiplier = prices.nc.options.onprem;
// }
// Appliquer le multiplicateur d'option
price = (price + optionMultiplier.basePrice) * optionMultiplier.factor;
// Ajouter l'option gros volume si activée
if (ncState.opt_vol && ncState.opt_vol_val > 0) {
const volPrice = Math.max(100, Math.pow(ncState.opt_vol_val, 0.7) * prices.nc.options.vol[tierIndex]);
const volPrice = Math.max(40, Math.pow(ncState.opt_vol_val, 0.7) * prices.nc.options.vol[tierIndex]);
price += volPrice;
}
@@ -772,8 +772,8 @@ const UIController = {
StateManager.set('nc', 'storage', $('#nextcloud_stockage_source').slider('get value'));
StateManager.set('nc', 'users', $('#nextcloud_users_source').slider('get value'));
StateManager.set('nc', 'opt_lxc', $('.ui.toggle.checkbox.nc_opt_lxc').checkbox('is checked'));
StateManager.set('nc', 'opt_dedicated', $('.ui.toggle.checkbox.nc_opt_decicated').checkbox('is checked'));
StateManager.set('nc', 'opt_onprem', $('.ui.toggle.checkbox.nc_opt_onprem').checkbox('is checked'));
// StateManager.set('nc', 'opt_dedicated', $('.ui.toggle.checkbox.nc_opt_decicated').checkbox('is checked'));
// StateManager.set('nc', 'opt_onprem', $('.ui.toggle.checkbox.nc_opt_onprem').checkbox('is checked'));
StateManager.set('nc', 'opt_vol', $('.ui.checkbox.nc_opt_vol').checkbox('is checked'));
StateManager.set('nc', 'opt_vol_val', parseInt($('#nc_opt_vol_val').val()) || 1);
@@ -809,26 +809,26 @@ const UIController = {
$('#nc_opt_vol_val').val(state.nc.opt_vol_val);
this.setCheckboxState('nc_opt_lxc', state.nc.opt_lxc);
this.setCheckboxState('nc_opt_decicated', state.nc.opt_dedicated);
this.setCheckboxState('nc_opt_onprem', state.nc.opt_onprem);
// this.setCheckboxState('nc_opt_decicated', state.nc.opt_dedicated);
// this.setCheckboxState('nc_opt_onprem', state.nc.opt_onprem);
this.setCheckboxState('nc_opt_vol', state.nc.opt_vol);
// Gérer l'état enabled/disabled des checkboxes hiérarchiques Nextcloud
if (state.nc.opt_lxc) {
// Si lxc est coché, activer dedicated
$('.ui.toggle.checkbox.nc_opt_decicated').checkbox('set enabled');
if (state.nc.opt_dedicated) {
// Si dedicated est coché, activer onprem
$('.ui.toggle.checkbox.nc_opt_onprem').checkbox('set enabled');
} else {
// Sinon, désactiver onprem
$('.ui.toggle.checkbox.nc_opt_onprem').checkbox('set disabled');
}
} else {
// Si lxc n'est pas coché, désactiver dedicated et onprem
$('.ui.toggle.checkbox.nc_opt_decicated').checkbox('set disabled');
$('.ui.toggle.checkbox.nc_opt_onprem').checkbox('set disabled');
}
// if (state.nc.opt_lxc) {
// // Si lxc est coché, activer dedicated
// $('.ui.toggle.checkbox.nc_opt_decicated').checkbox('set enabled');
// if (state.nc.opt_dedicated) {
// // Si dedicated est coché, activer onprem
// $('.ui.toggle.checkbox.nc_opt_onprem').checkbox('set enabled');
// } else {
// // Sinon, désactiver onprem
// $('.ui.toggle.checkbox.nc_opt_onprem').checkbox('set disabled');
// }
// } else {
// // Si lxc n'est pas coché, désactiver dedicated et onprem
// $('.ui.toggle.checkbox.nc_opt_decicated').checkbox('set disabled');
// $('.ui.toggle.checkbox.nc_opt_onprem').checkbox('set disabled');
// }
// Gérer l'affichage du shape pour Nextcloud users
const $ncShape = $('#ncusers');
@@ -1033,13 +1033,13 @@ const SummaryGenerator = {
items.push(`<span class="ui label">Utilisateurs illimités</span>`);
}
if (nc.opt_dedicated) {
items.push(`<span class="ui label blue">Serveur dédié</span>`);
}
// if (nc.opt_dedicated) {
// items.push(`<span class="ui label blue">Serveur dédié</span>`);
// }
if (nc.opt_onprem) {
items.push(`<span class="ui label blue">Sur site</span>`);
}
// if (nc.opt_onprem) {
// items.push(`<span class="ui label blue">Sur site</span>`);
// }
if (nc.opt_vol && nc.opt_vol_val > 0) {
items.push(`<span class="ui label violet">${nc.opt_vol_val} To de volume supplémentaire</span>`);
@@ -1067,13 +1067,13 @@ const SummaryGenerator = {
items.push(`Instance privée (utilisateurs illimités)`);
}
if (nc.opt_dedicated) {
items.push(`Serveur dédié`);
}
// if (nc.opt_dedicated) {
// items.push(`Serveur dédié`);
// }
if (nc.opt_onprem) {
items.push(`Sur site (on-premise)`);
}
// if (nc.opt_onprem) {
// items.push(`Sur site (on-premise)`);
// }
if (nc.opt_vol && nc.opt_vol_val > 0) {
items.push(`Gros volume: ${nc.opt_vol_val} To supplémentaires`);
@@ -1383,37 +1383,37 @@ const SummaryGenerator = {
const ExampleFormulas = {
formulas: {
solo: {
nc: { storage: 50, users: 1, opt_lxc: false, opt_dedicated: false, opt_onprem: false, opt_vol: false, opt_vol_val: 1 },
nc: { storage: 50, users: 1, opt_lxc: false, /* opt_dedicated: false, opt_onprem: false, */ opt_vol: false, opt_vol_val: 1 },
wh: { storage: 0, sites: 0, opt_preinstall: false },
mail: { storage: 20, users: 1, opt_catchall: true },
vps: { storage: 0, cpu: 0, ram: 0, opt_ip4: false }
},
team: {
nc: { storage: 150, users: 5, opt_lxc: false, opt_dedicated: false, opt_onprem: false, opt_vol: false, opt_vol_val: 1 },
nc: { storage: 150, users: 5, opt_lxc: false, /* opt_dedicated: false, opt_onprem: false, */ opt_vol: false, opt_vol_val: 1 },
wh: { storage: 10, sites: 1, opt_preinstall: false },
mail: { storage: 25, users: 5, opt_catchall: false },
vps: { storage: 0, cpu: 0, ram: 0, opt_ip4: false }
},
company: {
nc: { storage: 0, users: 0, opt_lxc: true, opt_dedicated: false, opt_onprem: false, opt_vol: true, opt_vol_val: 2 },
nc: { storage: 0, users: 0, opt_lxc: true, /* opt_dedicated: false, opt_onprem: false, */ opt_vol: true, opt_vol_val: 2 },
wh: { storage: 50, sites: 3, opt_preinstall: false },
mail: { storage: 100, users: 20, opt_catchall: false },
vps: { storage: 0, cpu: 0, ram: 0, opt_ip4: false }
},
storage: {
nc: { storage: 0, users: 0, opt_lxc: true, opt_dedicated: true, opt_onprem: false, opt_vol: true, opt_vol_val: 10 },
nc: { storage: 0, users: 0, opt_lxc: true, /* opt_dedicated: true, opt_onprem: false, */ opt_vol: true, opt_vol_val: 10 },
wh: { storage: 0, sites: 0, opt_preinstall: false },
mail: { storage: 0, users: 0, opt_catchall: false },
vps: { storage: 0, cpu: 0, ram: 0, opt_ip4: false }
},
developer: {
nc: { storage: 0, users: 0, opt_lxc: false, opt_dedicated: false, opt_onprem: false, opt_vol: false, opt_vol_val: 1 },
nc: { storage: 0, users: 0, opt_lxc: false, /* opt_dedicated: false, opt_onprem: false, */ opt_vol: false, opt_vol_val: 1 },
wh: { storage: 0, sites: 0, opt_preinstall: false },
mail: { storage: 0, users: 0, opt_catchall: false },
vps: { storage: 50, cpu: 2, ram: 4, opt_ip4: false }
},
devteam: {
nc: { storage: 0, users: 0, opt_lxc: false, opt_dedicated: false, opt_onprem: false, opt_vol: false, opt_vol_val: 1 },
nc: { storage: 0, users: 0, opt_lxc: false, /* opt_dedicated: false, opt_onprem: false, */ opt_vol: false, opt_vol_val: 1 },
wh: { storage: 0, sites: 0, opt_preinstall: false },
mail: { storage: 0, users: 0, opt_catchall: false },
vps: { storage: 250, cpu: 8, ram: 16, opt_ip4: false }