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
Tatuya Kamada
gitlab-ce
Commits
cfe2e6b7
Commit
cfe2e6b7
authored
Mar 21, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loading being shown at the same time at the empty states
parent
d34d2718
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
16 deletions
+19
-16
app/assets/javascripts/commit/pipelines/pipelines_table.js
app/assets/javascripts/commit/pipelines/pipelines_table.js
+2
-5
app/assets/javascripts/vue_pipelines_index/pipelines.js
app/assets/javascripts/vue_pipelines_index/pipelines.js
+11
-11
spec/javascripts/commit/pipelines/pipelines_spec.js
spec/javascripts/commit/pipelines/pipelines_spec.js
+3
-0
spec/javascripts/vue_pipelines_index/pipelines_spec.js
spec/javascripts/vue_pipelines_index/pipelines_spec.js
+3
-0
No files found.
app/assets/javascripts/commit/pipelines/pipelines_table.js
View file @
cfe2e6b7
/* eslint-disable no-new*/
/* global Flash */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
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
'
;
...
@@ -50,11 +48,11 @@ export default Vue.component('pipelines-table', {
...
@@ -50,11 +48,11 @@ export default Vue.component('pipelines-table', {
computed
:
{
computed
:
{
shouldRenderErrorState
()
{
shouldRenderErrorState
()
{
return
this
.
hasError
&&
!
this
.
pageRequest
;
return
this
.
hasError
&&
!
this
.
isLoading
;
},
},
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
return
!
this
.
state
.
pipelines
.
length
&&
!
this
.
pageRequest
;
return
!
this
.
state
.
pipelines
.
length
&&
!
this
.
isLoading
;
},
},
},
},
...
@@ -98,7 +96,6 @@ export default Vue.component('pipelines-table', {
...
@@ -98,7 +96,6 @@ export default Vue.component('pipelines-table', {
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
hasError
=
true
;
this
.
hasError
=
true
;
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
new
Flash
(
'
An error occurred while fetching the pipelines, please reload the page again.
'
);
});
});
},
},
},
},
...
...
app/assets/javascripts/vue_pipelines_index/pipelines.js
View file @
cfe2e6b7
...
@@ -45,7 +45,7 @@ export default {
...
@@ -45,7 +45,7 @@ export default {
state
:
this
.
store
.
state
,
state
:
this
.
store
.
state
,
apiScope
:
'
all
'
,
apiScope
:
'
all
'
,
pagenum
:
1
,
pagenum
:
1
,
pageRequest
:
false
,
isLoading
:
false
,
hasError
:
false
,
hasError
:
false
,
};
};
},
},
...
@@ -61,7 +61,7 @@ export default {
...
@@ -61,7 +61,7 @@ export default {
},
},
shouldRenderErrorState
()
{
shouldRenderErrorState
()
{
return
this
.
hasError
&&
!
this
.
pageRequest
;
return
this
.
hasError
&&
!
this
.
isLoading
;
},
},
/**
/**
...
@@ -71,7 +71,7 @@ export default {
...
@@ -71,7 +71,7 @@ export default {
* @return {Boolean}
* @return {Boolean}
*/
*/
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
return
!
this
.
pageRequest
&&
return
!
this
.
isLoading
&&
!
this
.
hasError
&&
!
this
.
hasError
&&
!
this
.
state
.
pipelines
.
length
&&
!
this
.
state
.
pipelines
.
length
&&
(
this
.
scope
===
'
all
'
||
this
.
scope
===
null
);
(
this
.
scope
===
'
all
'
||
this
.
scope
===
null
);
...
@@ -83,7 +83,7 @@ export default {
...
@@ -83,7 +83,7 @@ export default {
* @return {Boolean}
* @return {Boolean}
*/
*/
shouldRenderNoPipelinesMessage
()
{
shouldRenderNoPipelinesMessage
()
{
return
!
this
.
pageRequest
&&
return
!
this
.
isLoading
&&
!
this
.
hasError
&&
!
this
.
hasError
&&
!
this
.
state
.
pipelines
.
length
&&
!
this
.
state
.
pipelines
.
length
&&
this
.
scope
!==
'
all
'
&&
this
.
scope
!==
'
all
'
&&
...
@@ -92,7 +92,7 @@ export default {
...
@@ -92,7 +92,7 @@ export default {
shouldRenderTable
()
{
shouldRenderTable
()
{
return
!
this
.
hasError
&&
return
!
this
.
hasError
&&
!
this
.
pageRequest
&&
this
.
state
.
pipelines
.
length
;
!
this
.
isLoading
&&
this
.
state
.
pipelines
.
length
;
},
},
/**
/**
...
@@ -101,7 +101,7 @@ export default {
...
@@ -101,7 +101,7 @@ export default {
* @return {Boolean}
* @return {Boolean}
*/
*/
shouldRenderPagination
()
{
shouldRenderPagination
()
{
return
!
this
.
pageRequest
&&
return
!
this
.
isLoading
&&
this
.
state
.
pipelines
.
length
&&
this
.
state
.
pipelines
.
length
&&
this
.
state
.
pageInfo
.
total
>
this
.
state
.
pageInfo
.
perPage
;
this
.
state
.
pageInfo
.
total
>
this
.
state
.
pageInfo
.
perPage
;
},
},
...
@@ -157,7 +157,7 @@ export default {
...
@@ -157,7 +157,7 @@ export default {
const
pageNumber
=
gl
.
utils
.
getParameterByName
(
'
page
'
)
||
this
.
pagenum
;
const
pageNumber
=
gl
.
utils
.
getParameterByName
(
'
page
'
)
||
this
.
pagenum
;
const
scope
=
gl
.
utils
.
getParameterByName
(
'
scope
'
)
||
this
.
apiScope
;
const
scope
=
gl
.
utils
.
getParameterByName
(
'
scope
'
)
||
this
.
apiScope
;
this
.
pageRequest
=
true
;
this
.
isLoading
=
true
;
return
this
.
service
.
getPipelines
(
scope
,
pageNumber
)
return
this
.
service
.
getPipelines
(
scope
,
pageNumber
)
.
then
(
resp
=>
({
.
then
(
resp
=>
({
headers
:
resp
.
headers
,
headers
:
resp
.
headers
,
...
@@ -169,11 +169,11 @@ export default {
...
@@ -169,11 +169,11 @@ export default {
this
.
store
.
storePagination
(
response
.
headers
);
this
.
store
.
storePagination
(
response
.
headers
);
})
})
.
then
(()
=>
{
.
then
(()
=>
{
this
.
pageRequest
=
false
;
this
.
isLoading
=
false
;
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
hasError
=
true
;
this
.
hasError
=
true
;
this
.
pageRequest
=
false
;
this
.
isLoading
=
false
;
});
});
},
},
},
},
...
@@ -183,7 +183,7 @@ export default {
...
@@ -183,7 +183,7 @@ export default {
<div
<div
class="top-area"
class="top-area"
v-if="!
pageRequest
&& !shouldRenderEmptyState">
v-if="!
isLoading
&& !shouldRenderEmptyState">
<navigation-tabs
<navigation-tabs
:scope="scope"
:scope="scope"
:count="state.count"
:count="state.count"
...
@@ -201,7 +201,7 @@ export default {
...
@@ -201,7 +201,7 @@ export default {
<div
<div
class="realtime-loading"
class="realtime-loading"
v-if="
pageRequest
">
v-if="
isLoading
">
<i
<i
class="fa fa-spinner fa-spin"
class="fa fa-spinner fa-spin"
aria-hidden="true" />
aria-hidden="true" />
...
...
spec/javascripts/commit/pipelines/pipelines_spec.js
View file @
cfe2e6b7
...
@@ -34,6 +34,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
...
@@ -34,6 +34,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.empty-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.empty-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.realtime-loading
'
)).
toBe
(
null
);
done
();
done
();
},
1
);
},
1
);
});
});
...
@@ -63,6 +64,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
...
@@ -63,6 +64,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
table > tbody > tr
'
).
length
).
toEqual
(
1
);
expect
(
component
.
$el
.
querySelectorAll
(
'
table > tbody > tr
'
).
length
).
toEqual
(
1
);
expect
(
component
.
$el
.
querySelector
(
'
.realtime-loading
'
)).
toBe
(
null
);
done
();
done
();
},
0
);
},
0
);
});
});
...
@@ -93,6 +95,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
...
@@ -93,6 +95,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.js-pipelines-error-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.js-pipelines-error-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.realtime-loading
'
)).
toBe
(
null
);
done
();
done
();
},
0
);
},
0
);
});
});
...
...
spec/javascripts/vue_pipelines_index/pipelines_spec.js
View file @
cfe2e6b7
...
@@ -41,6 +41,7 @@ describe('Pipelines', () => {
...
@@ -41,6 +41,7 @@ describe('Pipelines', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.table-holder
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.table-holder
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.realtime-loading
'
)).
toBe
(
null
);
done
();
done
();
});
});
});
});
...
@@ -72,6 +73,7 @@ describe('Pipelines', () => {
...
@@ -72,6 +73,7 @@ describe('Pipelines', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.empty-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.empty-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.realtime-loading
'
)).
toBe
(
null
);
done
();
done
();
});
});
});
});
...
@@ -104,6 +106,7 @@ describe('Pipelines', () => {
...
@@ -104,6 +106,7 @@ describe('Pipelines', () => {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.js-pipelines-error-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.js-pipelines-error-state
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
.realtime-loading
'
)).
toBe
(
null
);
done
();
done
();
});
});
});
});
...
...
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