Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
appmonitor-dashboard
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
appmonitor-dashboard
Commits
8cf71f53
Commit
8cf71f53
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
ubd: update docs; enhance init and renderer
parent
e1c490ff
Branches
Branches containing commit
No related tags found
1 merge request
!3
Abstract ubd class
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public_html/javascript/ubd.class.js
+33
-24
33 additions, 24 deletions
public_html/javascript/ubd.class.js
with
33 additions
and
24 deletions
public_html/javascript/ubd.class.js
+
33
−
24
View file @
8cf71f53
...
@@ -39,20 +39,22 @@ var ubd = function(){
...
@@ -39,20 +39,22 @@ var ubd = function(){
* @returns {undefined}
* @returns {undefined}
*/
*/
this
.
init
=
function
(
oConfig
){
this
.
init
=
function
(
oConfig
){
if
(
oConfig
[
'
domid
'
]){
if
(
oConfig
){
this
.
setDomid
(
oConfig
[
'
domid
'
]);
if
(
oConfig
[
'
domid
'
]){
}
this
.
setDomid
(
oConfig
[
'
domid
'
]);
if
(
oConfig
[
'
url
'
]){
}
this
.
setUrl
(
oConfig
[
'
url
'
]);
if
(
oConfig
[
'
url
'
]){
}
this
.
setUrl
(
oConfig
[
'
url
'
]);
if
(
oConfig
[
'
header
'
]){
}
this
.
setHeaders
(
oConfig
[
'
header
'
]);
if
(
oConfig
[
'
header
'
]){
}
this
.
setHeaders
(
oConfig
[
'
header
'
]);
if
(
oConfig
[
'
renderer
'
]){
}
this
.
setRenderfunction
(
oConfig
[
'
renderer
'
]);
if
(
oConfig
[
'
renderer
'
]){
}
this
.
setRenderfunction
(
oConfig
[
'
renderer
'
]);
if
(
oConfig
[
'
ttl
'
]){
}
this
.
setTtl
(
oConfig
[
'
ttl
'
]);
if
(
oConfig
[
'
ttl
'
]){
this
.
setTtl
(
oConfig
[
'
ttl
'
]);
}
}
}
},
},
...
@@ -78,7 +80,7 @@ var ubd = function(){
...
@@ -78,7 +80,7 @@ var ubd = function(){
/**
/**
* set a rendering function that visualized data after a http request
* set a rendering function that visualized data after a http request
* @param {string|function} oFunction
* @param {string|function} oFunction
reference to a function ... or false to disable rendering
*/
*/
this
.
setRenderfunction
=
function
(
oFunction
){
this
.
setRenderfunction
=
function
(
oFunction
){
this
.
_sRenderfunction
=
oFunction
;
this
.
_sRenderfunction
=
oFunction
;
...
@@ -122,25 +124,30 @@ var ubd = function(){
...
@@ -122,25 +124,30 @@ var ubd = function(){
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
/**
/**
* show rendered html content into set domid using the render function
* show rendered html content into set domid using the render function.
* Optionally you can set a string to display an error message.
* If no rendering function was set then the response will be written
* directly.
* You can override both by giving a parameter (a string with html)
* to write that one directly. It can be used to show an error message.
*
* TODO:
* other output places than innerHTML by detecting the tag e.g.
* to use input or textarea.
*
*
* @param {string} sHtml optional: htmlcode of an error message
* @param {string} sHtml optional: htmlcode of an error message
*/
*/
this
.
render
=
function
(
sHtml
)
{
this
.
render
=
function
(
sHtml
)
{
let
out
=
sHtml
?
sHtml
:
this
.
_sRenderfunction
(
this
.
_body
);
let
out
=
sHtml
?
sHtml
:
(
this
.
_sRenderfunction
?
this
.
_sRenderfunction
(
this
.
_body
)
:
this
.
_body
);
this
.
_oDomObject
.
innerHTML
=
out
;
this
.
_oDomObject
.
innerHTML
=
out
;
},
},
/**
/**
* reset timer to update the content in dom id after reaching TTL
* reset timer to update the content in dom id after reaching TTL
* used in setTtl
* used in setTtl
*
* WIP: repeating the update braks out from current instance.
* But what works is
* var oUbd=new ubd(...)
* by setting ttl = 0 and
* window.setInterval("oUbd.update();", 3000);
*/
*/
this
.
resetTimer
=
function
(){
this
.
resetTimer
=
function
(){
clearTimeout
(
this
.
_oTimer
);
clearTimeout
(
this
.
_oTimer
);
...
@@ -192,6 +199,8 @@ var ubd = function(){
...
@@ -192,6 +199,8 @@ var ubd = function(){
if
(
arguments
)
{
if
(
arguments
)
{
this
.
init
(
arguments
[
0
]);
this
.
init
(
arguments
[
0
]);
}
else
{
this
.
init
();
}
}
};
};
\ No newline at end of file
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