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
f66e1c17
Commit
f66e1c17
authored
Apr 06, 2017
by
Filipa Lacerda
Committed by
Kamil Trzcinski
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Destroys pipeline table component when we change tabs in order to stop polling
parent
9e89c93e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
23 deletions
+29
-23
app/assets/javascripts/commit/pipelines/pipelines_bundle.js
app/assets/javascripts/commit/pipelines/pipelines_bundle.js
+3
-4
app/assets/javascripts/commit/pipelines/pipelines_table.js
app/assets/javascripts/commit/pipelines/pipelines_table.js
+13
-6
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+13
-13
No files found.
app/assets/javascripts/commit/pipelines/pipelines_bundle.js
View file @
f66e1c17
...
...
@@ -8,10 +8,8 @@ Vue.use(VueResource);
/**
* Commits View > Pipelines Tab > Pipelines Table.
* Merge Request View > Pipelines Tab > Pipelines Table.
*
* Renders Pipelines table in pipelines tab in the commits show view.
* Renders Pipelines table in pipelines tab in the merge request show view.
*/
$
(()
=>
{
...
...
@@ -20,13 +18,14 @@ $(() => {
gl
.
commits
.
pipelines
=
gl
.
commits
.
pipelines
||
{};
if
(
gl
.
commits
.
PipelinesTableBundle
)
{
document
.
querySelector
(
'
#commit-pipeline-table-view
'
).
removeChild
(
this
.
pipelinesTableBundle
.
$el
);
gl
.
commits
.
PipelinesTableBundle
.
$destroy
(
true
);
}
const
pipelineTableViewEl
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
gl
.
commits
.
pipelines
.
PipelinesTableBundle
=
new
CommitPipelinesTable
();
if
(
pipelineTableViewEl
&&
pipelineTableViewEl
.
dataset
.
disableInitialization
===
undefined
)
{
gl
.
commits
.
pipelines
.
PipelinesTableBundle
.
$mount
(
pipelineTableViewEl
);
gl
.
commits
.
pipelines
.
PipelinesTableBundle
=
new
CommitPipelinesTable
().
$mount
();
document
.
querySelector
(
'
#commit-pipeline-table-view
'
).
appendChild
(
this
.
pipelinesTableBundle
.
$el
);
}
});
app/assets/javascripts/commit/pipelines/pipelines_table.js
View file @
f66e1c17
...
...
@@ -22,6 +22,7 @@ import Poll from '../../lib/utils/poll';
*/
export
default
Vue
.
component
(
'
pipelines-table
'
,
{
components
:
{
'
pipelines-table-component
'
:
PipelinesTableComponent
,
'
error-state
'
:
ErrorState
,
...
...
@@ -67,11 +68,13 @@ export default Vue.component('pipelines-table', {
*
*/
beforeMount
()
{
this
.
endpoint
=
this
.
$el
.
dataset
.
endpoint
;
this
.
helpPagePath
=
this
.
$el
.
dataset
.
helpPagePath
;
const
element
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
this
.
endpoint
=
element
.
dataset
.
endpoint
;
this
.
helpPagePath
=
element
.
dataset
.
helpPagePath
;
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
const
poll
=
new
Poll
({
this
.
poll
=
new
Poll
({
resource
:
this
.
service
,
method
:
'
getPipelines
'
,
successCallback
:
this
.
successCallback
,
...
...
@@ -81,14 +84,14 @@ export default Vue.component('pipelines-table', {
if
(
!
Visibility
.
hidden
())
{
this
.
isLoading
=
true
;
poll
.
makeRequest
();
this
.
poll
.
makeRequest
();
}
Visibility
.
change
(()
=>
{
if
(
!
Visibility
.
hidden
())
{
poll
.
restart
();
this
.
poll
.
restart
();
}
else
{
poll
.
stop
();
this
.
poll
.
stop
();
}
});
...
...
@@ -108,6 +111,10 @@ export default Vue.component('pipelines-table', {
eventHub
.
$off
(
'
refreshPipelines
'
);
},
destroyed
()
{
this
.
poll
.
stop
();
},
methods
:
{
fetchPipelines
()
{
this
.
isLoading
=
true
;
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
f66e1c17
...
...
@@ -99,9 +99,10 @@ import './flash';
.
off
(
'
click
'
,
this
.
clickTab
);
}
destroy
()
{
this
.
unbindEvents
();
destroyPipelinesView
()
{
if
(
this
.
commitPipelinesTable
)
{
document
.
querySelector
(
'
#commit-pipeline-table-view
'
)
.
removeChild
(
this
.
commitPipelinesTable
.
$el
);
this
.
commitPipelinesTable
.
$destroy
();
}
}
...
...
@@ -128,6 +129,7 @@ import './flash';
this
.
loadCommits
(
$target
.
attr
(
'
href
'
));
this
.
expandView
();
this
.
resetViewContainer
();
this
.
destroyPipelinesView
();
}
else
if
(
this
.
isDiffAction
(
action
))
{
this
.
loadDiff
(
$target
.
attr
(
'
href
'
));
if
(
Breakpoints
.
get
().
getBreakpointSize
()
!==
'
lg
'
)
{
...
...
@@ -136,12 +138,14 @@ import './flash';
if
(
this
.
diffViewType
()
===
'
parallel
'
)
{
this
.
expandViewContainer
();
}
this
.
destroyPipelinesView
();
}
else
if
(
action
===
'
pipelines
'
)
{
this
.
resetViewContainer
();
this
.
loadPipelines
();
this
.
mountPipelinesView
();
}
else
{
this
.
expandView
();
this
.
resetViewContainer
();
this
.
destroyPipelinesView
();
}
if
(
this
.
setUrl
)
{
this
.
setCurrentAction
(
action
);
...
...
@@ -227,16 +231,12 @@ import './flash';
});
}
loadPipelines
()
{
if
(
this
.
pipelinesLoaded
)
{
return
;
}
const
pipelineTableViewEl
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
// Could already be mounted from the `pipelines_bundle`
if
(
pipelineTableViewEl
)
{
this
.
commitPipelinesTable
=
new
CommitPipelinesTable
().
$mount
(
pipelineTableViewEl
);
}
this
.
pipelinesLoaded
=
true
;
mountPipelinesView
()
{
this
.
commitPipelinesTable
=
new
CommitPipelinesTable
().
$mount
();
// $mount(el) replaces the el with the new rendered component. We need it in order to mount
// it everytime this tab is clicked - https://vuejs.org/v2/api/#vm-mount
document
.
querySelector
(
'
#commit-pipeline-table-view
'
)
.
appendChild
(
this
.
commitPipelinesTable
.
$el
);
}
loadDiff
(
source
)
{
...
...
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