Commit 365bcd8d authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'add_standard_field_into_payload' into 'master'

Add field is_standard as part of the payload

See merge request gitlab-org/gitlab!37527
parents f4be9361 9d828748
...@@ -44,6 +44,7 @@ export const createPolicy = ({ state, commit }, { environmentId, policy }) => { ...@@ -44,6 +44,7 @@ export const createPolicy = ({ state, commit }, { environmentId, policy }) => {
.post(state.policiesEndpoint, { .post(state.policiesEndpoint, {
environment_id: environmentId, environment_id: environmentId,
manifest: policy.manifest, manifest: policy.manifest,
is_standard: policy.isStandard,
}) })
.then(({ data }) => { .then(({ data }) => {
commit(types.RECEIVE_CREATE_POLICY_SUCCESS, data); commit(types.RECEIVE_CREATE_POLICY_SUCCESS, data);
...@@ -71,6 +72,7 @@ export const updatePolicy = ({ state, commit }, { environmentId, policy }) => { ...@@ -71,6 +72,7 @@ export const updatePolicy = ({ state, commit }, { environmentId, policy }) => {
environment_id: environmentId, environment_id: environmentId,
manifest: policy.manifest, manifest: policy.manifest,
enabled: policy.isEnabled, enabled: policy.isEnabled,
is_standard: policy.isStandard,
}) })
.then(({ data }) => { .then(({ data }) => {
commit(types.RECEIVE_UPDATE_POLICY_SUCCESS, { commit(types.RECEIVE_UPDATE_POLICY_SUCCESS, {
......
---
title: Add is_standard as part of frontend payload for NetworkPolicyController
merge_request: 37527
author:
type: changed
...@@ -6,10 +6,10 @@ exports[`NetworkPolicyList component renders policies table 1`] = ` ...@@ -6,10 +6,10 @@ exports[`NetworkPolicyList component renders policies table 1`] = `
<table <table
aria-busy="false" aria-busy="false"
aria-colcount="3" aria-colcount="3"
aria-describedby="__BVID__143__caption_" aria-describedby="__BVID__151__caption_"
aria-multiselectable="false" aria-multiselectable="false"
class="table b-table gl-table table-hover b-table-stacked-md b-table-selectable b-table-select-single" class="table b-table gl-table table-hover b-table-stacked-md b-table-selectable b-table-select-single"
id="__BVID__143" id="__BVID__151"
role="table" role="table"
> >
<!----> <!---->
...@@ -92,6 +92,47 @@ exports[`NetworkPolicyList component renders policies table 1`] = ` ...@@ -92,6 +92,47 @@ exports[`NetworkPolicyList component renders policies table 1`] = `
3 months ago 3 months ago
</div>
</td>
</tr>
<tr
aria-selected="false"
class=""
role="row"
tabindex="0"
>
<td
aria-colindex="1"
class=""
data-label="Name"
role="cell"
>
<div>
cilium_policy
</div>
</td>
<td
aria-colindex="2"
class=""
data-label="Status"
role="cell"
>
<div>
Enabled
</div>
</td>
<td
aria-colindex="3"
class=""
data-label="Last modified"
role="cell"
>
<div>
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -38,6 +38,28 @@ spec: ...@@ -38,6 +38,28 @@ spec:
project: myproject`, project: myproject`,
creation_timestamp: '2020-04-14T00:08:30Z', creation_timestamp: '2020-04-14T00:08:30Z',
is_enabled: true, is_enabled: true,
is_standard: true,
},
{
name: 'cilium_policy',
namespace: 'production',
manifest: `---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: cilium_policy
namespace: production
spec:
endpointSelector:
matchLabels:
role: db
ingress:
- fromEndpoints:
- matchLabels:
project: myproject`,
created_timestamp: '2020-04-15T00:08:30Z',
is_enabled: true,
is_standard: false,
}, },
]; ];
......
...@@ -20,7 +20,7 @@ describe('Network Policy actions', () => { ...@@ -20,7 +20,7 @@ describe('Network Policy actions', () => {
let state; let state;
let mock; let mock;
const environmentId = 3; const environmentId = 3;
const policy = { name: 'policy', manifest: 'foo', isEnabled: true }; const policy = { name: 'policy', manifest: 'foo', isEnabled: true, isStandard: true };
beforeEach(() => { beforeEach(() => {
state = getInitialState(); state = getInitialState();
...@@ -139,7 +139,7 @@ describe('Network Policy actions', () => { ...@@ -139,7 +139,7 @@ describe('Network Policy actions', () => {
}); });
describe('createPolicy', () => { describe('createPolicy', () => {
const createdPolicy = { name: 'policy', manifest: 'bar', isEnabled: true }; const createdPolicy = { name: 'policy', manifest: 'bar', isEnabled: true, isStandard: true };
describe('on success', () => { describe('on success', () => {
beforeEach(() => { beforeEach(() => {
...@@ -147,6 +147,7 @@ describe('Network Policy actions', () => { ...@@ -147,6 +147,7 @@ describe('Network Policy actions', () => {
.onPost(networkPoliciesEndpoint, { .onPost(networkPoliciesEndpoint, {
environment_id: environmentId, environment_id: environmentId,
manifest: policy.manifest, manifest: policy.manifest,
is_standard: true,
}) })
.replyOnce(httpStatus.OK, createdPolicy); .replyOnce(httpStatus.OK, createdPolicy);
}); });
...@@ -177,6 +178,7 @@ describe('Network Policy actions', () => { ...@@ -177,6 +178,7 @@ describe('Network Policy actions', () => {
.onPost(networkPoliciesEndpoint, { .onPost(networkPoliciesEndpoint, {
environment_id: environmentId, environment_id: environmentId,
manifest: policy.manifest, manifest: policy.manifest,
is_standard: true,
}) })
.replyOnce(500, error); .replyOnce(500, error);
}); });
...@@ -241,7 +243,7 @@ describe('Network Policy actions', () => { ...@@ -241,7 +243,7 @@ describe('Network Policy actions', () => {
}); });
describe('updatePolicy', () => { describe('updatePolicy', () => {
const updatedPolicy = { name: 'policy', manifest: 'bar', isEnabled: true }; const updatedPolicy = { name: 'policy', manifest: 'bar', isEnabled: true, isStandard: true };
describe('on success', () => { describe('on success', () => {
beforeEach(() => { beforeEach(() => {
...@@ -250,6 +252,7 @@ describe('Network Policy actions', () => { ...@@ -250,6 +252,7 @@ describe('Network Policy actions', () => {
environment_id: environmentId, environment_id: environmentId,
manifest: policy.manifest, manifest: policy.manifest,
enabled: policy.isEnabled, enabled: policy.isEnabled,
is_standard: policy.isStandard,
}) })
.replyOnce(httpStatus.OK, updatedPolicy); .replyOnce(httpStatus.OK, updatedPolicy);
}); });
...@@ -279,6 +282,7 @@ describe('Network Policy actions', () => { ...@@ -279,6 +282,7 @@ describe('Network Policy actions', () => {
environment_id: environmentId, environment_id: environmentId,
manifest: policy.manifest, manifest: policy.manifest,
enabled: policy.isEnabled, enabled: policy.isEnabled,
is_standard: policy.isStandard,
}) })
.replyOnce(500, error); .replyOnce(500, error);
}); });
......
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