Fixed js warnings

This commit is contained in:
VakarisZ 2020-10-06 17:20:26 +03:00
parent 4a44a38be5
commit 18aa5fe320
5 changed files with 15 additions and 10 deletions

View File

@ -83,7 +83,7 @@ const getContents = (props) => {
<h5>Keys for custom user</h5>
<p>1. Open the IAM console at <a href={'https://console.aws.amazon.com/iam/'}
target={'_blank'}>https://console.aws.amazon.com/iam/</a>.</p>
target={'_blank'} rel="noopener noreferrer">https://console.aws.amazon.com/iam/</a>.</p>
<p>2. In the navigation pane, choose Users.</p>
<p>3. Choose the name of the user whose access keys you want to create, and then choose the Security credentials
tab.</p>

View File

@ -20,7 +20,7 @@ const authComponent = new AuthComponent({})
const getContents = (props) => {
const [description, setDescription] = useState("Loading...");
const [description, setDescription] = useState('Loading...');
const [iconType, setIconType] = useState('spinning-icon');
const [icon, setIcon] = useState(faSync);

View File

@ -22,7 +22,8 @@ export default function ResourceDropdown(props) {
<button className={'btn-collapse'}
onClick={() => setIsCollapseOpen(!isCollapseOpen)}>
<span>
{resource_value.hasOwnProperty('name') ? resource_value.name : props.resource_path}
{Object.prototype.hasOwnProperty.call(resource_value, 'name') ?
resource_value.name : props.resource_path}
</span>
<span>
<FontAwesomeIcon icon={isCollapseOpen ? faChevronDown : faChevronUp}/>

View File

@ -11,7 +11,7 @@ export default function RuleDisplay(props) {
<h3>{props.rule.description}({props.rule.service})</h3>
</div>
<div className={'rationale'}>
<p dangerouslySetInnerHTML={{__html: props.rule.rationale}} />
<p dangerouslySetInnerHTML={{__html: props.rule.rationale}}/>
</div>
<div className={'checked-resources'}>
<p className={'checked-resources-title'}>Resources checked: </p>
@ -28,7 +28,10 @@ export default function RuleDisplay(props) {
function getReferences() {
let references = []
props.rule.references.forEach(reference => {
references.push(<a href={reference} className={'reference-link'} target={'_blank'}>{reference}</a>)
references.push(<a href={reference}
className={'reference-link'}
target={'_blank'}
rel="noopener noreferrer">{reference}</a>)
})
return (
<div className={'reference-list'}>
@ -40,7 +43,8 @@ export default function RuleDisplay(props) {
function getResources() {
let resources = []
props.rule.items.forEach(item => {
let template_path = props.rule.hasOwnProperty('display_path') ? props.rule.display_path : props.rule.path;
let template_path = Object.prototype.hasOwnProperty.call(props.rule, 'display_path')
? props.rule.display_path : props.rule.path;
resources.push(<ResourceDropdown resource_path={item}
template_path={template_path}
scoutsuite_data={props.scoutsuite_data}/>)

View File

@ -53,13 +53,13 @@ export default function ScoutSuiteSingleRuleDropdown(props) {
let ruleStatus = getRuleStatus(props.rule);
switch (ruleStatus) {
case STATUSES.STATUS_PASSED:
return "collapse-success";
return 'collapse-success';
case STATUSES.STATUS_VERIFY:
return "collapse-danger";
return 'collapse-danger';
case STATUSES.STATUS_FAILED:
return "collapse-danger";
return 'collapse-danger';
case STATUSES.STATUS_UNEXECUTED:
return "collapse-default";
return 'collapse-default';
}
}