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

[CCR]: Add UI page + form to create Auto-follow pattern #26407

Conversation

sebelga
Copy link
Contributor

@sebelga sebelga commented Nov 29, 2018

This PR contains the UI view to create an auto-follow pattern. For some reason (a change in history on the target branch feature/ccr?) the (de)serialization on the server appears here in the change although it has already been reviewed 😊

This PR does not include yet the client validation on the form which is the next thing that will be added along with the UI tests.

Until the client validation is put in place, the required fields are:

  • auto-follow pattern name
  • at least 1 leader index pattern

I really would like to be able to add the leader index pattern when leaving the input field (onBlur()) as I think it would make the UX better on the Combobox (so many times I have written the pattern then pressed TAB go to the next field, and then realized I have to go back and press ENTER). I will talk with the @elastic/kibana-design team for that.

EDIT: I added the UI Edit capability for an auto-follow pattern as I made a refactor that changed the current PR. The functionality does not allow to refresh the page on the auto-follow pattern being edited.

Use cases to tests

No clusters added

When there are no clusters added in the "Remote Cluster" app, the following screen appears

screen shot 2018-11-29 at 12 22 53

Clusters added but none is connected

ES throws an error when trying to add an auto-follow pattern to a cluster that is not connected. In order to prevent a bad UX, if none of the clusters defined in the Remote Cluster app is connected, then the following screen appears

screen shot 2018-11-29 at 12 20 23

Disconnected clusters

The user should not be allowed to create an auto-follow pattern from a disconnected cluster. Thus, it should be disabled in the select dropdown.

screen shot 2018-11-29 at 12 19 36

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@snide
Copy link
Contributor

snide commented Nov 29, 2018

Hey @sebelga, nice work. I couldn't get this running locally (assume there is some setup), so I'm just adding some comments to the screens posted. We're trying to get more consistant with breadcrumb usage #25689.

Although sub-nav breadcrumbs are fine, they seem pretty duplicative in a lot of these situations. I'd just keep the thread in a single place. As we move towards K7 you'll not only have a more consistent breadcrumb path, but also have a left side nav for management in general, which should better highlight where you are within management.

cc @cjcenizal since I see similar stuff in rollups and I'm sure he has opinions.

image

image

image

Also for context, though this is missing the breadcrumbs in the top. But shows off why the sub breadcrumbs aren't really very useful in management once the sidenav comes in along with #25905

image

@cjcenizal
Copy link
Contributor

@snide Good points. The reason I created these in-page breadcrumbs was in anticipation of that new side, since it also seemed like the header breadcrumbs duplicate part of the side nav. I probably jumped the gun by incorporating them into 6.5, but I was thinking that switching to breadcrumbs in the page itself for management would make more sense once the side nav is present. That said, we'll go whichever direction Design team thinks makes sense.

Header breadcrumbs:

image

In-page breadcrumbs:

image

@snide
Copy link
Contributor

snide commented Nov 30, 2018 via email

@sebelga sebelga requested a review from cjcenizal November 30, 2018 07:00
@sebelga
Copy link
Contributor Author

sebelga commented Nov 30, 2018

@snide thanks for the feedback! We'll align with what you say it makes sense.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@cjcenizal
Copy link
Contributor

@snide @sebelga I just tried using the chrome.breadcrumbs service, and unfortunately Management has a built-in breadcrumb system which automatically generates the breadcrumbs based on route changes detected by the Angular router and overrides this service. Because we're using React router to handle the route changes in our apps, we can't hook into the auto-breadcrumb system either.

Spencer is planning on removing the auto-breadcrumb system for 7.0. I think our best option for the time being is to just remove the in-page breadcrumbs for now. When Spencer works on removing the auto-breadcrumb system he'll let us know, at which point we can update the breadcrumbs to show the correct trail.

@snide
Copy link
Contributor

snide commented Nov 30, 2018

@cjcenizal that sounds good to me. This is all minor stuff and I don't think you all need to get hung up on it for me. Hopefully the new service will help clean this stuff up.

@cjcenizal cjcenizal added the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Dec 1, 2018
Copy link
Contributor

@cjcenizal cjcenizal 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! Tested locally and everything works as expected. I have some UI/UX suggestions.

  1. Can we set a max-width on the page form? We do this with a class in remote clusters: https://github.com/elastic/kibana/blob/feature/ccr/x-pack/plugins/remote_clusters/public/sections/remote_cluster_edit/remote_cluster_edit.js#L184
  2. I see an error immediately when I load the "Add auto-follow pattern" page.
  3. I think we can shorten the "Auto-follow pattern name" label to simply "Name".

image

import { BASE_PATH_REMOTE_CLUSTERS } from '../../../../common/constants';
import { AutoFollowPatternForm, RemoteClustersProvider, SectionLoading, SectionError } from '../../components';

class AutoFollowPatternAddUI extends PureComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit, but I think UI should be Ui to follow the camel case pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

defaultMessage: 'Remote cluster connection error'
});

return (
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving the button inside of the callout? This way the problem and solution are associated more closely with one another. Right now the EUI callout styles mess up the color of the button but I can help fix this in EUI if you think this is an improvement. I also made some changes to the copy to make it a bit clearer.

image

    return (
      <EuiCallOut
        title={title}
        color="warning"
        iconType="cross"
      >
        <p>
          <FormattedMessage
            id="xpack.crossClusterReplication.autoFollowPatternCreateForm.emptyRemoteClustersCallOutDescription"
            defaultMessage="Auto-follow patterns capture indices on remote clusters. Add a remote cluster before you create an auto-follow pattern." //eslint-disable-line max-len
          />
        </p>

        <EuiButton
          {...routing.getRouterLinkProps('/add', BASE_PATH_REMOTE_CLUSTERS)}
          iconType="plusInCircle"
          color="warning"
        >
          <FormattedMessage
            id="xpack.crossClusterReplication.autoFollowPatternCreateForm.addRemoteClusterButtonLabel"
            defaultMessage="Add remote cluster"
          />
        </EuiButton>
      </EuiCallOut>
    );

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 like the idea! It might be worth seeing this with @elastic/eui-design and know what is the recommendation here (fill button? align left/center/right? should any button inside a callout inherit the color of the callout automatically? should the callout have a actionLabel, actionIcon, and actionHandler props?)

});

return (
<Fragment>
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar suggestion here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

<SectionLoading>
<FormattedMessage
id="xpack.crossClusterReplication.autoFollowPatternForm.loadingRemoteClusters"
defaultMessage="Loading remote clusters..."
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the copywriters discourage the use of the ellipsis in these kinds of situations: ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The eui writing style guide mentions: Do. Use an ellipsis for truncated text or situations that require waiting., talking as an example the loading texts.

* Example of the array returned:
* ["prefix_leader-index-0_suffix", "prefix_leader-index-1_suffix", "prefix_leader-index-2_suffix"]
*/
export const getPreviewIndicesFromAutoFollowPattern = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a couple simple tests to this function and getPrefixSuffixFromFollowPattern?

template: template,
controllerAs: 'ccr',
controller: class CrossClusterReplicationController {
constructor($scope, $route, $http) {
unmountReactApp();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a comment explaining why we need to do this?

// React-router's <Redirect> will cause this controller to re-execute without the $destroy
// handler being called. This means the app will re-mount, so we need to unmount it first
// here.

Copy link
Contributor Author

@sebelga sebelga Dec 3, 2018

Choose a reason for hiding this comment

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

Totally right, and I'll also send an email to all kibana devs as a warning.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@sebelga sebelga merged commit b1c609f into elastic:feature/ccr Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:CCR and Remote Clusters review Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants