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
Boxiang Sun
gitlab-ce
Commits
6f9fdebc
Commit
6f9fdebc
authored
Mar 24, 2017
by
Filipa Lacerda
Committed by
Kamil Trzcinski
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds polling function to pipelines table
Adds restart function to polling class so we can restart polling
parent
5fbb9e95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
19 deletions
+48
-19
app/assets/javascripts/vue_pipelines_index/pipelines.js
app/assets/javascripts/vue_pipelines_index/pipelines.js
+46
-18
app/assets/javascripts/vue_pipelines_index/services/pipelines_service.js
...scripts/vue_pipelines_index/services/pipelines_service.js
+2
-1
No files found.
app/assets/javascripts/vue_pipelines_index/pipelines.js
View file @
6f9fdebc
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Visibility
from
'
visibilityjs
'
;
import
PipelinesService
from
'
./services/pipelines_service
'
;
import
PipelinesService
from
'
./services/pipelines_service
'
;
import
eventHub
from
'
./event_hub
'
;
import
eventHub
from
'
./event_hub
'
;
import
PipelinesTableComponent
from
'
../vue_shared/components/pipelines_table
'
;
import
PipelinesTableComponent
from
'
../vue_shared/components/pipelines_table
'
;
...
@@ -7,6 +8,7 @@ import EmptyState from './components/empty_state';
...
@@ -7,6 +8,7 @@ import EmptyState from './components/empty_state';
import
ErrorState
from
'
./components/error_state
'
;
import
ErrorState
from
'
./components/error_state
'
;
import
NavigationTabs
from
'
./components/navigation_tabs
'
;
import
NavigationTabs
from
'
./components/navigation_tabs
'
;
import
NavigationControls
from
'
./components/nav_controls
'
;
import
NavigationControls
from
'
./components/nav_controls
'
;
import
Poll
from
'
../lib/utils/poll
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -123,9 +125,31 @@ export default {
...
@@ -123,9 +125,31 @@ export default {
},
},
created
()
{
created
()
{
const
pageNumber
=
gl
.
utils
.
getParameterByName
(
'
page
'
)
||
this
.
pagenum
;
const
scope
=
gl
.
utils
.
getParameterByName
(
'
scope
'
)
||
this
.
apiScope
;
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
this
.
fetchPipelines
();
const
poll
=
new
Poll
({
resource
:
this
.
service
,
method
:
'
getPipelines
'
,
data
:
{
page
:
pageNumber
,
scope
},
successCallback
:
this
.
successCallback
,
errorCallback
:
this
.
errorCallback
,
});
if
(
!
Visibility
.
hidden
())
{
this
.
isLoading
=
true
;
poll
.
makeRequest
();
}
Visibility
.
change
((
e
,
state
)
=>
{
if
(
state
===
'
visible
'
)
{
poll
.
restart
();
}
else
{
poll
.
stop
();
}
});
eventHub
.
$on
(
'
refreshPipelines
'
,
this
.
fetchPipelines
);
eventHub
.
$on
(
'
refreshPipelines
'
,
this
.
fetchPipelines
);
},
},
...
@@ -158,23 +182,27 @@ export default {
...
@@ -158,23 +182,27 @@ export default {
const
scope
=
gl
.
utils
.
getParameterByName
(
'
scope
'
)
||
this
.
apiScope
;
const
scope
=
gl
.
utils
.
getParameterByName
(
'
scope
'
)
||
this
.
apiScope
;
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
return
this
.
service
.
getPipelines
(
scope
,
pageNumber
)
return
this
.
service
.
getPipelines
({
scope
,
page
:
pageNumber
})
.
then
(
resp
=>
({
.
then
(
response
=>
this
.
successCallback
(
response
))
.
catch
(()
=>
this
.
errorCallback
());
},
successCallback
(
resp
)
{
const
response
=
{
headers
:
resp
.
headers
,
headers
:
resp
.
headers
,
body
:
resp
.
json
(),
body
:
resp
.
json
(),
}))
};
.
then
((
response
)
=>
{
this
.
store
.
storeCount
(
response
.
body
.
count
);
this
.
store
.
storeCount
(
response
.
body
.
count
);
this
.
store
.
storePipelines
(
response
.
body
.
pipelines
);
this
.
store
.
storePipelines
(
response
.
body
.
pipelines
);
this
.
store
.
storePagination
(
response
.
headers
);
this
.
store
.
storePagination
(
response
.
headers
);
})
.
then
(()
=>
{
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
})
},
.
catch
(()
=>
{
errorCallback
()
{
this
.
hasError
=
true
;
this
.
hasError
=
true
;
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
});
},
},
},
},
...
...
app/assets/javascripts/vue_pipelines_index/services/pipelines_service.js
View file @
6f9fdebc
...
@@ -26,7 +26,8 @@ export default class PipelinesService {
...
@@ -26,7 +26,8 @@ export default class PipelinesService {
this
.
pipelines
=
Vue
.
resource
(
endpoint
);
this
.
pipelines
=
Vue
.
resource
(
endpoint
);
}
}
getPipelines
(
scope
,
page
)
{
getPipelines
(
data
)
{
const
{
scope
,
page
}
=
data
;
return
this
.
pipelines
.
get
({
scope
,
page
});
return
this
.
pipelines
.
get
({
scope
,
page
});
}
}
...
...
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