Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cronlog-viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Cronlog-viewer
Commits
78cb6a3e
Commit
78cb6a3e
authored
5 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
2nd commit
parent
6eeac4c1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.html
+2
-1
2 additions, 1 deletion
index.html
js/asimax.class.js
+226
-0
226 additions, 0 deletions
js/asimax.class.js
js/functions.js
+41
-1
41 additions, 1 deletion
js/functions.js
with
269 additions
and
2 deletions
index.html
+
2
−
1
View file @
78cb6a3e
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<meta
http-equiv=
"Pragma"
content=
"no-cache"
>
<meta
http-equiv=
"Pragma"
content=
"no-cache"
>
<title>
Cronjob-Viewer
</title>
<title>
Cronjob-Viewer
</title>
<script
type=
"text/javascript"
src=
"vendor/jquery/3.2.1/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"vendor/jquery/3.2.1/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/asimax.class.js"
></script>
<script
type=
"text/javascript"
src=
"js/functions.js"
></script>
<script
type=
"text/javascript"
src=
"js/functions.js"
></script>
<script
type=
"text/javascript"
src=
"vendor/vis/4.21.0/vis.min.js"
></script>
<script
type=
"text/javascript"
src=
"vendor/vis/4.21.0/vis.min.js"
></script>
...
@@ -32,7 +33,7 @@
...
@@ -32,7 +33,7 @@
<a
href=
"#cronhistory"
onclick=
"setTab(this); return false;"
><i
class=
"fas fa-history"
></i>
History
</a>
<a
href=
"#cronhistory"
onclick=
"setTab(this); return false;"
><i
class=
"fas fa-history"
></i>
History
</a>
<a
href=
"#graph"
onclick=
"setTab(this); return false;"
><i
class=
"far fa-chart-bar"
></i>
Timeline
</a>
<a
href=
"#graph"
onclick=
"setTab(this); return false;"
><i
class=
"far fa-chart-bar"
></i>
Timeline
</a>
</nav><br><br>
</nav><br><br>
<!--
<!--
<button onclick="refreshPage(); return false;"><i class="fas fa-sync"></i> Reload</button>
<button onclick="refreshPage(); return false;"><i class="fas fa-sync"></i> Reload</button>
...
...
This diff is collapsed.
Click to expand it.
js/asimax.class.js
0 → 100644
+
226
−
0
View file @
78cb6a3e
/**
* ----------------------------------------------------------------------
*
* A S I M A X
*
* A X E Ls
* S I M P L E
* A J A X
* H E L P E R
*
* - requires jQuery
* ----------------------------------------------------------------------
*
* ----------------------------------------------------------------------
*/
var
asimax
=
function
()
{
// settings
this
.
cfg
=
{
apimethod
:
'
GET
'
,
apibase
:
false
,
taskparam
:
'
id
'
,
tasks
:{
/*
'myDomId':{
// part behind apibase
apimore: '?',
params: {
server: 'localhost'
},
// autoupdate each N sec; 0 = off
interval: 10
}
*/
}
};
this
.
vars
=
{};
this
.
intervalObjects
=
{};
// ----------------------------------------------------------------------
// SETTER
// ----------------------------------------------------------------------
/**
* add a variable for query params in ajax call
* it will be used if a params value in a task points to it
* @param {string} sName name variable (=param variable too)
* @param {string} value value
*/
this
.
setVar
=
function
(
sName
,
value
)
{
this
.
vars
[
sName
]
=
value
;
return
true
;
};
// ----------------------------------------------------------------------
// GETTER
// ----------------------------------------------------------------------
/**
* get an array of all defined tasks ids
*/
this
.
getTasks
=
function
()
{
var
aReturn
=
[];
for
(
var
sId
in
this
.
cfg
.
tasks
){
aReturn
.
push
(
sId
);
}
return
aReturn
;
};
/**
* get a value of a stored variable
* @param {string} sName name variable (=param variable too)
*/
this
.
getVar
=
function
(
sName
)
{
try
{
if
(
this
.
vars
[
sName
]){
return
this
.
vars
[
sName
];
};
}
catch
(
e
){
// nop
}
console
.
log
(
'
ERROR in getVar() - argument "
'
+
sName
+
'
" does not exist
'
);
return
false
;
};
/**
* get all values of all stored variables
*/
this
.
getVars
=
function
()
{
return
this
.
vars
;
};
// ----------------------------------------------------------------------
// ACTIONS
// ----------------------------------------------------------------------
this
.
updateAllTasks
=
function
()
{
for
(
var
sId
in
this
.
getTasks
()){
this
.
execTask
(
sId
);
}
};
/**
* make an ajax-request and put response content into given div id
* @param {string} id id of the div to be filled
* @returns {undefined}
*/
this
.
execTask
=
function
(
id
)
{
// clog("getPageItem('"+id+"', '"+sMoreData+"')");
// $('#'+id).html('reading ...');
/*
if (!$('#' + id).hasClass('active')) {
$('#errorlog').html('#' + id + ' is not active');
return false;
}
*/
var
oTask
=
this
.
cfg
.
tasks
[
id
];
if
(
!
oTask
){
console
.
log
(
'
ERROR in execTask() - a task with the name "
'
+
id
+
'
" does not exist.
'
);
return
false
;
}
var
domid
=
oTask
.
domid
?
oTask
.
domid
:
id
;
var
url
=
this
.
cfg
.
apibase
+
oTask
.
apimore
;
var
queryparams
=
this
.
cfg
.
taskparam
+
'
=
'
+
domid
;
if
(
this
.
cfg
.
tasks
[
id
].
params
){
var
aParams
=
oTask
.
params
;
for
(
var
i
=
0
;
i
<
aParams
.
length
;
i
++
){
queryparams
+=
'
&
'
+
aParams
[
i
]
+
'
=
'
+
this
.
getVar
(
aParams
[
i
]);
}
}
$
(
'
#
'
+
domid
).
css
(
'
opacity
'
,
'
0.2
'
);
jQuery
.
ajax
({
url
:
url
,
data
:
queryparams
,
type
:
this
.
cfg
.
apimethod
,
success
:
function
(
data
)
{
$
(
'
#
'
+
domid
).
css
(
'
opacity
'
,
1
);
$
(
'
#
'
+
domid
).
html
(
data
);
},
error
:
function
(
data
)
{
$
(
'
#
'
+
domid
).
css
(
'
opacity
'
,
1
);
$
(
'
#
'
+
domid
).
html
(
'
Failed :-/
'
+
data
);
console
.
log
(
data
);
/*
$('#errorlog').html(
$('#errorlog').html('AJAX error: <a href="' + url + '?' + queryparams + '">' + url + '?' + queryparams + '</a>')
);
*/
}
});
/*
$('#' + id).css('opacity', '0.2');
sData = 'item=' + id + '&server=' + sSELECTEDSERVER + (sMoreData ? '&'+sMoreData : '');
if(!bNoAdressbarUpdate){
setAdressbar();
iRefreshCounter=0;
}
jQuery.ajax({
url: phpscript,
data: sData,
type: "GET",
success: function (data) {
$('#' + id).css('opacity', '1');
$('#' + id).html(data);
},
error: function () {
$('#' + id).css('opacity', false);
$('#' + id).html('Failed :-/');
$('#errorlog').html(
$('#errorlog').html('AJAX error: <a href="' + phpscript + '?' + sData + '">' + phpscript + '?' + sData + '</a>')
);
}
});
*/
};
this
.
init
=
function
()
{
for
(
var
sId
in
this
.
cfg
.
tasks
){
var
oTask
=
this
.
cfg
.
tasks
[
i
];
if
(
this
.
intervalObjects
[
sId
]){
clearInterval
(
this
.
intervalObjects
[
sId
]);
this
.
intervalObjects
[
sId
]
=
false
;
}
if
(
oTask
.
interval
){
this
.
intervalObjects
[
sId
]
=
window
.
setInterval
(
this
.
execTask
(
sId
),
oTask
.
interval
);
}
}
}
// ----------------------------------------------------------------------
// MAIN
// ----------------------------------------------------------------------
if
(
arguments
[
0
]){
this
.
cfg
=
realMerge
(
this
.
cfg
,
arguments
[
0
]);
};
return
true
;
};
// --------------------------------------------------------------------------------
// FUNCTIONS
// --------------------------------------------------------------------------------
/**
* merge 2 objects
* @param to assoc array 1
* @param from assoc array 2
*/
var
realMerge
=
function
(
to
,
from
)
{
for
(
n
in
from
)
{
if
(
typeof
to
[
n
]
!==
'
object
'
)
{
to
[
n
]
=
from
[
n
];
}
else
if
(
typeof
from
[
n
]
===
'
object
'
)
{
to
[
n
]
=
realMerge
(
to
[
n
],
from
[
n
]);
}
}
return
to
;
};
This diff is collapsed.
Click to expand it.
js/functions.js
+
41
−
1
View file @
78cb6a3e
...
@@ -9,6 +9,8 @@ var iRefreshCounter = 0;
...
@@ -9,6 +9,8 @@ var iRefreshCounter = 0;
var
bDEBUG
=
0
;
var
bDEBUG
=
0
;
var
oAjax
=
false
;
/**
/**
* show log on console ... if bDEBUG is true
* show log on console ... if bDEBUG is true
* @param {string} sMessage
* @param {string} sMessage
...
@@ -186,7 +188,9 @@ function showFile(sLogfile) {
...
@@ -186,7 +188,9 @@ function showFile(sLogfile) {
clog
(
"
showFile('
"
+
sLogfile
+
"
')
"
);
clog
(
"
showFile('
"
+
sLogfile
+
"
')
"
);
$
(
'
#overlay
'
).
show
();
$
(
'
#overlay
'
).
show
();
sLOGFILE
=
sLogfile
;
sLOGFILE
=
sLogfile
;
getPageItem
(
'
showlog
'
,
'
logfile=
'
+
sLOGFILE
,
true
);
oAjaxHelper
.
setVar
(
'
logfile
'
,
sLOGFILE
);
oAjaxHelper
.
execTask
(
'
showlog
'
);
// getPageItem('showlog', 'logfile=' + sLOGFILE, true);
}
}
/**
/**
* close overlay
* close overlay
...
@@ -239,6 +243,42 @@ $(document).ready(function () {
...
@@ -239,6 +243,42 @@ $(document).ready(function () {
}
}
bSETADDRESSBAR
=
true
;
bSETADDRESSBAR
=
true
;
window
.
setInterval
(
'
refreshTimer()
'
,
1000
);
window
.
setInterval
(
'
refreshTimer()
'
,
1000
);
// test section for asimax
var
aOptions
=
{
'
apibase
'
:
'
get.php
'
,
'
taskparam
'
:
'
item
'
,
'
tasks
'
:{
'
selectserverAll
'
:{
domid
:
'
selectserver
'
,
apimore
:
'
?
'
,
params
:
[],
interval
:
0
},
'
selectserver
'
:{
domid
:
'
selectserver
'
,
apimore
:
'
?
'
,
params
:
[
'
server
'
],
interval
:
0
},
'
showlog
'
:{
apimore
:
'
?
'
,
params
:
[
'
logfile
'
],
interval
:
0
}
}
};
oAjaxHelper
=
new
asimax
(
aOptions
);
oAjaxHelper
.
setVar
(
'
server
'
,
sSELECTEDSERVER
);
oAjaxHelper
.
setVar
(
'
tab
'
,
sACTIVESERVERTAB
);
oAjaxHelper
.
execTask
(
'
selectserver
'
);
// oAjaxHelper.execTask('selectserverAll');
});
});
/*
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment