Skip to content

Commit

Permalink
Fix missing notes, spaces after commas, and urlEncode in exports
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcnulty committed Oct 23, 2023
1 parent 21683d2 commit 7d3952a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions site/gatsby-site/src/utils/checklists.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const exportJson = (checklist) => {

const a = document.createElement('a');

a.setAttribute('href', 'data:text/json,' + json);
a.setAttribute('href', 'data:text/json,' + encodeURIComponent(json));
a.setAttribute('download', `${checklist.name} - Risk Checklist.json`);
a.click();
};
Expand Down Expand Up @@ -179,11 +179,11 @@ const exportHtml = (checklist) => {
<div className="value">{risk.severity}</div>
</section>
)}
{risk.notes && (
{risk.risk_notes && (
<section className="notes">
<h4 className="title">Notes</h4>
<div className="value text" style={{ whiteSpace: 'pre-wrap' }}>
{risk.notes}
{risk.risk_notes}
</div>
</section>
)}
Expand Down Expand Up @@ -222,9 +222,9 @@ const exportCsv = (checklist) => {
const csv = rowsToCsv([
['Title', checklist.name],
['About', checklist.about],
['Goals Tags', checklist.tags_goals],
['Methods Tags', checklist.tags_methods],
['Other Tags', checklist.tags_other],
['Goals Tags', (checklist.tags_goals || []).join(', ')],
['Methods Tags', (checklist.tags_methods || []).join(', ')],
['Other Tags', (checklist.tags_other || []).join(', ')],
[''],
['== Risks =='],
[''],
Expand All @@ -235,8 +235,8 @@ const exportCsv = (checklist) => {
['Status', /* */ r.risk_status],
['Severity', /* */ r.severity],
['Likelihood', /* */ r.likelihood],
['Precedents (AIID #)', r.precedents.map((p) => p.incident_id)],
['Notes', /* */ r.notes],
['Precedents (AIID #)', (r.precedents || []).map((p) => p.incident_id).join(', ')],
['Notes', /* */ r.risk_notes],

// Show headings in first row, values in rest
].map((pair) => (i == 0 ? pair[0] : pair[1]))
Expand Down

0 comments on commit 7d3952a

Please sign in to comment.