Commit 75f9ccc3 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add minimal backend changes to expose blob_path [ci skip]

parent 43371992
......@@ -195,11 +195,19 @@ class MergeRequestEntity < IssuableEntity
path: 'codeclimate.json')
end
expose :head_blob_path, if: -> (mr, _) { mr.head_pipeline_sha } do |merge_request|
project_blob_path(merge_request.project, merge_request.head_pipeline_sha)
end
expose :base_path, if: -> (mr, _) { can?(current_user, :read_build, mr.base_codeclimate_artifact) } do |merge_request|
raw_project_build_artifacts_url(merge_request.target_project,
merge_request.base_codeclimate_artifact,
path: 'codeclimate.json')
end
expose :base_blob_path, if: -> (mr, _) { mr.base_pipeline_sha } do |merge_request|
project_blob_path(merge_request.project, merge_request.base_pipeline_sha)
end
end
private
......
......@@ -107,7 +107,7 @@ export default {
},
created() {
const { head_path, base_path } = this.mr.codeclimate;
const { head_path, head_blob_path, base_path, base_blob_path } = this.mr.codeclimate;
this.isLoading = true;
......
......@@ -57,7 +57,10 @@ export default class MergeRequestStore extends CEMergeRequestStore {
}
compareCodeclimateMetrics(headIssues, baseIssues) {
// newIssues link to head_blob_path+"/"+filename+"#L"+begin
this.codeclimateMetrics.newIssues = this.filterByFingerprint(headIssues, baseIssues);
// resolvedIssues link to base_blob_path+"/"+filename+"#L"+begin
this.codeclimateMetrics.resolvedIssues = this.filterByFingerprint(baseIssues, headIssues);
}
......
......@@ -11,6 +11,8 @@ module EE
delegate :codeclimate_artifact, to: :head_pipeline, prefix: :head, allow_nil: true
delegate :codeclimate_artifact, to: :base_pipeline, prefix: :base, allow_nil: true
delegate :sha, to: :head_pipeline, prefix: :head_pipeline, allow_nil: true
delegate :sha, to: :base_pipeline, prefix: :base_pipeline, allow_nil: true
end
def rebase_dir_path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment