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
8fa6fb52
Commit
8fa6fb52
authored
May 16, 2017
by
Filipa Lacerda
Committed by
Phil Hughes
May 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only renders empty state for pipelines table if no pipelines are received when request is made
parent
71e2f4ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
16 deletions
+40
-16
app/assets/javascripts/commit/pipelines/pipelines_table.js
app/assets/javascripts/commit/pipelines/pipelines_table.js
+19
-6
app/assets/javascripts/pipelines/pipelines.js
app/assets/javascripts/pipelines/pipelines.js
+17
-10
changelogs/unreleased/31998-pipelines-empty-state.yml
changelogs/unreleased/31998-pipelines-empty-state.yml
+4
-0
No files found.
app/assets/javascripts/commit/pipelines/pipelines_table.js
View file @
8fa6fb52
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Visibility
from
'
visibilityjs
'
;
import
Visibility
from
'
visibilityjs
'
;
import
P
ipelinesTableComponent
from
'
../../vue_shared/components/pipelines_table
'
;
import
p
ipelinesTableComponent
from
'
../../vue_shared/components/pipelines_table
'
;
import
PipelinesService
from
'
../../pipelines/services/pipelines_service
'
;
import
PipelinesService
from
'
../../pipelines/services/pipelines_service
'
;
import
PipelineStore
from
'
../../pipelines/stores/pipelines_store
'
;
import
PipelineStore
from
'
../../pipelines/stores/pipelines_store
'
;
import
eventHub
from
'
../../pipelines/event_hub
'
;
import
eventHub
from
'
../../pipelines/event_hub
'
;
import
E
mptyState
from
'
../../pipelines/components/empty_state.vue
'
;
import
e
mptyState
from
'
../../pipelines/components/empty_state.vue
'
;
import
E
rrorState
from
'
../../pipelines/components/error_state.vue
'
;
import
e
rrorState
from
'
../../pipelines/components/error_state.vue
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
'
../../lib/utils/common_utils
'
;
import
'
../../lib/utils/common_utils
'
;
import
'
../../vue_shared/vue_resource_interceptor
'
;
import
'
../../vue_shared/vue_resource_interceptor
'
;
...
@@ -23,9 +23,9 @@ import Poll from '../../lib/utils/poll';
...
@@ -23,9 +23,9 @@ import Poll from '../../lib/utils/poll';
export
default
Vue
.
component
(
'
pipelines-table
'
,
{
export
default
Vue
.
component
(
'
pipelines-table
'
,
{
components
:
{
components
:
{
'
pipelines-table-component
'
:
P
ipelinesTableComponent
,
p
ipelinesTableComponent
,
'
error-state
'
:
E
rrorState
,
e
rrorState
,
'
empty-state
'
:
E
mptyState
,
e
mptyState
,
loadingIcon
,
loadingIcon
,
},
},
...
@@ -47,6 +47,7 @@ export default Vue.component('pipelines-table', {
...
@@ -47,6 +47,7 @@ export default Vue.component('pipelines-table', {
hasError
:
false
,
hasError
:
false
,
isMakingRequest
:
false
,
isMakingRequest
:
false
,
updateGraphDropdown
:
false
,
updateGraphDropdown
:
false
,
hasMadeRequest
:
false
,
};
};
},
},
...
@@ -55,9 +56,15 @@ export default Vue.component('pipelines-table', {
...
@@ -55,9 +56,15 @@ export default Vue.component('pipelines-table', {
return
this
.
hasError
&&
!
this
.
isLoading
;
return
this
.
hasError
&&
!
this
.
isLoading
;
},
},
/**
* Empty state is only rendered if after the first request we receive no pipelines.
*
* @return {Boolean}
*/
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
return
!
this
.
state
.
pipelines
.
length
&&
return
!
this
.
state
.
pipelines
.
length
&&
!
this
.
isLoading
&&
!
this
.
isLoading
&&
this
.
hasMadeRequest
&&
!
this
.
hasError
;
!
this
.
hasError
;
},
},
...
@@ -94,6 +101,10 @@ export default Vue.component('pipelines-table', {
...
@@ -94,6 +101,10 @@ export default Vue.component('pipelines-table', {
if
(
!
Visibility
.
hidden
())
{
if
(
!
Visibility
.
hidden
())
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
this
.
poll
.
makeRequest
();
this
.
poll
.
makeRequest
();
}
else
{
// If tab is not visible we need to make the first request so we don't show the empty
// state without knowing if there are any pipelines
this
.
fetchPipelines
();
}
}
Visibility
.
change
(()
=>
{
Visibility
.
change
(()
=>
{
...
@@ -127,6 +138,8 @@ export default Vue.component('pipelines-table', {
...
@@ -127,6 +138,8 @@ export default Vue.component('pipelines-table', {
successCallback
(
resp
)
{
successCallback
(
resp
)
{
const
response
=
resp
.
json
();
const
response
=
resp
.
json
();
this
.
hasMadeRequest
=
true
;
// depending of the endpoint the response can either bring a `pipelines` key or not.
// depending of the endpoint the response can either bring a `pipelines` key or not.
const
pipelines
=
response
.
pipelines
||
response
;
const
pipelines
=
response
.
pipelines
||
response
;
this
.
store
.
storePipelines
(
pipelines
);
this
.
store
.
storePipelines
(
pipelines
);
...
...
app/assets/javascripts/pipelines/pipelines.js
View file @
8fa6fb52
import
Visibility
from
'
visibilityjs
'
;
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
P
ipelinesTableComponent
from
'
../vue_shared/components/pipelines_table
'
;
import
p
ipelinesTableComponent
from
'
../vue_shared/components/pipelines_table
'
;
import
tablePagination
from
'
../vue_shared/components/table_pagination.vue
'
;
import
tablePagination
from
'
../vue_shared/components/table_pagination.vue
'
;
import
E
mptyState
from
'
./components/empty_state.vue
'
;
import
e
mptyState
from
'
./components/empty_state.vue
'
;
import
E
rrorState
from
'
./components/error_state.vue
'
;
import
e
rrorState
from
'
./components/error_state.vue
'
;
import
N
avigationTabs
from
'
./components/navigation_tabs
'
;
import
n
avigationTabs
from
'
./components/navigation_tabs
'
;
import
N
avigationControls
from
'
./components/nav_controls
'
;
import
n
avigationControls
from
'
./components/nav_controls
'
;
import
loadingIcon
from
'
../vue_shared/components/loading_icon.vue
'
;
import
loadingIcon
from
'
../vue_shared/components/loading_icon.vue
'
;
import
Poll
from
'
../lib/utils/poll
'
;
import
Poll
from
'
../lib/utils/poll
'
;
...
@@ -20,11 +20,11 @@ export default {
...
@@ -20,11 +20,11 @@ export default {
components
:
{
components
:
{
tablePagination
,
tablePagination
,
'
pipelines-table-component
'
:
P
ipelinesTableComponent
,
p
ipelinesTableComponent
,
'
empty-state
'
:
E
mptyState
,
e
mptyState
,
'
error-state
'
:
E
rrorState
,
e
rrorState
,
'
navigation-tabs
'
:
N
avigationTabs
,
n
avigationTabs
,
'
navigation-controls
'
:
N
avigationControls
,
n
avigationControls
,
loadingIcon
,
loadingIcon
,
},
},
...
@@ -52,6 +52,7 @@ export default {
...
@@ -52,6 +52,7 @@ export default {
hasError
:
false
,
hasError
:
false
,
isMakingRequest
:
false
,
isMakingRequest
:
false
,
updateGraphDropdown
:
false
,
updateGraphDropdown
:
false
,
hasMadeRequest
:
false
,
};
};
},
},
...
@@ -78,6 +79,7 @@ export default {
...
@@ -78,6 +79,7 @@ export default {
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
return
!
this
.
isLoading
&&
return
!
this
.
isLoading
&&
!
this
.
hasError
&&
!
this
.
hasError
&&
this
.
hasMadeRequest
&&
!
this
.
state
.
pipelines
.
length
&&
!
this
.
state
.
pipelines
.
length
&&
(
this
.
scope
===
'
all
'
||
this
.
scope
===
null
);
(
this
.
scope
===
'
all
'
||
this
.
scope
===
null
);
},
},
...
@@ -150,6 +152,10 @@ export default {
...
@@ -150,6 +152,10 @@ export default {
if
(
!
Visibility
.
hidden
())
{
if
(
!
Visibility
.
hidden
())
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
poll
.
makeRequest
();
poll
.
makeRequest
();
}
else
{
// If tab is not visible we need to make the first request so we don't show the empty
// state without knowing if there are any pipelines
this
.
fetchPipelines
();
}
}
Visibility
.
change
(()
=>
{
Visibility
.
change
(()
=>
{
...
@@ -202,6 +208,7 @@ export default {
...
@@ -202,6 +208,7 @@ export default {
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
this
.
updateGraphDropdown
=
true
;
this
.
updateGraphDropdown
=
true
;
this
.
hasMadeRequest
=
true
;
},
},
errorCallback
()
{
errorCallback
()
{
...
...
changelogs/unreleased/31998-pipelines-empty-state.yml
0 → 100644
View file @
8fa6fb52
---
title
:
Fix Pipelines table empty state - only render empty state if we receive 0 pipelines
merge_request
:
author
:
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