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
627d603d
Commit
627d603d
authored
Jul 11, 2021
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor computed props
parent
e17c24ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
ee/app/assets/javascripts/threat_monitoring/components/constants.js
...ets/javascripts/threat_monitoring/components/constants.js
+2
-4
ee/app/assets/javascripts/threat_monitoring/components/policy_list.vue
.../javascripts/threat_monitoring/components/policy_list.vue
+17
-15
No files found.
ee/app/assets/javascripts/threat_monitoring/components/constants.js
View file @
627d603d
...
...
@@ -26,16 +26,14 @@ export const POLICY_KINDS = {
scanExecution
:
'
scanner_profile
'
,
};
export
const
POLICY_TYPE_NETWORK
=
s__
(
'
SecurityPolicies|Network
'
);
export
const
POLICY_TYPE_SCAN_EXECUTION
=
s__
(
'
SecurityPolicies|Scan execution
'
);
export
const
POLICY_TYPE_OPTIONS
=
{
POLICY_TYPE_NETWORK
:
{
value
:
'
POLICY_TYPE_NETWORK
'
,
text
:
POLICY_TYPE_NETWORK
,
text
:
s__
(
'
SecurityPolicies|Network
'
)
,
},
POLICY_TYPE_SCAN_EXECUTION
:
{
value
:
'
POLICY_TYPE_SCAN_EXECUTION
'
,
text
:
POLICY_TYPE_SCAN_EXECUTION
,
text
:
s__
(
'
SecurityPolicies|Scan execution
'
)
,
},
ALL
:
{
value
:
''
,
...
...
ee/app/assets/javascripts/threat_monitoring/components/policy_list.vue
View file @
627d603d
...
...
@@ -9,6 +9,7 @@ import {
GlIcon
,
GlTooltipDirective
,
}
from
'
@gitlab/ui
'
;
import
{
flatten
}
from
'
lodash
'
;
import
{
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
PREDEFINED_NETWORK_POLICIES
}
from
'
ee/threat_monitoring/constants
'
;
import
createFlash
from
'
~/flash
'
;
...
...
@@ -17,7 +18,7 @@ import { setUrlFragment, mergeUrlParams } from '~/lib/utils/url_utility';
import
{
__
,
s__
}
from
'
~/locale
'
;
import
networkPoliciesQuery
from
'
../graphql/queries/network_policies.query.graphql
'
;
import
scanExecutionPoliciesQuery
from
'
../graphql/queries/scan_execution_policies.query.graphql
'
;
import
{
POLICY_TYPE_
NETWORK
,
POLICY_TYPE_SCAN_EXECUTION
,
POLICY_TYPE_
OPTIONS
}
from
'
./constants
'
;
import
{
POLICY_TYPE_OPTIONS
}
from
'
./constants
'
;
import
EnvironmentPicker
from
'
./environment_picker.vue
'
;
import
PolicyDrawer
from
'
./policy_drawer/policy_drawer.vue
'
;
import
PolicyTypeFilter
from
'
./policy_type_filter.vue
'
;
...
...
@@ -114,6 +115,12 @@ export default {
'
isLoadingEnvironments
'
,
]),
...
mapGetters
(
'
threatMonitoring
'
,
[
'
currentEnvironmentGid
'
]),
allPolicyTypes
()
{
return
{
[
POLICY_TYPE_OPTIONS
.
POLICY_TYPE_NETWORK
.
value
]:
this
.
networkPolicies
,
[
POLICY_TYPE_OPTIONS
.
POLICY_TYPE_SCAN_EXECUTION
.
value
]:
this
.
scanExecutionPolicies
,
};
},
documentationFullPath
()
{
return
setUrlFragment
(
this
.
documentationPath
,
'
container-network-policy
'
);
},
...
...
@@ -123,21 +130,16 @@ export default {
POLICY_TYPE_OPTIONS
.
POLICY_TYPE_NETWORK
.
value
,
].
includes
(
this
.
selectedPolicyType
);
},
shouldShowScanExecutionPolicies
()
{
return
[
POLICY_TYPE_OPTIONS
.
ALL
.
value
,
POLICY_TYPE_OPTIONS
.
POLICY_TYPE_SCAN_EXECUTION
.
value
,
].
includes
(
this
.
selectedPolicyType
);
},
policies
()
{
return
[
...(
this
.
shouldShowNetworkPolicies
?
getPoliciesWithType
(
this
.
networkPolicies
,
POLICY_TYPE_NETWORK
)
:
[]),
...(
this
.
shouldShowScanExecutionPolicies
?
getPoliciesWithType
(
this
.
scanExecutionPolicies
,
POLICY_TYPE_SCAN_EXECUTION
)
:
[]),
];
const
policyTypes
=
this
.
selectedPolicyType
===
POLICY_TYPE_OPTIONS
.
ALL
.
value
?
Object
.
keys
(
this
.
allPolicyTypes
)
:
[
this
.
selectedPolicyType
];
const
policies
=
policyTypes
.
map
((
type
)
=>
getPoliciesWithType
(
this
.
allPolicyTypes
[
type
],
POLICY_TYPE_OPTIONS
[
type
].
text
),
);
return
flatten
(
policies
);
},
isLoadingPolicies
()
{
return
(
...
...
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