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

ui: Empty state #45981

Merged
merged 3 commits into from
Apr 22, 2020
Merged

ui: Empty state #45981

merged 3 commits into from
Apr 22, 2020

Conversation

vladlos
Copy link
Contributor

@vladlos vladlos commented Mar 11, 2020

tables empty state redesign, created reusable component for no results state

Resolves: #45264

Release justification: bug fixes and low-risk updates to new functionality

Release note (ui): new design of empty state on Jobs, Diagnostics, Statements and StatementsDetails pages

@vladlos vladlos requested a review from a team March 11, 2020 13:30
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

ui: Empty state

This is not descriptive enough. Please keep it to 50 chars but mention what was done.

I really like that this change moves a component from src/views/app/... into the upper level components directory. 👏

The commit message needs more detail.
I'd like to see:

  • what the Empty component is and where we should use it. Is it only for tables, for instance, or can I use it anywhere?
  • a list of components that the Empty component is now being used in
  • discussion of new props being added to components that facilitate use of Empty component

Reviewed 15 of 17 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @elkmaster)


pkg/ui/src/util/docs.ts, line 35 at r1 (raw file):

export const adminUIAccess = docsURL("admin-ui-overview.html#admin-ui-access");
export const statementDiagnostics = docsURLNoVersion("admin-ui-statements-page.html#diagnostics");
export const databaseTable = docsURLNoVersion("admin-ui-databases-page.html");

Why are these links noVersion? I would assume we would link to the versioned one.


pkg/ui/src/views/databases/containers/tableDetails/index.tsx, line 34 at r1 (raw file):

import { databaseDetails } from "../databaseSummary";
import { Button, BackIcon } from "oss/src/components/button";
import { databaseTable } from "oss/src/util/docs";

We need to stop using oss/ as a prefix for imports. Import should always come from /src. The oss or ccl prefix is added by webpack. This is to allow ccl directory to override. Can you change just the ones in this PR for now? I will file a ticket to fix the rest.


pkg/ui/src/views/databases/containers/tableDetails/index.tsx, line 103 at r1 (raw file):

      return statements.filter((statement: AggregateStatistics) => statement.label.indexOf(title) !== -1);
    }
    return [];

thanks for this, we should explore turning on strict null checks 🤔


pkg/ui/src/views/databases/containers/tableDetails/index.tsx, line 166 at r1 (raw file):

              </TabPane>
              <TabPane tab="Statements" key="2">
                <StatementsSortedTable

Did you explore a different style of API where the Empty component wraps an existing component? We could have:

<Empty showWhen={statementsData.length === 0} ... >
  <StatementsSortedTable ... />
</Empty>

Then you can avoid having to implement the if (empty) { return <Empty... inside every other component.

What do you think?


pkg/ui/src/views/databases/containers/tableDetails/index.tsx, line 179 at r1 (raw file):

              </TabPane>
              <TabPane tab="Grants" key="3">
                <GrantsSortedTable

Why doesn't this have empty prop?


pkg/ui/src/views/jobs/jobTable.tsx, line 161 at r1 (raw file):

          columns={jobsTableColumns}
          renderNoResult={this.noJobResult()}
          empty={_.isEmpty(jobs) && !this.props.isUsedFilter}

Why do we need empty and renderNoResult? Couldn't we do both with just the empty functionality?


pkg/ui/src/views/shared/components/sortabletable/index.tsx, line 17 at r1 (raw file):

import { DrawerComponent } from "../drawer";
import "./sortabletable.styl";
import Empty, { IEmptyProps } from "oss/src/components/empty/empty";

this import looks weird, no? can we just import from /components/empty?

@dhartunian
Copy link
Collaborator

One last comment: the change is failing the linter because of a missing Release justification.

@vladlos
Copy link
Contributor Author

vladlos commented Mar 23, 2020

Did you explore a different style of API where the Empty component wraps an existing component? We could have…

In my opinion "wrapping" components should be used only when there is no other way, for example for real wrappers, like layout or anything that adds something before and\or after {children}. In current case it will just add unnecessary complexity.

Why doesn’t this have empty prop?

Some screens have empty prop implementations as separated prs.

Why do we need empty and renderNoResult? Couldn’t we do both with just the empty functionality?

No result state is only for tables with filters, when we have data, but nothing is matching filter criteria. Maybe make sense to create another ticket for moving it out in component too.

Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

@elkmaster can you update the release note to explain exactly which pages on the site are changing. I assume it's just the 4 mentioned in the issue.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian and @elkmaster)

@vladlos vladlos force-pushed the feature/empty-state branch 4 times, most recently from 619fdcc to 8d8662d Compare April 6, 2020 12:25
@vladlos
Copy link
Contributor Author

vladlos commented Apr 6, 2020

databases
diagnostics
jobs
statements

@blathers-crl
Copy link

blathers-crl bot commented Apr 6, 2020

❌ The GitHub CI (Cockroach) build has failed on faee5c4a.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. I am experimental - my owner is otan.

Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

Reviewed 11 of 11 files at r2, 8 of 8 files at r3, 2 of 2 files at r4.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @elkmaster)


pkg/ui/src/components/empty/empty.tsx, line 36 at r4 (raw file):

  backgroundImage,
}: IEmptyProps) => (
  <div className="cl-empty-view" style={{ backgroundImage: `url(${backgroundImage})` }}>

Is this currently overridden by any user of this component? Why not have it set in the CSS?

@vladlos
Copy link
Contributor Author

vladlos commented Apr 13, 2020

Is this currently overridden by any user of this component? Why not have it set in the CSS?

Now it not used but I think I seen some designs with different images, so for easier customisation in future it was done with inline styles.

@blathers-crl
Copy link

blathers-crl bot commented Apr 14, 2020

❌ The GitHub CI (Cockroach) build has failed on 65a57212.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl
Copy link

blathers-crl bot commented Apr 17, 2020

❌ The GitHub CI (Cockroach) build has failed on 79265313.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl
Copy link

blathers-crl bot commented Apr 21, 2020

❌ The GitHub CI (Cockroach) build has failed on 80f32009.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

@elkmaster this looks good! thanks for the edits.

It looks like you have an edit to yarn-vendor that should not be there. Can you remove that, rebase and resolve conflicts so we can merge?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian and @elkmaster)

@blathers-crl
Copy link

blathers-crl bot commented Apr 22, 2020

❌ The GitHub CI (Cockroach) build has failed on 3e1efe4c.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl
Copy link

blathers-crl bot commented Apr 22, 2020

❌ The GitHub CI (Cockroach) build has failed on f2790ec8.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

tables empty state redesign, created reusable component for no results state

Resolves: cockroachdb#45264

Release note (ui): none
Used versioned links for docs.
Removed `oss/` prefix from imports.
Changed `Empty` component export.

Release justification: bug fixes and low-risk updates to new functionality

Release note (ui): new design of empty state on Jobs, Diagnostics, Statements and StatementsDetails pages
@blathers-crl
Copy link

blathers-crl bot commented Apr 22, 2020

❌ The GitHub CI (Cockroach) build has failed on 40d23e70.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Removed `z-index` from `Empty` styles and moved banner from `img` to `background-image` to avoid overlap with other absolute positioned elements

Release note (ui): new design of empty state on Jobs, Diagnostics, Statements and StatementsDetails pages
Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

:lgtm: thanks for the update

Reviewed 15 of 15 files at r5, 7 of 7 files at r6, 2 of 5 files at r7.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @dhartunian and @elkmaster)

@dhartunian
Copy link
Collaborator

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 22, 2020

Merge conflict (retrying...)

@dhartunian
Copy link
Collaborator

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 22, 2020

Build succeeded

@craig craig bot merged commit 9bfecbd into cockroachdb:master Apr 22, 2020
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.

ui: 'empty' and 'no results' states (statements, jobs, tables)
3 participants