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

Correct message when all datasources filtered out #112

Merged
merged 8 commits into from Aug 24, 2018

Conversation

wojta
Copy link
Contributor

@wojta wojta commented Aug 17, 2018

https://issues.jboss.org/browse/AEROGEAR-7791

Motivation

Better UX.

What

Searching the data sources - when searching for an item and it's not found show a No item found on search type message.

Why

As of writing this ticket it shows the blank slate message which could be confusing for the user.

Verification Steps

  1. Display page with datasources, when there is none, it should show No Data Sources defined page
  2. Add some datasources
  3. It should show the datasources in the list
  4. Try to filter it by name so the filter no longer matches any of them
  5. It should show page No item found while filtering the data sources and button Clear the filter
  6. When pressing Clear the filter filter is cleared and all datasources are displayed

Checklist:

  • Code has been tested locally by PR requester
  • Changes have been successfully verified by another team member

Progress

  • Displaying different messages
  • Possibility to clear filter quickly

Additional Notes

PS.: Add images and/or .gifs to illustrate what was changed if this pull request modify the appearance/output of something presented to the users.

@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch 2 times, most recently from e168664 to 174b2be Compare August 17, 2018 14:30
@wojta wojta changed the title [WIP] Correct message when all datasources filtered out Correct message when all datasources filtered out Aug 17, 2018
@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch 2 times, most recently from a3490b3 to 6d8dafd Compare August 17, 2018 14:39
Copy link
Contributor

@cfoskin cfoskin left a comment

Choose a reason for hiding this comment

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

Functionality works fine. Code looks good also, but lets wait for @josemigallas to review that first before merging

@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch from 6d8dafd to 03058a1 Compare August 23, 2018 12:57
@josemigallas
Copy link
Contributor

@wojta 2 things

  • It would be good to have Chris' feedback before we change the current UI, I for instance would not add a clear filter button but would keep the create one.
  • Implementation wise, EmptyList have changed so much it is now even less flexible. Instead of adding new prop whenFiltered why not extract the customizable values ({ title, info, action, actionName }) so that this component could be easy to reuse? action and actionName could be optional. And then even DefaultEmptyList could be merged with all this and make a single component.

@@ -50,6 +52,8 @@ class CommonToolbar extends Component {
type="text"
placeholder="Filter by Name"
className={toolbarFilter}
value={get(this.props.filter, "name", "")}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can avoid installing the new package for this, perhaps destructuring:

const { onFilter, filter: { name } } = this.props;

Copy link
Contributor Author

@wojta wojta Aug 23, 2018

Choose a reason for hiding this comment

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

I understand that. I'm not very experienced with JavaScript, but I think that this destructuring is particularly very confusing thing to do in this case, especially for someone coming from other languages.

@@ -19,6 +19,7 @@ import { DeleteResolverDialog } from "./DeleteResolverDialog";
import { DefaultEmptyView } from "../common/DefaultEmptyView";

import UpsertResolver from "../../graphql/UpsertResolver.graphql";
import GetDataSources from "../../graphql/GetDataSources.graphql";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the branch needs rebasing

@@ -50,6 +52,8 @@ class CommonToolbar extends Component {
type="text"
placeholder="Filter by Name"
className={toolbarFilter}
value={get(this.props.filter, "name", "")}
style={{ height: "26px" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be declared in .toolbarFilter css class, but I think it's not needed anyway.

@@ -53,6 +53,10 @@ class DataSourcesContainer extends Component {
this.setState({ showDeleteModal: true, selectedDataSource: dataSource });
}

clearFilter() {
this.setState({ filter: {} });
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is filter an object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was like that previously, someone probably thought that there might be filters by more criteria.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's true, my bad!

@wtrocki
Copy link
Contributor

wtrocki commented Aug 24, 2018

@wojta Please rebase and update this. We could merge that after

@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch from 03058a1 to 99e51a4 Compare August 24, 2018 13:27
@@ -47,6 +49,8 @@ class CommonToolbar extends Component {
type="text"
placeholder="Filter by Name"
className={toolbarFilter}
value={get(this.props.filter, "name", "")}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you need lodash.get?

Copy link
Contributor Author

@wojta wojta Aug 24, 2018

Choose a reason for hiding this comment

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

Isn't there some other way than destructuting? I really don't like it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure you'll get used to it after a few tries! Unfortunately, I don't think installing a whole new package just to avoid an unliked built-in feature of ES6 is justified :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, then :/

@@ -47,6 +49,8 @@ class CommonToolbar extends Component {
type="text"
placeholder="Filter by Name"
className={toolbarFilter}
value={get(this.props.filter, "name", "")}
style={{ height: "26px" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should removed or at least included in the css class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

let name = nameToFilter;
if (name === "") {
name = undefined;
const { name, ...newFilter } = this.state.filter;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it's needed for clearing the filter.

@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch 2 times, most recently from e3540e5 to 3094daf Compare August 24, 2018 14:58
@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch from 3094daf to 1f56e03 Compare August 24, 2018 14:59
@wtrocki
Copy link
Contributor

wtrocki commented Aug 24, 2018

Got that running and checked the code.
@josemigallas Could you take look on this as well.

@wojta wojta force-pushed the AEROGEAR-7791-filtered-out-datasources branch from 1f56e03 to fb47a0a Compare August 24, 2018 15:31
@josemigallas josemigallas merged commit 4907038 into master Aug 24, 2018
@josemigallas josemigallas deleted the AEROGEAR-7791-filtered-out-datasources branch August 24, 2018 18:17
@wtrocki
Copy link
Contributor

wtrocki commented Aug 24, 2018

Awesome work Josemi

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

4 participants