Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monster
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Javascript
Monster
Commits
3a9efb4c
Verified
Commit
3a9efb4c
authored
2 months ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
feat(datatable-status): add callbacks.onError
parent
54dbe350
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/components/datatable/status.mjs
+17
-0
17 additions, 0 deletions
source/components/datatable/status.mjs
with
17 additions
and
0 deletions
source/components/datatable/status.mjs
+
17
−
0
View file @
3a9efb4c
...
...
@@ -30,6 +30,7 @@ import "./datasource/rest.mjs";
import
"
../form/popper.mjs
"
;
import
"
../form/context-error.mjs
"
;
import
{
StatusStyleSheet
}
from
"
./stylesheet/status.mjs
"
;
import
{
Formatter
}
from
"
../../text/formatter.mjs
"
;
export
{
DatasourceStatus
};
...
...
@@ -82,6 +83,11 @@ class DatasourceStatus extends CustomElement {
* @property {string} templates.main Main template
* @property {Object} datasource Datasource configuration
* @property {string} datasource.selector The selector of the datasource
* @property {Object} callbacks Callbacks
* @property {Function} callbacks.onError Callback function for error handling
* @property {Object} timeouts Timeouts
* @property {number} timeouts.message Timeout for the message
* @property {Object} state State
*/
get
defaults
()
{
return
Object
.
assign
({},
super
.
defaults
,
{
...
...
@@ -93,6 +99,11 @@ class DatasourceStatus extends CustomElement {
selector
:
null
,
},
callbacks
:
{
onError
:
null
},
timeouts
:
{
message
:
4000
,
},
...
...
@@ -205,6 +216,12 @@ function initEventHandler() {
}
}
catch
(
e
)
{
}
finally
{
const
callback
=
self
.
getOption
(
"
callbacks.onError
"
,
null
);
if
(
callback
)
{
msg
=
callback
(
msg
);
}
self
[
errorElementSymbol
].
setErrorMessage
(
msg
,
timeout
);
}
});
...
...
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