Skip to content
Snippets Groups Projects
Unverified Commit 359ec852 authored by Alexander Turinske's avatar Alexander Turinske Committed by GitLab
Browse files

Merge branch '496451-policies-policy-scope-scope-info-row' into 'master'

Add extra check for policy scope drawer

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167601



Merged-by: default avatarAlexander Turinske <aturinske@gitlab.com>
Approved-by: default avatarAlexander Turinske <aturinske@gitlab.com>
Co-authored-by: default avatarArtur Fedorov <afedorov@gitlab.com>
parents f0eef4fb e643df59
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -83,20 +83,26 @@ export default {
isProject() {
return isProject(this.namespaceType);
},
showScopeSection() {
return this.isGroup || this.hasMultipleProjectsLinked;
},
policyScopeHasComplianceFrameworks() {
return policyScopeHasComplianceFrameworks(this.policyScope);
return policyScopeHasComplianceFrameworks(this.policyScope) && this.showScopeSection;
},
policyScopeHasIncludingProjects() {
return policyScopeHasIncludingProjects(this.policyScope);
},
policyScopeHasGroups() {
return policyScopeHasGroups(this.policyScope) && this.showGroupScope;
return policyScopeHasGroups(this.policyScope) && this.showGroupScope && this.showScopeSection;
},
policyScopeHasExcludingProjects() {
return policyScopeHasExcludingProjects(this.policyScope);
},
policyHasProjects() {
return this.policyScopeHasIncludingProjects || this.policyScopeHasExcludingProjects;
return (
(this.policyScopeHasIncludingProjects || this.policyScopeHasExcludingProjects) &&
this.showScopeSection
);
},
policyScopeGroups() {
return policyScopeGroups(this.policyScope);
Loading
Loading
Loading
Loading
@@ -254,7 +254,7 @@ describe('ScopeInfoRow', () => {
);
});
 
it('renders group scope when groups and project exceptions are provided on project level', () => {
it('does not render group scope when groups and project exceptions are provided on project level', () => {
createComponent({
propsData: {
policyScope: {
Loading
Loading
@@ -267,13 +267,47 @@ describe('ScopeInfoRow', () => {
},
},
provide: {
namaspaceType: NAMESPACE_TYPES.PROJECT,
namespaceType: NAMESPACE_TYPES.PROJECT,
glFeatures: {
policyGroupScopeProject: true,
},
},
});
expect(findGroupsToggleList().exists()).toBe(false);
});
it('renders group scope when groups and project exceptions are provided on project level', async () => {
createComponent({
handler: mockLinkedSppItemsResponse({
projects: [
{ id: '1', name: 'name1', fullPath: 'fullPath1' },
{ id: '2', name: 'name2', fullPath: 'fullPath2' },
],
groups: [
{ id: '1', name: 'name1', fullPath: 'fullPath1' },
{ id: '2', name: 'name2', fullPath: 'fullPath2' },
],
}),
propsData: {
policyScope: {
includingGroups: {
nodes: items,
},
excludingProjects: {
nodes: items,
},
},
},
provide: {
namespaceType: NAMESPACE_TYPES.PROJECT,
glFeatures: {
policyGroupScope: true,
policyGroupScopeProject: true,
},
},
});
 
await waitForPromises();
expect(findGroupsToggleList().exists()).toBe(true);
expect(findGroupsToggleList().props('groups')).toEqual(items);
expect(findGroupsToggleList().props('projects')).toEqual(items);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment