Skip to content

Commit

Permalink
feat: add saved insight to notebook (#17551)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Sep 21, 2023
1 parent f121d51 commit b515bed
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 23 additions & 2 deletions frontend/src/scenes/insights/InsightPageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { EditableField } from 'lib/components/EditableField/EditableField'

import { AvailableFeature, ExporterFormat, InsightLogicProps, InsightModel, InsightShortId, ItemMode } from '~/types'
import {
AvailableFeature,
ExporterFormat,
InsightLogicProps,
InsightModel,
InsightShortId,
ItemMode,
NotebookNodeType,
} from '~/types'
import { IconLock } from 'lib/lemon-ui/icons'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
Expand Down Expand Up @@ -33,6 +41,8 @@ import { summarizeInsight } from 'scenes/insights/summarizeInsight'
import { AddToDashboardModal } from 'lib/components/AddToDashboard/AddToDashboardModal'
import { useState } from 'react'
import { NewDashboardModal } from 'scenes/dashboard/NewDashboardModal'
import { NotebookSelectButton } from 'scenes/notebooks/NotebookSelectButton/NotebookSelectButton'
import { NodeKind } from '~/queries/schema'

export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: InsightLogicProps }): JSX.Element {
// insightSceneLogic
Expand Down Expand Up @@ -246,7 +256,18 @@ export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: In
</LemonButton>
)}
{insightMode !== ItemMode.Edit && hasDashboardItemId && (
<AddToDashboard insight={insight} setOpenModal={setAddToDashboardModalOpenModal} />
<>
<NotebookSelectButton
resource={{
attrs: {
query: { kind: NodeKind.SavedInsightNode, shortId: insight.short_id },
},
type: NotebookNodeType.Query,
}}
type="secondary"
/>
<AddToDashboard insight={insight} setOpenModal={setAddToDashboardModalOpenModal} />
</>
)}

{insightMode !== ItemMode.Edit ? (
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/insights/Insights.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const meta: Meta = {
'/api/projects/:team_id/persons/retention': sampleRetentionPeopleResponse,
'/api/projects/:team_id/persons/properties': samplePersonProperties,
'/api/projects/:team_id/groups_types': [],
'/api/projects/:team_id/notebooks?contains=query': {},
},
post: {
'/api/projects/:team_id/cohorts/': { id: 1 },
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b515bed

Please sign in to comment.