Commit 95185504 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ek-fix-missing-namespace-in-vsa-stage=item-path' into 'master'

Include namespace in group VSA stage table display

See merge request gitlab-org/gitlab!78245
parents 6963a296 095f3f35
...@@ -32,6 +32,9 @@ const WORKFLOW_COLUMN_TITLES = { ...@@ -32,6 +32,9 @@ const WORKFLOW_COLUMN_TITLES = {
mergeRequests: { ...DEFAULT_WORKFLOW_TITLE_PROPERTIES, label: __('Merge requests') }, mergeRequests: { ...DEFAULT_WORKFLOW_TITLE_PROPERTIES, label: __('Merge requests') },
}; };
const fullProjectPath = ({ namespaceFullPath = '', projectPath }) =>
namespaceFullPath.split('/').length > 1 ? `${namespaceFullPath}/${projectPath}` : projectPath;
export default { export default {
name: 'StageTable', name: 'StageTable',
components: { components: {
...@@ -149,8 +152,10 @@ export default { ...@@ -149,8 +152,10 @@ export default {
isMrLink(url = '') { isMrLink(url = '') {
return url.includes('/merge_request'); return url.includes('/merge_request');
}, },
itemId({ iid, projectPath }, separator = '#') { itemId({ iid, projectPath, namespaceFullPath = '' }, separator = '#') {
const prefix = this.includeProjectName ? projectPath : ''; const prefix = this.includeProjectName
? fullProjectPath({ namespaceFullPath, projectPath })
: '';
return `${prefix}${separator}${iid}`; return `${prefix}${separator}${iid}`;
}, },
itemDisplayName(item) { itemDisplayName(item) {
......
...@@ -13,6 +13,10 @@ class AnalyticsBuildEntity < Grape::Entity ...@@ -13,6 +13,10 @@ class AnalyticsBuildEntity < Grape::Entity
build.project.path build.project.path
end end
expose :namespace_full_path do |build|
build.project.namespace.full_path
end
expose :started_at, as: :date do |build| expose :started_at, as: :date do |build|
interval_in_words(build[:started_at]) interval_in_words(build[:started_at])
end end
......
...@@ -10,6 +10,10 @@ class AnalyticsIssueEntity < Grape::Entity ...@@ -10,6 +10,10 @@ class AnalyticsIssueEntity < Grape::Entity
object[:project_path] object[:project_path]
end end
expose :namespace_full_path do |object|
object[:namespace_path]
end
expose :iid do |object| expose :iid do |object|
object[:iid].to_s object[:iid].to_s
end end
......
...@@ -198,6 +198,7 @@ describe('StageTable', () => { ...@@ -198,6 +198,7 @@ describe('StageTable', () => {
}); });
describe('includeProjectName set', () => { describe('includeProjectName set', () => {
const fakenamespace = 'some/fake/path';
beforeEach(() => { beforeEach(() => {
wrapper = createComponent({ includeProjectName: true }); wrapper = createComponent({ includeProjectName: true });
}); });
...@@ -210,6 +211,37 @@ describe('StageTable', () => { ...@@ -210,6 +211,37 @@ describe('StageTable', () => {
expect(links[index]).toBe(`${ev.projectPath}#${ev.iid}`); expect(links[index]).toBe(`${ev.projectPath}#${ev.iid}`);
}); });
}); });
describe.each`
namespaceFullPath | hasFullPath
${'fake'} | ${false}
${fakenamespace} | ${true}
`('with a namespace', ({ namespaceFullPath, hasFullPath }) => {
let evs = null;
let links = null;
beforeEach(() => {
wrapper = createComponent({
includeProjectName: true,
stageEvents: issueEventItems.map((ie) => ({ ...ie, namespaceFullPath })),
});
evs = findStageEvents();
links = evs.wrappers.map((ev) => findStageEventLink(ev).text());
});
it(`with namespaceFullPath='${namespaceFullPath}' ${
hasFullPath ? 'will' : 'does not'
} include the namespace`, () => {
issueEventItems.forEach((ev, index) => {
if (hasFullPath) {
expect(links[index]).toBe(`${namespaceFullPath}/${ev.projectPath}#${ev.iid}`);
} else {
expect(links[index]).toBe(`${ev.projectPath}#${ev.iid}`);
}
});
});
});
}); });
describe('Pagination', () => { describe('Pagination', () => {
......
...@@ -31,6 +31,10 @@ RSpec.describe AnalyticsBuildEntity do ...@@ -31,6 +31,10 @@ RSpec.describe AnalyticsBuildEntity do
expect(subject).to include(:project_path) expect(subject).to include(:project_path)
end end
it 'contains the namespace full path' do
expect(subject).to include(:namespace_full_path)
end
it 'does not contain sensitive information' do it 'does not contain sensitive information' do
expect(subject).not_to include(/token/) expect(subject).not_to include(/token/)
expect(subject).not_to include(/variables/) expect(subject).not_to include(/variables/)
......
...@@ -36,6 +36,10 @@ RSpec.describe AnalyticsIssueEntity do ...@@ -36,6 +36,10 @@ RSpec.describe AnalyticsIssueEntity do
expect(subject).to include(:project_path) expect(subject).to include(:project_path)
end end
it 'contains the namespace full path' do
expect(subject).to include(:namespace_full_path)
end
it 'does not contain sensitive information' do it 'does not contain sensitive information' do
expect(subject).not_to include(/token/) expect(subject).not_to include(/token/)
expect(subject).not_to include(/variables/) expect(subject).not_to include(/variables/)
......
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