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 = {
mergeRequests: { ...DEFAULT_WORKFLOW_TITLE_PROPERTIES, label: __('Merge requests') },
};
const fullProjectPath = ({ namespaceFullPath = '', projectPath }) =>
namespaceFullPath.split('/').length > 1 ? `${namespaceFullPath}/${projectPath}` : projectPath;
export default {
name: 'StageTable',
components: {
......@@ -149,8 +152,10 @@ export default {
isMrLink(url = '') {
return url.includes('/merge_request');
},
itemId({ iid, projectPath }, separator = '#') {
const prefix = this.includeProjectName ? projectPath : '';
itemId({ iid, projectPath, namespaceFullPath = '' }, separator = '#') {
const prefix = this.includeProjectName
? fullProjectPath({ namespaceFullPath, projectPath })
: '';
return `${prefix}${separator}${iid}`;
},
itemDisplayName(item) {
......
......@@ -13,6 +13,10 @@ class AnalyticsBuildEntity < Grape::Entity
build.project.path
end
expose :namespace_full_path do |build|
build.project.namespace.full_path
end
expose :started_at, as: :date do |build|
interval_in_words(build[:started_at])
end
......
......@@ -10,6 +10,10 @@ class AnalyticsIssueEntity < Grape::Entity
object[:project_path]
end
expose :namespace_full_path do |object|
object[:namespace_path]
end
expose :iid do |object|
object[:iid].to_s
end
......
......@@ -198,6 +198,7 @@ describe('StageTable', () => {
});
describe('includeProjectName set', () => {
const fakenamespace = 'some/fake/path';
beforeEach(() => {
wrapper = createComponent({ includeProjectName: true });
});
......@@ -210,6 +211,37 @@ describe('StageTable', () => {
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', () => {
......
......@@ -31,6 +31,10 @@ RSpec.describe AnalyticsBuildEntity do
expect(subject).to include(:project_path)
end
it 'contains the namespace full path' do
expect(subject).to include(:namespace_full_path)
end
it 'does not contain sensitive information' do
expect(subject).not_to include(/token/)
expect(subject).not_to include(/variables/)
......
......@@ -36,6 +36,10 @@ RSpec.describe AnalyticsIssueEntity do
expect(subject).to include(:project_path)
end
it 'contains the namespace full path' do
expect(subject).to include(:namespace_full_path)
end
it 'does not contain sensitive information' do
expect(subject).not_to include(/token/)
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