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
Branches
No related tags found
1 merge request!62V2.0
...@@ -452,6 +452,11 @@ function filterTable() { ...@@ -452,6 +452,11 @@ function filterTable() {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// API secret // API secret
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
/**
* for project settings - generate api key
* @param {integer} length length of the key to generate
* @return {string}
*/
function generateSecret(length) { function generateSecret(length) {
var result = ''; var result = '';
...@@ -464,3 +469,24 @@ function generateSecret(length) { ...@@ -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){ ...@@ -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); window.setTimeout("shellcmd_plugin_init('load', "+load_render+", 2);", 200);
\ No newline at end of file \ No newline at end of file
...@@ -26,17 +26,4 @@ function processes_render(aData){ ...@@ -26,17 +26,4 @@ function processes_render(aData){
return sReturn; return sReturn;
} }
function processes_init(){ window.setTimeout("shellcmd_plugin_init('processes', "+processes_render+", 2);", 200);
oUbdProcesses=new ubd( \ No newline at end of file
{
"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
...@@ -26,17 +26,5 @@ function top_render(aData){ ...@@ -26,17 +26,5 @@ function top_render(aData){
return sReturn; 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); window.setTimeout("shellcmd_plugin_init('top', "+top_render+", 2);", 200);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment