Skip to content

Commit

Permalink
allow * as service in microsegmentation
Browse files Browse the repository at this point in the history
Signed-off-by: craman <[email protected]>
  • Loading branch information
craman committed Jan 6, 2022
1 parent 1784c60 commit d1502d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 66 deletions.
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

0 comments on commit d1502d4

Please sign in to comment.