diff --git a/adminSiteClient/ChartList.tsx b/adminSiteClient/ChartList.tsx index 157ba0c896a..521d71aa992 100644 --- a/adminSiteClient/ChartList.tsx +++ b/adminSiteClient/ChartList.tsx @@ -27,6 +27,9 @@ export interface ChartListItem { publishedAt: string publishedBy: string + hasParentIndicator?: boolean + isInheritanceEnabled?: boolean + tags: DbChartTagJoin[] } @@ -101,6 +104,11 @@ export class ChartList extends React.Component<{ render() { const { charts, searchHighlight } = this.props const { availableTags } = this + + // if the first chart has inheritance information, we assume all charts have it + const showInheritanceColumn = + charts[0]?.isInheritanceEnabled !== undefined + return (
Chart | Id | Type | + {showInheritanceColumn &&Inheritance | }Tags | Published | Last Updated | @@ -124,6 +133,7 @@ export class ChartList extends React.Component<{ availableTags={availableTags} searchHighlight={searchHighlight} onDelete={this.onDeleteChart} + showInheritanceColumn={showInheritanceColumn} /> ))} diff --git a/adminSiteClient/ChartRow.tsx b/adminSiteClient/ChartRow.tsx index ef1ba985090..e3fcefb6c01 100644 --- a/adminSiteClient/ChartRow.tsx +++ b/adminSiteClient/ChartRow.tsx @@ -19,6 +19,7 @@ export class ChartRow extends React.Component<{ searchHighlight?: (text: string) => string | React.ReactElement availableTags: DbChartTagJoin[] onDelete: (chart: ChartListItem) => void + showInheritanceColumn?: boolean }> { static contextType = AdminAppContext context!: AdminAppContextType @@ -40,7 +41,8 @@ export class ChartRow extends React.Component<{ } render() { - const { chart, searchHighlight, availableTags } = this.props + const { chart, searchHighlight, availableTags, showInheritanceColumn } = + this.props const highlight = searchHighlight || lodash.identity @@ -80,6 +82,7 @@ export class ChartRow extends React.Component<{{chart.id} | {showChartType(chart)} | + {showInheritanceColumn &&
|
+
+ // if the chart doesn't have a parent, inheritance doesn't apply
+ if (!chart.hasParentIndicator) return n/a | + + return chart.isInheritanceEnabled ?enabled | :disabled | +} diff --git a/adminSiteServer/apiRouter.ts b/adminSiteServer/apiRouter.ts index b14ce09592c..4f0be5575bd 100644 --- a/adminSiteServer/apiRouter.ts +++ b/adminSiteServer/apiRouter.ts @@ -56,6 +56,8 @@ import { mergeGrapherConfigs, diffGrapherConfigs, omitUndefinedValues, + getParentVariableIdFromChartConfig, + omit, } from "@ourworldindata/utils" import { applyPatch } from "../adminShared/patchHelper.js" import { @@ -94,6 +96,7 @@ import { DbInsertUser, FlatTagGraph, DbRawChartConfig, + parseChartConfig, } from "@ourworldindata/types" import { uuidv7 } from "uuidv7" import { @@ -1408,10 +1411,15 @@ getRouteWithROTransaction( variable.catalogPath += `#${variable.shortName}` } - const charts = await db.knexRaw
---|