Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
236bb933
Commit
236bb933
authored
Mar 24, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes after review
parent
9f7c19b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
app/assets/javascripts/lib/utils/poll.js
app/assets/javascripts/lib/utils/poll.js
+9
-7
No files found.
app/assets/javascripts/lib/utils/poll.js
View file @
236bb933
...
...
@@ -8,10 +8,10 @@ import httpStatusCodes from './http_status';
* new Poll({
* resource: resource,
* method: 'name',
* data: {page: 1, scope: 'all'},
* data: {page: 1, scope: 'all'},
// optional
* successCallback: () => {},
* errorCallback: () => {},
*
auxiliarCallback: () => {},
*
notificationCallback: () => {}, // optional
* }).makeRequest();
*
* Usage in pipelines table with visibility lib:
...
...
@@ -22,7 +22,7 @@ import httpStatusCodes from './http_status';
* data: { page: pageNumber, scope },
* successCallback: this.successCallback,
* errorCallback: this.errorCallback,
*
auxiliar
Callback: this.updateLoading,
*
notification
Callback: this.updateLoading,
* });
*
* if (!Visibility.hidden()) {
...
...
@@ -48,6 +48,8 @@ export default class Poll {
constructor
(
options
=
{})
{
this
.
options
=
options
;
this
.
options
.
data
=
options
.
data
||
{};
this
.
options
.
notificationCallback
=
options
.
notificationCallback
||
function
notificationCallback
()
{};
this
.
intervalHeader
=
'
POLL-INTERVAL
'
;
this
.
timeoutID
=
null
;
...
...
@@ -68,10 +70,10 @@ export default class Poll {
}
makeRequest
()
{
const
{
resource
,
method
,
data
,
errorCallback
,
auxiliar
Callback
}
=
this
.
options
;
const
{
resource
,
method
,
data
,
errorCallback
,
notification
Callback
}
=
this
.
options
;
// It's called everytime a new request is made. Useful to update the status.
auxiliar
Callback
(
true
);
notification
Callback
(
true
);
return
resource
[
method
](
data
)
.
then
(
response
=>
this
.
checkConditions
(
response
))
...
...
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