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
5922385f
Commit
5922385f
authored
Apr 01, 2021
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added polling to ready to merge widget state
Adds polling to get the updated merge trains count
parent
aded595a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
...merge_request_widget/components/states/ready_to_merge.vue
+21
-0
ee/spec/features/merge_trains/user_adds_merge_request_to_merge_train_spec.rb
...rge_trains/user_adds_merge_request_to_merge_train_spec.rb
+0
-6
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
View file @
5922385f
...
@@ -16,8 +16,10 @@ import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_
...
@@ -16,8 +16,10 @@ import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_
import
readyToMergeQuery
from
'
ee_else_ce/vue_merge_request_widget/queries/states/ready_to_merge.query.graphql
'
;
import
readyToMergeQuery
from
'
ee_else_ce/vue_merge_request_widget/queries/states/ready_to_merge.query.graphql
'
;
import
{
refreshUserMergeRequestCounts
}
from
'
~/commons/nav/user_merge_requests
'
;
import
{
refreshUserMergeRequestCounts
}
from
'
~/commons/nav/user_merge_requests
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
secondsToMilliseconds
}
from
'
~/lib/utils/datetime_utility
'
;
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
SmartInterval
from
'
~/smart_interval
'
;
import
glFeatureFlagMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
glFeatureFlagMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
MergeRequest
from
'
../../../merge_request
'
;
import
MergeRequest
from
'
../../../merge_request
'
;
import
{
AUTO_MERGE_STRATEGIES
,
DANGER
,
INFO
,
WARNING
}
from
'
../../constants
'
;
import
{
AUTO_MERGE_STRATEGIES
,
DANGER
,
INFO
,
WARNING
}
from
'
../../constants
'
;
...
@@ -66,6 +68,10 @@ export default {
...
@@ -66,6 +68,10 @@ export default {
this
.
isSquashReadOnly
=
data
.
project
.
squashReadOnly
;
this
.
isSquashReadOnly
=
data
.
project
.
squashReadOnly
;
this
.
squashCommitMessage
=
data
.
project
.
mergeRequest
.
defaultSquashCommitMessage
;
this
.
squashCommitMessage
=
data
.
project
.
mergeRequest
.
defaultSquashCommitMessage
;
this
.
loading
=
false
;
this
.
loading
=
false
;
if
(
this
.
state
.
mergeTrainsCount
!==
null
)
{
this
.
initPolling
();
}
},
},
},
},
},
},
...
@@ -291,8 +297,23 @@ export default {
...
@@ -291,8 +297,23 @@ export default {
if
(
this
.
glFeatures
.
mergeRequestWidgetGraphql
)
{
if
(
this
.
glFeatures
.
mergeRequestWidgetGraphql
)
{
eventHub
.
$off
(
'
ApprovalUpdated
'
,
this
.
updateGraphqlState
);
eventHub
.
$off
(
'
ApprovalUpdated
'
,
this
.
updateGraphqlState
);
}
}
if
(
this
.
pollingInterval
)
{
this
.
pollingInterval
.
destroy
();
}
},
},
methods
:
{
methods
:
{
initPolling
()
{
const
startingPollInterval
=
secondsToMilliseconds
(
5
);
this
.
pollingInterval
=
new
SmartInterval
({
callback
:
()
=>
this
.
$apollo
.
queries
.
state
.
refetch
(),
startingInterval
:
startingPollInterval
,
maxInterval
:
startingPollInterval
+
secondsToMilliseconds
(
4
*
60
),
hiddenInterval
:
secondsToMilliseconds
(
6
*
60
),
incrementByFactorOf
:
2
,
});
},
updateGraphqlState
()
{
updateGraphqlState
()
{
return
this
.
$apollo
.
queries
.
state
.
refetch
();
return
this
.
$apollo
.
queries
.
state
.
refetch
();
},
},
...
...
ee/spec/features/merge_trains/user_adds_merge_request_to_merge_train_spec.rb
View file @
5922385f
...
@@ -85,12 +85,6 @@ RSpec.describe 'User adds a merge request to a merge train', :js do
...
@@ -85,12 +85,6 @@ RSpec.describe 'User adds a merge request to a merge train', :js do
context
"when user clicks 'Remove from merge train' button"
do
context
"when user clicks 'Remove from merge train' button"
do
before
do
before
do
click_link
'Remove from merge train'
click_link
'Remove from merge train'
# Currently, this page shows "Add to merge train" button instead of "Start merge train",
# even though the merge train is empty.
# This likely is caused by the stale cache in client side. Frontend
# would need to refresh the mergiability data, specifically `stateData.mergeTrainsCount` periodically e.g. polling.
# As a workaround, we're doing a hard reload by executing `visit` here.
visit
project_merge_request_path
(
project
,
merge_request
)
end
end
it
'cancels automatic merge'
do
it
'cancels automatic merge'
do
...
...
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