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

[Shared UX] No Data Views Component #125403

Merged
merged 37 commits into from
Feb 24, 2022
Merged

Conversation

majagrubic
Copy link
Contributor

@majagrubic majagrubic commented Feb 11, 2022

Summary

This PR adds a "No Data Views" component. Its intended usage is to be shown in cases where there is data in ES, but no data views. The initial design is taken from Empty Index Pattern Prompt and follows the same functionality. Some styles were replaced by emotion and index-pattern references were changed to data-view references.

Screen Shot 2022-02-22 at 17 11 47 PM

The component is not used anywhere yet, but in the follow-up PR it can be consumed inside 'Data View Editor'.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@majagrubic majagrubic added Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.2.0 release_note:enhancement labels Feb 12, 2022
@majagrubic majagrubic marked this pull request as ready for review February 12, 2022 06:27
viewBox="0 0 226 166"
>
<path
className="dscNoResultsIllustration__decor"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these need to be changed so they don't reference Discover, but didn't want to do this yet in case we're not going to go with this particular svg in the end.

defaultMessage: 'You have data in Elasticsearch, but no data views',
});

export const NoDataViewsComponent = (props: NoDataViewsComponentProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great @majagrubic!

We currently have a design/component for the No Data View style prompt here: https://github.com/elastic/kibana/blob/main/src/plugins/data_view_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx

Screen Shot 2022-02-14 at 10 34 39 AM

Can you re-use that in some capacity instead? I don't know if it's better to copy/paste or just move the whole component and fix the references.

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

An awesome start, a lot to like here. I'll complete another review after you get a chance to address the comments from @cchaos . Great work!

@@ -0,0 +1,18 @@
.dscNoResultsIllustration__decor {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: let's add a comment as to why this SASS file is here, and refer to and document the exception here: #122594

* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export * from './no_data_views';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: new line

});

export const NoDataViewsComponent = (props: NoDataViewsComponentProps) => {
const { onClick, canCreateNewDataView } = props;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can destructure above.

description={noDescriptionText}
css={componentCss}
>
<div className="noResults__illustration">
Copy link
Contributor

Choose a reason for hiding this comment

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

consider comment, refer to #122594


export const PureComponentCannotCreateDataViews = () => {
return <NoDataViewsComponent canCreateNewDataView={false} />;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@rshen91 rshen91 left a comment

Choose a reason for hiding this comment

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

This is awesome!! I love the clarity in the test files and thank you for introducing me to kbn/test-jest-helpers 🙌🏻 . I can always look over this again when the other changes people suggested are implemented. I'm so excited to be on your team - this PR looks so great!

@clintandrewhall
Copy link
Contributor

@elasticmachine merge upstream

@cchaos
Copy link
Contributor

cchaos commented Feb 23, 2022

A minor nit, but can we change "Read documentation" to "Read the docs"? It's friendlier.

@gchaps Is this general advice we should be using everywhere? When do we rely on a friendly tone vs authoritative? Is there a lookup guide we can reference for these kinds of sayings?

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

We need to add some docs and other tweaks. I can open a PR to merge some of my changes, if that's helpful?

import { FormattedMessage } from '@kbn/i18n-react';

interface Props {
documentationUrl: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since this is a DocumentationLink, restating it on the prop is a bit redundant. In addition, given that we're stating it's a link, I'd consider href.

Suggested change
documentationUrl: string;
href: string;

</EuiTitle>
&emsp;
<dd className="eui-displayInline">
<EuiLink href={documentationUrl} target="_blank" external>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<EuiLink href={documentationUrl} target="_blank" external>
<EuiLink href={href} target="_blank" external>


export function DocumentationLink({ documentationUrl }: Props) {
return (
<dl>
Copy link
Contributor

Choose a reason for hiding this comment

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

🥳 Semantic markup is my favorite!

export { NoDataViewsPage } from './no_data_views_page';

// eslint-disable-next-line import/no-default-export
export default NoDataViewsPage;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I was recently convinced to change my approach to imports by other Kibana engineers, given the noise of disabling eslint.

This would be in src/plugins/shared_ux/public/components/index.ts

export const NoDataViewsPage = React.lazy(() =>
  import('./no_data_views_page').then(({ NoDataViewsPage }) => ({
    default: NoDataViewsPage,
  }))
);

@@ -0,0 +1,89 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the standard we've adopted here so far has been: no_data_views.component.tsx

const Illustration = lazy(() => import('../assets/data_view_illustration'));

interface Props {
canCreateNewDataView: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

These all need documentation.

defaultMessage: 'Create Data View',
});

export const NoDataViewsComponent = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add documentation.

emptyPromptColor = 'plain',
}: Props) => {
// Using raw value because it is content dependent
const maxWidth = '830px';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: consider a const outside the component.

const MAX_WIDTH = 830;

data-test-subj="noDataViewsPrompt"
layout="horizontal"
css={css`
max-width: ${maxWidth} !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

...and this would become:

Suggested change
max-width: ${maxWidth} !important;
max-width: ${MAX_WIDTH}px !important;

@cchaos what's our stance on !important...?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sometimes it's necessary to override specificity. In Sass, we have a linter that by default doesn't allow them, but you can comment the linter to ignore by also adding a reason. So something like

Suggested change
max-width: ${maxWidth} !important;
max-width: ${MAX_WIDTH}px !important; // Necessary to override EuiEmptyPrompt to fit content

@gchaps
Copy link
Contributor

gchaps commented Feb 23, 2022

@cchaos "docs" is a common shortcut for "documentation", which is another reason that I prefer it here. Also, a lot of the Management pages already use "docs" in the the links on their pages.

We definitely should have guidelines for voice and tone in the UI copy. I think we can use a friendlier tone in empty states, landing pages, and tour components. A more authoritative tone works in error messages, where users want to know what went wrong and how to fix it.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
sharedUX 23 47 +24

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
sharedUX 8.5KB 100.5KB +92.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
sharedUX 3.8KB 4.7KB +972.0B
Unknown metric groups

API count

id before after diff
sharedUX 10 14 +4

async chunk count

id before after diff
sharedUX 1 3 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@majagrubic majagrubic merged commit febb41c into elastic:main Feb 24, 2022
@majagrubic majagrubic deleted the no-data-views-2 branch February 24, 2022 19:40
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 125403 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 28, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 125403 or prevent reminders by adding the backport:skip label.

lucasfcosta pushed a commit to lucasfcosta/kibana that referenced this pull request Mar 2, 2022
* Adding illustration

* Add components

* Add fake data view editor

* [Shared UX] Adding No data views component

* updating failing button snapshot

* Fix style name

* Update test

* Change folder structure

* Refactoring service

* Fixing comments

* Minor fixes

* Fix failing snapshot

* Change the layout of the component

* Polish

* Fix missing export

* Fix docLinks initialization

* Fix failing test

* Remove unnecessary div

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>

* Use calc function

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>

* Rename onClick prop

* Updated to use EuiEmptyPrompt

* Fixing tests

* Applying Clint's comments

* Add documentation

* Update string

* Feedback for PR elastic#125403

* Add missing comment

* Fix import issue

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 125403 or prevent reminders by adding the backport:skip label.

3 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 125403 or prevent reminders by adding the backport:skip label.

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 125403 or prevent reminders by adding the backport:skip label.

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 125403 or prevent reminders by adding the backport:skip label.

@clintandrewhall clintandrewhall added the backport:skip This commit does not require backporting label Mar 7, 2022
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 7, 2022
@KOTungseth KOTungseth added the Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages label Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:enhancement Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants