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

User Event Logs - filter, search and sorting #455

Merged
merged 11 commits into from
Jun 15, 2022
Merged

Conversation

nebs-dev
Copy link
Contributor

@nebs-dev nebs-dev commented Jun 7, 2022

Resolves #376

  • Added sorting, filtering and search UI
  • Refactor Event Logs query and EventLogsTypes recoil methods
  • Added EventLogsTypes transformer and controller method

@nebs-dev nebs-dev requested review from mattyg and kristoferlund June 7, 2022 20:50
@nebs-dev nebs-dev self-assigned this Jun 7, 2022
return { data: paginatedResponse, loading: false };
};

export const useAllEventTypeLogs = (): {
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's rename useAllEventTypeLogs to useAllEventLogTypes


const response = get(
ApiAuthGet({
url: `/eventlogs/all${qs ? `?${qs}` : ''}`,
Copy link
Collaborator

@mattyg mattyg Jun 8, 2022

Choose a reason for hiding this comment

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

It might be a bit cleaner to use the apiAuthClient instead of the ApiAuthGet recoil selector -- then you can pass the query parameters as an object and you don't have to do this string formatting stuff.

I'm hoping we can rip out the recoil api selectors (ApiAuthGet, ApiAuthPost, etc.) entirely at some point.

eventLogsQueryParameters
);

const returnValues = useMemo(
Copy link
Collaborator

@mattyg mattyg Jun 8, 2022

Choose a reason for hiding this comment

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

getting a lint warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, i am not sure what to do here - if i add dependencies for useMemo hook (queryParameters & setQueryParameters) i will create infinite loop because we are updating queryParameters here and they will change every time.
Also i am not really sure why component is rerendering every time I update queryParameters @mattyg

Copy link
Collaborator

@mattyg mattyg Jun 12, 2022

Choose a reason for hiding this comment

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

hm, i am not sure what to do here - if i add dependencies for useMemo hook (queryParameters & setQueryParameters) i will create infinite loop because we are updating queryParameters here and they will change every time. Also i am not really sure why component is rerendering every time I update queryParameters @mattyg

Sorry I think I didn't look closely enough at this the first time. I think the confusion comes from using this pattern where EventLogsList reads+writes to recoil state, and EventLogsActions also reads+writes to recoil state, and the parameters to the api request are stored in recoil state.

I think it would be clearer if instead:

  • EventLogsList is the "smart" component, that reads+writes to recoil state
  • The query parameters are stored internally in EventLogsList's component state
  • EventLogsActions is a "dumb" component, that purely takes in user input and emits it to it's parent component. Or alternatively, you could remove it entirely and put the code inside it's parent component

Does that make sense? We could pair program it too if you want.

mattyg
mattyg previously requested changes Jun 8, 2022
Copy link
Collaborator

@mattyg mattyg left a comment

Choose a reason for hiding this comment

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

Awesome!

I requested some minor changes inline.

The only other change I'd request is that we style the search, filter, and sort input components to reflect the styling used in the new Users page. Ideally by making generic input components we can keep using throughout the application.

@nebs-dev
Copy link
Contributor Author

nebs-dev commented Jun 9, 2022

throughout

ok.. i will have to check new user page and use those input styles
but honestly my design looks better to me :)

@nebs-dev nebs-dev requested a review from mattyg June 9, 2022 20:57
@kristoferlund
Copy link
Member

How about this:

image

  • Skip the filter icon, it is vague. Go with the standard dropdown icon instead.
  • The headless ui dropdown provides the checkboxes the default dropdown doesn't include. Let's make this component our default choice.
  • Margins need to be adjusted, use margin 4 between components.
  • These inputs should be same height as a std text input (on my screen 42 px) - adjust margins pls.

We'll look into styling borders etc soon - perhaps making them slightly more soft.

@nebs-dev
Copy link
Contributor Author

How about this:

image
  • Skip the filter icon, it is vague. Go with the standard dropdown icon instead.
  • The headless ui dropdown provides the checkboxes the default dropdown doesn't include. Let's make this component our default choice.
  • Margins need to be adjusted, use margin 4 between components.
  • These inputs should be same height as a std text input (on my screen 42 px) - adjust margins pls.

We'll look into styling borders etc soon - perhaps making them slightly more soft.

i updated styles to be like your design, now we have checkboxes that are black/white.. and also i changed some other styles
And i updated user screen to use new components for sorti/filter

@kristoferlund
Copy link
Member

Great, almost there! I'll post a few comments before Monday.

kristoferlund
kristoferlund previously approved these changes Jun 15, 2022
Copy link
Member

@kristoferlund kristoferlund left a comment

Choose a reason for hiding this comment

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

Great! I made some minor styling changes. Merging now.

@kristoferlund kristoferlund merged commit 5dac5fb into main Jun 15, 2022
@kristoferlund kristoferlund deleted the enh/user_event_logs branch June 15, 2022 10:02
@kristoferlund kristoferlund mentioned this pull request Jun 20, 2022
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.

Custom filtering, sorting, and searching of UserEventLogs
3 participants