FE: Migrate network policies fetch to GraphQL
Why are we doing this work
In #329423 (closed) we have implemented a GraphQL endpoint to fetch scan execution policies in Threat Monitoring. However, we currently rely on a REST endpoint to fetch network policies. To make things consistent, we are moving network policies over to a GraphQL endpoint as well: #333072 (closed). Once that's done, the frontend will need to be updated to fetch network policies from GraphQL, which will later let us add scan execution policies to the mix.
Relevant links
- Epic: &5362 (closed)
- Issue for creating the scan execution policies GraphQL endpoint: #329423 (closed)
- Issue for creating the network policies GraphQL endpoint: #333072 (closed)
Non-functional requirements
-
Testing: -
Remove Vuex/REST based mocks. -
Mock Apollo client and test that the query is properly triggered. -
Existing rendering tests should pass without any significant change.
-
Implementation plan
-
Create an Apollo provider, remember to set assumeImmutableResults
totrue
. -
Create the client-side query network_policies.query.graphql
. -
Update network_policy_list.vue
so that it fetches network policies via GraphQL. -
Remove anything related to the /:namespace/:project/-/security/network_policies?environment_id=:id
REST endpoint. -
Cleanup the Vuex store to reflect the fact the responsibility of storing policies is moving to Apollo.
Edited by Paul Gascou-Vaillancourt