Skip to content

Commit

Permalink
feat(cdp): show new destinations on the overview page (#26355)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben White <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent fa08767 commit 5960ef8
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 7 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.
4 changes: 3 additions & 1 deletion frontend/src/scenes/pipeline/NewButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { PipelineStage } from '~/types'

type NewButtonProps = {
stage: PipelineStage
size?: 'xsmall' | 'small' | 'medium' | 'large'
}

export function NewButton({ stage }: NewButtonProps): JSX.Element {
export function NewButton({ stage, size }: NewButtonProps): JSX.Element {
return (
<LemonButton
data-attr={`new-${stage}`}
to={urls.pipelineNodeNew(stage)}
type="primary"
icon={<IconPlusSmall />}
size={size}
>
New {stage}
</LemonButton>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/pipeline/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function Overview(): JSX.Element {
Send your data to destinations in real time or with batch exports. Only active Destinations are
shown here. <Link to={urls.pipeline(PipelineTab.Destinations)}>See all.</Link>
</p>
<DestinationsTable />
<DestinationsTable hideFeedback={true} hideAddDestinationButton={false} />
</div>
</div>
</>
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/scenes/pipeline/destinations/Destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,20 @@ export function Destinations(): JSX.Element {
</>
)
}
export type DestinationsTableProps = {
hideFeedback?: boolean
hideAddDestinationButton?: boolean
}

export function DestinationsTable(): JSX.Element {
export function DestinationsTable({ hideFeedback, hideAddDestinationButton }: DestinationsTableProps): JSX.Element {
const { canConfigurePlugins, canEnableDestination } = useValues(pipelineAccessLogic)
const { loading, filteredDestinations, destinations, hiddenDestinations } = useValues(pipelineDestinationsLogic)
const { toggleNode, deleteNode } = useActions(pipelineDestinationsLogic)
const { resetFilters } = useActions(destinationsFiltersLogic)

return (
<div className="space-y-2">
<DestinationsFilters />
<DestinationsFilters hideFeedback={hideFeedback} hideAddDestinationButton={hideAddDestinationButton} />

<LemonTable
dataSource={filteredDestinations}
Expand Down
16 changes: 13 additions & 3 deletions frontend/src/scenes/pipeline/destinations/DestinationsFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LemonCheckbox, LemonInput, LemonSelect, Link } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { NewButton } from 'scenes/pipeline/NewButton'

import { PipelineStage } from '~/types'

import { PipelineBackend } from '../types'
import { destinationsFiltersLogic } from './destinationsFiltersLogic'
Expand All @@ -8,12 +11,16 @@ export type DestinationsFiltersProps = {
hideSearch?: boolean
hideShowPaused?: boolean
hideKind?: boolean
hideFeedback?: boolean
hideAddDestinationButton?: boolean
}

export function DestinationsFilters({
hideSearch,
hideShowPaused,
hideKind,
hideFeedback,
hideAddDestinationButton = true,
}: DestinationsFiltersProps): JSX.Element | null {
const { filters } = useValues(destinationsFiltersLogic)
const { setFilters, openFeedbackDialog } = useActions(destinationsFiltersLogic)
Expand All @@ -29,9 +36,11 @@ export function DestinationsFilters({
onChange={(e) => setFilters({ search: e })}
/>
)}
<Link className="text-sm font-semibold" subtle onClick={() => openFeedbackDialog()}>
Can't find what you're looking for?
</Link>
{!hideFeedback ? (
<Link className="text-sm font-semibold" subtle onClick={() => openFeedbackDialog()}>
Can't find what you're looking for?
</Link>
) : null}
<div className="flex-1" />
{typeof hideShowPaused !== 'boolean' && (
<LemonCheckbox
Expand All @@ -57,6 +66,7 @@ export function DestinationsFilters({
onChange={(e) => setFilters({ kind: e ?? null })}
/>
)}
{hideAddDestinationButton ? null : <NewButton stage={PipelineStage.Destination} size="small" />}
</div>
</div>
)
Expand Down

0 comments on commit 5960ef8

Please sign in to comment.