Skip to content

Commit 06d7c14

Browse files
authored
Merge pull request #196 from hemslo/fix-warnings
Fix react warnings on render
2 parents 4f73f93 + 1aa6b1a commit 06d7c14

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

src/components/NamePathList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function DisplayNamePathList({ items }) {
1414
return (
1515
<ul>
1616
{items &&
17-
items.map(item => (
18-
<li>
17+
items.map((item, i) => (
18+
<li key={i}>
1919
<LinkPath item={item} />
2020
</li>
2121
))}

src/components/SearchBar.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,13 @@ function SearchBar({ filterText, handleFilterTextChange, handleSelect, options,
1717
onToggle();
1818
}
1919

20-
function toggleTemplate({ toggleTemplateProps }) {
21-
const { text } = toggleTemplateProps;
22-
return <React.Fragment>{text}</React.Fragment>;
23-
}
24-
2520
if (options !== undefined) {
2621
const menuItems = options.map(i => (
2722
<OptionsMenuItem onSelect={onSelect} isSelected={selected === i} id={i} key={i} className="optionsMenuItem">
2823
{i}
2924
</OptionsMenuItem>
3025
));
31-
const menuToggle = (
32-
<OptionsMenuToggle onToggle={onToggle} toggleTemplate={toggleTemplate} toggleTemplateProps={{ text: selected }} />
33-
);
26+
const menuToggle = <OptionsMenuToggle onToggle={onToggle} toggleTemplate={<>{selected}</>} />;
3427
optionsMenu = (
3528
<OptionsMenu
3629
id="options-menu"

src/pages/elements/Namespaces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Namespaces({ namespaces, users }) {
1010
const [selected, changeSelected] = useState(options[0]);
1111
const [filterText, changeFilterText] = useState('');
1212
if (namespaces.length === 0) {
13-
return <p style={{ 'font-style': 'italic' }}>No namespaces.</p>;
13+
return <p style={{ fontStyle: 'italic' }}>No namespaces.</p>;
1414
}
1515
const headerFormat = value => <Table.Heading>{value}</Table.Heading>;
1616
const cellFormat = value => <Table.Cell>{value}</Table.Cell>;

src/pages/elements/Report.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const Vulnerabilities = ({ vs }) => (
5454
const ReportVulnerabilities = ({ get_ns, vulnerabilities }) => {
5555
let reportVulnerabilitiesTable;
5656
if (vulnerabilities == null) {
57-
reportVulnerabilitiesTable = <p style={{ 'font-style': 'italic' }}>No vulnerabilities.</p>;
57+
reportVulnerabilitiesTable = <p style={{ fontStyle: 'italic' }}>No vulnerabilities.</p>;
5858
} else {
5959
for (let i = 0; i < vulnerabilities.length; i++) {
6060
vulnerabilities[i].ns = get_ns(vulnerabilities[i].cluster, vulnerabilities[i].namespace);
@@ -423,7 +423,7 @@ const MergeActivities = ({ merge_activities }) => {
423423
const PostDeployJobs = ({ get_ns, post_deploy_jobs }) => {
424424
let postDeployJobsTable;
425425
if (post_deploy_jobs == null) {
426-
postDeployJobsTable = <p style={{ 'font-style': 'italic' }}>No post_deploy_jobs.</p>;
426+
postDeployJobsTable = <p style={{ fontStyle: 'italic' }}>No post_deploy_jobs.</p>;
427427
} else {
428428
for (let i = 0; i < post_deploy_jobs.length; i++) {
429429
post_deploy_jobs[i].ns = get_ns(post_deploy_jobs[i].cluster, post_deploy_jobs[i].namespace);
@@ -514,7 +514,7 @@ const PostDeployJobs = ({ get_ns, post_deploy_jobs }) => {
514514
const DeploymentValidations = ({ get_ns, deployment_validations }) => {
515515
let deploymentValidationTable;
516516
if (deployment_validations == null) {
517-
deploymentValidationTable = <p style={{ 'font-style': 'italic' }}>No deployment_validations.</p>;
517+
deploymentValidationTable = <p style={{ fontStyle: 'italic' }}>No deployment_validations.</p>;
518518
} else {
519519
for (let i = 0; i < deployment_validations.length; i++) {
520520
deployment_validations[i].ns = get_ns(deployment_validations[i].cluster, deployment_validations[i].namespace);
@@ -702,7 +702,7 @@ const ServiceSLO = ({ get_ns, service_slo, slo_documents_for_report }) => {
702702
throw new Error(`No SLO documents found relating to SLOs`);
703703
}
704704
if (service_slo == null) {
705-
ServiceSLOTable = <p style={{ 'font-style': 'italic' }}>No service_slo.</p>;
705+
ServiceSLOTable = <p style={{ fontStyle: 'italic' }}>No service_slo.</p>;
706706
} else {
707707
for (let i = 0; i < service_slo.length; i++) {
708708
const slo_doc = get_doc_for_slo(slo_documents_for_report, service_slo[i]);
@@ -818,7 +818,7 @@ function Report({ report, namespaces, saas_files, slo_documents }) {
818818
promotionSection = (
819819
<React.Fragment>
820820
<h4>Promotions</h4>
821-
<p style={{ 'font-style': 'italic' }}>No promotions.</p>
821+
<p style={{ fontStyle: 'italic' }}>No promotions.</p>
822822
</React.Fragment>
823823
);
824824
}
@@ -834,7 +834,7 @@ function Report({ report, namespaces, saas_files, slo_documents }) {
834834
mergeSection = (
835835
<React.Fragment>
836836
<h4>Merge Activties</h4>
837-
<p style={{ 'font-style': 'italic' }}>No merge_activities.</p>
837+
<p style={{ fontStyle: 'italic' }}>No merge_activities.</p>
838838
</React.Fragment>
839839
);
840840
}

src/pages/elements/Service.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const booleanFormat = (t, f) => value => (value ? t : f);
2626
const EscalationPolicy = ({ app }) => {
2727
let escalationPolicyDefinition;
2828
if (app.escalationPolicy == null) {
29-
escalationPolicyDefinition = <p style={{ 'font-style': 'italic' }}>No Escalation Policy.</p>;
29+
escalationPolicyDefinition = <p style={{ fontStyle: 'italic' }}>No Escalation Policy.</p>;
3030
} else {
3131
escalationPolicyDefinition = (
3232
<NonEmptyDefinition
@@ -193,7 +193,7 @@ function Service({ service, reports, saas_files_v2, scorecards }) {
193193

194194
let quayReposTable;
195195
if (service.quayRepos == null) {
196-
quayReposTable = <p style={{ 'font-style': 'italic' }}>No quay repos.</p>;
196+
quayReposTable = <p style={{ fontStyle: 'italic' }}>No quay repos.</p>;
197197
} else {
198198
const quayRepos = service.quayRepos
199199
.map(orgGroup =>
@@ -274,7 +274,7 @@ function Service({ service, reports, saas_files_v2, scorecards }) {
274274
}
275275
let dependenciesTable;
276276
if (service.dependencies == null) {
277-
dependenciesTable = <p style={{ 'font-style': 'italic' }}>No dependencies.</p>;
277+
dependenciesTable = <p style={{ fontStyle: 'italic' }}>No dependencies.</p>;
278278
} else {
279279
dependenciesTable = (
280280
<Table.PfProvider
@@ -357,7 +357,7 @@ function Service({ service, reports, saas_files_v2, scorecards }) {
357357
</div>
358358
);
359359
} else {
360-
reportSection = <p style={{ 'font-style': 'italic' }}>No Latest Report.</p>;
360+
reportSection = <p style={{ fontStyle: 'italic' }}>No Latest Report.</p>;
361361
}
362362

363363
// scorecards

0 commit comments

Comments
 (0)