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
f81e1acb
Commit
f81e1acb
authored
May 29, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves codeclimate code into ee folder
parent
801a5093
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
50 additions
and
47 deletions
+50
-47
app/assets/javascripts/vue_merge_request_widget/dependencies.js
...sets/javascripts/vue_merge_request_widget/dependencies.js
+0
-1
app/assets/javascripts/vue_merge_request_widget/ee/components/mr_widget_code_quality.vue
...e_request_widget/ee/components/mr_widget_code_quality.vue
+2
-2
app/assets/javascripts/vue_merge_request_widget/ee/components/mr_widget_code_quality_issues.vue
...st_widget/ee/components/mr_widget_code_quality_issues.vue
+0
-0
app/assets/javascripts/vue_merge_request_widget/ee/mr_widget_options.js
...ascripts/vue_merge_request_widget/ee/mr_widget_options.js
+11
-0
app/assets/javascripts/vue_merge_request_widget/ee/services/mr_widget_service.js
...vue_merge_request_widget/ee/services/mr_widget_service.js
+4
-0
app/assets/javascripts/vue_merge_request_widget/ee/stores/mr_widget_store.js
...pts/vue_merge_request_widget/ee/stores/mr_widget_store.js
+30
-0
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+0
-11
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
...ts/vue_merge_request_widget/services/mr_widget_service.js
+0
-4
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+0
-26
spec/javascripts/vue_mr_widget/components/mr_widget_code_quality_issues_spec.js
...r_widget/components/mr_widget_code_quality_issues_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/mr_widget_code_quality_spec.js
...s/vue_mr_widget/components/mr_widget_code_quality_spec.js
+1
-1
spec/javascripts/vue_mr_widget/mock_data.js
spec/javascripts/vue_mr_widget/mock_data.js
+1
-1
No files found.
app/assets/javascripts/vue_merge_request_widget/dependencies.js
View file @
f81e1acb
...
...
@@ -16,7 +16,6 @@ export { default as WidgetMergeHelp } from './components/mr_widget_merge_help';
export
{
default
as
WidgetPipeline
}
from
'
./components/mr_widget_pipeline
'
;
export
{
default
as
WidgetDeployment
}
from
'
./components/mr_widget_deployment
'
;
export
{
default
as
WidgetRelatedLinks
}
from
'
./components/mr_widget_related_links
'
;
export
{
default
as
WidgetCodeQuality
}
from
'
./components/mr_widget_code_quality.vue
'
;
export
{
default
as
MergedState
}
from
'
./components/states/mr_widget_merged
'
;
export
{
default
as
FailedToMerge
}
from
'
./components/states/mr_widget_failed_to_merge
'
;
export
{
default
as
ClosedState
}
from
'
./components/states/mr_widget_closed
'
;
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_code_quality.vue
→
app/assets/javascripts/vue_merge_request_widget/
ee/
components/mr_widget_code_quality.vue
View file @
f81e1acb
...
...
@@ -2,8 +2,8 @@
import
successIcon
from
'
icons/_icon_status_success.svg
'
;
import
errorIcon
from
'
icons/_icon_status_failed.svg
'
;
import
issuesBlock
from
'
./mr_widget_code_quality_issues.vue
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
'
../../lib/utils/text_utility
'
;
import
loadingIcon
from
'
../../
../
vue_shared/components/loading_icon.vue
'
;
import
'
../../
../
lib/utils/text_utility
'
;
export
default
{
name
:
'
MRWidgetCodeQuality
'
,
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_code_quality_issues.vue
→
app/assets/javascripts/vue_merge_request_widget/
ee/
components/mr_widget_code_quality_issues.vue
View file @
f81e1acb
File moved
app/assets/javascripts/vue_merge_request_widget/ee/mr_widget_options.js
View file @
f81e1acb
...
...
@@ -2,6 +2,7 @@ import CEWidgetOptions from '../mr_widget_options';
import
WidgetApprovals
from
'
./components/approvals/mr_widget_approvals
'
;
import
GeoSecondaryNode
from
'
./components/states/mr_widget_secondary_geo_node
'
;
import
RebaseState
from
'
./components/states/mr_widget_rebase
'
;
import
WidgetCodeQuality
from
'
./components/mr_widget_code_quality.vue
'
;
export
default
{
extends
:
CEWidgetOptions
,
...
...
@@ -9,11 +10,16 @@ export default {
'
mr-widget-approvals
'
:
WidgetApprovals
,
'
mr-widget-geo-secondary-node
'
:
GeoSecondaryNode
,
'
mr-widget-rebase
'
:
RebaseState
,
'
mr-widget-code-quality
'
:
WidgetCodeQuality
,
},
computed
:
{
shouldRenderApprovals
()
{
return
this
.
mr
.
approvalsRequired
;
},
shouldRenderCodeQuality
()
{
const
{
codeclimate
}
=
this
.
mr
;
return
codeclimate
&&
codeclimate
.
head_path
&&
codeclimate
.
base_path
;
},
},
template
:
`
<div class="mr-state-widget prepend-top-default">
...
...
@@ -29,6 +35,11 @@ export default {
v-if="mr.approvalsRequired"
:mr="mr"
:service="service" />
<mr-widget-code-quality
v-if="shouldRenderCodeQuality"
:mr="mr"
:service="service"
/>
<component
:is="componentName"
:mr="mr"
...
...
app/assets/javascripts/vue_merge_request_widget/ee/services/mr_widget_service.js
View file @
f81e1acb
...
...
@@ -28,4 +28,8 @@ export default class MRWidgetService extends CEWidgetService {
rebase
()
{
return
this
.
rebaseResource
.
save
();
}
fetchCodeclimate
(
endpoint
)
{
// eslint-disable-line
return
Vue
.
http
.
get
(
endpoint
);
}
}
app/assets/javascripts/vue_merge_request_widget/ee/stores/mr_widget_store.js
View file @
f81e1acb
...
...
@@ -6,6 +6,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this
.
initSquashBeforeMerge
(
data
);
this
.
initRebase
(
data
);
this
.
initApprovals
(
data
);
this
.
initCodeclimate
(
data
);
super
.
setData
(
data
);
}
...
...
@@ -43,4 +44,33 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this
.
isApproved
=
!
this
.
approvalsLeft
||
false
;
this
.
preventMerge
=
this
.
approvalsRequired
&&
this
.
approvalsLeft
;
}
initCodeclimate
(
data
)
{
this
.
codeclimate
=
data
.
codeclimate
;
this
.
codeclimateMetrics
=
{
headIssues
:
[],
baseIssues
:
[],
newIssues
:
[],
resolvedIssues
:
[],
};
}
setCodeclimateHeadMetrics
(
data
)
{
this
.
codeclimateMetrics
.
headIssues
=
data
;
}
setCodeclimateBaseMetrics
(
data
)
{
this
.
codeclimateMetrics
.
baseIssues
=
data
;
}
compareCodeclimateMetrics
()
{
const
{
headIssues
,
baseIssues
}
=
this
.
codeclimateMetrics
;
this
.
codeclimateMetrics
.
newIssues
=
this
.
filterByFingerprint
(
headIssues
,
baseIssues
);
this
.
codeclimateMetrics
.
resolvedIssues
=
this
.
filterByFingerprint
(
baseIssues
,
headIssues
);
}
filterByFingerprint
(
firstArray
,
secondArray
)
{
// eslint-disable-line
return
firstArray
.
filter
(
item
=>
!
secondArray
.
find
(
el
=>
el
.
fingerprint
===
item
.
fingerprint
));
}
}
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
f81e1acb
...
...
@@ -6,7 +6,6 @@ import {
WidgetPipeline
,
WidgetDeployment
,
WidgetRelatedLinks
,
WidgetCodeQuality
,
MergedState
,
ClosedState
,
LockedState
,
...
...
@@ -59,10 +58,6 @@ export default {
shouldRenderDeployments
()
{
return
this
.
mr
.
deployments
.
length
;
},
shouldRenderCodeQuality
()
{
const
{
codeclimate
}
=
this
.
mr
;
return
codeclimate
&&
codeclimate
.
head_path
&&
codeclimate
.
base_path
;
},
},
methods
:
{
createService
(
store
)
{
...
...
@@ -215,7 +210,6 @@ export default {
'
mr-widget-pipeline-failed
'
:
PipelineFailedState
,
'
mr-widget-merge-when-pipeline-succeeds
'
:
MergeWhenPipelineSucceedsState
,
'
mr-widget-auto-merge-failed
'
:
AutoMergeFailed
,
'
mr-widget-code-quality
'
:
WidgetCodeQuality
,
},
template
:
`
<div class="mr-state-widget prepend-top-default">
...
...
@@ -227,11 +221,6 @@ export default {
v-if="shouldRenderDeployments"
:mr="mr"
:service="service" />
<mr-widget-code-quality
v-if="shouldRenderCodeQuality"
:mr="mr"
:service="service"
/>
<component
:is="componentName"
:mr="mr"
...
...
app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
View file @
f81e1acb
...
...
@@ -47,10 +47,6 @@ export default class MRWidgetService {
return
this
.
mergeActionsContentResource
.
get
();
}
fetchCodeclimate
(
endpoint
)
{
// eslint-disable-line
return
Vue
.
http
.
get
(
endpoint
);
}
static
stopEnvironment
(
url
)
{
return
Vue
.
http
.
post
(
url
);
}
...
...
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
f81e1acb
...
...
@@ -5,13 +5,6 @@ export default class MergeRequestStore {
constructor
(
data
)
{
this
.
sha
=
data
.
diff_head_sha
;
this
.
codeclimate
=
data
.
codeclimate
;
this
.
codeclimateMetrics
=
{
headIssues
:
[],
baseIssues
:
[],
newIssues
:
[],
resolvedIssues
:
[],
};
this
.
setData
(
data
);
}
...
...
@@ -121,25 +114,6 @@ export default class MergeRequestStore {
}
}
setCodeclimateHeadMetrics
(
data
)
{
this
.
codeclimateMetrics
.
headIssues
=
data
;
}
setCodeclimateBaseMetrics
(
data
)
{
this
.
codeclimateMetrics
.
baseIssues
=
data
;
}
compareCodeclimateMetrics
()
{
const
{
headIssues
,
baseIssues
}
=
this
.
codeclimateMetrics
;
this
.
codeclimateMetrics
.
newIssues
=
this
.
filterByFingerprint
(
headIssues
,
baseIssues
);
this
.
codeclimateMetrics
.
resolvedIssues
=
this
.
filterByFingerprint
(
baseIssues
,
headIssues
);
}
filterByFingerprint
(
firstArray
,
secondArray
)
{
// eslint-disable-line
return
firstArray
.
filter
(
item
=>
!
secondArray
.
find
(
el
=>
el
.
fingerprint
===
item
.
fingerprint
));
}
static
getAuthorObject
(
event
)
{
if
(
!
event
)
{
return
{};
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_code_quality_issues_spec.js
View file @
f81e1acb
import
Vue
from
'
vue
'
;
import
mrWidgetCodeQualityIssues
from
'
~/vue_merge_request_widget/components/mr_widget_code_quality_issues.vue
'
;
import
mrWidgetCodeQualityIssues
from
'
~/vue_merge_request_widget/
ee/
components/mr_widget_code_quality_issues.vue
'
;
describe
(
'
Merge Request Code Quality Issues
'
,
()
=>
{
let
vm
;
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_code_quality_spec.js
View file @
f81e1acb
import
Vue
from
'
vue
'
;
import
mrWidgetCodeQuality
from
'
~/vue_merge_request_widget/components/mr_widget_code_quality.vue
'
;
import
mrWidgetCodeQuality
from
'
~/vue_merge_request_widget/
ee/
components/mr_widget_code_quality.vue
'
;
import
Store
from
'
~/vue_merge_request_widget/stores/mr_widget_store
'
;
import
Service
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
mockData
,
{
baseIssues
,
headIssues
}
from
'
../mock_data
'
;
...
...
spec/javascripts/vue_mr_widget/mock_data.js
View file @
f81e1acb
...
...
@@ -215,7 +215,7 @@ export default {
"
head_path
"
:
"
head.json
"
,
"
base_path
"
:
"
base.json
"
}
}
}
;
export
const
headIssues
=
[
{
...
...
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