fleet/website/api/controllers/view-software-management.js
Eric a3e0704fc0
Website: update quotes and sort order on /testimonials page and landing pages (#24441)
Changes:
- Updated the product categories used in testimonials.yml and updated
the build-static-content script to add support for the changed values
(`Endpoint operations` » `Observability` & `Vulnerability management` »
`Software management`)
- Updated the testimonial cards on landing pages to only show the
testimonials that have an explicit sort order set for them.
- Updated the order of testimonials on landing pages and the
/testimonials page.
- Updated the styles of the `<scrollable-tweets>` component.
- Updated the layout of the CTA buttons on the /device-management page
on smaller screen sizes
2024-12-06 09:03:44 +09:00

61 lines
1.8 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);
// Specify an order for the testimonials on this page using the last names of quote authors
let testimonialOrderForThisPage = [
'Wes Whetstone',
'Kenny Botelho',
'Andre Shields',
'Erik Gomez',
'Arsenio Figueroa',
'Eric Tan',
'Chandra Majumdar',
'Nico Waisman',
'Dan Grzelak',
];
// Filter the testimonials by product category
testimonialsForScrollableTweets = _.filter(testimonialsForScrollableTweets, (testimonial)=>{
return _.contains(testimonial.productCategories, 'Software management') && _.contains(testimonialOrderForThisPage, testimonial.quoteAuthorName);
});
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,
};
}
};