Commit b18926b4 authored by Alexander Turinske's avatar Alexander Turinske

Update graphql query selection to be more readable

- remove usage of project-specific policy methods
- update test naming
parent bf9d41e4
......@@ -27,6 +27,11 @@ import PolicyEnvironments from '../policy_environments.vue';
import PolicyTypeFilter from '../policy_type_filter.vue';
import NoPoliciesEmptyState from './no_policies_empty_state.vue';
const NAMESPACE_QUERY_DICT = {
[NAMESPACE_TYPES.PROJECT]: projectScanExecutionPoliciesQuery,
[NAMESPACE_TYPES.GROUP]: groupScanExecutionPoliciesQuery,
};
const createPolicyFetchError = ({ gqlError, networkError }) => {
const error =
gqlError?.message ||
......@@ -98,12 +103,7 @@ export default {
},
scanExecutionPolicies: {
query() {
switch (this.namespaceType) {
case NAMESPACE_TYPES.GROUP:
return groupScanExecutionPoliciesQuery;
default:
return projectScanExecutionPoliciesQuery;
}
return NAMESPACE_QUERY_DICT[this.namespaceType];
},
variables() {
return {
......
- breadcrumb_title _("Policies")
- disable_security_policy_project = !can_update_security_orchestration_policy_project?(group)
- @content_wrapper_class = 'js-security-policies-container-wrapper'
#js-group-security-policies-list{ data: { group_path: group.full_path,
assigned_policy_project: assigned_policy_project(group).to_json,
disable_security_policy_project: disable_security_policy_project.to_s,
assigned_policy_project: 'null',
disable_security_policy_project: false.to_s,
new_policy_path: new_group_security_policy_path(group),
empty_filter_svg_path: image_path('illustrations/issues.svg'),
empty_list_svg_path: image_path('illustrations/security-dashboard_empty.svg'),
......
......@@ -272,7 +272,7 @@ describe('PoliciesList component', () => {
await waitForPromises();
});
it('fetches policies', () => {
it('does not fetch policies', () => {
expect(requestHandlers.networkPolicies).not.toHaveBeenCalled();
expect(requestHandlers.projectScanExecutionPolicies).not.toHaveBeenCalled();
expect(requestHandlers.scanResultPolicies).not.toHaveBeenCalled();
......
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