From 75423a034c7b7e54b2caaf93d8cad94d78a73a82 Mon Sep 17 00:00:00 2001 From: Ally Wu <wuall826@gmail.com> Date: Fri, 15 Nov 2024 13:45:52 -0500 Subject: [PATCH 1/4] [GLT-4301] fixed QC report table display --- changes/fix_GLT-4301 | 1 + ts/util/html-utils.ts | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 changes/fix_GLT-4301 diff --git a/changes/fix_GLT-4301 b/changes/fix_GLT-4301 new file mode 100644 index 00000000..1d5f3aff --- /dev/null +++ b/changes/fix_GLT-4301 @@ -0,0 +1 @@ +QC report for samples were not being displayed \ No newline at end of file diff --git a/ts/util/html-utils.ts b/ts/util/html-utils.ts index decc920d..8e9bed85 100644 --- a/ts/util/html-utils.ts +++ b/ts/util/html-utils.ts @@ -10,17 +10,13 @@ export function addColumnHeader( colspan?: number ) { const th = document.createElement("th"); - th.className = - `p-4 text-white font-semibold ${bgColor} text-left align-text-top` + - (firstColumn ? "" : " border-grey-200 border-l-1"); - if (addClass) { - th.classList.add(addClass); - } - if (colspan) { - th.colSpan = colspan; - } - // allow line-wrapping on "/" character + th.className = `p-4 text-white font-semibold ${bgColor + .trim() + .replace(/\s+/g, "-")} text-left align-text-top ${ + !firstColumn ? "border-grey-200 border-l-1" : "" + } ${addClass ? addClass.split(/\s+/).join(" ") : ""}`; + if (colspan) th.colSpan = colspan; header.split("/").forEach((part, index, arr) => { th.appendChild(document.createTextNode(`${index > 0 ? "/" : ""}${part}`)); if (index < arr.length - 1) { From 9091bb178580eb45d8df76b192d7db665ab9ebf5 Mon Sep 17 00:00:00 2001 From: Ally Wu <wuall826@gmail.com> Date: Tue, 19 Nov 2024 16:30:01 -0500 Subject: [PATCH 2/4] comments implemented --- changes/fix_GLT-4301 | 2 +- ts/component/table-builder.ts | 8 +++++++- ts/util/html-utils.ts | 25 ++++++++++++++++++------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/changes/fix_GLT-4301 b/changes/fix_GLT-4301 index 1d5f3aff..2f9b96b4 100644 --- a/changes/fix_GLT-4301 +++ b/changes/fix_GLT-4301 @@ -1 +1 @@ -QC report for samples were not being displayed \ No newline at end of file +Case QC Report sample tables were not being displayed \ No newline at end of file diff --git a/ts/component/table-builder.ts b/ts/component/table-builder.ts index 2f90f792..e68ebe23 100644 --- a/ts/component/table-builder.ts +++ b/ts/component/table-builder.ts @@ -730,7 +730,13 @@ export class TableBuilder<ParentType, ChildType> { ? `text-black ${column.headingClass || ""}`.trim() : `text-white ${column.headingClass || ""}`.trim(); const bgColor = isChildHeader ? "bg-grey-100" : "bg-grey-300"; - addColumnHeader(row, column.title, isFirstColumn, combinedClass, bgColor); + addColumnHeader( + row, + column.title, + isFirstColumn, + [combinedClass], + bgColor + ); }); } diff --git a/ts/util/html-utils.ts b/ts/util/html-utils.ts index 8e9bed85..3c012358 100644 --- a/ts/util/html-utils.ts +++ b/ts/util/html-utils.ts @@ -5,18 +5,29 @@ export function addColumnHeader( thead: HTMLTableRowElement, header: string, firstColumn: boolean, - addClass?: string, + addClass: string[] = [], bgColor: string = "bg-grey-300", colspan?: number ) { const th = document.createElement("th"); + // combine classes into a single string + const baseClasses = [ + "p-4", + "text-white", + "font-semibold", + bgColor, + "text-left", + "align-text-top", + ...addClass, + ]; + if (!firstColumn) { + baseClasses.push("border-grey-200", "border-l-1"); + } + th.className = baseClasses.join(" "); + if (colspan) { + th.colSpan = colspan; + } // allow line-wrapping on "/" character - th.className = `p-4 text-white font-semibold ${bgColor - .trim() - .replace(/\s+/g, "-")} text-left align-text-top ${ - !firstColumn ? "border-grey-200 border-l-1" : "" - } ${addClass ? addClass.split(/\s+/).join(" ") : ""}`; - if (colspan) th.colSpan = colspan; header.split("/").forEach((part, index, arr) => { th.appendChild(document.createTextNode(`${index > 0 ? "/" : ""}${part}`)); if (index < arr.length - 1) { From 6c93347270d44b96e38e943f087a8fa11ce0a280 Mon Sep 17 00:00:00 2001 From: Ally Wu <wuall826@gmail.com> Date: Wed, 20 Nov 2024 10:57:35 -0500 Subject: [PATCH 3/4] fixup --- ts/component/table-builder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/component/table-builder.ts b/ts/component/table-builder.ts index e68ebe23..e65e288a 100644 --- a/ts/component/table-builder.ts +++ b/ts/component/table-builder.ts @@ -730,11 +730,12 @@ export class TableBuilder<ParentType, ChildType> { ? `text-black ${column.headingClass || ""}`.trim() : `text-white ${column.headingClass || ""}`.trim(); const bgColor = isChildHeader ? "bg-grey-100" : "bg-grey-300"; + const combinedClassArray = combinedClass.split(/\s+/); addColumnHeader( row, column.title, isFirstColumn, - [combinedClass], + combinedClassArray, bgColor ); }); From aff305269810a1b9b94814b4a92db324c20b3a94 Mon Sep 17 00:00:00 2001 From: Ally Wu <wuall826@gmail.com> Date: Thu, 21 Nov 2024 10:56:02 -0500 Subject: [PATCH 4/4] more fixups --- ts/component/table-builder.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/ts/component/table-builder.ts b/ts/component/table-builder.ts index e65e288a..f3127062 100644 --- a/ts/component/table-builder.ts +++ b/ts/component/table-builder.ts @@ -726,18 +726,12 @@ export class TableBuilder<ParentType, ChildType> { this.columns.forEach((column, i) => { const isFirstColumn = i === 0 && !this.definition.bulkActions; const isChildHeader = !!this.definition.parentHeaders; - const combinedClass = isChildHeader - ? `text-black ${column.headingClass || ""}`.trim() - : `text-white ${column.headingClass || ""}`.trim(); + const combinedClass = isChildHeader ? ["text-black"] : ["text-white"]; + if (column.headingClass) { + combinedClass.push(column.headingClass); + } const bgColor = isChildHeader ? "bg-grey-100" : "bg-grey-300"; - const combinedClassArray = combinedClass.split(/\s+/); - addColumnHeader( - row, - column.title, - isFirstColumn, - combinedClassArray, - bgColor - ); + addColumnHeader(row, column.title, isFirstColumn, combinedClass, bgColor); }); }