-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Conversation
viewBox="0 0 226 166" | ||
> | ||
<path | ||
className="dscNoResultsIllustration__decor" |
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.
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) => { |
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 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
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.
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.
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 { |
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.
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'; |
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.
nit: new line
...lugins/shared_ux/public/components/empty_state/no_data_views/no_data_view_component.test.tsx
Outdated
Show resolved
Hide resolved
...lugins/shared_ux/public/components/empty_state/no_data_views/no_data_view_component.test.tsx
Outdated
Show resolved
Hide resolved
}); | ||
|
||
export const NoDataViewsComponent = (props: NoDataViewsComponentProps) => { | ||
const { onClick, canCreateNewDataView } = props; |
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.
nit: you can destructure above.
description={noDescriptionText} | ||
css={componentCss} | ||
> | ||
<div className="noResults__illustration"> |
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 comment, refer to #122594
|
||
export const PureComponentCannotCreateDataViews = () => { | ||
return <NoDataViewsComponent canCreateNewDataView={false} />; | ||
}; |
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 would combine these examples and add a control. For an example, see: https://github.com/elastic/kibana/blob/main/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.stories.tsx#L27-L36
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 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!
@elasticmachine merge upstream |
@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? |
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.
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; |
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.
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
.
documentationUrl: string; | |
href: string; |
</EuiTitle> | ||
  | ||
<dd className="eui-displayInline"> | ||
<EuiLink href={documentationUrl} target="_blank" external> |
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.
<EuiLink href={documentationUrl} target="_blank" external> | |
<EuiLink href={href} target="_blank" external> |
src/plugins/shared_ux/public/components/empty_state/no_data_views/documentation_link.tsx
Show resolved
Hide resolved
|
||
export function DocumentationLink({ documentationUrl }: Props) { | ||
return ( | ||
<dl> |
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.
🥳 Semantic markup is my favorite!
export { NoDataViewsPage } from './no_data_views_page'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default NoDataViewsPage; |
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.
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 @@ | |||
/* |
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.
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; |
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.
These all need documentation.
defaultMessage: 'Create Data View', | ||
}); | ||
|
||
export const NoDataViewsComponent = ({ |
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.
Please add documentation.
emptyPromptColor = 'plain', | ||
}: Props) => { | ||
// Using raw value because it is content dependent | ||
const maxWidth = '830px'; |
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.
nit: consider a const outside the component.
const MAX_WIDTH = 830;
data-test-subj="noDataViewsPrompt" | ||
layout="horizontal" | ||
css={css` | ||
max-width: ${maxWidth} !important; |
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.
...and this would become:
max-width: ${maxWidth} !important; | |
max-width: ${MAX_WIDTH}px !important; |
@cchaos what's our stance on !important
...?
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.
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
max-width: ${maxWidth} !important; | |
max-width: ${MAX_WIDTH}px !important; // Necessary to override EuiEmptyPrompt to fit content |
@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. |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
To update your PR or re-run it, just comment with: |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
* 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>
Friendly reminder: Looks like this PR hasn’t been backported yet. |
3 similar comments
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
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 todata-view
references.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.
- [ ] Documentation was added for features that require explanation or tutorials- [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker listFor maintainers