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
788f3451
Commit
788f3451
authored
Mar 28, 2017
by
Filipa Lacerda
Committed by
Kamil Trzcinski
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend realtime for other pipelines tables
parent
90fc9237
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
13 deletions
+47
-13
app/assets/javascripts/commit/pipelines/pipelines_table.js
app/assets/javascripts/commit/pipelines/pipelines_table.js
+46
-12
app/assets/javascripts/vue_pipelines_index/services/pipelines_service.js
...scripts/vue_pipelines_index/services/pipelines_service.js
+1
-1
No files found.
app/assets/javascripts/commit/pipelines/pipelines_table.js
View file @
788f3451
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Visibility
from
'
visibilityjs
'
;
import
PipelinesTableComponent
from
'
../../vue_shared/components/pipelines_table
'
;
import
PipelinesTableComponent
from
'
../../vue_shared/components/pipelines_table
'
;
import
PipelinesService
from
'
../../vue_pipelines_index/services/pipelines_service
'
;
import
PipelinesService
from
'
../../vue_pipelines_index/services/pipelines_service
'
;
import
PipelineStore
from
'
../../vue_pipelines_index/stores/pipelines_store
'
;
import
PipelineStore
from
'
../../vue_pipelines_index/stores/pipelines_store
'
;
...
@@ -7,6 +8,7 @@ import EmptyState from '../../vue_pipelines_index/components/empty_state';
...
@@ -7,6 +8,7 @@ import EmptyState from '../../vue_pipelines_index/components/empty_state';
import
ErrorState
from
'
../../vue_pipelines_index/components/error_state
'
;
import
ErrorState
from
'
../../vue_pipelines_index/components/error_state
'
;
import
'
../../lib/utils/common_utils
'
;
import
'
../../lib/utils/common_utils
'
;
import
'
../../vue_shared/vue_resource_interceptor
'
;
import
'
../../vue_shared/vue_resource_interceptor
'
;
import
Poll
from
'
../../lib/utils/poll
'
;
/**
/**
*
*
...
@@ -42,6 +44,7 @@ export default Vue.component('pipelines-table', {
...
@@ -42,6 +44,7 @@ export default Vue.component('pipelines-table', {
state
:
store
.
state
,
state
:
store
.
state
,
isLoading
:
false
,
isLoading
:
false
,
hasError
:
false
,
hasError
:
false
,
setIsMakingRequest
:
false
,
};
};
},
},
...
@@ -70,11 +73,32 @@ export default Vue.component('pipelines-table', {
...
@@ -70,11 +73,32 @@ export default Vue.component('pipelines-table', {
this
.
fetchPipelines
();
this
.
fetchPipelines
();
const
poll
=
new
Poll
({
resource
:
this
.
service
,
method
:
'
getPipelines
'
,
successCallback
:
this
.
successCallback
,
errorCallback
:
this
.
errorCallback
,
notificationCallback
:
this
.
setIsMakingRequest
,
});
if
(
!
Visibility
.
hidden
())
{
this
.
isLoading
=
true
;
poll
.
makeRequest
();
}
Visibility
.
change
(()
=>
{
if
(
!
Visibility
.
hidden
())
{
poll
.
restart
();
}
else
{
poll
.
stop
();
}
});
eventHub
.
$on
(
'
refreshPipelines
'
,
this
.
fetchPipelines
);
eventHub
.
$on
(
'
refreshPipelines
'
,
this
.
fetchPipelines
);
},
},
beforeUpdate
()
{
beforeUpdate
()
{
if
(
this
.
state
.
pipelines
.
length
&&
this
.
$children
)
{
if
(
this
.
state
.
pipelines
.
length
&&
this
.
$children
&&
!
this
.
isMakingRequest
)
{
this
.
store
.
startTimeAgoLoops
.
call
(
this
,
Vue
);
this
.
store
.
startTimeAgoLoops
.
call
(
this
,
Vue
);
}
}
},
},
...
@@ -86,18 +110,28 @@ export default Vue.component('pipelines-table', {
...
@@ -86,18 +110,28 @@ export default Vue.component('pipelines-table', {
methods
:
{
methods
:
{
fetchPipelines
()
{
fetchPipelines
()
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
return
this
.
service
.
getPipelines
()
return
this
.
service
.
getPipelines
()
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
this
.
successCallback
(
response
))
.
then
((
json
)
=>
{
.
catch
(()
=>
this
.
errorCallback
());
// depending of the endpoint the response can either bring a `pipelines` key or not.
},
const
pipelines
=
json
.
pipelines
||
json
;
this
.
store
.
storePipelines
(
pipelines
);
successCallback
(
resp
)
{
this
.
isLoading
=
false
;
const
response
=
resp
.
json
();
})
.
catch
(()
=>
{
// depending of the endpoint the response can either bring a `pipelines` key or not.
this
.
hasError
=
true
;
const
pipelines
=
response
.
pipelines
||
response
;
this
.
isLoading
=
false
;
this
.
store
.
storePipelines
(
pipelines
);
});
this
.
isLoading
=
false
;
},
errorCallback
()
{
this
.
hasError
=
true
;
this
.
isLoading
=
false
;
},
setIsMakingRequest
(
isMakingRequest
)
{
this
.
isMakingRequest
=
isMakingRequest
;
},
},
},
},
...
...
app/assets/javascripts/vue_pipelines_index/services/pipelines_service.js
View file @
788f3451
...
@@ -26,7 +26,7 @@ export default class PipelinesService {
...
@@ -26,7 +26,7 @@ export default class PipelinesService {
this
.
pipelines
=
Vue
.
resource
(
endpoint
);
this
.
pipelines
=
Vue
.
resource
(
endpoint
);
}
}
getPipelines
(
data
)
{
getPipelines
(
data
=
{}
)
{
const
{
scope
,
page
}
=
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