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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
156171ca
Commit
156171ca
authored
Nov 13, 2020
by
Payton Burdette
Committed by
Olena Horal-Koretska
Nov 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix polling bug
Stop polling once pipeline has a finished status.
parent
7145daf0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
app/assets/javascripts/pipelines/components/header_component.vue
...ets/javascripts/pipelines/components/header_component.vue
+15
-1
spec/frontend/pipelines/header_component_spec.js
spec/frontend/pipelines/header_component_spec.js
+18
-0
No files found.
app/assets/javascripts/pipelines/components/header_component.vue
View file @
156171ca
...
@@ -16,6 +16,7 @@ export default {
...
@@ -16,6 +16,7 @@ export default {
name
:
'
PipelineHeaderSection
'
,
name
:
'
PipelineHeaderSection
'
,
pipelineCancel
:
'
pipelineCancel
'
,
pipelineCancel
:
'
pipelineCancel
'
,
pipelineRetry
:
'
pipelineRetry
'
,
pipelineRetry
:
'
pipelineRetry
'
,
finishedStatuses
:
[
'
FAILED
'
,
'
SUCCESS
'
,
'
CANCELED
'
],
components
:
{
components
:
{
ciHeader
,
ciHeader
,
GlAlert
,
GlAlert
,
...
@@ -95,6 +96,9 @@ export default {
...
@@ -95,6 +96,9 @@ export default {
status
()
{
status
()
{
return
this
.
pipeline
?.
status
;
return
this
.
pipeline
?.
status
;
},
},
isFinished
()
{
return
this
.
$options
.
finishedStatuses
.
includes
(
this
.
status
);
},
shouldRenderContent
()
{
shouldRenderContent
()
{
return
!
this
.
isLoadingInitialQuery
&&
this
.
hasPipelineData
;
return
!
this
.
isLoadingInitialQuery
&&
this
.
hasPipelineData
;
},
},
...
@@ -123,6 +127,13 @@ export default {
...
@@ -123,6 +127,13 @@ export default {
}
}
},
},
},
},
watch
:
{
isFinished
(
finished
)
{
if
(
finished
)
{
this
.
$apollo
.
queries
.
pipeline
.
stopPolling
();
}
},
},
methods
:
{
methods
:
{
reportFailure
(
errorType
)
{
reportFailure
(
errorType
)
{
this
.
failureType
=
errorType
;
this
.
failureType
=
errorType
;
...
@@ -141,7 +152,10 @@ export default {
...
@@ -141,7 +152,10 @@ export default {
if
(
errors
.
length
>
0
)
{
if
(
errors
.
length
>
0
)
{
this
.
reportFailure
(
POST_FAILURE
);
this
.
reportFailure
(
POST_FAILURE
);
}
else
{
}
else
{
this
.
$apollo
.
queries
.
pipeline
.
refetch
();
await
this
.
$apollo
.
queries
.
pipeline
.
refetch
();
if
(
!
this
.
isFinished
)
{
this
.
$apollo
.
queries
.
pipeline
.
startPolling
(
POLL_INTERVAL
);
}
}
}
}
catch
{
}
catch
{
this
.
reportFailure
(
POST_FAILURE
);
this
.
reportFailure
(
POST_FAILURE
);
...
...
spec/frontend/pipelines/header_component_spec.js
View file @
156171ca
...
@@ -97,6 +97,24 @@ describe('Pipeline details header', () => {
...
@@ -97,6 +97,24 @@ describe('Pipeline details header', () => {
);
);
});
});
describe
(
'
polling
'
,
()
=>
{
it
(
'
is stopped when pipeline is finished
'
,
async
()
=>
{
wrapper
=
createComponent
({
...
mockRunningPipelineHeader
});
await
wrapper
.
setData
({
pipeline
:
{
...
mockCancelledPipelineHeader
},
});
expect
(
wrapper
.
vm
.
$apollo
.
queries
.
pipeline
.
stopPolling
).
toHaveBeenCalled
();
});
it
(
'
is not stopped when pipeline is not finished
'
,
()
=>
{
wrapper
=
createComponent
();
expect
(
wrapper
.
vm
.
$apollo
.
queries
.
pipeline
.
stopPolling
).
not
.
toHaveBeenCalled
();
});
});
describe
(
'
actions
'
,
()
=>
{
describe
(
'
actions
'
,
()
=>
{
describe
(
'
Retry action
'
,
()
=>
{
describe
(
'
Retry action
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
...
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