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
254c0754
Commit
254c0754
authored
Dec 15, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch vue_merge_request_widget to Axios
parent
d2e5313a
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
75 additions
and
99 deletions
+75
-99
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_deployment.js
...e_merge_request_widget/components/mr_widget_deployment.js
+4
-4
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_memory_usage.js
...merge_request_widget/components/mr_widget_memory_usage.js
+4
-4
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merge_when_pipeline_succeeds.js
...mponents/states/mr_widget_merge_when_pipeline_succeeds.js
+6
-6
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.js
...erge_request_widget/components/states/mr_widget_merged.js
+3
-3
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
...uest_widget/components/states/mr_widget_ready_to_merge.js
+15
-15
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_wip.js
...e_merge_request_widget/components/states/mr_widget_wip.js
+3
-3
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+11
-11
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
...ts/vue_merge_request_widget/services/mr_widget_service.js
+12
-22
spec/javascripts/vue_mr_widget/components/mr_widget_deployment_spec.js
...pts/vue_mr_widget/components/mr_widget_deployment_spec.js
+2
-4
spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js
...s/vue_mr_widget/components/mr_widget_memory_usage_spec.js
+1
-3
spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
...nts/states/mr_widget_merge_when_pipeline_succeeds_spec.js
+3
-7
spec/javascripts/vue_mr_widget/components/states/mr_widget_merged_spec.js
.../vue_mr_widget/components/states/mr_widget_merged_spec.js
+2
-4
spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
...widget/components/states/mr_widget_ready_to_merge_spec.js
+7
-6
spec/javascripts/vue_mr_widget/components/states/mr_widget_wip_spec.js
...pts/vue_mr_widget/components/states/mr_widget_wip_spec.js
+1
-3
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
+1
-4
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_deployment.js
View file @
254c0754
...
@@ -34,10 +34,10 @@ export default {
...
@@ -34,10 +34,10 @@ export default {
if
(
isConfirmed
)
{
if
(
isConfirmed
)
{
MRWidgetService
.
stopEnvironment
(
deployment
.
stop_url
)
MRWidgetService
.
stopEnvironment
(
deployment
.
stop_url
)
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
if
(
res
.
redirect_url
)
{
if
(
data
.
redirect_url
)
{
visitUrl
(
res
.
redirect_url
);
visitUrl
(
data
.
redirect_url
);
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_memory_usage.js
View file @
254c0754
...
@@ -102,11 +102,11 @@ export default {
...
@@ -102,11 +102,11 @@ export default {
return
res
;
return
res
;
}
}
return
res
.
json
()
;
return
res
.
data
;
})
})
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
this
.
computeGraphData
(
res
.
metrics
,
res
.
deployment_time
);
this
.
computeGraphData
(
data
.
metrics
,
data
.
deployment_time
);
return
res
;
return
data
;
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
loadFailed
=
true
;
this
.
loadFailed
=
true
;
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merge_when_pipeline_succeeds.js
View file @
254c0754
...
@@ -31,9 +31,9 @@ export default {
...
@@ -31,9 +31,9 @@ export default {
cancelAutomaticMerge
()
{
cancelAutomaticMerge
()
{
this
.
isCancellingAutoMerge
=
true
;
this
.
isCancellingAutoMerge
=
true
;
this
.
service
.
cancelAutomaticMerge
()
this
.
service
.
cancelAutomaticMerge
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
eventHub
.
$emit
(
'
UpdateWidgetData
'
,
res
);
eventHub
.
$emit
(
'
UpdateWidgetData
'
,
data
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
isCancellingAutoMerge
=
false
;
this
.
isCancellingAutoMerge
=
false
;
...
@@ -49,9 +49,9 @@ export default {
...
@@ -49,9 +49,9 @@ export default {
this
.
isRemovingSourceBranch
=
true
;
this
.
isRemovingSourceBranch
=
true
;
this
.
service
.
mergeResource
.
save
(
options
)
this
.
service
.
mergeResource
.
save
(
options
)
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
if
(
res
.
status
===
'
merge_when_pipeline_succeeds
'
)
{
if
(
data
.
status
===
'
merge_when_pipeline_succeeds
'
)
{
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
}
}
})
})
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.js
View file @
254c0754
...
@@ -47,9 +47,9 @@ export default {
...
@@ -47,9 +47,9 @@ export default {
removeSourceBranch
()
{
removeSourceBranch
()
{
this
.
isMakingRequest
=
true
;
this
.
isMakingRequest
=
true
;
this
.
service
.
removeSourceBranch
()
this
.
service
.
removeSourceBranch
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
if
(
res
.
message
===
'
Branch was removed
'
)
{
if
(
data
.
message
===
'
Branch was removed
'
)
{
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
,
()
=>
{
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
,
()
=>
{
this
.
isMakingRequest
=
false
;
this
.
isMakingRequest
=
false
;
});
});
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
View file @
254c0754
...
@@ -135,16 +135,16 @@ export default {
...
@@ -135,16 +135,16 @@ export default {
this
.
isMakingRequest
=
true
;
this
.
isMakingRequest
=
true
;
this
.
service
.
merge
(
options
)
this
.
service
.
merge
(
options
)
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
const
hasError
=
res
.
status
===
'
failed
'
||
res
.
status
===
'
hook_validation_error
'
;
const
hasError
=
data
.
status
===
'
failed
'
||
data
.
status
===
'
hook_validation_error
'
;
if
(
res
.
status
===
'
merge_when_pipeline_succeeds
'
)
{
if
(
data
.
status
===
'
merge_when_pipeline_succeeds
'
)
{
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
}
else
if
(
res
.
status
===
'
success
'
)
{
}
else
if
(
data
.
status
===
'
success
'
)
{
this
.
initiateMergePolling
();
this
.
initiateMergePolling
();
}
else
if
(
hasError
)
{
}
else
if
(
hasError
)
{
eventHub
.
$emit
(
'
FailedToMerge
'
,
res
.
merge_error
);
eventHub
.
$emit
(
'
FailedToMerge
'
,
data
.
merge_error
);
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
@@ -159,9 +159,9 @@ export default {
...
@@ -159,9 +159,9 @@ export default {
},
},
handleMergePolling
(
continuePolling
,
stopPolling
)
{
handleMergePolling
(
continuePolling
,
stopPolling
)
{
this
.
service
.
poll
()
this
.
service
.
poll
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
if
(
res
.
state
===
'
merged
'
)
{
if
(
data
.
state
===
'
merged
'
)
{
// If state is merged we should update the widget and stop the polling
// If state is merged we should update the widget and stop the polling
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
eventHub
.
$emit
(
'
FetchActionsContent
'
);
eventHub
.
$emit
(
'
FetchActionsContent
'
);
...
@@ -174,11 +174,11 @@ export default {
...
@@ -174,11 +174,11 @@ export default {
// If user checked remove source branch and we didn't remove the branch yet
// If user checked remove source branch and we didn't remove the branch yet
// we should start another polling for source branch remove process
// we should start another polling for source branch remove process
if
(
this
.
removeSourceBranch
&&
res
.
source_branch_exists
)
{
if
(
this
.
removeSourceBranch
&&
data
.
source_branch_exists
)
{
this
.
initiateRemoveSourceBranchPolling
();
this
.
initiateRemoveSourceBranchPolling
();
}
}
}
else
if
(
res
.
merge_error
)
{
}
else
if
(
data
.
merge_error
)
{
eventHub
.
$emit
(
'
FailedToMerge
'
,
res
.
merge_error
);
eventHub
.
$emit
(
'
FailedToMerge
'
,
data
.
merge_error
);
stopPolling
();
stopPolling
();
}
else
{
}
else
{
// MR is not merged yet, continue polling until the state becomes 'merged'
// MR is not merged yet, continue polling until the state becomes 'merged'
...
@@ -199,11 +199,11 @@ export default {
...
@@ -199,11 +199,11 @@ export default {
},
},
handleRemoveBranchPolling
(
continuePolling
,
stopPolling
)
{
handleRemoveBranchPolling
(
continuePolling
,
stopPolling
)
{
this
.
service
.
poll
()
this
.
service
.
poll
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
// If source branch exists then we should continue polling
// If source branch exists then we should continue polling
// because removing a source branch is a background task and takes time
// because removing a source branch is a background task and takes time
if
(
res
.
source_branch_exists
)
{
if
(
data
.
source_branch_exists
)
{
continuePolling
();
continuePolling
();
}
else
{
}
else
{
// Branch is removed. Update widget, stop polling and hide the spinner
// Branch is removed. Update widget, stop polling and hide the spinner
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_wip.js
View file @
254c0754
...
@@ -23,9 +23,9 @@ export default {
...
@@ -23,9 +23,9 @@ export default {
removeWIP
()
{
removeWIP
()
{
this
.
isMakingRequest
=
true
;
this
.
isMakingRequest
=
true
;
this
.
service
.
removeWIP
()
this
.
service
.
removeWIP
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
eventHub
.
$emit
(
'
UpdateWidgetData
'
,
res
);
eventHub
.
$emit
(
'
UpdateWidgetData
'
,
data
);
new
window
.
Flash
(
'
The merge request can now be merged.
'
,
'
notice
'
);
// eslint-disable-line
new
window
.
Flash
(
'
The merge request can now be merged.
'
,
'
notice
'
);
// eslint-disable-line
$
(
'
.merge-request .detail-page-description .title
'
).
text
(
this
.
mr
.
title
);
$
(
'
.merge-request .detail-page-description .title
'
).
text
(
this
.
mr
.
title
);
})
})
...
...
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
254c0754
...
@@ -84,14 +84,14 @@ export default {
...
@@ -84,14 +84,14 @@ export default {
},
},
checkStatus
(
cb
)
{
checkStatus
(
cb
)
{
return
this
.
service
.
checkStatus
()
return
this
.
service
.
checkStatus
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
this
.
handleNotification
(
res
);
this
.
handleNotification
(
data
);
this
.
mr
.
setData
(
res
);
this
.
mr
.
setData
(
data
);
this
.
setFaviconHelper
();
this
.
setFaviconHelper
();
if
(
cb
)
{
if
(
cb
)
{
cb
.
call
(
null
,
res
);
cb
.
call
(
null
,
data
);
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
@@ -124,10 +124,10 @@ export default {
...
@@ -124,10 +124,10 @@ export default {
},
},
fetchDeployments
()
{
fetchDeployments
()
{
return
this
.
service
.
fetchDeployments
()
return
this
.
service
.
fetchDeployments
()
.
then
(
res
=>
res
.
json
()
)
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
.
then
((
data
)
=>
{
if
(
res
.
length
)
{
if
(
data
.
length
)
{
this
.
mr
.
deployments
=
res
;
this
.
mr
.
deployments
=
data
;
}
}
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
@@ -137,9 +137,9 @@ export default {
...
@@ -137,9 +137,9 @@ export default {
fetchActionsContent
()
{
fetchActionsContent
()
{
this
.
service
.
fetchMergeActionsContent
()
this
.
service
.
fetchMergeActionsContent
()
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
if
(
res
.
body
)
{
if
(
res
.
data
)
{
const
el
=
document
.
createElement
(
'
div
'
);
const
el
=
document
.
createElement
(
'
div
'
);
el
.
innerHTML
=
res
.
body
;
el
.
innerHTML
=
res
.
data
;
document
.
body
.
appendChild
(
el
);
document
.
body
.
appendChild
(
el
);
Project
.
initRefSwitcher
();
Project
.
initRefSwitcher
();
}
}
...
...
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
View file @
254c0754
import
Vue
from
'
vue
'
;
import
axios
from
'
../../lib/utils/axios_utils
'
;
import
VueResource
from
'
vue-resource
'
;
Vue
.
use
(
VueResource
);
export
default
class
MRWidgetService
{
export
default
class
MRWidgetService
{
constructor
(
endpoints
)
{
constructor
(
endpoints
)
{
this
.
mergeResource
=
Vue
.
resource
(
endpoints
.
mergePath
);
this
.
endpoints
=
endpoints
;
this
.
mergeCheckResource
=
Vue
.
resource
(
`
${
endpoints
.
statusPath
}
?serializer=widget`
);
this
.
cancelAutoMergeResource
=
Vue
.
resource
(
endpoints
.
cancelAutoMergePath
);
this
.
removeWIPResource
=
Vue
.
resource
(
endpoints
.
removeWIPPath
);
this
.
removeSourceBranchResource
=
Vue
.
resource
(
endpoints
.
sourceBranchPath
);
this
.
deploymentsResource
=
Vue
.
resource
(
endpoints
.
ciEnvironmentsStatusPath
);
this
.
pollResource
=
Vue
.
resource
(
`
${
endpoints
.
statusPath
}
?serializer=basic`
);
this
.
mergeActionsContentResource
=
Vue
.
resource
(
endpoints
.
mergeActionsContentPath
);
}
}
merge
(
data
)
{
merge
(
data
)
{
return
this
.
mergeResource
.
save
(
data
);
return
axios
.
post
(
this
.
endpoints
.
mergePath
,
data
);
}
}
cancelAutomaticMerge
()
{
cancelAutomaticMerge
()
{
return
this
.
cancelAutoMergeResource
.
save
(
);
return
axios
.
post
(
this
.
endpoints
.
cancelAutoMergePath
);
}
}
removeWIP
()
{
removeWIP
()
{
return
this
.
removeWIPResource
.
save
(
);
return
axios
.
post
(
this
.
endpoints
.
removeWIPPath
);
}
}
removeSourceBranch
()
{
removeSourceBranch
()
{
return
this
.
removeSourceBranchResource
.
delete
(
);
return
axios
.
delete
(
this
.
endpoints
.
sourceBranchPath
);
}
}
fetchDeployments
()
{
fetchDeployments
()
{
return
this
.
deploymentsResource
.
get
(
);
return
axios
.
get
(
this
.
endpoints
.
ciEnvironmentsStatusPath
);
}
}
poll
()
{
poll
()
{
return
this
.
pollResource
.
get
(
);
return
axios
.
get
(
`
${
this
.
endpoints
.
statusPath
}
?serializer=basic`
);
}
}
checkStatus
()
{
checkStatus
()
{
return
this
.
mergeCheckResource
.
get
(
);
return
axios
.
get
(
`
${
this
.
endpoints
.
statusPath
}
?serializer=widget`
);
}
}
fetchMergeActionsContent
()
{
fetchMergeActionsContent
()
{
return
this
.
mergeActionsContentResource
.
get
(
);
return
axios
.
get
(
this
.
endpoints
.
mergeActionsContentPath
);
}
}
static
stopEnvironment
(
url
)
{
static
stopEnvironment
(
url
)
{
return
Vue
.
http
.
post
(
url
);
return
axios
.
post
(
url
);
}
}
static
fetchMetrics
(
metricsUrl
)
{
static
fetchMetrics
(
metricsUrl
)
{
return
Vue
.
http
.
get
(
`
${
metricsUrl
}
.json`
);
return
axios
.
get
(
`
${
metricsUrl
}
.json`
);
}
}
}
}
spec/javascripts/vue_mr_widget/components/mr_widget_deployment_spec.js
View file @
254c0754
...
@@ -95,10 +95,8 @@ describe('MRWidgetDeployment', () => {
...
@@ -95,10 +95,8 @@ describe('MRWidgetDeployment', () => {
const
url
=
'
/foo/bar
'
;
const
url
=
'
/foo/bar
'
;
const
returnPromise
=
()
=>
new
Promise
((
resolve
)
=>
{
const
returnPromise
=
()
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
{
return
{
redirect_url
:
url
,
redirect_url
:
url
,
};
},
},
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js
View file @
254c0754
...
@@ -155,9 +155,7 @@ describe('MemoryUsage', () => {
...
@@ -155,9 +155,7 @@ describe('MemoryUsage', () => {
describe
(
'
loadMetrics
'
,
()
=>
{
describe
(
'
loadMetrics
'
,
()
=>
{
const
returnServicePromise
=
()
=>
new
Promise
((
resolve
)
=>
{
const
returnServicePromise
=
()
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
metricsMockData
,
return
metricsMockData
;
},
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
View file @
254c0754
...
@@ -108,9 +108,7 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
...
@@ -108,9 +108,7 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
vm
.
service
,
'
cancelAutomaticMerge
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
cancelAutomaticMerge
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
mrObj
,
return
mrObj
;
},
});
});
}));
}));
...
@@ -129,10 +127,8 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
...
@@ -129,10 +127,8 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
vm
.
service
.
mergeResource
,
'
save
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
.
mergeResource
,
'
save
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
{
return
{
status
:
'
merge_when_pipeline_succeeds
'
,
status
:
'
merge_when_pipeline_succeeds
'
,
};
},
},
});
});
}));
}));
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_merged_spec.js
View file @
254c0754
...
@@ -111,10 +111,8 @@ describe('MRWidgetMerged', () => {
...
@@ -111,10 +111,8 @@ describe('MRWidgetMerged', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
vm
.
service
,
'
removeSourceBranch
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
removeSourceBranch
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
{
return
{
message
:
'
Branch was removed
'
,
message
:
'
Branch was removed
'
,
};
},
},
});
});
}));
}));
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
View file @
254c0754
...
@@ -292,8 +292,8 @@ describe('MRWidgetReadyToMerge', () => {
...
@@ -292,8 +292,8 @@ describe('MRWidgetReadyToMerge', () => {
describe
(
'
handleMergeButtonClick
'
,
()
=>
{
describe
(
'
handleMergeButtonClick
'
,
()
=>
{
const
returnPromise
=
status
=>
new
Promise
((
resolve
)
=>
{
const
returnPromise
=
status
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
{
return
{
status
};
status
,
},
},
});
});
});
});
...
@@ -364,8 +364,9 @@ describe('MRWidgetReadyToMerge', () => {
...
@@ -364,8 +364,9 @@ describe('MRWidgetReadyToMerge', () => {
describe
(
'
handleMergePolling
'
,
()
=>
{
describe
(
'
handleMergePolling
'
,
()
=>
{
const
returnPromise
=
state
=>
new
Promise
((
resolve
)
=>
{
const
returnPromise
=
state
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
{
return
{
state
,
source_branch_exists
:
true
};
state
,
source_branch_exists
:
true
,
},
},
});
});
});
});
...
@@ -422,8 +423,8 @@ describe('MRWidgetReadyToMerge', () => {
...
@@ -422,8 +423,8 @@ describe('MRWidgetReadyToMerge', () => {
describe
(
'
handleRemoveBranchPolling
'
,
()
=>
{
describe
(
'
handleRemoveBranchPolling
'
,
()
=>
{
const
returnPromise
=
state
=>
new
Promise
((
resolve
)
=>
{
const
returnPromise
=
state
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
{
return
{
source_branch_exists
:
state
};
source_branch_exists
:
state
,
},
},
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_wip_spec.js
View file @
254c0754
...
@@ -50,9 +50,7 @@ describe('MRWidgetWIP', () => {
...
@@ -50,9 +50,7 @@ describe('MRWidgetWIP', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
vm
.
service
,
'
removeWIP
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
spyOn
(
vm
.
service
,
'
removeWIP
'
).
and
.
returnValue
(
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
:
mrObj
,
return
mrObj
;
},
});
});
}));
}));
...
...
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
View file @
254c0754
...
@@ -8,10 +8,7 @@ import mountComponent from '../helpers/vue_mount_component_helper';
...
@@ -8,10 +8,7 @@ import mountComponent from '../helpers/vue_mount_component_helper';
const
returnPromise
=
data
=>
new
Promise
((
resolve
)
=>
{
const
returnPromise
=
data
=>
new
Promise
((
resolve
)
=>
{
resolve
({
resolve
({
json
()
{
data
,
return
data
;
},
body
:
data
,
});
});
});
});
...
...
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