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

Filtering scheduled flows from the heartbeattimeline #188

Merged
merged 5 commits into from
Sep 4, 2020

Conversation

kingsleyb
Copy link
Contributor

@kingsleyb kingsleyb commented Sep 1, 2020

PR Checklist:

  • add a short description of what's changed to the top of the CHANGELOG.md
  • add/update tests (or don't, for reasons explained below)

Describe this PR

The dual timestamps on the activity timeline for scheduled flow runs is causing some confusion on the meaning of the two displayed times. Given that the scheduled flow runs are shown both in the dashboard overview and also the flow run over view in a separate window, I want to suggest removing the scheduled flow runs from the activity timeline altogether.

This PR shows how this would look.

I'll wait on feedback on the suggested change prior to adding to changelog.

Copy link
Contributor

@znicholasbrown znicholasbrown left a comment

Choose a reason for hiding this comment

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

Welcome to the UI @kingsleyb!

Completely agreed on this proposal but I don't think is the correct place to make this change - we want this component to be as agnostic to inputs as possible so this filtering should be done either on the heartbeat tiles or queries. In addition, by filtering this on the client we'll run into situations where all 10 items returned by the @/Dashboard/heartbeat.gql and @/Flow/heartbeat.gql queries are scheduled, which would result in an empty activity timeline. My suggestion would be to modify those queries to exclude scheduled states instead.

@kingsleyb
Copy link
Contributor Author

Made some changes based on the feedback provided on where to filter out the Scheduled states.

flow_run(
limit: 10
where: {
flow: { project_id: { _eq: $projectId } }
state_timestamp: { _gte: $timestamp }
state: { _eq: $state }
state: { _eq: $state, _neq: $filterOutState }
Copy link
Member

Choose a reason for hiding this comment

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

This feels a little convoluted and will be confusing when separated from the motivation in this PR, because if someone weren't aware of how Hasura treats null variables, this looks like we're saying "give me flow runs that match a state but not a different state", which doesn't make much sense.

However, I recognize that it fits our usage. My suggestion would be to make it a _nin clause instead of a _neq clause, to make it easier to filter out potentially other states going forward.

Suggested change
state: { _eq: $state, _neq: $filterOutState }
state: { _eq: $state, _nin: $filterOutStates }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jlowin this makes sense but should $state also be made a list whilst i'm making this change?

Copy link
Member

Choose a reason for hiding this comment

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

I'm more hesitant to touch things that are already in use because it may require more updates elsewhere

@@ -1,10 +1,10 @@
query Heartbeat($projectId: uuid, $timestamp: timestamptz, $state: String) {
query Heartbeat($projectId: uuid, $timestamp: timestamptz, $state: String, $filterOutState: String) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
query Heartbeat($projectId: uuid, $timestamp: timestamptz, $state: String, $filterOutState: String) {
query Heartbeat($projectId: uuid, $timestamp: timestamptz, $state: String, $filterOutStates: [String!]) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made suggested changes.

Copy link
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

👍

jlowin
jlowin previously approved these changes Sep 3, 2020
Copy link
Contributor

@znicholasbrown znicholasbrown left a comment

Choose a reason for hiding this comment

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

LGTM @kingsleyb ~

@znicholasbrown znicholasbrown merged commit 71de34e into master Sep 4, 2020
@znicholasbrown znicholasbrown deleted the remove_scheduled_from_heartbeat_timeline branch September 4, 2020 17:47
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.

3 participants