mirror of
https://github.com/fleetdm/fleet
synced 2026-04-30 01:47:23 +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
49 lines
1.2 KiB
JavaScript
Vendored
49 lines
1.2 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'View script details',
|
|
|
|
|
|
description: 'Display "Script details" page.',
|
|
|
|
|
|
inputs: {
|
|
slug: { type: 'string', required: true, description: 'A slug uniquely identifying this script in the library.', example: 'macos-uninstall-fleetd' },
|
|
},
|
|
|
|
|
|
exits: {
|
|
|
|
success: { viewTemplatePath: 'pages/docs/script-details' },
|
|
notFound: { responseType: 'notFound' },
|
|
badConfig: { responseType: 'badConfig' },
|
|
|
|
},
|
|
|
|
|
|
fn: async function ({slug}) {
|
|
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.scripts)) {
|
|
throw {badConfig: 'builtStaticContent.scripts'};
|
|
}
|
|
|
|
|
|
let thisScript = _.find(sails.config.builtStaticContent.scripts, { slug: slug });
|
|
if(!thisScript){
|
|
throw 'notFound';
|
|
}
|
|
|
|
let pageTitleForMeta = `${thisScript.name} | Fleet controls library`;
|
|
let pageDescriptionForMeta = thisScript.description ? thisScript.description : 'View more information about a script in Fleet\'s controls library';
|
|
|
|
// Respond with view.
|
|
return {
|
|
thisScript,
|
|
pageTitleForMeta,
|
|
pageDescriptionForMeta,
|
|
algoliaPublicKey: sails.config.custom.algoliaPublicKey,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|