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
8f3fe6b1
Commit
8f3fe6b1
authored
Sep 29, 2017
by
Filipa Lacerda
Committed by
Phil Hughes
Sep 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes code quality requests in parallel
parent
9363a476
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
53 deletions
+11
-53
ee/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_code_quality.vue
...erge_request_widget/components/mr_widget_code_quality.vue
+9
-12
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+1
-13
spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
.../javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
+1
-28
No files found.
ee/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_code_quality.vue
View file @
8f3fe6b1
...
@@ -111,20 +111,17 @@ export default {
...
@@ -111,20 +111,17 @@ export default {
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
Promise
.
all
([
this
.
service
.
fetchCodeclimate
(
head_path
)
this
.
service
.
fetchCodeclimate
(
head_path
)
.
then
(
resp
=>
resp
.
json
())
.
then
(
resp
=>
resp
.
json
()),
.
then
((
data
)
=>
{
this
.
mr
.
setCodeclimateHeadMetrics
(
data
);
this
.
service
.
fetchCodeclimate
(
base_path
)
this
.
service
.
fetchCodeclimate
(
base_path
)
.
then
(
response
=>
response
.
json
())
.
then
(
resp
=>
resp
.
json
()),
.
then
(
baseData
=>
this
.
mr
.
setCodeclimateBaseMetrics
(
baseData
)
)
]
)
.
then
(()
=>
this
.
mr
.
compareCodeclimateMetrics
())
.
then
((
values
)
=>
{
.
then
(()
=>
{
this
.
mr
.
compareCodeclimateMetrics
(
values
[
0
],
values
[
1
]);
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
})
})
.
catch
(()
=>
this
.
handleError
());
.
catch
(()
=>
this
.
handleError
());
})
.
catch
(()
=>
this
.
handleError
());
},
},
};
};
</
script
>
</
script
>
...
...
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
8f3fe6b1
...
@@ -53,24 +53,12 @@ export default class MergeRequestStore extends CEMergeRequestStore {
...
@@ -53,24 +53,12 @@ export default class MergeRequestStore extends CEMergeRequestStore {
initCodeclimate
(
data
)
{
initCodeclimate
(
data
)
{
this
.
codeclimate
=
data
.
codeclimate
;
this
.
codeclimate
=
data
.
codeclimate
;
this
.
codeclimateMetrics
=
{
this
.
codeclimateMetrics
=
{
headIssues
:
[],
baseIssues
:
[],
newIssues
:
[],
newIssues
:
[],
resolvedIssues
:
[],
resolvedIssues
:
[],
};
};
}
}
setCodeclimateHeadMetrics
(
data
)
{
compareCodeclimateMetrics
(
headIssues
,
baseIssues
)
{
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
.
newIssues
=
this
.
filterByFingerprint
(
headIssues
,
baseIssues
);
this
.
codeclimateMetrics
.
resolvedIssues
=
this
.
filterByFingerprint
(
baseIssues
,
headIssues
);
this
.
codeclimateMetrics
.
resolvedIssues
=
this
.
filterByFingerprint
(
baseIssues
,
headIssues
);
}
}
...
...
spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
View file @
8f3fe6b1
...
@@ -54,36 +54,9 @@ describe('MergeRequestStore', () => {
...
@@ -54,36 +54,9 @@ describe('MergeRequestStore', () => {
});
});
});
});
describe
(
'
setCodeclimateHeadMetrics
'
,
()
=>
{
it
(
'
should set defaults
'
,
()
=>
{
expect
(
store
.
codeclimate
).
toEqual
(
mockData
.
codeclimate
);
expect
(
store
.
codeclimateMetrics
).
toEqual
({
headIssues
:
[],
baseIssues
:
[],
newIssues
:
[],
resolvedIssues
:
[],
});
});
it
(
'
should set the provided head metrics
'
,
()
=>
{
store
.
setCodeclimateHeadMetrics
(
headIssues
);
expect
(
store
.
codeclimateMetrics
.
headIssues
).
toEqual
(
headIssues
);
});
});
describe
(
'
setCodeclimateBaseMetrics
'
,
()
=>
{
it
(
'
should set the provided base metrics
'
,
()
=>
{
store
.
setCodeclimateBaseMetrics
(
baseIssues
);
expect
(
store
.
codeclimateMetrics
.
baseIssues
).
toEqual
(
baseIssues
);
});
});
describe
(
'
compareCodeclimateMetrics
'
,
()
=>
{
describe
(
'
compareCodeclimateMetrics
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
.
setCodeclimateHeadMetrics
(
headIssues
);
store
.
compareCodeclimateMetrics
(
headIssues
,
baseIssues
);
store
.
setCodeclimateBaseMetrics
(
baseIssues
);
store
.
compareCodeclimateMetrics
();
});
});
it
(
'
should return the new issues
'
,
()
=>
{
it
(
'
should return the new issues
'
,
()
=>
{
...
...
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