-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add Empty state components and use them #285
Conversation
edb06b4
to
33d53d5
Compare
33d53d5
to
d9e9c58
Compare
a89b11b
to
08bc0c2
Compare
@sbuenafe-rh @fionayhlin does it look to be heading the right way? |
@ZitaNemeckova for the No groups empty state, can you swap out the plus icon outline with the solid plus icon? The PF icon name is: fa-plus-circle or if using React name: PlusCircleIcon For the Not found message. If the Readme file or any other file that isn't available then it should have the PF icon: fa-exclamation-circle with the message: "The file is not available in this version of ___". If the user is searching/filtering for a particular file and it cannot be found, then I would use the magnifying glass icon. Lemme know if you have any questions or need examples/mocks. :) |
@ZitaNemeckova for the No users added to this group, you can shorten that title to No users |
@ZitaNemeckova @sbuenafe-rh Should that be No users yet to match the other titles? |
@fionayhlin @ZitaNemeckova yes! good catch. |
0e52bee
to
eefef55
Compare
@sbuenafe-rh @fionayhlin here's new Container Registry empty pages and fixed ones. WDYT? |
@himdel please have a look code-wise, thanks :) |
Sure, thanks for the help getting it working :), some testing... Repo Management > Remote tab - always shows empty state, on master there are 2 items (I have yet to go through the code, next comment :)) (I also noticed the UI doesn't stop me from removing the current user, which is probably a bug too, though unrelated :)) And do we have a list of all the screens with an EmptyState? |
src/components/index.ts
Outdated
@@ -48,3 +48,7 @@ export { RemoteRepositoryTable } from './repositories/remote-repository-table'; | |||
export { LocalRepositoryTable } from './repositories/local-repository-table'; | |||
export { StatusIndicator } from './status/status-indicator'; | |||
export { HelperText } from './helper-text/helper-text'; | |||
export { EmptyStateFilter } from './empty-state/empty-state-filter'; | |||
export { EmptyStateUnauthorised } from './empty-state/empty-state-unauthorised'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be spelled Unauthorized (s
-> z
)? (ngrams)
@himdel Thanks for reviewing our code! Appreciate the comments. I think @alikins is working on the issue regarding users deleting their own account. View the issue here. |
@sbuenafe-rh @fionayhlin some more Empty State pages. WDYT? |
@ZitaNemeckova @sbuenafe-rh I believe the no results found from search keyword ones should have a "Clear all filters" link button in the empty state under the text, but otherwise looks good! |
@fionayhlin We agreed with @sbuenafe-rh that filter handling should stay in filter component only for this case |
- remove Primary button
@himdel It's ready for another round of review. Thanks :) |
@@ -69,30 +55,6 @@ export class RemoteRepositoryTable extends React.Component<IProps> { | |||
|
|||
render() { | |||
const { remotes } = this.props; | |||
if (remotes.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 handled by repository-list
now, the only user of RemoteRepositoryTable
I think diff --git a/src/components/empty-state/empty-state-unauthorised.tsx b/src/components/empty-state/empty-state-unauthorised.tsx
index a205ca6..bef7e2e 100644
--- a/src/components/empty-state/empty-state-unauthorised.tsx
+++ b/src/components/empty-state/empty-state-unauthorised.tsx
@@ -15,9 +15,9 @@ interface IProps {}
export class EmptyStateUnauthorised extends React.Component<IProps> {
render() {
return (
- <EmptyState variant={EmptyStateVariant.xs}>
+ <EmptyState variant={EmptyStateVariant.small}>
<EmptyStateIcon icon={LockIcon} />
- <Title headingLevel='h4'>
+ <Title headingLevel='h4' size='lg'>
You do not have have access to Automation Hub
</Title>
<EmptyStateBody> (And I still think Unauthorized is the proper spelling, unless Ansible is using non-US spellings?) Would it make sense to DRY it up by implementing the other empty states on top of If we move the export const EmptyStateFilter = ({}) => (<EmptyStateCustom
title="No resuls found"
description="No results match the filter criteria. Remove all filters or clear all filters to show results."
icon={SearchIcon}
/>);
export const EmptyStateNoData = ({ title, description, button }) => (<EmptyStateCustom
title={title}
description={description}
icon={button ? PlusCircleIcon : SearchIcon}
button={button}
/>);
export const EmptyStateUnauthorized = ({}) => (<EmptyStateCustom
title="You do not have have access to Automation Hub"
description="Contact you organization administrator for more information."
icon={LockIcon}
/>); (+- typescript and the component syntax anyway) I'm seeing some icon changes, And I'll continue tomorrow :) |
@@ -0,0 +1,12 @@ | |||
// Checks that at least one filter is set | |||
export function filterIsSet(params, filters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be _.some(filters, (filter) => filter in params));
, if lodash is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
@himdel Icon changes are intentional based on UX requirements. |
@himdel last review addressed. Ready for another round. Thanks :) |
/> | ||
<div> | ||
<Pagination | ||
{filterIsSet(this.state.params, ['keywords']) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using a noData
var as well? (also on line 166, and possibly 209)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added noData
var. Leaving 209 as is.
<RemoteRepositoryTable | ||
remotes={content} | ||
updateParams={this.updateParams} | ||
editRemote={(remote: RemoteType) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.selectRemoteToEdit
becomes unused (and does the same thing except on a copy of remote
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot remember why I did that. Fixing back at this.selectRemoteToEdit
return <Redirect to={Paths.notFound}></Redirect>; | ||
} | ||
return ( | ||
const notAutthorised = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, double T (and s/z for consistency (sorry :)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed :)
Thanks, looks great :) Is If it's local only, would it make sense to split redirect from 404 and use a separate state param? It looks like some components ( I'm not seeing any logic errors in the conversion 👍 , but if it's safe to split, I'd keep EDIT: or I do notice that And perhaps the meta params could be app global, enforcing But that's probably a separate refactoring as that's not really related to this change? I can't seem to be able to rebuild now ( But except for comments above, LGTM 👍 :) |
Params refactoring sounds like good idea but it's out of scope for this PR. How to rebuild: |
1b9bdc8
to
a6c29e3
Compare
@@ -109,6 +104,8 @@ export class NamespaceList extends React.Component<IProps, IState> { | |||
const { namespaces, params, itemCount } = this.state; | |||
const { title, filterOwner } = this.props; | |||
const { user } = this.context; | |||
const noData = | |||
!filterIsSet(this.state.params, ['keywords']) && namespaces.length === 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespaces
can be undefined, we can't check length if it is (maybe just move this after the if (!namespaces)
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
Ah, managed to rebuild, Trying to load
(#285 (comment))
|
Yes, it gets all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, not seeing any issues in code or when testing 👍
How it looks so far:




TODO:
not-found
List of all pages:
Empty state - No data yet:
Empty state - No data for filter:
Empty state - Unauthorised:
Custom "errror" state: