Commit 10265281 authored by Piotr Stankowski's avatar Piotr Stankowski

Fix links in code quality widget

Links to code in code quality widget were not working correctly due to
couple variables being removed in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55708
This commit reintroduces those variables. This change also fixes showing
warning about base pipeline codequality artifact not being found.

Changelog: fixed
parent 9a2d5688
...@@ -12,11 +12,24 @@ export default { ...@@ -12,11 +12,24 @@ export default {
ReportSection, ReportSection,
}, },
props: { props: {
headPath: {
type: String,
required: true,
},
headBlobPath: {
type: String,
required: true,
},
basePath: { basePath: {
type: String, type: String,
required: false, required: false,
default: null, default: null,
}, },
baseBlobPath: {
type: String,
required: false,
default: null,
},
codequalityReportsPath: { codequalityReportsPath: {
type: String, type: String,
required: false, required: false,
...@@ -40,6 +53,9 @@ export default { ...@@ -40,6 +53,9 @@ export default {
created() { created() {
this.setPaths({ this.setPaths({
basePath: this.basePath, basePath: this.basePath,
headPath: this.headPath,
baseBlobPath: this.baseBlobPath,
headBlobPath: this.headBlobPath,
reportsPath: this.codequalityReportsPath, reportsPath: this.codequalityReportsPath,
helpPath: this.codequalityHelpPath, helpPath: this.codequalityHelpPath,
}); });
......
...@@ -3,6 +3,9 @@ import * as types from './mutation_types'; ...@@ -3,6 +3,9 @@ import * as types from './mutation_types';
export default { export default {
[types.SET_PATHS](state, paths) { [types.SET_PATHS](state, paths) {
state.basePath = paths.basePath; state.basePath = paths.basePath;
state.headPath = paths.headPath;
state.baseBlobPath = paths.baseBlobPath;
state.headBlobPath = paths.headBlobPath;
state.reportsPath = paths.reportsPath; state.reportsPath = paths.reportsPath;
state.helpPath = paths.helpPath; state.helpPath = paths.helpPath;
}, },
......
...@@ -489,6 +489,9 @@ export default { ...@@ -489,6 +489,9 @@ export default {
<grouped-codequality-reports-app <grouped-codequality-reports-app
v-if="shouldRenderCodeQuality" v-if="shouldRenderCodeQuality"
:base-path="mr.codeclimate.base_path" :base-path="mr.codeclimate.base_path"
:head-path="mr.codeclimate.head_path"
:head-blob-path="mr.headBlobPath"
:base-blob-path="mr.baseBlobPath"
:codequality-reports-path="mr.codequalityReportsPath" :codequality-reports-path="mr.codequalityReportsPath"
:codequality-help-path="mr.codequalityHelpPath" :codequality-help-path="mr.codequalityHelpPath"
/> />
......
...@@ -305,6 +305,9 @@ export default { ...@@ -305,6 +305,9 @@ export default {
<grouped-codequality-reports-app <grouped-codequality-reports-app
v-if="shouldRenderCodeQuality" v-if="shouldRenderCodeQuality"
:base-path="mr.codeclimate.base_path" :base-path="mr.codeclimate.base_path"
:head-path="mr.codeclimate.head_path"
:head-blob-path="mr.headBlobPath"
:base-blob-path="mr.baseBlobPath"
:codequality-reports-path="mr.codequalityReportsPath" :codequality-reports-path="mr.codequalityReportsPath"
:codequality-help-path="mr.codequalityHelpPath" :codequality-help-path="mr.codequalityHelpPath"
/> />
......
...@@ -20,6 +20,9 @@ describe('Codequality Reports actions', () => { ...@@ -20,6 +20,9 @@ describe('Codequality Reports actions', () => {
it('should commit SET_PATHS mutation', (done) => { it('should commit SET_PATHS mutation', (done) => {
const paths = { const paths = {
basePath: 'basePath', basePath: 'basePath',
headPath: 'headPath',
baseBlobPath: 'baseBlobPath',
headBlobPath: 'headBlobPath',
reportsPath: 'reportsPath', reportsPath: 'reportsPath',
helpPath: 'codequalityHelpPath', helpPath: 'codequalityHelpPath',
}; };
......
...@@ -13,16 +13,25 @@ describe('Codequality Reports mutations', () => { ...@@ -13,16 +13,25 @@ describe('Codequality Reports mutations', () => {
describe('SET_PATHS', () => { describe('SET_PATHS', () => {
it('sets paths to given values', () => { it('sets paths to given values', () => {
const basePath = 'base.json'; const basePath = 'base.json';
const headPath = 'head.json';
const baseBlobPath = 'base/blob/path/';
const headBlobPath = 'head/blob/path/';
const reportsPath = 'reports.json'; const reportsPath = 'reports.json';
const helpPath = 'help.html'; const helpPath = 'help.html';
mutations.SET_PATHS(localState, { mutations.SET_PATHS(localState, {
basePath, basePath,
headPath,
baseBlobPath,
headBlobPath,
reportsPath, reportsPath,
helpPath, helpPath,
}); });
expect(localState.basePath).toEqual(basePath); expect(localState.basePath).toEqual(basePath);
expect(localState.headPath).toEqual(headPath);
expect(localState.baseBlobPath).toEqual(baseBlobPath);
expect(localState.headBlobPath).toEqual(headBlobPath);
expect(localState.reportsPath).toEqual(reportsPath); expect(localState.reportsPath).toEqual(reportsPath);
expect(localState.helpPath).toEqual(helpPath); expect(localState.helpPath).toEqual(helpPath);
}); });
......
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