Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
1a9f1eb0
Commit
1a9f1eb0
authored
7 years ago
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_core] activity watcher: use renderJS onLoop functionnality
parent
53982a05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
53 deletions
+34
-53
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_activity_watcher.js.js
...Item/portal_skins/erp5_core/gadget_activity_watcher.js.js
+34
-53
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_activity_watcher.js.js
View file @
1a9f1eb0
...
...
@@ -17,60 +17,41 @@
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
.
ready
(
function
(
g
)
{
return
g
.
getElement
().
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
.
declareService
(
function
()
{
.
onLoop
(
function
()
{
var
form_gadget
=
this
,
html_content
,
basedir
=
location
.
pathname
.
split
(
'
/
'
).
slice
(
0
,
-
1
).
join
(
'
/
'
)
+
'
/
'
,
queue
=
new
RSVP
.
Queue
();
function
getDataExamine
()
{
queue
.
push
(
function
()
{
return
jIO
.
util
.
ajax
(
{
"
type
"
:
"
POST
"
,
"
url
"
:
basedir
+
'
ActivityTool_getSqlStatisticList
'
,
"
xhrFields
"
:
{
withCredentials
:
true
}
basedir
=
location
.
pathname
.
split
(
'
/
'
).
slice
(
0
,
-
1
).
join
(
'
/
'
)
+
'
/
'
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
(
{
"
type
"
:
"
POST
"
,
"
url
"
:
basedir
+
'
ActivityTool_getSqlStatisticList
'
,
"
xhrFields
"
:
{
withCredentials
:
true
}
);
})
.
push
(
function
(
evt
)
{
var
data
=
JSON
.
parse
(
evt
.
target
.
response
);
html_content
=
get_data_template
(
{
time
:
new
Date
().
toTimeString
(),
messageList1
:
putMessageType
(
data
,
'
dict
'
,
'
SQLDict
'
),
messageList2
:
putMessageType
(
data
,
'
queue
'
,
'
SQLQueue
'
),
messagePri1
:
putMessageType
(
data
,
'
dict
'
,
'
SQLDict2
'
),
messagePri2
:
putMessageType
(
data
,
'
queue
'
,
'
SQLQueue2
'
)
}
);
}
);
})
.
push
(
function
(
evt
)
{
var
data
=
JSON
.
parse
(
evt
.
target
.
response
);
form_gadget
.
element
.
querySelector
(
"
.activity_watcher_gadget
"
)
.
innerHTML
=
get_data_template
(
{
time
:
new
Date
().
toTimeString
(),
messageList1
:
putMessageType
(
data
,
'
dict
'
,
'
SQLDict
'
),
messageList2
:
putMessageType
(
data
,
'
queue
'
,
'
SQLQueue
'
),
messagePri1
:
putMessageType
(
data
,
'
dict
'
,
'
SQLDict2
'
),
messagePri2
:
putMessageType
(
data
,
'
queue
'
,
'
SQLQueue2
'
)
}
);
form_gadget
.
props
.
element
.
querySelector
(
"
.activity_watcher_gadget
"
)
.
innerHTML
=
html_content
;
},
function
(
error
)
{
//Exception is raised if network is lost for some reasons,
//in this case, try patiently until network is back.
console
.
log
(
"
Unable to fetch activities from ERP5
"
,
error
);
})
.
push
(
function
()
{
return
RSVP
.
delay
(
1000
);
})
.
push
(
function
()
{
return
getDataExamine
();
});
}
return
queue
.
push
(
function
()
{
return
getDataExamine
();
});
});
},
function
(
error
)
{
//Exception is raised if network is lost for some reasons,
//in this case, try patiently until network is back.
console
.
warn
(
"
Unable to fetch activities from ERP5
"
,
error
);
form_gadget
.
element
.
querySelector
(
"
.activity_watcher_gadget
"
)
.
textContent
=
"
Unable to fetch activities from ERP5
"
;
});
},
1000
);
}(
rJS
,
jIO
,
Handlebars
,
RSVP
,
window
));
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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