-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in r2-2074-insights-api-send-all-columns (pull request #5913)
R2-2074 - Insights API sends back information on all columns and rows, even if all zeros Approved-by: Pavel Nabutovsky Approved-by: Joshua Toliver
- Loading branch information
Showing
82 changed files
with
991 additions
and
940 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/javascript/components/charts/table-values/components/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as InsightsTableHeader } from "../../../insights-sub-report/components/insights-table-header"; | ||
export { default as TableHeader } from "./table-header"; | ||
export { default as TableRows } from "./table-rows"; |
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...sights-sub-report/components/exporter.jsx → ...b-report/components/exporter/exporter.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...b-report/components/exporter.unit.test.js → ...components/exporter/exporter.unit.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/javascript/components/insights-sub-report/components/exporter/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./exporter"; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
app/javascript/components/insights-sub-report/components/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as exporter } from "./exporter"; | ||
export { default as InsightsTableHeader } from "./insights-table-header"; |
43 changes: 43 additions & 0 deletions
43
app/javascript/components/insights-sub-report/components/insights-table-header/component.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import PropTypes from "prop-types"; | ||
import { TableCell, TableRow } from "@material-ui/core"; | ||
import isNil from "lodash/isNil"; | ||
|
||
import css from "./styles.css"; | ||
import { NAME } from "./constants"; | ||
|
||
const InsightsTableHeader = ({ addEmptyCell = true, columns }) => { | ||
const groupedSubcolumns = columns.reduce((acc, column) => ({ ...acc, [column.label]: column.items }), {}); | ||
const subcolumnsNumber = Object.values(groupedSubcolumns) | ||
.flat() | ||
.some(subcolumn => !isNil(subcolumn)); | ||
|
||
return ( | ||
<> | ||
<TableRow className={css.tableRowHeader}> | ||
{addEmptyCell && <TableCell />} | ||
{columns.map(column => ( | ||
<TableCell key={column.label} colSpan={column.colspan || column.items?.length}> | ||
{column.label} | ||
</TableCell> | ||
))} | ||
</TableRow> | ||
{subcolumnsNumber && ( | ||
<TableRow className={css.tableRowSubHeader}> | ||
{addEmptyCell && <TableCell />} | ||
{Object.entries(groupedSubcolumns).flatMap(([parent, subcolumns]) => | ||
subcolumns.map(subcolumn => <TableCell key={`${parent}-${subcolumn}`}>{subcolumn}</TableCell>) | ||
)} | ||
</TableRow> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
InsightsTableHeader.displayName = NAME; | ||
|
||
InsightsTableHeader.propTypes = { | ||
addEmptyCell: PropTypes.bool, | ||
columns: PropTypes.array | ||
}; | ||
|
||
export default InsightsTableHeader; |
2 changes: 2 additions & 0 deletions
2
app/javascript/components/insights-sub-report/components/insights-table-header/constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* eslint-disable import/prefer-default-export */ | ||
export const NAME = "InsightsTableHeader"; |
1 change: 1 addition & 0 deletions
1
app/javascript/components/insights-sub-report/components/insights-table-header/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./component"; |
17 changes: 17 additions & 0 deletions
17
app/javascript/components/insights-sub-report/components/insights-table-header/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.tableRowSubHeader { | ||
& th { | ||
border-right: 1px solid var(--c-light-grey-2); | ||
} | ||
} | ||
|
||
.tableRowHeader { | ||
& th:not(:first-child) { | ||
background-color: var(--c-light-grey); | ||
font-weight: bold; | ||
border-left: 1px solid var(--c-light-grey-2); | ||
} | ||
|
||
& th:last-of-type { | ||
border-right: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.