Skip to content

Commit

Permalink
fix(insights): fix insights display configs in notebooks (#18456)
Browse files Browse the repository at this point in the history
* feat(notebooks): allow editing the insight config in notebooks

* remove propsQuery

* show header

* Update frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx

Co-authored-by: David Newell <[email protected]>

---------

Co-authored-by: David Newell <[email protected]>
  • Loading branch information
thmsobrmlr and daibhin authored Nov 7, 2023
1 parent fb80cae commit ccd53c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 2 additions & 9 deletions frontend/src/scenes/insights/insightDataLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,14 @@ export const insightDataLogic = kea<insightDataLogicType>([

selectors({
query: [
(s) => [s.propsQuery, s.filters, s.insight, s.internalQuery, s.filterTestAccountsDefault],
(propsQuery, filters, insight, internalQuery, filterTestAccountsDefault) =>
propsQuery ||
(s) => [s.filters, s.insight, s.internalQuery, s.filterTestAccountsDefault],
(filters, insight, internalQuery, filterTestAccountsDefault) =>
internalQuery ||
insight.query ||
(filters && filters.insight ? queryFromFilters(filters) : undefined) ||
queryFromKind(NodeKind.TrendsQuery, filterTestAccountsDefault),
],

propsQuery: [
() => [(_, props) => props],
// overwrite query from props for standalone InsightVizNode queries
(props: InsightLogicProps) => (props.dashboardItemId?.startsWith('new-AdHoc.') ? props.query : null),
],

isQueryBasedInsight: [
(s) => [s.query],
(query) => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Component = ({ attributes }: NotebookNodeProps<NotebookNodeQueryAttributes
<div
className={clsx('flex flex-1 flex-col', NodeKind.DataTableNode === modifiedQuery.kind && 'overflow-hidden')}
>
<Query query={modifiedQuery} uniqueKey={nodeId} readOnly={true} />
<Query query={modifiedQuery} uniqueKey={nodeId} />
</div>
)
}
Expand Down Expand Up @@ -126,6 +126,7 @@ export const Settings = ({

if (NodeKind.InsightVizNode === modifiedQuery.kind || NodeKind.SavedInsightNode === modifiedQuery.kind) {
modifiedQuery.showFilters = true
modifiedQuery.showHeader = true
modifiedQuery.showResults = false
modifiedQuery.embedded = true
}
Expand Down

0 comments on commit ccd53c1

Please sign in to comment.