Skip to content

Commit

Permalink
Notification page throws an error when the user/service mentioned con…
Browse files Browse the repository at this point in the history
…tains * pattern (AthenZ#1149)

Co-authored-by: pgote <[email protected]>
  • Loading branch information
pratikgote and pgote authored Oct 15, 2020
1 parent b9482f7 commit 95a3bc5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
21 changes: 17 additions & 4 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import TextArea from '../denali/TextArea';
import FlatPicker from '../flatpicker/FlatPicker';
import Icon from '../denali/icons/Icon';
import DateUtils from '../utils/DateUtils';
import NameUtils from '../utils/NameUtils';

const TableTd = styled.td`
text-align: left;
Expand Down Expand Up @@ -109,7 +110,7 @@ export default class PendingApprovalTableRow extends React.Component {
render() {
const key =
this.props.domainName + this.props.memberName + this.props.roleName;
const fpkey = key.replace(/\./g, '_');
const fpkey = NameUtils.getFlatPickrKey(key);
let approveColor = this.props.checked
? colors.grey500
: colors.green600;
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/role/AddMemberForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import FlatPicker from '../flatpicker/FlatPicker';
import DateUtils from '../utils/DateUtils';
import Color from '../denali/Color';
import RequestUtils from '../utils/RequestUtils';
import NameUtils from '../utils/NameUtils';

const SectionsDiv = styled.div`
width: 100%;
Expand Down Expand Up @@ -197,7 +198,7 @@ export default class AddMemberForm extends React.Component {
<FlatPicker
onChange={memberExpiryChanged}
clear={this.state.memberExpiry}
id={this.props.role.replace(/\./g, '_')}
id={NameUtils.getFlatPickrKey(this.props.role)}
/>
</FlatPickrInputDiv>
</div>
Expand All @@ -208,7 +209,7 @@ export default class AddMemberForm extends React.Component {
clear={this.state.memberReviewReminder}
placeholder='Reminder (Optional)'
id={
this.props.role.replace(/\./g, '_') +
NameUtils.getFlatPickrKey(this.props.role) +
'-reminder'
}
/>
Expand Down
4 changes: 4 additions & 0 deletions ui/src/components/utils/NameUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class NameUtils {
resource = resource.trim();
return resource.includes(':') ? resource : `${domainId}:${resource}`;
}

static getFlatPickrKey(key) {
return key.replace(/\./g, '_').replace(/\W/g, '_');
}
}

export default NameUtils;

0 comments on commit 95a3bc5

Please sign in to comment.