Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLT-4261] TAT trend report table metrics #232

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/add_GLT-4261
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TAT trend report table metrics
8 changes: 8 additions & 0 deletions src/main/resources/templates/tat-trend.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ <h1 class="text-green-200 font-sarabun font-light text-32">TAT Trend Report</h1>
<option value="DataRelease">Data Release (DR)</option>
<option value="All">All</option>
</select>
<button id="metricsButton"
class="noprint bg-green-200 rounded-md hover:ring-2 ring-offset-1 ring-green-200 text-white font-inter font-medium text-12 px-2 py-1">Metrics</button>
</div>
</div>
<div id="gatesCheckboxes" class="flex gap-2 mt-2 font-inter font-medium text-12 items-center">
Expand All @@ -55,6 +57,12 @@ <h1 class="text-green-200 font-sarabun font-light text-32">TAT Trend Report</h1>
</div>

<div id="plotContainer"></div>
<div class="flex justify-end mt-4">
<button id="metricsDownload"
class="noprint bg-green-200 rounded-md hover:ring-2 ring-offset-1 ring-green-200 text-white font-inter font-medium text-12 px-2 py-1">Download
Metrics</button>
wuall826 marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div id="metricContainer"></div>
</div>
<script src="/js/tatTrend.js"></script>
</div>
Expand Down
48 changes: 36 additions & 12 deletions ts/component/table-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export interface TableDefinition<ParentType, ChildType> {
// when a parent object has no children, noChildrenWarning is displayed with warning highlight.
// if noChildrenWarning is not provided, 'N/A' is displayed instead
noChildrenWarning?: string;
parentHeaders?: Array<{ title: string; colspan: number }>;
}

class AcceptedFilter {
Expand Down Expand Up @@ -690,20 +691,43 @@ export class TableBuilder<ParentType, ChildType> {
private addTableHead(table: HTMLTableElement) {
this.thead = table.createTHead();
this.thead.className = "relative";
const row = this.thead.insertRow();
if (this.definition.bulkActions) {
this.addSelectAllHeader(row);
if (this.definition.parentHeaders) {
wuall826 marked this conversation as resolved.
Show resolved Hide resolved
// create the first row with parent headers
const parentRow = this.thead.insertRow();
this.definition.parentHeaders.forEach((parentHeader) => {
const th = document.createElement("th");
th.textContent = parentHeader.title;
th.colSpan = parentHeader.colspan; // set the colspan to cover subcolumns
th.className =
"p-4 font-semibold bg-grey-300 text-center text-white border-l-1 border-grey-200";
parentRow.appendChild(th);
});
// create the second row for child headers
const childRow = this.thead.insertRow();
this.columns.forEach((column, i) => {
const th = document.createElement("th");
th.textContent = column.title; // populate it dynamically based on the provided columns
th.className =
"p-4 font-semibold bg-grey-200 text-left border-l-1 border-grey-200";
wuall826 marked this conversation as resolved.
Show resolved Hide resolved
childRow.appendChild(th);
});
wuall826 marked this conversation as resolved.
Show resolved Hide resolved
} else {
this.selectAllCheckbox = undefined;
// only one row of headers (normal case)
const row = this.thead.insertRow();
if (this.definition.bulkActions) {
this.addSelectAllHeader(row);
} else {
this.selectAllCheckbox = undefined;
}
this.columns.forEach((column, i) => {
addColumnHeader(
row,
column.title,
i == 0 && !this.definition.bulkActions,
column.headingClass
);
});
}
this.columns.forEach((column, i) => {
addColumnHeader(
row,
column.title,
i == 0 && !this.definition.bulkActions,
column.headingClass
);
});
}

private addSelectAllHeader(thead: HTMLTableRowElement) {
Expand Down
Loading
Loading