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

Added hidden filter to data streams tab #85028

Merged
merged 9 commits into from
Dec 14, 2020
Merged

Conversation

yuliacech
Copy link
Contributor

@yuliacech yuliacech commented Dec 4, 2020

Summary

Fixes #83709.

This PR adds support for hidden data streams in Index Management app. A new view button allows user to toggle several filters for data streams. Currently, there are 'Fleet-managed data streams' and 'hidden data streams'. Fleet-managed data streams are enabled by default, hidden data streams are disabled by default.
The code reuses view filter button created for index template list.

Screenshots

There are some data streams, but all are filtered out: table is displayed with no rows.
Screenshot 2020-12-08 at 18 59 10

Hidden data streams with a label
Screenshot 2020-12-08 at 18 59 19

When there are no data streams at all, the empty prompt is shown. This UI has not changed
Screenshot 2020-12-09 at 12 11 56

How to test

A hidden data stream is usually already preexisting ilm-history-5. To create more hidden data streams:

PUT _index_template/test
{
  "template": {},
  "index_patterns": [
    "test"
  ],
  "data_stream": {
    "hidden": true   
  }
}

POST test/_doc
{
  "@timestamp": "2020-01-27"
}

Checklist

Release note

In Index Management app, hidden data streams are now displayed and indicated by a label.

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@yuliacech yuliacech added Feature:Index Management Index and index templates UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 v8.0.0 release_note:enhancement labels Dec 9, 2020
@yuliacech yuliacech marked this pull request as ready for review December 9, 2020 11:17
@yuliacech yuliacech requested a review from a team as a code owner December 9, 2020 11:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Nice work @yuliacech! This is looking great. I left a few comments in the code. I think we might be able to make the api integration tests a little more robust; let me know what you think.

I'd also like to test the deep-linking before I approve. Can you remind me on how/where to test that? I checked the index templates UI, but from what I could see we are only indicating if there is an associated data stream and not actually linking to the data stream.

I also had a few UX questions/suggestions (some of which might be better suited for a separate PR):

  • I have trouble understanding the difference between managed, system and hidden 😄. Should hidden actually be managed, or is it a different behavior for data streams? For example, the ILM index template is actually marked as managed in the UI, but the associated data stream is hidden.
  • Could we also add the badge to the details panel of the data stream? You can check out index templates as an example.

Screen Shot 2020-12-09 at 10 39 59 AM

  • For system templates, we add an additional warning when deleting. Would this be applicable to hidden data streams?

Screen Shot 2020-12-09 at 11 24 52 AM

@@ -6,10 +6,34 @@

import { DataStream } from '../../../common';

export const isManagedByIngestManager = (dataStream: DataStream): boolean => {
export const isFleetManaged = (dataStream: DataStream): boolean => {
// TODO check if the wording will change to 'fleet'
Copy link
Contributor

Choose a reason for hiding this comment

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

Were you planning on addressing this TODO as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll remove this as soon as I get info from the Fleet team :)

dataStream: DataStream;
}

export const DataStreamsBadges: React.FunctionComponent<Props> = ({ dataStream }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that a fleet-managed data stream could also be hidden? Are there any UX concerns with displaying two badges side-by-side in a table row?

@@ -65,12 +65,24 @@ const enhanceDataStreams = ({
});
};

const getDataStreams = (client: ElasticsearchClient, name = '') => {
// TODO update when elasticsearch client has update requestParams for 'indices.getDataStream'
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an open issue that we can point to as part of this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no issue as elasticsearch-js client generates their typings for API automatically. I think we just need to wait for the next client update, so I left this comment. But let me know what you think :)

@@ -65,12 +65,24 @@ const enhanceDataStreams = ({
});
};

const getDataStreams = (client: ElasticsearchClient, name = '') => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just not include name in the path if it isn't defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the code would not be much easier with a ternary operator for path, so I'd prefer to have a default value. Or did you mean something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

My main concern is the path ends up resolving to /_data_stream// is there is no name specified

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for bringing this up, @alisonelizabeth ! I haven't thought about it and that's a valid concern. I changed the empty string to a wildcard * and deleted the closing forward slash. So if name isn't defined, the path would be /_data_stream/*.

