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

Index pattern management - EUI refactor #26857

Merged
merged 67 commits into from
Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
6ae13d4
partial progress
mattkime Dec 9, 2018
30fb166
Merge branch 'master' into index-patterns-refactor
mattkime Jan 2, 2019
492e3a7
Merge branch 'master' into index-patterns-refactor
mattkime Jan 3, 2019
553d843
Merge branch 'master' into index-patterns-refactor
mattkime Jan 7, 2019
d0a3cea
partial progress
mattkime Jan 8, 2019
c988aa9
Merge branch 'master' into index-patterns-refactor
mattkime Jan 22, 2019
b9e368f
Merge branch 'master' into index-patterns-refactor
mattkime Jan 24, 2019
cfbdd28
index pattern table working
mattkime Jan 25, 2019
2a8a968
displaying ui sections as appropriate
mattkime Jan 25, 2019
ddf4312
Merge branch 'master' into index-patterns-refactor
mattkime Jan 25, 2019
56112ef
partial progress
mattkime Jan 27, 2019
4780bf8
partial progress
mattkime Jan 27, 2019
f2cd878
partial progress
mattkime Jan 27, 2019
9219c25
localization
mattkime Jan 28, 2019
ada5ef4
remove unused code
mattkime Jan 28, 2019
e5dbff7
fix list
mattkime Jan 28, 2019
8e7e0c0
simplify code
mattkime Jan 28, 2019
31b313d
fix nav, sorting
mattkime Jan 28, 2019
10c0c46
Merge branch 'master' into index-patterns-refactor
mattkime Jan 30, 2019
af9da29
Merge branch 'index-patterns-refactor' of github.com:mattkime/kibana …
mattkime Jan 30, 2019
2208a14
fix functional tests, create index pattern prompt
mattkime Jan 31, 2019
3cc6833
partial progress in fixing tests
mattkime Jan 31, 2019
7aa0869
partial progress
mattkime Feb 4, 2019
a988699
use the same label for create index pattern in prompt and ip list
mattkime Feb 4, 2019
19504ae
fix url in test
mattkime Feb 4, 2019
77fec11
click on index pattern and then delete
mattkime Feb 4, 2019
16a845b
Merge branch 'master' into index-patterns-refactor
mattkime Feb 4, 2019
b85d186
fix i18n, index pattern filter test
mattkime Feb 4, 2019
4bcbc96
partial progress on fixing tests
mattkime Feb 4, 2019
6fe801b
yet another 'click on the index before manipulating' change
mattkime Feb 4, 2019
0ad4a38
yet another 'click on the index before manipulating' change
mattkime Feb 4, 2019
b5c3c5c
fix click-an-index-pattern, only one await
mattkime Feb 4, 2019
b561185
add data-test-subj to fix test
mattkime Feb 4, 2019
15c34cd
remove log statements
mattkime Feb 4, 2019
9c167b8
cleanup
mattkime Feb 5, 2019
222cf7b
remove unneeded comments
mattkime Feb 5, 2019
f9491b4
reenable creation of rollup index patterns
mattkime Feb 5, 2019
69d240f
remove unneeded comment
mattkime Feb 5, 2019
59e27ff
use create button in prompt as well
mattkime Feb 5, 2019
a5a9bc7
simplify tests
mattkime Feb 5, 2019
cf6c727
simplify functional tests
mattkime Feb 5, 2019
6f1af6f
styling fixes
mattkime Feb 6, 2019
4811003
fix wrapped strings
mattkime Feb 6, 2019
4411135
fix newlines, breadcrumbs
mattkime Feb 6, 2019
c9f3418
EUI-ify the empty prompt view
ryankeairns Feb 6, 2019
ea0f1d0
Merge branch 'master' into index-patterns-refactor
mattkime Feb 7, 2019
063d9c5
Merge pull request #4 from ryankeairns/index-patterns-refactor
mattkime Feb 8, 2019
8fc171b
localize some bits
mattkime Feb 8, 2019
33893de
Merge branch 'master' into index-patterns-refactor
mattkime Feb 8, 2019
4d2d2b8
better bread makes better crumbs
mattkime Feb 8, 2019
186b8ff
Merge branch 'master' into index-patterns-refactor
mattkime Feb 8, 2019
6e34937
typescript
mattkime Feb 8, 2019
8e4b9d6
Merge branch 'master' into index-patterns-refactor
mattkime Feb 11, 2019
742d813
fix typo
mattkime Feb 11, 2019
4cb1daf
Merge branch 'master' into index-patterns-refactor
mattkime Feb 13, 2019
4dc7714
partial progress - refactor into flyout
mattkime Feb 14, 2019
c85950b
header layout
ryankeairns Feb 14, 2019
6f49326
Merge pull request #5 from ryankeairns/index-patterns-refactor
mattkime Feb 14, 2019
5063846
Merge branch 'master' into index-patterns-refactor
mattkime Feb 15, 2019
eeabdc9
Merge branch 'master' into index-patterns-refactor
mattkime Feb 15, 2019
b7a111d
typescript fix
mattkime Feb 15, 2019
0f92c3d
Merge branch 'index-patterns-refactor' of github.com:mattkime/kibana …
mattkime Feb 15, 2019
5b5229f
typescript create_button
mattkime Feb 16, 2019
397ffc6
Merge branch 'master' into index-patterns-refactor
mattkime Feb 16, 2019
18caf5c
apparently I need to remove chinese translations to pass CI
mattkime Feb 16, 2019
a81072f
dismiss flyout for tests
mattkime Feb 16, 2019
70c4763
fix conditionally closing flyout
mattkime Feb 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,26 @@
import { MANAGEMENT_BREADCRUMB } from 'ui/management';
import { i18n } from '@kbn/i18n';

