mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
Changes: - Moved documentation pages into the docs/ folder - Updated routes, poicies, and importer.less - Renamed the "scripts" page to "script-library" to be consistent with the other landing pages for YAML documentation - removed a stray console.log() in the new-licence page script
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/docs/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,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|