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
c8cfa325
Commit
c8cfa325
authored
May 24, 2019
by
Sarah Groff Hennigh-Palermo
Committed by
Phil Hughes
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Visual Review Toolbar to post to MRs
parent
5d49646c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
20 deletions
+22
-20
app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
...cripts/vue_merge_request_widget/components/deployment.vue
+1
-1
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
...equest_widget/components/mr_widget_pipeline_container.vue
+1
-1
ee/app/assets/javascripts/vue_merge_request_widget/components/visual_review_app_link.vue
...erge_request_widget/components/visual_review_app_link.vue
+1
-1
ee/spec/frontend/vue_mr_widget/components/visual_review_app_spec.js
...ontend/vue_mr_widget/components/visual_review_app_spec.js
+3
-3
public/visual-review-toolbar.js
public/visual-review-toolbar.js
+16
-14
No files found.
app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
View file @
c8cfa325
...
@@ -49,7 +49,7 @@ export default {
...
@@ -49,7 +49,7 @@ export default {
required
:
false
,
required
:
false
,
default
:
()
=>
({
default
:
()
=>
({
sourceProjectId
:
''
,
sourceProjectId
:
''
,
issue
Id
:
''
,
mergeRequest
Id
:
''
,
appUrl
:
''
,
appUrl
:
''
,
}),
}),
},
},
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
View file @
c8cfa325
...
@@ -48,7 +48,7 @@ export default {
...
@@ -48,7 +48,7 @@ export default {
visualReviewAppMeta
()
{
visualReviewAppMeta
()
{
return
{
return
{
appUrl
:
this
.
mr
.
appUrl
,
appUrl
:
this
.
mr
.
appUrl
,
issue
Id
:
this
.
mr
.
iid
,
mergeRequest
Id
:
this
.
mr
.
iid
,
sourceProjectId
:
this
.
mr
.
sourceProjectId
,
sourceProjectId
:
this
.
mr
.
sourceProjectId
,
};
};
},
},
...
...
ee/app/assets/javascripts/vue_merge_request_widget/components/visual_review_app_link.vue
View file @
c8cfa325
...
@@ -37,7 +37,7 @@ export default {
...
@@ -37,7 +37,7 @@ export default {
return
{
return
{
script
:
`<script defer
script
:
`<script defer
data-project-id='
${
this
.
appMetadata
.
sourceProjectId
}
'
data-project-id='
${
this
.
appMetadata
.
sourceProjectId
}
'
data-
discussion-id='
${
this
.
appMetadata
.
issue
Id
}
'
data-
merge-request-id='
${
this
.
appMetadata
.
mergeRequest
Id
}
'
data-mr-url='
${
this
.
appMetadata
.
appUrl
}
'
data-mr-url='
${
this
.
appMetadata
.
appUrl
}
'
id='review-app-toolbar-script'
id='review-app-toolbar-script'
src='https://gitlab.com/public/visual-review-toolbar.js'
src='https://gitlab.com/public/visual-review-toolbar.js'
...
...
ee/spec/frontend/vue_mr_widget/components/visual_review_app_spec.js
View file @
c8cfa325
...
@@ -13,7 +13,7 @@ describe('Visual Review App Link', () => {
...
@@ -13,7 +13,7 @@ describe('Visual Review App Link', () => {
propsData
=
{
propsData
=
{
cssClass
:
'
button cool-button best-button
'
,
cssClass
:
'
button cool-button best-button
'
,
appMetadata
:
{
appMetadata
:
{
issue
Id
:
1
,
mergeRequest
Id
:
1
,
sourceProjectId
:
20
,
sourceProjectId
:
20
,
appUrl
:
'
http://gitlab.example.com
'
,
appUrl
:
'
http://gitlab.example.com
'
,
},
},
...
@@ -58,9 +58,9 @@ describe('Visual Review App Link', () => {
...
@@ -58,9 +58,9 @@ describe('Visual Review App Link', () => {
);
);
});
});
it
(
'
with expected
discussion I
d
'
,
()
=>
{
it
(
'
with expected
merge request i
d
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlModal
).
text
()).
toEqual
(
expect
(
wrapper
.
find
(
GlModal
).
text
()).
toEqual
(
expect
.
stringContaining
(
`data-
discussion-id='
${
propsData
.
appMetadata
.
issue
Id
}
'`
),
expect
.
stringContaining
(
`data-
merge-request-id='
${
propsData
.
appMetadata
.
mergeRequest
Id
}
'`
),
);
);
});
});
...
...
public/visual-review-toolbar.js
View file @
c8cfa325
...
@@ -374,12 +374,12 @@ function clearNote (inputId) {
...
@@ -374,12 +374,12 @@ function clearNote (inputId) {
}
}
}
}
function
confirmAndClear
(
discussion
Id
)
{
function
confirmAndClear
(
mergeRequest
Id
)
{
const
commentButton
=
document
.
getElementById
(
'
gitlab-comment-button
'
);
const
commentButton
=
document
.
getElementById
(
'
gitlab-comment-button
'
);
const
note
=
document
.
getElementById
(
'
gitlab-validation-note
'
);
const
note
=
document
.
getElementById
(
'
gitlab-validation-note
'
);
commentButton
.
innerText
=
'
Feedback sent
'
;
commentButton
.
innerText
=
'
Feedback sent
'
;
note
.
innerText
=
`Your comment was successfully posted to
issue #
${
discussion
Id
}
`
;
note
.
innerText
=
`Your comment was successfully posted to
merge request #
${
mergeRequest
Id
}
`
;
setTimeout
(
resetCommentButton
,
1000
);
setTimeout
(
resetCommentButton
,
1000
);
}
}
...
@@ -412,7 +412,7 @@ function getProjectDetails () {
...
@@ -412,7 +412,7 @@ function getProjectDetails () {
const
browser
=
getBrowserId
(
userAgent
);
const
browser
=
getBrowserId
(
userAgent
);
const
scriptEl
=
document
.
getElementById
(
'
review-app-toolbar-script
'
)
const
scriptEl
=
document
.
getElementById
(
'
review-app-toolbar-script
'
)
const
{
projectId
,
discussion
Id
,
mrUrl
}
=
scriptEl
.
dataset
;
const
{
projectId
,
mergeRequest
Id
,
mrUrl
}
=
scriptEl
.
dataset
;
return
{
return
{
href
,
href
,
...
@@ -422,7 +422,7 @@ function getProjectDetails () {
...
@@ -422,7 +422,7 @@ function getProjectDetails () {
innerWidth
,
innerWidth
,
innerHeight
,
innerHeight
,
projectId
,
projectId
,
discussion
Id
,
mergeRequest
Id
,
mrUrl
,
mrUrl
,
};
};
}
}
...
@@ -449,7 +449,7 @@ function postComment ({
...
@@ -449,7 +449,7 @@ function postComment ({
innerWidth
,
innerWidth
,
innerHeight
,
innerHeight
,
projectId
,
projectId
,
discussion
Id
,
mergeRequest
Id
,
mrUrl
,
mrUrl
,
})
{
})
{
// Clear any old errors
// Clear any old errors
...
@@ -466,18 +466,20 @@ function postComment ({
...
@@ -466,18 +466,20 @@ function postComment ({
}
}
const
detailText
=
`
const
detailText
=
`
<details>
\n
<summary>Metadata</summary>
<details>
Posted from
${
href
}
|
${
platform
}
|
${
browser
}
|
${
innerWidth
}
x
${
innerHeight
}
.
<summary>Metadata</summary>
<br /><br />
Posted from
${
href
}
|
${
platform
}
|
${
browser
}
|
${
innerWidth
}
x
${
innerHeight
}
.
*User agent:
${
userAgent
}
*
<br /><br />
</details>
<em>User agent:
${
userAgent
}
</em>
</details>
`
;
`
;
const
url
=
`
const
url
=
`
${
mrUrl
}
/api/v4/projects/
${
projectId
}
/
issues/
${
discussion
Id
}
/discussions`
;
${
mrUrl
}
/api/v4/projects/
${
projectId
}
/
merge_requests/
${
mergeRequest
Id
}
/discussions`
;
const
body
=
`
${
commentText
}${
detailText
}
`
;
const
body
=
`
${
commentText
}
${
detailText
}
`
;
fetch
(
url
,
{
fetch
(
url
,
{
method
:
'
POST
'
,
method
:
'
POST
'
,
...
@@ -489,7 +491,7 @@ function postComment ({
...
@@ -489,7 +491,7 @@ function postComment ({
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
confirmAndClear
(
discussion
Id
);
confirmAndClear
(
mergeRequest
Id
);
return
;
return
;
}
}
...
...
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