@lighthouse/common 4.31.1-canary.0 → 4.31.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -87,7 +87,7 @@ function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {
|
|
|
87
87
|
const iconJumpCell = _images.launchIcon ? {
|
|
88
88
|
alignment: 'center',
|
|
89
89
|
fit: [8, 8],
|
|
90
|
-
image: _images.
|
|
90
|
+
image: _images.internalLinkIcon,
|
|
91
91
|
linkToDestination
|
|
92
92
|
} : {
|
|
93
93
|
text: ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/pdf/helpers/build-audit-follow-ups/index.js"],"names":["moment","getStatusDetails","getUserFullName","defaultStyles","horizontalLine","sixColumnTable","launchIcon","internalLinkIcon","LIGHTHOUSE_BASE_URL","buildAuditFollowUps","rawFollowUpIssues","options","console","log","sectionTitle","text","style","font","lineHeight","margin","sectionDivider","followUpIssues","filter","item","errorMessage","length","subTitle","timezone","tableBody","forEach","mappedStatus","status","toUpperCase","small","color","alignment","updatedAt","format","tz","link","issueId","iconLinkCell","fit","image","linkToDestination","questionId","iconJumpCell","assignees","assigneeUsername","push","issueTitle","questionLabel","headerText","headerRow","map","bold","fontSize","followUpsTable","body","widths"],"mappings":";;;;;;AAAA,OAAOA,MAAP,MAAmB,iBAAnB;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,kBAAlD;AACA,SAASC,aAAT,EAAwBC,cAAxB,EAAwCC,cAAxC,QAA8D,KAA9D;AACA,SAASC,UAAT,EAAqBC,gBAArB,QAA6C,iBAA7C,C,CACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,mBAAmB,GAAG,2BAA5B;AAEA,OAAO,SAASC,mBAAT,GAAmE;AAAA,MAAtCC,iBAAsC,uEAAlB,EAAkB;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AACxEC,EAAAA,OAAO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EADO;AAEbhB,MAAAA,KAAK,kCACAb,aAAa,CAAC8B,KADd;AAEHC,QAAAA,KAAK,EAAEJ,YAAY,CAACd,KAAb,CAAmBkB,KAFvB;AAGHC,QAAAA,SAAS,EAAE;AAHR;AAFQ,KAAf;AASA,QAAIC,SAAS,GAAG,EAAhB;;AACA,QAAIb,IAAI,CAACa,SAAT,EAAoB;AAClB,UAAMC,MAAM,GAAG,aAAf,CADkB,CACW;;AAC7BD,MAAAA,SAAS,GAAGpC,MAAM,CAACsC,EAAP,CAAUf,IAAI,CAACa,SAAf,EAA0BT,QAA1B,EAAoCU,MAApC,CAA2CA,MAA3C,CAAZ;AACD;;AAED,QAAME,IAAI,aAAM/B,mBAAN,6BAA4Ce,IAAI,CAACiB,OAAjD,CAAV;AACA,QAAMC,YAAY,GAAGnC,UAAU,GAC3B;AAAE6B,MAAAA,SAAS,EAAE,QAAb;AAAuBO,MAAAA,GAAG,EAAE,CAAC,CAAD,EAAI,CAAJ,CAA5B;AAAoCC,MAAAA,KAAK,EAAErC,UAA3C;AAAuDiC,MAAAA,IAAI,EAAJA;AAAvD,KAD2B,GAE3B;AAAExB,MAAAA,IAAI,EAAE;AAAR,KAFJ,CAlB6B,CAsB7B;;AACA,QAAM6B,iBAAiB,GAAGrB,IAAI,CAACsB,UAA/B;AACA,QAAMC,YAAY,GAAGxC,UAAU,GAC3B;AACE6B,MAAAA,SAAS,EAAE,QADb;AAEEO,MAAAA,GAAG,EAAE,CAAC,CAAD,EAAI,CAAJ,CAFP;AAGEC,MAAAA,KAAK,
|
|
1
|
+
{"version":3,"sources":["../../../../src/pdf/helpers/build-audit-follow-ups/index.js"],"names":["moment","getStatusDetails","getUserFullName","defaultStyles","horizontalLine","sixColumnTable","launchIcon","internalLinkIcon","LIGHTHOUSE_BASE_URL","buildAuditFollowUps","rawFollowUpIssues","options","console","log","sectionTitle","text","style","font","lineHeight","margin","sectionDivider","followUpIssues","filter","item","errorMessage","length","subTitle","timezone","tableBody","forEach","mappedStatus","status","toUpperCase","small","color","alignment","updatedAt","format","tz","link","issueId","iconLinkCell","fit","image","linkToDestination","questionId","iconJumpCell","assignees","assigneeUsername","push","issueTitle","questionLabel","headerText","headerRow","map","bold","fontSize","followUpsTable","body","widths"],"mappings":";;;;;;AAAA,OAAOA,MAAP,MAAmB,iBAAnB;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,kBAAlD;AACA,SAASC,aAAT,EAAwBC,cAAxB,EAAwCC,cAAxC,QAA8D,KAA9D;AACA,SAASC,UAAT,EAAqBC,gBAArB,QAA6C,iBAA7C,C,CACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,mBAAmB,GAAG,2BAA5B;AAEA,OAAO,SAASC,mBAAT,GAAmE;AAAA,MAAtCC,iBAAsC,uEAAlB,EAAkB;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AACxEC,EAAAA,OAAO,CAACC,GAAR,CAAY,qBAAZ,EAAmC;AACjCH,IAAAA,iBAAiB,EAAjBA,iBADiC;AAEjCC,IAAAA,OAAO,EAAPA;AAFiC,GAAnC;AAKA,MAAMG,YAAY,GAAG,CACnB;AACEC,IAAAA,IAAI,EAAE,kBADR;AAEEC,IAAAA,KAAK,EAAE;AACLC,MAAAA,IAAI,EAAE,QADD;AAELC,MAAAA,UAAU,EAAE,GAFP;AAGLC,MAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,EAAV;AAHH;AAFT,GADmB,CAArB;AAUA,MAAMC,cAAc,GAAGhB,cAAc,CAAC;AAAEe,IAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV;AAAV,GAAD,CAArC;AAEA,MAAME,cAAc,GAAGX,iBAAiB,CAACY,MAAlB,CAAyB,UAAAC,IAAI;AAAA,WAAI,CAACA,IAAI,CAACC,YAAV;AAAA,GAA7B,CAAvB;;AACA,MAAI,CAACH,cAAc,CAACI,MAApB,EAA4B;A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ers'\nimport { defaultStyles, horizontalLine, sixColumnTable } from '../'\nimport { launchIcon, internalLinkIcon } from '../../../images'\n// Still to do:\n// *. Setup the page breaks, either on the last item here or the first in the next section\n// - I want to do this in a way that avoids orphans, or at least only add a page break if the result looks balanced\n// - If we can work out the page position of the last follow up item then we can determine whether to use a page break or not\n// *. If you're not using the flag then you should make sure that all of the variables necessary have been passed in\n// - If the required data isn't present then you should probably just not process follow up issues for the document\n// - If you establish this at the start you can build it into the `hasFollowUps` flag\n// *. Is there some way that you can setup an override for the pdfmake version used by storybook?\n\nconst LIGHTHOUSE_BASE_URL = 'https://app.lighthouse.io'\n\nexport function buildAuditFollowUps(rawFollowUpIssues = [], options = {}) {\n console.log('buildAuditFollowUps', {\n rawFollowUpIssues,\n options,\n })\n\n const sectionTitle = [\n {\n text: 'Follow-up Issues',\n style: {\n font: 'Gotham',\n lineHeight: 1.1,\n margin: [0, 0, 0, 50],\n },\n },\n ]\n const sectionDivider = horizontalLine({ margin: [0, 0, 0, 0] })\n\n const followUpIssues = rawFollowUpIssues.filter(item => !item.errorMessage)\n if (!followUpIssues.length) {\n // Show a `no follow up issues` message if there are no follow up issues\n return [\n sectionTitle,\n sectionDivider,\n {\n text: 'No follow up issues exist for this Audit',\n style: defaultStyles.subTitle,\n margin: [0, 5, 0, 50],\n },\n ]\n }\n\n const { timezone = 'America/New_York' } = options\n const tableBody = []\n followUpIssues.forEach(item => {\n const mappedStatus = getStatusDetails(item.status)\n const status = {\n text: mappedStatus.text.toUpperCase(),\n style: {\n ...defaultStyles.small,\n color: mappedStatus.style.color,\n alignment: 'center',\n },\n }\n\n let updatedAt = ''\n if (item.updatedAt) {\n const format = 'MMM D h:mma' // e.g. Jan 21 12:59am in the Audit timezone\n updatedAt = moment.tz(item.updatedAt, timezone).format(format)\n }\n\n const link = `${LIGHTHOUSE_BASE_URL}/reports/issues/${item.issueId}`\n const iconLinkCell = launchIcon\n ? { alignment: 'center', fit: [8, 8], image: launchIcon, link }\n : { text: '' }\n\n // TODO Should we use the same icon for an external link as we do for a jump link?\n const linkToDestination = item.questionId\n const iconJumpCell = launchIcon\n ? {\n alignment: 'center',\n fit: [8, 8],\n image: internalLinkIcon,\n linkToDestination,\n }\n : { text: '' }\n\n const assignees = item.assignees || []\n const assigneeUsername = assignees.length === 0\n ? 'Unassigned'\n : assignees.length === 1\n // TODO Currently this gives `first last`, I don't think it can fall back to 'Unknown User' here\n ? getUserFullName(assignees, 0)\n : `${assignees.length} users`\n \n tableBody.push([\n iconLinkCell,\n { text: item.issueTitle || '', link, style: 'small', image: launchIcon },\n status,\n { text: assigneeUsername, style: 'small' },\n iconJumpCell,\n { text: item.questionLabel || '', style: 'small', linkToDestination },\n { text: updatedAt || '', style: 'small', alignment: 'right' },\n ])\n })\n\n const headerText = [\n '',\n 'Issue Title',\n 'Status',\n 'Assignees',\n '',\n 'Audit Question',\n 'Last Updated',\n ]\n const headerRow = headerText.map(text => ({\n text,\n style: {\n bold: true,\n font: 'Gotham',\n fontSize: 8,\n alignment: 'left',\n },\n }))\n headerRow[2].alignment = 'center'\n headerRow[6].alignment = 'right'\n\n const followUpsTable = sixColumnTable({\n body: [headerRow, ...tableBody],\n style: 'titleTable',\n widths: [6, '*', 55, 55, 6, '*', '18%'],\n margin: [0, 0, 0, 30],\n })\n\n console.log('buildAuditFollowUps', {\n followUpsTable,\n })\n\n return [sectionTitle, sectionDivider, followUpsTable]\n}\n"],"file":"index.js"}
|