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);
...
@@ -8,10 +8,8 @@ Vue.use(VueResource);
/**
/**
* Commits View > Pipelines Tab > Pipelines Table.
* 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 commits show view.
* Renders Pipelines table in pipelines tab in the merge request show view.
*/
*/
$
(()
=>
{
$
(()
=>
{
...
@@ -20,13 +18,14 @@ $(() => {
...
@@ -20,13 +18,14 @@ $(() => {
gl
.
commits
.
pipelines
=
gl
.
commits
.
pipelines
||
{};
gl
.
commits
.
pipelines
=
gl
.
commits
.
pipelines
||
{};
if
(
gl
.
commits
.
PipelinesTableBundle
)
{
if
(
gl
.
commits
.
PipelinesTableBundle
)
{
document
.
querySelector
(
'
#commit-pipeline-table-view
'
).
removeChild
(
this
.
pipelinesTableBundle
.
$el
);
gl
.
commits
.
PipelinesTableBundle
.
$destroy
(
true
);
gl
.
commits
.
PipelinesTableBundle
.
$destroy
(
true
);
}
}
const
pipelineTableViewEl
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
const
pipelineTableViewEl
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
gl
.
commits
.
pipelines
.
PipelinesTableBundle
=
new
CommitPipelinesTable
();
if
(
pipelineTableViewEl
&&
pipelineTableViewEl
.
dataset
.
disableInitialization
===
undefined
)
{
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';
...
@@ -22,6 +22,7 @@ import Poll from '../../lib/utils/poll';
*/
*/
export
default
Vue
.
component
(
'
pipelines-table
'
,
{
export
default
Vue
.
component
(
'
pipelines-table
'
,
{
components
:
{
components
:
{
'
pipelines-table-component
'
:
PipelinesTableComponent
,
'
pipelines-table-component
'
:
PipelinesTableComponent
,
'
error-state
'
:
ErrorState
,
'
error-state
'
:
ErrorState
,
...
@@ -67,11 +68,13 @@ export default Vue.component('pipelines-table', {
...
@@ -67,11 +68,13 @@ export default Vue.component('pipelines-table', {
*
*
*/
*/
beforeMount
()
{
beforeMount
()
{
this
.
endpoint
=
this
.
$el
.
dataset
.
endpoint
;
const
element
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
this
.
helpPagePath
=
this
.
$el
.
dataset
.
helpPagePath
;
this
.
endpoint
=
element
.
dataset
.
endpoint
;
this
.
helpPagePath
=
element
.
dataset
.
helpPagePath
;
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
this
.
service
=
new
PipelinesService
(
this
.
endpoint
);
const
poll
=
new
Poll
({
this
.
poll
=
new
Poll
({
resource
:
this
.
service
,
resource
:
this
.
service
,
method
:
'
getPipelines
'
,
method
:
'
getPipelines
'
,
successCallback
:
this
.
successCallback
,
successCallback
:
this
.
successCallback
,
...
@@ -81,14 +84,14 @@ export default Vue.component('pipelines-table', {
...
@@ -81,14 +84,14 @@ export default Vue.component('pipelines-table', {
if
(
!
Visibility
.
hidden
())
{
if
(
!
Visibility
.
hidden
())
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
poll
.
makeRequest
();
this
.
poll
.
makeRequest
();
}
}
Visibility
.
change
(()
=>
{
Visibility
.
change
(()
=>
{
if
(
!
Visibility
.
hidden
())
{
if
(
!
Visibility
.
hidden
())
{
poll
.
restart
();
this
.
poll
.
restart
();
}
else
{
}
else
{
poll
.
stop
();
this
.
poll
.
stop
();
}
}
});
});
...
@@ -108,6 +111,10 @@ export default Vue.component('pipelines-table', {
...
@@ -108,6 +111,10 @@ export default Vue.component('pipelines-table', {
eventHub
.
$off
(
'
refreshPipelines
'
);
eventHub
.
$off
(
'
refreshPipelines
'
);
},
},
destroyed
()
{
this
.
poll
.
stop
();
},
methods
:
{
methods
:
{
fetchPipelines
()
{
fetchPipelines
()
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
f66e1c17
...
@@ -99,9 +99,10 @@ import './flash';
...
@@ -99,9 +99,10 @@ import './flash';
.
off
(
'
click
'
,
this
.
clickTab
);
.
off
(
'
click
'
,
this
.
clickTab
);
}
}
destroy
()
{
destroyPipelinesView
()
{
this
.
unbindEvents
();
if
(
this
.
commitPipelinesTable
)
{
if
(
this
.
commitPipelinesTable
)
{
document
.
querySelector
(
'
#commit-pipeline-table-view
'
)
.
removeChild
(
this
.
commitPipelinesTable
.
$el
);
this
.
commitPipelinesTable
.
$destroy
();
this
.
commitPipelinesTable
.
$destroy
();
}
}
}
}
...
@@ -128,6 +129,7 @@ import './flash';
...
@@ -128,6 +129,7 @@ import './flash';
this
.
loadCommits
(
$target
.
attr
(
'
href
'
));
this
.
loadCommits
(
$target
.
attr
(
'
href
'
));
this
.
expandView
();
this
.
expandView
();
this
.
resetViewContainer
();
this
.
resetViewContainer
();
this
.
destroyPipelinesView
();
}
else
if
(
this
.
isDiffAction
(
action
))
{
}
else
if
(
this
.
isDiffAction
(
action
))
{
this
.
loadDiff
(
$target
.
attr
(
'
href
'
));
this
.
loadDiff
(
$target
.
attr
(
'
href
'
));
if
(
Breakpoints
.
get
().
getBreakpointSize
()
!==
'
lg
'
)
{
if
(
Breakpoints
.
get
().
getBreakpointSize
()
!==
'
lg
'
)
{
...
@@ -136,12 +138,14 @@ import './flash';
...
@@ -136,12 +138,14 @@ import './flash';
if
(
this
.
diffViewType
()
===
'
parallel
'
)
{
if
(
this
.
diffViewType
()
===
'
parallel
'
)
{
this
.
expandViewContainer
();
this
.
expandViewContainer
();
}
}
this
.
destroyPipelinesView
();
}
else
if
(
action
===
'
pipelines
'
)
{
}
else
if
(
action
===
'
pipelines
'
)
{
this
.
resetViewContainer
();
this
.
resetViewContainer
();
this
.
loadPipelines
();
this
.
mountPipelinesView
();
}
else
{
}
else
{
this
.
expandView
();
this
.
expandView
();
this
.
resetViewContainer
();
this
.
resetViewContainer
();
this
.
destroyPipelinesView
();
}
}
if
(
this
.
setUrl
)
{
if
(
this
.
setUrl
)
{
this
.
setCurrentAction
(
action
);
this
.
setCurrentAction
(
action
);
...
@@ -227,16 +231,12 @@ import './flash';
...
@@ -227,16 +231,12 @@ import './flash';
});
});
}
}
loadPipelines
()
{
mountPipelinesView
()
{
if
(
this
.
pipelinesLoaded
)
{
this
.
commitPipelinesTable
=
new
CommitPipelinesTable
().
$mount
();
return
;
// $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
const
pipelineTableViewEl
=
document
.
querySelector
(
'
#commit-pipeline-table-view
'
);
document
.
querySelector
(
'
#commit-pipeline-table-view
'
)
// Could already be mounted from the `pipelines_bundle`
.
appendChild
(
this
.
commitPipelinesTable
.
$el
);
if
(
pipelineTableViewEl
)
{
this
.
commitPipelinesTable
=
new
CommitPipelinesTable
().
$mount
(
pipelineTableViewEl
);
}
this
.
pipelinesLoaded
=
true
;
}
}
loadDiff
(
source
)
{
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