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

allow * as service in microsegmentation #1737

Merged
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
48 changes: 3 additions & 45 deletions ui/src/components/microsegmentation/AddSegmentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,9 @@ export default class AddSegmentation extends React.Component {
}
let names = NameUtils.splitNames(sourceServiceName);
for (let i = 0; i < names.length; i++) {
if (!names[i].includes('*')) {
members.push({
memberName: names[i],
});
}
members.push({
memberName: names[i],
});
}

if (this.state.isCategory) {
Expand Down Expand Up @@ -544,26 +542,6 @@ export default class AddSegmentation extends React.Component {
return 1;
}

for (let member of this.state.members) {
if (member.memberName.includes('*')) {
this.setState({
errorMessage:
'Service name cannot contain wildcard (*) characters',
saving: 'todo',
});
return 1;
}
}

if (this.state.sourceServiceMembers.includes('*')) {
this.setState({
errorMessage:
'Service name cannot contain wildcard (*) characters',
saving: 'todo',
});
return 1;
}

if (!this.state.sourcePort || this.state.sourcePort === '') {
this.setState({
errorMessage: 'Source port is required.',
Expand Down Expand Up @@ -611,26 +589,6 @@ export default class AddSegmentation extends React.Component {
return 1;
}

for (let member of this.state.members) {
if (member.memberName.includes('*')) {
this.setState({
errorMessage:
'Service name cannot contain wildcard (*) characters',
saving: 'todo',
});
return 1;
}
}

if (this.state.destinationServiceMembers.includes('*')) {
this.setState({
errorMessage:
'Service name cannot contain wildcard (*) characters',
saving: 'todo',
});
return 1;
}

if (
!this.state.destinationPort ||
this.state.destinationPort === ''
Expand Down
23 changes: 2 additions & 21 deletions ui/src/components/microsegmentation/ServiceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ const StyledLink = styled.a`
cursor: pointer;
`;

const StyledInvalidLink = styled.a`
color: red;
`;
const StyledInvalidLink = styled.a``;

const StyledMessageDiv = styled.div`
min-width: 200px;
Expand Down Expand Up @@ -112,24 +110,7 @@ class ServiceList extends React.Component {
</StyledLink>
)}

{item.includes('*') && (
<StyledMenu
placement='right'
trigger={
<StyledInvalidLink>
{' '}
{item}{' '}
</StyledInvalidLink>
}
>
<StyledMessageDiv>
<p>
Service is invalid as it contains
wildcard characters.
</p>
</StyledMessageDiv>
</StyledMenu>
)}
{item.includes('*') && <p>{item} </p>}
</StyledTd>
</StyledTr>
);
Expand Down