Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pipeline 3000 creating configs #22200

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

tiina303
Copy link
Contributor

@tiina303 tiina303 commented May 8, 2024

Problem

Creation was broken because of permission checks

Changes

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Copy link
Contributor

github-actions bot commented May 8, 2024

Size Change: -26 B (0%)

Total Size: 1.05 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.05 MB -26 B (0%)

compressed-size-action

},
]
: []),
]
}

export function checkPermissions(stage: PipelineStage, togglingToEnabledOrNew: boolean): boolean {
const { canConfigurePlugins, canEnableNewDestinations } = useValues(pipelineLogic)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is the reason why updates started failing, we can't call a function with using from a logic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I totally should have caught that. My bad.

@tiina303 tiina303 requested a review from benjackwhite May 8, 2024 20:04
(user, hasAvailableFeature) =>
user?.is_impersonated ||
(canConfigurePlugins(user?.organization) && hasAvailableFeature(AvailableFeature.DATA_PIPELINES)),
notAllowedReasonByStageAndOperationType: [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this is the best way to do this, but having a consistent disabled reason / error is nice, later other things might be allowed / disallowed and that can be changed here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this really hard to parse overall as a concept tbh. I don't fully get what it is trying to achieve tbh.

My gut tells me this shouldn't be abstracted here but rather implemented in each logic for the different kinds of thing. Reason being that the benefits of abstracting it here seem very light in comparison to the high complexity of passing this object around everywhere.

For example the NewButton is made relatively complex as it is trying to be super abstract when in actual fact the logic to decide whether it should be shown could easily belong to the more specific logic like pipelineDestinationsLogic and then the NewButton can remain simple and not need this passed object.

Might be worth an in person sync if this doesn't make sense 👍

@tiina303 tiina303 marked this pull request as ready for review May 8, 2024 20:06
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

},
]
: []),
]
}

export function checkPermissions(stage: PipelineStage, togglingToEnabledOrNew: boolean): boolean {
const { canConfigurePlugins, canEnableNewDestinations } = useValues(pipelineLogic)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I totally should have caught that. My bad.

(user, hasAvailableFeature) =>
user?.is_impersonated ||
(canConfigurePlugins(user?.organization) && hasAvailableFeature(AvailableFeature.DATA_PIPELINES)),
notAllowedReasonByStageAndOperationType: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this really hard to parse overall as a concept tbh. I don't fully get what it is trying to achieve tbh.

My gut tells me this shouldn't be abstracted here but rather implemented in each logic for the different kinds of thing. Reason being that the benefits of abstracting it here seem very light in comparison to the high complexity of passing this object around everywhere.

For example the NewButton is made relatively complex as it is trying to be super abstract when in actual fact the logic to decide whether it should be shown could easily belong to the more specific logic like pipelineDestinationsLogic and then the NewButton can remain simple and not need this passed object.

Might be worth an in person sync if this doesn't make sense 👍

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@tiina303 tiina303 removed the stale label May 21, 2024
@tiina303 tiina303 marked this pull request as draft May 21, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants