fleet/website/api/controllers/view-software-management.js
Eric 8658e4f1ec
Website: Software management landing page (#23961)
Closes: #23890

Changes:
- Updated the styles, layout and content of the
/vulnerability-management page to match the latest wireframes
- Renamed the /vulnerability-management page to /software-management
- Added a redirect for the /vulnerability-management page that takes
users to the /software-management page with all query parameters.
2024-11-20 18:54:36 +09:00

50 lines
1.6 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View software-management',
description: 'Display "Software management" page.',
exits: {
success: {
viewTemplatePath: 'pages/software-management'
},
badConfig: { responseType: 'badConfig' },
},
fn: async function () {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.testimonials) || !sails.config.builtStaticContent.compiledPagePartialsAppPath) {
throw {badConfig: 'builtStaticContent.testimonials'};
}
// Get testimonials for the <scrolalble-tweets> component.
let testimonialsForScrollableTweets = _.clone(sails.config.builtStaticContent.testimonials);
// Filter the testimonials by product category
testimonialsForScrollableTweets = _.filter(testimonialsForScrollableTweets, (testimonial)=>{
return _.contains(testimonial.productCategories, 'Vulnerability management');
});
// Specify an order for the testimonials on this page using the last names of quote authors
let testimonialOrderForThisPage = ['Nico Waisman', 'Andre Shields', 'Dhruv Majumdar', 'Austin Anderson', 'Dan Grzelak', 'Nick Fohs', 'Chandra Majumdar', 'Charles Zaffery'];
testimonialsForScrollableTweets.sort((a, b)=>{
if(testimonialOrderForThisPage.indexOf(a.quoteAuthorName) === -1){
return 1;
} else if(testimonialOrderForThisPage.indexOf(b.quoteAuthorName) === -1) {
return -1;
}
return testimonialOrderForThisPage.indexOf(a.quoteAuthorName) - testimonialOrderForThisPage.indexOf(b.quoteAuthorName);
});
// Respond with view.
return {
testimonialsForScrollableTweets,
};
}
};