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
Jérome Perrin
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
Hide 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';
...
@@ -8,10 +8,10 @@ import httpStatusCodes from './http_status';
* new Poll({
* new Poll({
* resource: resource,
* resource: resource,
* method: 'name',
* method: 'name',
* data: {page: 1, scope: 'all'},
* data: {page: 1, scope: 'all'},
// optional
* successCallback: () => {},
* successCallback: () => {},
* errorCallback: () => {},
* errorCallback: () => {},
*
auxiliarCallback: () => {},
*
notificationCallback: () => {}, // optional
* }).makeRequest();
* }).makeRequest();
*
*
* Usage in pipelines table with visibility lib:
* Usage in pipelines table with visibility lib:
...
@@ -22,7 +22,7 @@ import httpStatusCodes from './http_status';
...
@@ -22,7 +22,7 @@ import httpStatusCodes from './http_status';
* data: { page: pageNumber, scope },
* data: { page: pageNumber, scope },
* successCallback: this.successCallback,
* successCallback: this.successCallback,
* errorCallback: this.errorCallback,
* errorCallback: this.errorCallback,
*
auxiliar
Callback: this.updateLoading,
*
notification
Callback: this.updateLoading,
* });
* });
*
*
* if (!Visibility.hidden()) {
* if (!Visibility.hidden()) {
...
@@ -48,6 +48,8 @@ export default class Poll {
...
@@ -48,6 +48,8 @@ export default class Poll {
constructor
(
options
=
{})
{
constructor
(
options
=
{})
{
this
.
options
=
options
;
this
.
options
=
options
;
this
.
options
.
data
=
options
.
data
||
{};
this
.
options
.
data
=
options
.
data
||
{};
this
.
options
.
notificationCallback
=
options
.
notificationCallback
||
function
notificationCallback
()
{};
this
.
intervalHeader
=
'
POLL-INTERVAL
'
;
this
.
intervalHeader
=
'
POLL-INTERVAL
'
;
this
.
timeoutID
=
null
;
this
.
timeoutID
=
null
;
...
@@ -68,14 +70,14 @@ export default class Poll {
...
@@ -68,14 +70,14 @@ export default class Poll {
}
}
makeRequest
()
{
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.
// It's called everytime a new request is made. Useful to update the status.
auxiliar
Callback
(
true
);
notification
Callback
(
true
);
return
resource
[
method
](
data
)
return
resource
[
method
](
data
)
.
then
(
response
=>
this
.
checkConditions
(
response
))
.
then
(
response
=>
this
.
checkConditions
(
response
))
.
catch
(
error
=>
errorCallback
(
error
));
.
catch
(
error
=>
errorCallback
(
error
));
}
}
/**
/**
...
...
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