BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2ded26f6
Commit
2ded26f6
authored
Apr 20, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Guarantee only one state is shown at a time
parent
60a6389a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
pipelines_table.js
app/assets/javascripts/commit/pipelines/pipelines_table.js
+18
-5
empty_state.vue
app/assets/javascripts/pipelines/components/empty_state.vue
+1
-1
pipelines_spec.js
spec/javascripts/commit/pipelines/pipelines_spec.js
+6
-1
No files found.
app/assets/javascripts/commit/pipelines/pipelines_table.js
View file @
2ded26f6
...
@@ -55,7 +55,15 @@ export default Vue.component('pipelines-table', {
...
@@ -55,7 +55,15 @@ export default Vue.component('pipelines-table', {
},
},
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
return
!
this
.
state
.
pipelines
.
length
&&
!
this
.
isLoading
;
return
!
this
.
state
.
pipelines
.
length
&&
!
this
.
isLoading
&&
!
this
.
hasError
;
},
shouldRenderTable
()
{
return
!
this
.
isLoading
&&
this
.
state
.
pipelines
.
length
>
0
&&
!
this
.
hasError
;
},
},
},
},
...
@@ -145,8 +153,12 @@ export default Vue.component('pipelines-table', {
...
@@ -145,8 +153,12 @@ export default Vue.component('pipelines-table', {
template
:
`
template
:
`
<div class="content-list pipelines">
<div class="content-list pipelines">
<div class="realtime-loading" v-if="isLoading">
<div
<i class="fa fa-spinner fa-spin"></i>
class="realtime-loading"
v-if="isLoading">
<i
class="fa fa-spinner fa-spin"
aria-hidden="true" />
</div>
</div>
<empty-state
<empty-state
...
@@ -155,8 +167,9 @@ export default Vue.component('pipelines-table', {
...
@@ -155,8 +167,9 @@ export default Vue.component('pipelines-table', {
<error-state v-if="shouldRenderErrorState" />
<error-state v-if="shouldRenderErrorState" />
<div class="table-holder"
<div
v-if="!isLoading && state.pipelines.length > 0">
class="table-holder"
v-if="shouldRenderTable">
<pipelines-table-component
<pipelines-table-component
:pipelines="state.pipelines"
:pipelines="state.pipelines"
:service="service" />
:service="service" />
...
...
app/assets/javascripts/pipelines/components/empty_state.vue
View file @
2ded26f6
...
@@ -13,7 +13,7 @@ export default {
...
@@ -13,7 +13,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"row empty-state"
>
<div
class=
"row empty-state
js-empty-state
"
>
<div
class=
"col-xs-12"
>
<div
class=
"col-xs-12"
>
<div
class=
"svg-content"
v-html=
"pipelinesEmptyStateSVG"
/>
<div
class=
"svg-content"
v-html=
"pipelinesEmptyStateSVG"
/>
</div>
</div>
...
...
spec/javascripts/commit/pipelines/pipelines_spec.js
View file @
2ded26f6
...
@@ -36,6 +36,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
...
@@ -36,6 +36,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
this
.
component
.
$el
.
querySelector
(
'.empty-state'
)).
toBeDefined
();
expect
(
this
.
component
.
$el
.
querySelector
(
'.empty-state'
)).
toBeDefined
();
expect
(
this
.
component
.
$el
.
querySelector
(
'.realtime-loading'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.realtime-loading'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.js-pipelines-error-state'
)).
toBe
(
null
);
done
();
done
();
},
1
);
},
1
);
});
});
...
@@ -67,6 +68,8 @@ describe('Pipelines table in Commits and Merge requests', () => {
...
@@ -67,6 +68,8 @@ describe('Pipelines table in Commits and Merge requests', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
this
.
component
.
$el
.
querySelectorAll
(
'table > tbody > tr'
).
length
).
toEqual
(
1
);
expect
(
this
.
component
.
$el
.
querySelectorAll
(
'table > tbody > tr'
).
length
).
toEqual
(
1
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.realtime-loading'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.realtime-loading'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.empty-state'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.js-pipelines-error-state'
)).
toBe
(
null
);
done
();
done
();
},
0
);
},
0
);
});
});
...
@@ -95,10 +98,12 @@ describe('Pipelines table in Commits and Merge requests', () => {
...
@@ -95,10 +98,12 @@ describe('Pipelines table in Commits and Merge requests', () => {
this
.
component
.
$destroy
();
this
.
component
.
$destroy
();
});
});
it
(
'should render e
mpty
state'
,
function
(
done
)
{
it
(
'should render e
rror
state'
,
function
(
done
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
this
.
component
.
$el
.
querySelector
(
'.js-pipelines-error-state'
)).
toBeDefined
();
expect
(
this
.
component
.
$el
.
querySelector
(
'.js-pipelines-error-state'
)).
toBeDefined
();
expect
(
this
.
component
.
$el
.
querySelector
(
'.realtime-loading'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.realtime-loading'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'.js-empty-state'
)).
toBe
(
null
);
expect
(
this
.
component
.
$el
.
querySelector
(
'table'
)).
toBe
(
null
);
done
();
done
();
},
0
);
},
0
);
});
});
...
...
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