@@ -61,20 +61,44 @@ export default function ({ getService }: FtrProviderContext) {

describe('Data streams', function () {
describe('Get', () => {
const defaultHiddenDataStream = {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a little brittle to provide values for the data stream generated by ES. For example, are we confident that the name will always beilm-history-5 ?

@@ -101,11 +126,13 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);

// ES determines these values so we'll just echo them back.
const { name: indexName, uuid } = dataStreams[0].indices[0];
const { storageSize, ...dataStreamWithoutStorageSize } = dataStreams[0];
// dataStreams[0] is a hidden data stream created by ES
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the test would be more resilient if we used find to find the datastream created in the test. I have concerns about the current implementation if ES were to add more hidden data streams. WDYT?

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@yuliacech
Copy link
Contributor Author

Hi @alisonelizabeth , thank you so much for your review! I addressed the feedback, would you mind having another look?

  • I think 'managed' data streams will usually not be 'hidden', but if that happens I put the badges into a badge group, so that they would stack on a smaller screen. WDYT?

Screenshot 2020-12-10 at 19 17 01

Screenshot 2020-12-10 at 19 17 10

  • Added the badges to the detail flyout as well

Screenshot 2020-12-10 at 19 19 19

  • As far as I understand, hidden data stream can be deleted, because this is just a property of a data stream set via an index template. I would not add any special information there, as there is currently no semantics attached to this property.

  • I see how that can be confusing, but managed templates are not connected to managed data streams. Those are data streams managed by Fleet. Do you think we should change 'managed' label to 'Fleet-managed' or similar?

  • Thanks for your notes about the api integration tests, I updated them to be more resilient against ES changes.

  • To check cross-linking, you could open Indices list, enable hidden indices and click on data stream name 'ilm-history-5'. I also added a query param, should we need to cross-link to data streams tab with hidden filter on with includeHidden=true.

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback @yuliacech! I think the CITs need to be updated to react to your most recent changes, but otherwise LGTM. Tested again and verified the cross-linking.

Also, the badge on the details panel is misaligned for me - possibly caused by using the EuiBadgeGroup?

Screen Shot 2020-12-10 at 2 23 02 PM

@@ -65,12 +65,24 @@ const enhanceDataStreams = ({
});
};

const getDataStreams = (client: ElasticsearchClient, name = '') => {
Copy link
Contributor

Choose a reason for hiding this comment

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

My main concern is the path ends up resolving to /_data_stream// is there is no name specified

@alisonelizabeth
Copy link
Contributor

alisonelizabeth commented Dec 10, 2020

I think 'managed' data streams will usually not be 'hidden', but if that happens I put the badges into a badge group, so that they would stack on a smaller screen. WDYT?

👍

I see how that can be confusing, but managed templates are not connected to managed data streams. Those are data streams managed by Fleet. Do you think we should change 'managed' label to 'Fleet-managed' or similar?

I'm not as familiar with this area, but if they are always managed by Fleet I think it would be helpful to update the label to be more specific. As a future enhancement, I think it could also be helpful to provide a tooltip or something to each badge that gives a better explanation of what it means.

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

@yuliacech
Copy link
Contributor Author

Thanks for re-reviewing @alisonelizabeth ! I fixed the alignment issue in the detail panel :) Will create a separate PR for wording of Fleet-managed data streams and a possible tooltip for the label.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
indexManagement 523 525 +2

Async chunks

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

id before after diff
indexManagement 1.5MB 1.5MB +2.0KB

Distributable file count

id before after diff
default 47129 47889 +760

Page load bundle

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

id before after diff
indexManagement 124.1KB 124.1KB +45.0B

History

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

@yuliacech yuliacech merged commit a8d088f into elastic:master Dec 14, 2020
yuliacech added a commit to yuliacech/kibana that referenced this pull request Dec 14, 2020
* Added hidden filter to data streams tab

* Fix i18n import

* Fixed tests

* hidden ds pr feedback

* Added includeHidden query to data streams list

* Changed how badge group renders data streams badges

Co-authored-by: Kibana Machine <[email protected]>
yuliacech added a commit that referenced this pull request Dec 14, 2020
* Added hidden filter to data streams tab

* Fix i18n import

* Fixed tests

* hidden ds pr feedback

* Added includeHidden query to data streams list

* Changed how badge group renders data streams badges

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
@yuliacech yuliacech deleted the hidden_ds branch February 24, 2021 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Index Management Index and index templates UI release_note:enhancement Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support hidden data streams in Index Management
4 participants