Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SiB Notifications
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Startin blox
framework
SiB Notifications
Commits
0864a99b
Commit
0864a99b
authored
Jul 01, 2019
by
Matthieu Fesselier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/auto-refresh' into 'master'
feature: auto refresh See merge request
!15
parents
44dfb9b0
0f0b76b4
Pipeline
#4256
passed with stage
in 27 seconds
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
sib-notifications.js
sib-notifications.js
+19
-4
No files found.
sib-notifications.js
View file @
0864a99b
...
...
@@ -49,6 +49,13 @@ class SIBNotifications extends SIBTemplateElement {
if
(
notificationsMenu
)
notificationsMenu
.
removeAttribute
(
"
open
"
)
}
});
// Refresh every 30 seconds
window
.
setInterval
(()
=>
{
if
(
!
this
.
querySelector
(
'
details
'
).
hasAttribute
(
"
open
"
))
{
// prevent menu from closing on refresh
this
.
refresh
()
}
},
30000
);
}
static
get
propsDefinition
()
{
...
...
@@ -75,6 +82,11 @@ class SIBNotifications extends SIBTemplateElement {
}
}
refresh
()
{
const
context
=
document
.
querySelector
(
'
#notifications-list
'
).
context
;
store
.
get
(
this
.
resourceId
,
context
,
true
).
then
(()
=>
this
.
render
())
}
/* Events listeners */
_onReadResource
(
resourceId
)
{
const
edits
=
this
.
_getNotificationsList
()
...
...
@@ -128,9 +140,12 @@ class SIBNotifications extends SIBTemplateElement {
return
this
.
props
.
dateFormat
?
this
.
props
.
dateFormat
:
'
DD/MM/YYYY - kk:mm
'
;
}
template
({
dataSrc
,
idSuffix
})
{
get
resourceId
()
{
return
this
.
props
.
dataSrc
+
(
this
.
props
.
idSuffix
?
this
.
props
.
idSuffix
+
'
/
'
:
''
)
}
template
({
dataSrc
})
{
if
(
dataSrc
)
{
let
sourceUrl
=
dataSrc
+
(
idSuffix
?
idSuffix
+
'
/
'
:
''
)
return
`
<div class="sib-notifications">
<sib-widget name="custom-date">
...
...
@@ -142,7 +157,7 @@ class SIBNotifications extends SIBTemplateElement {
<div class="sib-notifications__counter">
<sib-display
id="unread-filter"
data-src="
${
sourceUrl
}
"
data-src="
${
this
.
resourceId
}
"
data-fields="none"
search-fields="unread"
search-value-unread="true"
...
...
@@ -155,7 +170,7 @@ class SIBNotifications extends SIBTemplateElement {
<sib-display
id="notifications-list"
class="sib-notifications__items"
data-src="
${
sourceUrl
}
"
data-src="
${
this
.
resourceId
}
"
widget-unread="read-badge"
set-source="type, object.name"
widget-object.name="sib-display-labelled-div"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment