/** * @description MeshCentral ScriptTask * @author Ryan Blenis * @copyright * @license Apache-2.0 */ 'use strict'; module.exports.createTaskManager = function (parent) { var obj = {}; obj.parent = parent.webserver; obj.meshServer = parent; obj.db = null; obj.intervalTimer = null; obj.debug = obj.meshServer.debug; obj.VIEWS = __dirname + '/views/'; obj.exports = [ 'onDeviceRefreshEnd', 'resizeContent', 'historyData', 'variableData', 'malix_triggerOption' ]; obj.malix_triggerOption = function(selectElem) { selectElem.options.add(new Option("ScriptTask - Run Script", "scripttask_runscript")); } obj.malix_triggerFields_scripttask_runscript = function() { } obj.resetQueueTimer = function() { clearTimeout(obj.intervalTimer); obj.intervalTimer = setInterval(obj.queueRun, 1 * 60 * 1000); // every minute }; // Start the task manager obj.server_startup = function() { obj.meshServer.pluginHandler.scripttask_db = require (__dirname + '/db.js').CreateDB(obj.meshServer); obj.db = obj.meshServer.pluginHandler.scripttask_db; obj.resetQueueTimer(); }; obj.onDeviceRefreshEnd = function() { pluginHandler.registerPluginTab({ tabTitle: 'ScriptTask', tabId: 'pluginScriptTask' }); QA('pluginScriptTask', '