Skip to content

Commit

Permalink
Privacy policy update support included (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldsce authored Mar 30, 2020
1 parent 44995eb commit f920c80
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/services/model/privacyPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const outboundSecurityRulesKeys = [

export const keys = [
{ field: fields.region, label: 'Region', sortable: true, visible: true },
{ field: fields.organizationName, serverField: 'key#OS#developer', label: 'Organization Name', sortable: true, visible: true },
{ field: fields.organizationName, serverField: 'key#OS#organization', label: 'Organization Name', sortable: true, visible: true },
{ field: fields.privacyPolicyName, serverField: 'key#OS#name', label: 'Privacy Policy Name', sortable: true, visible: true },
{ field: fields.outboundSecurityRulesCount, label: 'Rules Count', sortable: true, visible: true },
{
Expand Down Expand Up @@ -52,6 +52,7 @@ export const getPrivacyPolicyList = async (self, data) => {

export const updatePrivacyPolicy = (data) => {
let requestData = getKey(data)
requestData.privacypolicy.fields = ['3', '3.1', '3.2', '3.3', '3.4']
return { method: UPDATE_PRIVACY_POLICY, data: requestData }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PrivacyPolicy extends React.Component {
this.setState({ currentView: <PrivacyPolicyReg onClose={this.onRegClose} /> })
}

onUpdate = (data) => {
onUpdate = (action, data) => {
this.setState({ currentView: <PrivacyPolicyReg data={data} action='Update' onClose={this.onRegClose}/> })
}

Expand Down
14 changes: 8 additions & 6 deletions src/sites/siteFour/policies/privacyPolicy/privacyPolicyReg.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,18 @@ class AutoProvPolicyReg extends React.Component {
return data
}

onCreate = async () => {
let data = this.formattedData()
onCreate = async (data) => {
//let data = this.formattedData()
if (data) {
let outbound_security_rules = [];
let outboundSecurityRules = [];
if (!data[fields.fullIsolation]) {
for (let i = 0; i < this.state.forms.length; i++) {
let form = this.state.forms[i];
if (form.uuid) {
let uuid = form.uuid;
let outboundSecurityRule = data[uuid]
if (outboundSecurityRule) {
outbound_security_rules.push({
outboundSecurityRules.push({
protocol: outboundSecurityRule[fields.protocol],
port_range_min: outboundSecurityRule[fields.protocol] !== 'icmp' ? parseInt(outboundSecurityRule[fields.portRangeMin]) : undefined,
port_range_max: outboundSecurityRule[fields.protocol] !== 'icmp' ? parseInt(outboundSecurityRule[fields.portRangeMax]) : undefined,
Expand All @@ -206,8 +206,10 @@ class AutoProvPolicyReg extends React.Component {
}
}
}


if(outboundSecurityRules.length > 0)
{
data[fields.outboundSecurityRules] = outboundSecurityRules;
}
let mcRequest = await serverData.sendRequest(this, this.props.action === 'Update' ? updatePrivacyPolicy(data) : createPrivacyPolicy(data))
if (mcRequest && mcRequest.response) {
let response = mcRequest.response
Expand Down

0 comments on commit f920c80

Please sign in to comment.