Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ede499a3
Commit
ede499a3
authored
Oct 12, 2021
by
Jiaan Louw
Committed by
Denys Mishunov
Oct 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update compliance report drawer to share code with threat monitoring
parent
ab62b1a4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
18 deletions
+33
-18
app/assets/javascripts/lib/utils/constants.js
app/assets/javascripts/lib/utils/constants.js
+4
-0
ee/app/assets/javascripts/compliance_dashboard/components/drawer.vue
...ts/javascripts/compliance_dashboard/components/drawer.vue
+8
-15
ee/app/assets/javascripts/compliance_dashboard/constants.js
ee/app/assets/javascripts/compliance_dashboard/constants.js
+2
-0
ee/app/assets/javascripts/threat_monitoring/components/policy_drawer/policy_drawer.vue
...eat_monitoring/components/policy_drawer/policy_drawer.vue
+2
-3
ee/spec/frontend/compliance_dashboard/components/drawer_spec.js
...c/frontend/compliance_dashboard/components/drawer_spec.js
+17
-0
No files found.
app/assets/javascripts/lib/utils/constants.js
View file @
ede499a3
...
@@ -20,3 +20,7 @@ export const BV_DROPDOWN_HIDE = 'bv::dropdown::hide';
...
@@ -20,3 +20,7 @@ export const BV_DROPDOWN_HIDE = 'bv::dropdown::hide';
export
const
DEFAULT_TH_CLASSES
=
export
const
DEFAULT_TH_CLASSES
=
'
gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
'
;
'
gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
'
;
// We set the drawer's z-index to 252 to clear flash messages that might
// be displayed in the page and that have a z-index of 251.
export
const
DRAWER_Z_INDEX
=
252
;
ee/app/assets/javascripts/compliance_dashboard/components/drawer.vue
View file @
ede499a3
<
script
>
<
script
>
import
{
GlDrawer
}
from
'
@gitlab/ui
'
;
import
{
GlDrawer
}
from
'
@gitlab/ui
'
;
import
{
DRAWER_Z_INDEX
}
from
'
~/lib/utils/constants
'
;
import
{
COMPLIANCE_DRAWER_CONTAINER_CLASS
}
from
'
../constants
'
;
import
{
getContentWrapperHeight
}
from
'
../../threat_monitoring/utils
'
;
import
BranchPath
from
'
./drawer_sections/branch_path.vue
'
;
import
BranchPath
from
'
./drawer_sections/branch_path.vue
'
;
import
Committers
from
'
./drawer_sections/committers.vue
'
;
import
Committers
from
'
./drawer_sections/committers.vue
'
;
import
MergedBy
from
'
./drawer_sections/merged_by.vue
'
;
import
MergedBy
from
'
./drawer_sections/merged_by.vue
'
;
...
@@ -32,28 +35,18 @@ export default {
...
@@ -32,28 +35,18 @@ export default {
hasBranchDetails
()
{
hasBranchDetails
()
{
return
this
.
mergeRequest
.
source_branch
&&
this
.
mergeRequest
.
target_branch
;
return
this
.
mergeRequest
.
source_branch
&&
this
.
mergeRequest
.
target_branch
;
},
},
},
drawerHeaderHeight
()
{
methods
:
{
return
getContentWrapperHeight
(
COMPLIANCE_DRAWER_CONTAINER_CLASS
);
getDrawerHeaderHeight
()
{
const
wrapperEl
=
document
.
querySelector
(
'
.content-wrapper
'
);
if
(
wrapperEl
)
{
return
`
${
wrapperEl
.
offsetTop
}
px`
;
}
return
''
;
},
},
},
},
// We set the drawer's z-index to 252 to clear flash messages that might be displayed in the page
DRAWER_Z_INDEX
,
// and that have a z-index of 251.
Z_INDEX
:
252
,
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<gl-drawer
<gl-drawer
:open=
"showDrawer"
:open=
"showDrawer"
:header-height=
"
getDrawerHeaderHeight()
"
:header-height=
"
drawerHeaderHeight
"
:z-index=
"$options.Z_INDEX"
:z-index=
"$options.
DRAWER_
Z_INDEX"
@
close=
"$emit('close')"
@
close=
"$emit('close')"
>
>
<template
#title
>
<template
#title
>
...
...
ee/app/assets/javascripts/compliance_dashboard/constants.js
View file @
ede499a3
...
@@ -9,3 +9,5 @@ export const CUSTODY_REPORT_PARAMETER = 'commit_sha';
...
@@ -9,3 +9,5 @@ export const CUSTODY_REPORT_PARAMETER = 'commit_sha';
export
const
DRAWER_AVATAR_SIZE
=
24
;
export
const
DRAWER_AVATAR_SIZE
=
24
;
export
const
DRAWER_MAXIMUM_AVATARS
=
20
;
export
const
DRAWER_MAXIMUM_AVATARS
=
20
;
export
const
COMPLIANCE_DRAWER_CONTAINER_CLASS
=
'
.content-wrapper
'
;
ee/app/assets/javascripts/threat_monitoring/components/policy_drawer/policy_drawer.vue
View file @
ede499a3
<
script
>
<
script
>
import
{
GlButton
,
GlDrawer
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlDrawer
}
from
'
@gitlab/ui
'
;
import
{
DRAWER_Z_INDEX
}
from
'
~/lib/utils/constants
'
;
import
{
getContentWrapperHeight
,
removeUnnecessaryDashes
}
from
'
../../utils
'
;
import
{
getContentWrapperHeight
,
removeUnnecessaryDashes
}
from
'
../../utils
'
;
import
{
POLICIES_LIST_CONTAINER_CLASS
,
POLICY_TYPE_COMPONENT_OPTIONS
}
from
'
../constants
'
;
import
{
POLICIES_LIST_CONTAINER_CLASS
,
POLICY_TYPE_COMPONENT_OPTIONS
}
from
'
../constants
'
;
import
CiliumNetworkPolicy
from
'
./cilium_network_policy.vue
'
;
import
CiliumNetworkPolicy
from
'
./cilium_network_policy.vue
'
;
...
@@ -54,9 +55,7 @@ export default {
...
@@ -54,9 +55,7 @@ export default {
return
getContentWrapperHeight
(
this
.
containerClass
);
return
getContentWrapperHeight
(
this
.
containerClass
);
},
},
},
},
// We set the drawer's z-index to 252 to clear flash messages that might be displayed in the page
DRAWER_Z_INDEX
,
// and that have a z-index of 251.
DRAWER_Z_INDEX
:
252
,
};
};
</
script
>
</
script
>
...
...
ee/spec/frontend/compliance_dashboard/components/drawer_spec.js
View file @
ede499a3
...
@@ -10,6 +10,10 @@ import { complianceFramework } from 'ee_jest/vue_shared/components/compliance_fr
...
@@ -10,6 +10,10 @@ import { complianceFramework } from 'ee_jest/vue_shared/components/compliance_fr
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
createApprovers
,
createMergeRequests
}
from
'
../mock_data
'
;
import
{
createApprovers
,
createMergeRequests
}
from
'
../mock_data
'
;
jest
.
mock
(
'
ee/threat_monitoring/utils
'
,
()
=>
({
getContentWrapperHeight
:
jest
.
fn
().
mockReturnValue
(
'
50px
'
),
}));
describe
(
'
MergeRequestDrawer component
'
,
()
=>
{
describe
(
'
MergeRequestDrawer component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
mergeRequest
=
createMergeRequests
({
const
mergeRequest
=
createMergeRequests
({
...
@@ -44,6 +48,19 @@ describe('MergeRequestDrawer component', () => {
...
@@ -44,6 +48,19 @@ describe('MergeRequestDrawer component', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
describe
(
'
default behaviour
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
createComponent
();
});
it
(
'
configures the drawer with header height and z-index
'
,
()
=>
{
expect
(
findDrawer
().
props
()).
toMatchObject
({
headerHeight
:
'
50px
'
,
zIndex
:
252
,
});
});
});
describe
(
'
when closed
'
,
()
=>
{
describe
(
'
when closed
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
=
createComponent
({
showDrawer
:
false
});
wrapper
=
createComponent
({
showDrawer
:
false
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment