Skip to content
Snippets Groups Projects
Commit a27af206 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

simplify init of shellcmd plugin

parent f30e8aef
No related branches found
No related tags found
1 merge request!62V2.0
......@@ -452,6 +452,11 @@ function filterTable() {
// ----------------------------------------------------------------------
// API secret
// ----------------------------------------------------------------------
/**
* for project settings - generate api key
* @param {integer} length length of the key to generate
* @return {string}
*/
function generateSecret(length) {
var result = '';
......@@ -464,3 +469,24 @@ function generateSecret(length) {
}
// ----------------------------------------------------------------------
/**
* initialize a shellcmd plugin
* @param {string} sPlugin name of the shellcmd plugin
* @param {function} oRenderer rendering function for incoming data
* @param {integer} iTtl ttl in minutes
*/
function shellcmd_plugin_init(sPlugin, oRenderer, iTtl){
var sDomid="divPluginshellcmd"+sPlugin;
var sUrl="/deployment/plugins/shellcmd/getdata.php?plugin="+sPlugin;
var oUbd=new ubd(
{
"domid": sDomid,
"url": sUrl,
"renderer": oRenderer,
"ttl": iTtl,
}
);
// oUbdLoad.render('waiting for first data...');
oUbd.update();
}
......@@ -26,17 +26,5 @@ function load_render(aData){
;
}
function load_init(){
oUbdLoad=new ubd(
{
"domid": "divPluginshellcmdload",
"url": "/deployment/plugins/shellcmd/getdata.php?plugin=load",
"renderer": load_render,
"ttl": 2,
}
);
// oUbdLoad.render('waiting for first data...');
oUbdLoad.update();
}
window.setTimeout("load_init()", 200);
\ No newline at end of file
window.setTimeout("shellcmd_plugin_init('load', "+load_render+", 2);", 200);
\ No newline at end of file
......@@ -26,17 +26,4 @@ function processes_render(aData){
return sReturn;
}
function processes_init(){
oUbdProcesses=new ubd(
{
"domid": "divPluginshellcmdprocesses",
"url": "/deployment/plugins/shellcmd/getdata.php?plugin=processes",
"renderer": processes_render,
"ttl": 2,
}
);
// oUbdLoad.render('waiting for first data...');
oUbdProcesses.update();
}
window.setTimeout("processes_init()", 200);
\ No newline at end of file
window.setTimeout("shellcmd_plugin_init('processes', "+processes_render+", 2);", 200);
\ No newline at end of file
......@@ -26,17 +26,5 @@ function top_render(aData){
return sReturn;
}
function top_init(){
oUbdLoad=new ubd(
{
"domid": "divPluginshellcmdtop",
"url": "/deployment/plugins/shellcmd/getdata.php?plugin=top",
"renderer": top_render,
"ttl": 5,
}
);
// oUbdLoad.render('waiting for first data...');
oUbdLoad.update();
}
window.setTimeout("top_init()", 200);
\ No newline at end of file
window.setTimeout("shellcmd_plugin_init('top', "+top_render+", 2);", 200);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment