fleet/website/api/controllers/view-endpoint-ops.js
Eric 213baaa258
Website: update testimonials on landing pages (#16318)
Closes: #16246
Closes: https://github.com/fleetdm/fleet/issues/16245

Changes:
- Added a logo for the quote from Harrison Ravazzolo
- Changed the `productCategories` value for the quotes from Nick Fohs
and Erik Gomez
- Updated the order of testimonials on the /endpoint-ops and
/vulnerability-management pages
2024-01-26 15:20:33 -06:00

50 lines
1.7 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View endpoint ops',
description: 'Display "Endpoint ops" page.',
exits: {
success: {
viewTemplatePath: 'pages/endpoint-ops'
},
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, 'Endpoint operations');
});
// Specify an order for the testimonials on this page using the last names of quote authors
let testimonialOrderForThisPage = ['Zaffery','Grzelak','Waisman','Larkin','Anderson','Gomez','Fohs','Shaklovitz','Arpaia','Shields','Majumdar','Elshaer','Yousafzai','Ravazzolo','Whetstone','Botelho'];
testimonialsForScrollableTweets.sort((a, b)=>{
if(testimonialOrderForThisPage.indexOf(a.quoteAuthorName.split(' ')[1]) === -1){
return 1;
} else if(testimonialOrderForThisPage.indexOf(b.quoteAuthorName.split(' ')[1]) === -1) {
return -1;
}
return testimonialOrderForThisPage.indexOf(a.quoteAuthorName.split(' ')[1]) - testimonialOrderForThisPage.indexOf(b.quoteAuthorName.split(' ')[1]);
});
// Respond with view.
return {
testimonialsForScrollableTweets,
};
}
};