Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI fix: group review submitted for wrong domain #2655

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/src/__tests__/redux/thunk/groups.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ describe('reviewGroup method', () => {
const fakeDispatch = sinon.spy();

await reviewGroup(
domainName,
'singlegroup',
{ name: 'singlegroup' },
'auditRef',
Expand Down
4 changes: 2 additions & 2 deletions ui/src/__tests__/server/handlers/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ describe('Fetchr Server API Test', () => {
principal: 'user.dummy1',
assertions: [
{
dummyProperty: 'dummyValue'
dummyProperty: 'dummyValue',
},
],
},
Expand Down Expand Up @@ -1312,7 +1312,7 @@ describe('Fetchr Server API Test', () => {
principal: 'user.dummy1',
assertions: [
{
dummyProperty: 'dummyValue'
dummyProperty: 'dummyValue',
},
],
},
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/denali/TabGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -175,7 +176,7 @@ class TabGroup extends React.PureComponent {
<br />({splitLabel[1]}
</span>
);
};
}

return (
<div
Expand Down
18 changes: 15 additions & 3 deletions ui/src/components/domain/UserDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ class UserDomains extends React.Component {
verticalAlign={'baseline'}
/>
</UserAdminLogoDiv>
<Link href={PageUtils.rolePage(domainName)} passHref legacyBehavior>
<Link
href={PageUtils.rolePage(domainName)}
passHref
legacyBehavior
>
<StyledAnchor active={currentDomain === domainName}>
{domainName}
</StyledAnchor>
Expand Down Expand Up @@ -177,11 +181,19 @@ class UserDomains extends React.Component {
My Domains
</ManageDomainsTitleDiv>
<div>
<Link href={PageUtils.createDomainPage()} passHref legacyBehavior>
<Link
href={PageUtils.createDomainPage()}
passHref
legacyBehavior
>
<StyledAnchor>Create</StyledAnchor>
</Link>
<DividerSpan> | </DividerSpan>
<Link href={PageUtils.manageDomainPage()} passHref legacyBehavior>
<Link
href={PageUtils.manageDomainPage()}
passHref
legacyBehavior
>
<StyledAnchor>Manage</StyledAnchor>
</Link>
</div>
Expand Down
7 changes: 5 additions & 2 deletions ui/src/components/group/GroupReviewTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class GroupReviewTable extends React.Component {
});
this.props
.reviewGroup(
this.props.domain,
this.props.groupName,
group,
this.state.justification,
Expand Down Expand Up @@ -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);
3 changes: 1 addition & 2 deletions ui/src/components/group/GroupRoleTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down Expand Up @@ -153,7 +153,6 @@ const mapStateToProps = (state, props) => {
...props,
isLoading: selectIsLoading(state),
timeZone: selectTimeZone(state),

};
};

Expand Down
30 changes: 25 additions & 5 deletions ui/src/components/header/NameHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,20 @@ class NameHeader extends React.Component {
<TitleDiv data-testid='collection-name-header'>
{roleTypeIcon}
{roleAuditIcon}
<Link href={PageUtils.rolePage(domain)} passHref legacyBehavior>
<Link
href={PageUtils.rolePage(domain)}
passHref
legacyBehavior
>
<StyledAnchor>{domain}</StyledAnchor>
</Link>
:role.{collection}
{' (Delegated to '}
<Link href={PageUtils.rolePage(deDomain)} passHref legacyBehavior>
<Link
href={PageUtils.rolePage(deDomain)}
passHref
legacyBehavior
>
<StyledAnchor>{deDomain}</StyledAnchor>
</Link>
{')'}
Expand All @@ -111,7 +119,11 @@ class NameHeader extends React.Component {
let link;
if (this.props.category === 'group') {
link = (
<Link href={PageUtils.groupPage(domain)} passHref legacyBehavior>
<Link
href={PageUtils.groupPage(domain)}
passHref
legacyBehavior
>
<StyledAnchor>{domain}</StyledAnchor>
</Link>
);
Expand All @@ -123,13 +135,21 @@ class NameHeader extends React.Component {
);
} else if (this.props.category === 'policy') {
link = (
<Link href={PageUtils.servicePage(domain)} passHref legacyBehavior>
<Link
href={PageUtils.servicePage(domain)}
passHref
legacyBehavior
>
<StyledAnchor>{domain}</StyledAnchor>
</Link>
);
} else if (this.props.category === 'service') {
link = (
<Link href={PageUtils.servicePage(domain)} passHref legacyBehavior>
<Link
href={PageUtils.servicePage(domain)}
passHref
legacyBehavior
>
<StyledAnchor>{domain}</StyledAnchor>
</Link>
);
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/history/HistoryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
38 changes: 19 additions & 19 deletions ui/src/components/microsegmentation/AddSegmentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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 (
<Member
key={idx}
item={newItem}
onClickRemove={remove}
noanim
/>
);
})
// 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 (
<Member
key={idx}
item={newItem}
onClickRemove={remove}
noanim
/>
);
})
: '';

let sections = (
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/microsegmentation/EnforcementStateList.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ class EnforcementStateList extends React.Component {
>
<StyleTable>
<thead>
<StyledTr>
<StyledTh> Enforcement State </StyledTh>
<StyledTh> Hosts </StyledTh>
<StyledTh> Scope </StyledTh>
<StyledTh> Action </StyledTh>
</StyledTr>
<StyledTr>
<StyledTh> Enforcement State </StyledTh>
<StyledTh> Hosts </StyledTh>
<StyledTh> Scope </StyledTh>
<StyledTh> Action </StyledTh>
</StyledTr>
</thead>
<tbody>{rows}</tbody>
</StyleTable>
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/review/ReviewList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/utils/MemberUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
10 changes: 8 additions & 2 deletions ui/src/components/visibility/ServiceDependencyResGroupRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export default class ServiceDependencyResGroupRoles extends React.Component {
roleEntry.resourceGroupRole
}
>
<Link href={roleEntry.roleLink} style={{ textDecoration: 'none' }}>
<Link
href={roleEntry.roleLink}
style={{ textDecoration: 'none' }}
>
{roleEntry.resourceGroupRole}
</Link>
{' '}
Expand Down Expand Up @@ -88,7 +91,10 @@ export default class ServiceDependencyResGroupRoles extends React.Component {
roleEntry.resourceGroupRole
}
>
<Link href={roleEntry.roleLink} style={{ textDecoration: 'none' }}>
<Link
href={roleEntry.roleLink}
style={{ textDecoration: 'none' }}
>
{roleEntry.resourceGroupRole}
</Link>
{' '}
Expand Down
6 changes: 5 additions & 1 deletion ui/src/pages/search/[type]/[searchterm].js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ class PageSearchDetails extends React.Component {
items.push(
<ResultsDiv key={domain}>
<DomainLogoDiv>{icon}</DomainLogoDiv>
<Link href={PageUtils.rolePage(domain)} passHref legacyBehavior>
<Link
href={PageUtils.rolePage(domain)}
passHref
legacyBehavior
>
<StyledAnchor>{domain}</StyledAnchor>
</Link>
</ResultsDiv>
Expand Down
5 changes: 4 additions & 1 deletion ui/src/pages/workflow/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions ui/src/redux/thunks/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions ui/src/redux/thunks/utils/microsegmentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const buildInboundOutbound = (domainName, state) => {
tempCondition[key] =
condition['conditionsMap'][key][
'value'
];
];
}
);
tempCondition['id'] = condition['id'];
Expand Down Expand Up @@ -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);
}
});
}
Expand Down
Loading