diff --git a/ui/src/__tests__/redux/thunk/groups.test.js b/ui/src/__tests__/redux/thunk/groups.test.js index 638811416e3..8649f88e2eb 100644 --- a/ui/src/__tests__/redux/thunk/groups.test.js +++ b/ui/src/__tests__/redux/thunk/groups.test.js @@ -511,6 +511,7 @@ describe('reviewGroup method', () => { const fakeDispatch = sinon.spy(); await reviewGroup( + domainName, 'singlegroup', { name: 'singlegroup' }, 'auditRef', diff --git a/ui/src/__tests__/server/handlers/api.test.js b/ui/src/__tests__/server/handlers/api.test.js index 826c5925a64..0ab0f06bbe0 100644 --- a/ui/src/__tests__/server/handlers/api.test.js +++ b/ui/src/__tests__/server/handlers/api.test.js @@ -307,7 +307,7 @@ describe('Fetchr Server API Test', () => { principal: 'user.dummy1', assertions: [ { - dummyProperty: 'dummyValue' + dummyProperty: 'dummyValue', }, ], }, @@ -1312,7 +1312,7 @@ describe('Fetchr Server API Test', () => { principal: 'user.dummy1', assertions: [ { - dummyProperty: 'dummyValue' + dummyProperty: 'dummyValue', }, ], }, diff --git a/ui/src/components/denali/TabGroup.js b/ui/src/components/denali/TabGroup.js index c5e0533aa2b..5c8ce61c678 100644 --- a/ui/src/components/denali/TabGroup.js +++ b/ui/src/components/denali/TabGroup.js @@ -166,7 +166,8 @@ class TabGroup extends React.PureComponent { onClick(tab); }; - let shouldSplitOnParentheses = typeof(label) === 'string' && label.includes('('); + let shouldSplitOnParentheses = + typeof label === 'string' && label.includes('('); if (shouldSplitOnParentheses) { let splitLabel = label.split('('); label = ( @@ -175,7 +176,7 @@ class TabGroup extends React.PureComponent {
({splitLabel[1]} ); - }; + } return (
- + {domainName} @@ -177,11 +181,19 @@ class UserDomains extends React.Component { My Domains
- + Create | - + Manage
diff --git a/ui/src/components/group/GroupReviewTable.js b/ui/src/components/group/GroupReviewTable.js index 7c2755a0952..26ec5b10405 100644 --- a/ui/src/components/group/GroupReviewTable.js +++ b/ui/src/components/group/GroupReviewTable.js @@ -160,6 +160,7 @@ class GroupReviewTable extends React.Component { }); this.props .reviewGroup( + this.props.domain, this.props.groupName, group, this.state.justification, @@ -356,8 +357,10 @@ const mapStateToProps = (state, props) => { }; const mapDispatchToProps = (dispatch) => ({ - reviewGroup: (groupName, group, justification, _csrf) => - dispatch(reviewGroup(groupName, group, justification, _csrf)), + reviewGroup: (domainName, groupName, group, justification, _csrf) => + dispatch( + reviewGroup(domainName, groupName, group, justification, _csrf) + ), }); export default connect(mapStateToProps, mapDispatchToProps)(GroupReviewTable); diff --git a/ui/src/components/group/GroupRoleTable.js b/ui/src/components/group/GroupRoleTable.js index a602428e2c0..192f69951b4 100644 --- a/ui/src/components/group/GroupRoleTable.js +++ b/ui/src/components/group/GroupRoleTable.js @@ -20,7 +20,7 @@ import { GROUP_ROLES_CATEGORY } from '../constants/constants'; import { selectIsLoading } from '../../redux/selectors/loading'; import { connect } from 'react-redux'; import { ReduxPageLoader } from '../denali/ReduxPageLoader'; -import {selectTimeZone} from "../../redux/selectors/domains"; +import { selectTimeZone } from '../../redux/selectors/domains'; const StyleTable = styled.div` width: 100%; @@ -153,7 +153,6 @@ const mapStateToProps = (state, props) => { ...props, isLoading: selectIsLoading(state), timeZone: selectTimeZone(state), - }; }; diff --git a/ui/src/components/header/NameHeader.js b/ui/src/components/header/NameHeader.js index 3433f19aec4..a4968f4de0c 100644 --- a/ui/src/components/header/NameHeader.js +++ b/ui/src/components/header/NameHeader.js @@ -96,12 +96,20 @@ class NameHeader extends React.Component { {roleTypeIcon} {roleAuditIcon} - + {domain} :role.{collection} {' (Delegated to '} - + {deDomain} {')'} @@ -111,7 +119,11 @@ class NameHeader extends React.Component { let link; if (this.props.category === 'group') { link = ( - + {domain} ); @@ -123,13 +135,21 @@ class NameHeader extends React.Component { ); } else if (this.props.category === 'policy') { link = ( - + {domain} ); } else if (this.props.category === 'service') { link = ( - + {domain} ); diff --git a/ui/src/components/history/HistoryList.js b/ui/src/components/history/HistoryList.js index 1cde4bb7927..bc7efe53503 100644 --- a/ui/src/components/history/HistoryList.js +++ b/ui/src/components/history/HistoryList.js @@ -418,7 +418,9 @@ const mapStateToProps = (state, props) => { const mapDispatchToProps = (dispatch) => ({ getHistory: (domainName, startDate, endDate, _csrf, roleName) => - dispatch(getDomainHistory(domainName, startDate, endDate, _csrf, roleName)), + dispatch( + getDomainHistory(domainName, startDate, endDate, _csrf, roleName) + ), }); export default connect(mapStateToProps, mapDispatchToProps)(HistoryList); diff --git a/ui/src/components/microsegmentation/AddSegmentation.js b/ui/src/components/microsegmentation/AddSegmentation.js index af0574ae70c..7176734e068 100644 --- a/ui/src/components/microsegmentation/AddSegmentation.js +++ b/ui/src/components/microsegmentation/AddSegmentation.js @@ -238,13 +238,13 @@ class AddSegmentation extends React.Component { members: this.props.editMode ? this.props.data['category'] === 'inbound' ? this.props.data['source_services'].map((str) => ({ - memberName: str, - approved: true, - })) + memberName: str, + approved: true, + })) : this.props.data['destination_services'].map((str) => ({ - memberName: str, - approved: true, - })) + memberName: str, + approved: true, + })) : [], protocolValid: true, action: '', @@ -1286,19 +1286,19 @@ class AddSegmentation extends React.Component { render() { let members = this.state.members ? this.state.members.map((item, idx) => { - // dummy place holder so that it can be be used in the form - const newItem = { ...item }; - newItem.approved = true; - let remove = this.deleteMember.bind(this, idx); - return ( - - ); - }) + // dummy place holder so that it can be be used in the form + const newItem = { ...item }; + newItem.approved = true; + let remove = this.deleteMember.bind(this, idx); + return ( + + ); + }) : ''; let sections = ( diff --git a/ui/src/components/microsegmentation/EnforcementStateList.js b/ui/src/components/microsegmentation/EnforcementStateList.js index 79bf58b3e64..45a4d8da1eb 100644 --- a/ui/src/components/microsegmentation/EnforcementStateList.js +++ b/ui/src/components/microsegmentation/EnforcementStateList.js @@ -141,12 +141,12 @@ class EnforcementStateList extends React.Component { > - - Enforcement State - Hosts - Scope - Action - + + Enforcement State + Hosts + Scope + Action + {rows} diff --git a/ui/src/components/review/ReviewList.js b/ui/src/components/review/ReviewList.js index 772b8278ad1..9a0a8a533a7 100644 --- a/ui/src/components/review/ReviewList.js +++ b/ui/src/components/review/ReviewList.js @@ -63,7 +63,9 @@ class ReviewList extends React.Component { errorMessage: null, }); this.props.onSuccessReview && - this.props.onSuccessReview(successMessage + ` Removed ${this.props.category} from view.`); + this.props.onSuccessReview( + successMessage + ` Removed ${this.props.category} from view.` + ); setTimeout(() => { this.setState({ showSuccess: false, diff --git a/ui/src/components/utils/MemberUtils.js b/ui/src/components/utils/MemberUtils.js index 08a0d5e0c4b..20519e887bc 100644 --- a/ui/src/components/utils/MemberUtils.js +++ b/ui/src/components/utils/MemberUtils.js @@ -41,7 +41,9 @@ export default class MemberUtils { } static userSearch(part, userList) { - const userDomainOmitPart = part.startsWith(USER_DOMAIN) ? part.substring(USER_DOMAIN.length + 1) : part; + const userDomainOmitPart = part.startsWith(USER_DOMAIN) + ? part.substring(USER_DOMAIN.length + 1) + : part; return MemberUtils.getUsers(userDomainOmitPart, userList).then((r) => { let usersArr = []; r.forEach((u) => diff --git a/ui/src/components/visibility/ServiceDependencyResGroupRoles.js b/ui/src/components/visibility/ServiceDependencyResGroupRoles.js index 1093cdda6f4..3948333d127 100644 --- a/ui/src/components/visibility/ServiceDependencyResGroupRoles.js +++ b/ui/src/components/visibility/ServiceDependencyResGroupRoles.js @@ -52,7 +52,10 @@ export default class ServiceDependencyResGroupRoles extends React.Component { roleEntry.resourceGroupRole } > - + {roleEntry.resourceGroupRole} {' '} @@ -88,7 +91,10 @@ export default class ServiceDependencyResGroupRoles extends React.Component { roleEntry.resourceGroupRole } > - + {roleEntry.resourceGroupRole} {' '} diff --git a/ui/src/pages/search/[type]/[searchterm].js b/ui/src/pages/search/[type]/[searchterm].js index 3fe89c469bd..b0a2b96ab8c 100644 --- a/ui/src/pages/search/[type]/[searchterm].js +++ b/ui/src/pages/search/[type]/[searchterm].js @@ -206,7 +206,11 @@ class PageSearchDetails extends React.Component { items.push( {icon} - + {domain} diff --git a/ui/src/pages/workflow/domain.js b/ui/src/pages/workflow/domain.js index dc49be0b07d..c3320701824 100644 --- a/ui/src/pages/workflow/domain.js +++ b/ui/src/pages/workflow/domain.js @@ -24,7 +24,10 @@ import Error from '../_error'; import PendingApprovalTabs from '../../components/pending-approval/PendingApprovalTabs'; import InputDropdown from '../../components/denali/InputDropdown'; import { withRouter } from 'next/router'; -import { WORKFLOW_DOMAIN_VIEW_DROPDOWN_PLACEHOLDER, WORKFLOW_TITLE } from '../../components/constants/constants'; +import { + WORKFLOW_DOMAIN_VIEW_DROPDOWN_PLACEHOLDER, + WORKFLOW_TITLE, +} from '../../components/constants/constants'; import PageUtils from '../../components/utils/PageUtils'; import { selectIsLoading } from '../../redux/selectors/loading'; import { connect } from 'react-redux'; diff --git a/ui/src/redux/thunks/groups.js b/ui/src/redux/thunks/groups.js index 24d0eac8e39..07c2c558a74 100644 --- a/ui/src/redux/thunks/groups.js +++ b/ui/src/redux/thunks/groups.js @@ -110,9 +110,9 @@ export const deleteGroup = }; export const reviewGroup = - (groupName, group, justification, _csrf) => async (dispatch, getState) => { + (domainName, groupName, group, justification, _csrf) => + async (dispatch, getState) => { groupName = groupName.toLowerCase(); - let domainName = getState().groups.domainName; await dispatch(getGroup(domainName, groupName)); try { let reviewedGroup = await API().reviewGroup( diff --git a/ui/src/redux/thunks/utils/microsegmentation.js b/ui/src/redux/thunks/utils/microsegmentation.js index fb09194ad13..e09b6e040ef 100644 --- a/ui/src/redux/thunks/utils/microsegmentation.js +++ b/ui/src/redux/thunks/utils/microsegmentation.js @@ -79,7 +79,7 @@ export const buildInboundOutbound = (domainName, state) => { tempCondition[key] = condition['conditionsMap'][key][ 'value' - ]; + ]; } ); tempCondition['id'] = condition['id']; @@ -121,11 +121,11 @@ export const buildInboundOutbound = (domainName, state) => { if (category === 'inbound') { jsonData[category][index - 1][ 'source_services' - ].push(roleMember.memberName); + ].push(roleMember.memberName); } else if (category === 'outbound') { jsonData[category][index - 1][ 'destination_services' - ].push(roleMember.memberName); + ].push(roleMember.memberName); } }); } diff --git a/ui/src/server/handlers/api.js b/ui/src/server/handlers/api.js index 34ec92b8d0c..a9d22e84f05 100644 --- a/ui/src/server/handlers/api.js +++ b/ui/src/server/handlers/api.js @@ -2460,102 +2460,102 @@ Fetchr.registerService({ let category = ''; item.assertions && - item.assertions.forEach( - (assertionItem, assertionIdx) => { - if ( - !apiUtils - .getMicrosegmentationActionRegex() - .test(assertionItem.action) - ) { - return; - } - let tempData = {}; - let tempProtocol = - assertionItem.action.split('-'); - tempData['layer'] = - apiUtils.omitUndefined( - tempProtocol[0] - ); - let tempPort = - assertionItem.action.split(':'); - tempData['source_port'] = - apiUtils.omitUndefined(tempPort[1]); - tempData['destination_port'] = - apiUtils.omitUndefined(tempPort[2]); - if (assertionItem.conditions) { - tempData['conditionsList'] = []; - - assertionItem.conditions[ - 'conditionsList' + item.assertions.forEach( + (assertionItem, assertionIdx) => { + if ( + !apiUtils + .getMicrosegmentationActionRegex() + .test(assertionItem.action) + ) { + return; + } + let tempData = {}; + let tempProtocol = + assertionItem.action.split('-'); + tempData['layer'] = + apiUtils.omitUndefined( + tempProtocol[0] + ); + let tempPort = + assertionItem.action.split(':'); + tempData['source_port'] = + apiUtils.omitUndefined(tempPort[1]); + tempData['destination_port'] = + apiUtils.omitUndefined(tempPort[2]); + if (assertionItem.conditions) { + tempData['conditionsList'] = []; + + assertionItem.conditions[ + 'conditionsList' ].forEach((condition) => { - let tempCondition = {}; - Object.keys( - condition['conditionsMap'] - ).forEach((key) => { - tempCondition[key] = - condition[ - 'conditionsMap' + let tempCondition = {}; + Object.keys( + condition['conditionsMap'] + ).forEach((key) => { + tempCondition[key] = + condition[ + 'conditionsMap' ][key]['value']; + }); + tempCondition['id'] = + condition['id']; + tempCondition['assertionId'] = + assertionItem['id']; + tempCondition['policyName'] = + item.name; + tempData['conditionsList'].push( + tempCondition + ); }); - tempCondition['id'] = - condition['id']; - tempCondition['assertionId'] = - assertionItem['id']; - tempCondition['policyName'] = - item.name; - tempData['conditionsList'].push( - tempCondition + } + let index = 0; + if (item.name.includes('inbound')) { + category = 'inbound'; + tempData['destination_service'] = + serviceName; + tempData['source_services'] = []; + tempData['assertionIdx'] = + assertionItem.id; + jsonData['inbound'].push(tempData); + index = jsonData['inbound'].length; + } else if ( + item.name.includes('outbound') + ) { + category = 'outbound'; + tempData['source_service'] = + serviceName; + tempData['destination_services'] = + []; + tempData['assertionIdx'] = + assertionItem.id; + jsonData['outbound'].push(tempData); + index = jsonData['outbound'].length; + } + //assertion convention for microsegmentation: + //GRANT [Action: -IN / -OUT]:[Source Port]:[Destination Port] [Resource:] ON + // role name will be of the form : :role. + let roleName = + assertionItem.role.substring( + params.domainName.length + 6 ); - }); - } - let index = 0; - if (item.name.includes('inbound')) { - category = 'inbound'; - tempData['destination_service'] = - serviceName; - tempData['source_services'] = []; - tempData['assertionIdx'] = - assertionItem.id; - jsonData['inbound'].push(tempData); - index = jsonData['inbound'].length; - } else if ( - item.name.includes('outbound') - ) { - category = 'outbound'; - tempData['source_service'] = - serviceName; - tempData['destination_services'] = - []; - tempData['assertionIdx'] = - assertionItem.id; - jsonData['outbound'].push(tempData); - index = jsonData['outbound'].length; - } - //assertion convention for microsegmentation: - //GRANT [Action: -IN / -OUT]:[Source Port]:[Destination Port] [Resource:] ON - // role name will be of the form : :role. - let roleName = - assertionItem.role.substring( - params.domainName.length + 6 + promises.push( + getRole( + roleName, + params.domainName, + category, + index + ) ); - promises.push( - getRole( - roleName, - params.domainName, - category, - index - ) - ); - promises.push( - getIdentifier( - roleName, - category, - index - ) - ); - } - ); + promises.push( + getIdentifier( + roleName, + category, + index + ) + ); + } + ); } }); } else if (err) { @@ -2599,11 +2599,11 @@ Fetchr.registerService({ if (category === 'inbound') { jsonData[category][jsonIndex - 1][ 'source_services' - ].push(roleMember.memberName); + ].push(roleMember.memberName); } else if (category === 'outbound') { jsonData[category][jsonIndex - 1][ 'destination_services' - ].push(roleMember.memberName); + ].push(roleMember.memberName); } }); resolve(); @@ -2696,7 +2696,6 @@ Fetchr.registerService({ copyAssertionConditionData['value'] = '*'; } condition[key] = copyAssertionConditionData; - } }); assertionCondition['conditionsMap'] = condition;