mirror of
https://github.com/fleetdm/fleet
synced 2026-05-06 14:58:33 +00:00
Related to: https://github.com/fleetdm/confidential/issues/9096 Changes: - Created docs/queries.yml. A YAML file that contains the queries from the standard query library (`kind: query`) and the host vitals queries (`kind: built-in`). - Added the `vitals/*` page, a page that displays details about host vital queries used to gather information about. - Updated the /queries page to show queries from the new `docs/queries.yml` file, and moved policies to a new page (/policies) - Updated the view action for the query-detail page to look for/redirect to a policy page with a matching slug before returning a 404 response if a matching query is not found. This behavior will make it so all of the old URLs for policy pages will redirect users to the new URL. - Updated the website's "Docs" navigation menu to have links to the new vitals and policies pages.
45 lines
1.2 KiB
JavaScript
Vendored
45 lines
1.2 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'View query library',
|
|
|
|
|
|
description: 'Display "Query library" page.',
|
|
|
|
|
|
exits: {
|
|
success: { viewTemplatePath: 'pages/query-library' },
|
|
badConfig: { responseType: 'badConfig' },
|
|
},
|
|
|
|
|
|
fn: async function () {
|
|
|
|
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.queries)) {
|
|
throw {badConfig: 'builtStaticContent.queries'};
|
|
}
|
|
let policies = _.where(sails.config.builtStaticContent.queries, {kind: 'query'});
|
|
let macOsQueries = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(',');
|
|
return _.includes(platformsForThisPolicy, 'darwin');
|
|
});
|
|
let windowsQueries = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(',');
|
|
return _.includes(platformsForThisPolicy, 'windows');
|
|
});
|
|
let linuxQueries = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(',');
|
|
return _.includes(platformsForThisPolicy, 'linux');
|
|
});
|
|
// Respond with view.
|
|
return {
|
|
macOsQueries,
|
|
windowsQueries,
|
|
linuxQueries,
|
|
algoliaPublicKey: sails.config.custom.algoliaPublicKey,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|