mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
Website: fix pricing table filtering (#20912)
Changes: - Fixed the IT and Security filtering on the pricing features table.
This commit is contained in:
parent
8b5094ff37
commit
6fd628463d
1 changed files with 28 additions and 25 deletions
53
website/api/controllers/view-pricing.js
vendored
53
website/api/controllers/view-pricing.js
vendored
|
|
@ -44,36 +44,39 @@ module.exports = {
|
|||
pricingTable.push(allFeaturesInThisCategory);
|
||||
}
|
||||
|
||||
let pricingTableForSecurity = _.filter(pricingTable, (category)=>{
|
||||
return category.categoryName !== 'Device management' && (category.usualDepartment === 'Security' || category.usualDepartment === undefined);
|
||||
});
|
||||
let pricingTableForSecurity = [];
|
||||
let categoryOrderForSecurityPricingTable = ['Support', 'Deployment', 'Integrations', 'Endpoint operations', 'Vulnerability management'];
|
||||
// Sort the security-focused pricing table from the order of the elements in the categoryOrderForSecurityPricingTable array.
|
||||
pricingTableForSecurity.sort((a, b)=>{
|
||||
// If there is a category that is not in the list above, sort it to the end of the list.
|
||||
if(categoryOrderForSecurityPricingTable.indexOf(a.categoryName) === -1){
|
||||
return 1;
|
||||
} else if(categoryOrderForSecurityPricingTable.indexOf(b.categoryName) === -1) {
|
||||
return -1;
|
||||
}
|
||||
return categoryOrderForSecurityPricingTable.indexOf(a.categoryName) - categoryOrderForSecurityPricingTable.indexOf(b.categoryName);
|
||||
});
|
||||
for(let category of categoryOrderForSecurityPricingTable) {
|
||||
// Get all the features in that have a pricingTableFeatures array that contains this category.
|
||||
let featuresInThisCategory = _.filter(pricingTableFeatures, (feature)=>{
|
||||
return _.contains(feature.pricingTableCategories, category) && (feature.usualDepartment === 'Security' || feature.usualDepartment === undefined);
|
||||
});
|
||||
// Build a dictionary containing the category name, and all features in the category
|
||||
let allSecurityFeaturesInThisCategory = {
|
||||
categoryName: category,
|
||||
features: featuresInThisCategory,
|
||||
};
|
||||
// Add the dictionaries to the arrays that we'll use to build the features table.
|
||||
pricingTableForSecurity.push(allSecurityFeaturesInThisCategory);
|
||||
}
|
||||
|
||||
|
||||
let pricingTableForIt = _.filter(pricingTable, (category)=>{
|
||||
return category.categoryName !== 'Vulnerability management' && (category.usualDepartment === 'Security' || category.usualDepartment === undefined);
|
||||
});
|
||||
let categoryOrderForITPricingTable = [ 'Deployment','Device management', 'Endpoint operations', 'Integrations', 'Support'];
|
||||
let pricingTableForIt = [];
|
||||
// Sort the IT-focused pricing table from the order of the elements in the categoryOrderForITPricingTable array.
|
||||
pricingTableForIt.sort((a, b)=>{
|
||||
// If there is a category that is not in the list above, sort it to the end of the list.
|
||||
if(categoryOrderForITPricingTable.indexOf(a.categoryName) === -1){
|
||||
return 1;
|
||||
} else if(categoryOrderForITPricingTable.indexOf(b.categoryName) === -1) {
|
||||
return -1;
|
||||
}
|
||||
return categoryOrderForITPricingTable.indexOf(a.categoryName) - categoryOrderForITPricingTable.indexOf(b.categoryName);
|
||||
});
|
||||
for(let category of categoryOrderForITPricingTable) {
|
||||
// Get all the features in that have a pricingTableFeatures array that contains this category.
|
||||
let featuresInThisCategory = _.filter(pricingTableFeatures, (feature)=>{
|
||||
return _.contains(feature.pricingTableCategories, category) && (feature.usualDepartment === 'IT' || feature.usualDepartment === undefined);
|
||||
});
|
||||
// Build a dictionary containing the category name, and all features in the category, sorting premium features to the bottom of the list.
|
||||
let allItFeaturesInThisCategory = {
|
||||
categoryName: category,
|
||||
features: featuresInThisCategory,
|
||||
};
|
||||
// Add the dictionaries to the arrays that we'll use to build the features table.
|
||||
pricingTableForIt.push(allItFeaturesInThisCategory);
|
||||
}
|
||||
|
||||
|
||||
// Respond with view.
|
||||
|
|
|
|||
Loading…
Reference in a new issue