export function getCreateBreadcrumbs() {
export function getListBreadcrumbs() {
return [
MANAGEMENT_BREADCRUMB,
{
text: i18n.translate('kbn.management.indexPatterns.listBreadcrumb', {
defaultMessage: 'Index patterns'
}),
href: '#/management/kibana/index_patterns'
}
];
}

export function getCreateBreadcrumbs() {
return [
...getListBreadcrumbs(),
{
text: i18n.translate('kbn.management.indexPatterns.createBreadcrumb', {
defaultMessage: 'Create index pattern'
}),
href: '#/management/kibana/objects'
href: '#/management/kibana/index_pattern'
}
];
}
Expand All @@ -36,7 +48,7 @@ export function getEditBreadcrumbs($route) {
const { indexPattern } = $route.current.locals;

return [
MANAGEMENT_BREADCRUMB,
...getListBreadcrumbs(),
{
text: indexPattern.title,
href: `#/management/kibana/index_patterns/${indexPattern.id}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export class CreateButton extends Component {
<EuiButton
data-test-subj="createIndexPatternButton"
fill={true}
size={'s'}
onClick={options[0].onClick}
iconType="plusInCircle"
>
{children}
</EuiButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React, { Fragment } from 'react';
import {
EuiEmptyPrompt,
EuiText,
EuiHorizontalRule,
EuiDescriptionList,
EuiDescriptionListTitle,
EuiDescriptionListDescription,
EuiPageContent,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { CreateButton } from '../create_button';

export const CreateIndexPatternPrompt = ({
indexPatternCreationOptions
}) => (
<EuiPageContent horizontalPosition="center">
<EuiEmptyPrompt
iconType="indexPatternApp"
title={
<EuiText grow={false}>
<h2>
<FormattedMessage id="kbn.management.indexPatternPrompt.title" defaultMessage="Create your first index pattern" />
</h2>
</EuiText>}
body={
<Fragment>
<p>
<FormattedMessage
id="kbn.management.indexPatternPrompt.subtitle"
defaultMessage="Index patterns allow you to bucket disparate data sources together so their shared fields may be queried in
Kibana."
/>
</p>
<EuiHorizontalRule margin="l" />
<EuiText textAlign="left">
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 this content is a great idea, but I think this is a suboptimal location for it in the UX. The content contains some great tips for creating index patterns but I'm probably going to forget most of it once I click "Create index pattern". Additionally, I feel like the description at the top offers me enough of a compelling reason click this button -- the tips themselves don't offer any new reasons for why I would want (or not want) to click.

Can we move this content into the form itself, or into a "Help" flyout that's available within the creation form flow?

CC @ryankeairns

image

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this is helpful information and that it would be more effective in context of the index pattern creation flow. Placing it directly in the form would eat up quite a bit of real estate and interrupt more experienced users, so I'd recommend the flyout option.

See the 'Small flyout' example in the EUI docs here: https://elastic.github.io/eui/#/layout/flyout

As for the trigger, an icon button (with the questionInCircle icon) in the top right of the 'Create index pattern' view would be consistent with the buttons on the index pattern detail view seen here:

screenshot 2019-02-11 15 28 14

Copy link
Contributor

Choose a reason for hiding this comment

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

@ryankeairns Do you think the content is small enough that a popover would be give enough room to show the info?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's fairly long and made the empty prompt even larger than I would have preferred. I think the skinny flyout feels like a good sized container for what is essentially 3 titles and paragraphs, in this case.

<p>
<FormattedMessage
id="kbn.management.indexPatternPrompt.examplesTitle"
defaultMessage="Examples of index patterns"
/>
</p>
</EuiText>
<EuiDescriptionList className="indexPatternListPrompt__descList">
<EuiDescriptionListTitle>
<FormattedMessage
id="kbn.management.indexPatternPrompt.exampleOneTitle"
defaultMessage="Single data source"
/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
<FormattedMessage
id="kbn.management.indexPatternPrompt.exampleOne"
defaultMessage="Index a single data source named log-west-001 so you can build charts or query its contents fast."
/>
</EuiDescriptionListDescription>
<EuiDescriptionListTitle>
<FormattedMessage
id="kbn.management.indexPatternPrompt.exampleTwoTitle"
defaultMessage="Multiple data sources"
/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
<FormattedMessage
id="kbn.management.indexPatternPrompt.exampleTwo"
defaultMessage="Group all incoming data sources starting with log-west* so you can query against all your west coast server
logs."
/>
</EuiDescriptionListDescription>
<EuiDescriptionListTitle>
<FormattedMessage
id="kbn.management.indexPatternPrompt.exampleThreeTitle"
defaultMessage="Custom groupings"
/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
<FormattedMessage
id="kbn.management.indexPatternPrompt.exampleThree"
defaultMessage="Specifically group your archived, monthly, roll-up metrics of those logs into a separate index pattern so
you can aggregate histotical trends to compare."
Copy link
Member

Choose a reason for hiding this comment

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

histotical --> historical

/>
</EuiDescriptionListDescription>
</EuiDescriptionList>
</Fragment>
}
actions={[
<CreateButton options={indexPatternCreationOptions}>
<FormattedMessage
id="kbn.management.indexPatternPrompt.createBtn"
defaultMessage="Create index pattern"
/>
</CreateButton>
]}
/>
</EuiPageContent>
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<kbn-management-app section="kibana/index_patterns">
<kbn-management-index-patterns>
<div class="euiPanel euiPanel--paddingLarge">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing index pattern list sidebar

<div id="createIndexPatternReact"></div>
</kbn-management-index-patterns>
</div>
</kbn-management-app>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ActionButtons = ({
<EuiFlexItem grow={false}>
<EuiButton
isDisabled={!submittable}
data-test-subj="createIndexPatternCreateButton"
data-test-subj="createIndexPatternButton"
fill
onClick={createIndexPattern}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<kbn-management-app section="kibana/index_patterns">
<kbn-management-index-patterns>
<div class="euiPanel euiPanel--paddingLarge">
<div class="kuiViewContent">
<kbn-management-index-patterns-header
index-pattern="fieldSettings.indexPattern"
></kbn-management-index-patterns-header>
</div>

<div id="reactFieldEditor"></div>

</kbn-management-index-patterns>
</div>
</kbn-management-app>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<kbn-management-app section="kibana/index_patterns" omit-breadcrumb-pages="['index_patterns']">
<kbn-management-index-patterns>
<div class="euiPanel euiPanel--paddingLarge">
<div
ng-controller="managementIndexPatternsEdit"
data-test-subj="editIndexPattern"
Expand Down Expand Up @@ -178,5 +178,5 @@
<div id="reactSourceFiltersTable"></div>
</div>
</div>
</kbn-management-index-patterns>
</div>
</kbn-management-app>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { SourceFiltersTable } from './source_filters_table';
import { IndexedFieldsTable } from './indexed_fields_table';
import { ScriptedFieldsTable } from './scripted_fields_table';
import { i18n } from '@kbn/i18n';
import chrome from 'ui/chrome';
import { I18nContext } from 'ui/i18n';

import { getEditBreadcrumbs } from '../breadcrumbs';
Expand Down Expand Up @@ -164,23 +163,11 @@ uiRoutes
indexPattern: function ($route, redirectWhenMissing, indexPatterns) {
return indexPatterns
.get($route.current.params.indexPatternId)
.catch(redirectWhenMissing('/management/kibana/index_pattern'));
.catch(redirectWhenMissing('/management/kibana/index_patterns'));
}
},
});

uiRoutes
.when('/management/kibana/index_patterns', {
redirectTo() {
const defaultIndex = chrome.getUiSettingsClient().get('defaultIndex');
if (defaultIndex) {
return `/management/kibana/index_patterns/${defaultIndex}`;
}

return '/management/kibana/index_pattern';
}
});

uiModules.get('apps/management')
.controller('managementIndexPatternsEdit', function (
$scope, $location, $route, config, indexPatterns, Private, AppState, docTitle, confirmModal) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<div class="col-md-2 sidebar-container" role="region" aria-label="{{::'kbn.management.editIndexPatternAria' | i18n: { defaultMessage: 'Index patterns' } }}">
<div class="sidebar-list">
<div>
<div>
<div id="indexPatternListReact" role="region" aria-label="{{'kbn.management.editIndexPatternLiveRegionAriaLabel' | i18n: { defaultMessage: 'Index patterns' } }}"></div>
</div>
</div>

<div class="col-md-10">
<div class="euiPanel euiPanel--paddingLarge">
<div ng-transclude></div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,25 @@ import './edit_index_pattern';
import uiRoutes from 'ui/routes';
import { uiModules } from 'ui/modules';
import indexTemplate from './index.html';
import indexPatternListTemplate from './list.html';
import { IndexPatternTable } from './index_pattern_table';
import { CreateIndexPatternPrompt } from './create_index_pattern_prompt';
import { SavedObjectsClientProvider } from 'ui/saved_objects';
import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
import { i18n } from '@kbn/i18n';
import { I18nContext } from 'ui/i18n';
import { EuiBadge } from '@elastic/eui';
import { getListBreadcrumbs } from './breadcrumbs';

import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { IndexPatternList } from './index_pattern_list';

const INDEX_PATTERN_LIST_DOM_ELEMENT_ID = 'indexPatternListReact';

export function updateIndexPatternList(
$scope,
indexPatternCreationOptions,
defaultIndex,
indexPatterns,
kbnUrl,
indexPatternCreationOptions,
) {
const node = document.getElementById(INDEX_PATTERN_LIST_DOM_ELEMENT_ID);
if (!node) {
Expand All @@ -49,11 +52,15 @@ export function updateIndexPatternList(

render(
<I18nContext>
<IndexPatternList
indexPatternCreationOptions={indexPatternCreationOptions}
defaultIndex={defaultIndex}
indexPatterns={indexPatterns}
/>
{indexPatterns.length === 0 ?
(<CreateIndexPatternPrompt
indexPatternCreationOptions={indexPatternCreationOptions}
/>) :
(<IndexPatternTable
indexPatterns={indexPatterns}
navTo={kbnUrl.redirect}
indexPatternCreationOptions={indexPatternCreationOptions}
/>)}
</I18nContext>,
node,
);
Expand Down Expand Up @@ -82,6 +89,12 @@ uiRoutes
resolve: indexPatternsResolutions
});

uiRoutes
.when('/management/kibana/index_patterns', {
template: indexPatternListTemplate,
k7Breadcrumbs: getListBreadcrumbs
});

// wrapper directive, which sets some global stuff up like the left nav
uiModules.get('apps/management')
.directive('kbnManagementIndexPatterns', function ($route, config, kbnUrl, Private) {
Expand All @@ -103,7 +116,10 @@ uiModules.get('apps/management')

return {
id: id,
title: pattern.get('title'),
title:
<span>
{pattern.get('title')}{$scope.defaultIndex === id && (<EuiBadge style={{ marginLeft: '8px' }}>Default</EuiBadge>)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind creating a class in SCSS instead of an inline style? This way you can consume the EUI size variable, and avoid violating the CSP. @ryankeairns Can you provide guidance on how to do this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I had issues running this PR locally (I think due to ES version switching), so I can't see exactly the outcome here, but to answer the question you would do something like:

&& (<EuiBadge className='indexPatternList__badge'>Default</EuiBadge>)

...then add the .indexPatternList__badge class to the neighboring index.scss file:

.indexPatternList__badge {
  margin-right: $euiSizeS;
}

Copy link
Member

@lukeelmers lukeelmers Feb 11, 2019

Choose a reason for hiding this comment

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

Would you mind creating a class in SCSS instead of an inline style? This way you can consume the EUI size variable

++

</span>,
url: kbnUrl.eval('#/management/kibana/index_patterns/{{id}}', { id: id }),
active: $scope.editingId === id,
default: $scope.defaultIndex === id,
Expand All @@ -125,7 +141,7 @@ uiModules.get('apps/management')
return 0;
}) || [];

updateIndexPatternList($scope, indexPatternCreationOptions, $scope.defaultIndex, $scope.indexPatternList);
updateIndexPatternList($scope.indexPatternList, kbnUrl, indexPatternCreationOptions);
};

$scope.$on('$destroy', destroyIndexPatternList);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#indexPatternListReact {
display: flex;

.indexPatternList__headerWrapper {
padding-bottom: $euiSizeS;
}
Expand All @@ -12,4 +14,8 @@
overflow: hidden;
}
}

.indexPatternListPrompt__descList {
text-align: left;
}
}

This file was deleted.

Loading