Skip to content

Commit

Permalink
[CCR & Snapshot+Restore] Center align states under tabs (#103237)
Browse files Browse the repository at this point in the history
* fix up CCR centered sates in tabs content

* update snapshots list

* fix lint errors

* Change tab states for all pages in snapshot+restore

* Remove unnecessary variables

* Seems we dont need the class wrapper

* fix broken type

* Fix bug in ILM table when filtering it down

* center align search box

* fix linter errors

* fix prettier warnings

* revert content var refactor and just focus on ux

* add breakword class to paragraph so we avoid text overflowing

* fix prettier errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
sabarasaba and kibanamachine committed Jun 29, 2021
1 parent 1dce600 commit 09bd630
Show file tree
Hide file tree
Showing 14 changed files with 415 additions and 341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ export const PageError: React.FunctionComponent<Props> = ({
body={
error && (
<>
{cause ? message || errorString : <p>{message || errorString}</p>}
{cause ? (
message || errorString
) : (
<p className="eui-textBreakWord">{message || errorString}</p>
)}
{cause && (
<>
<EuiSpacer size="s" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('<AutoFollowPatternList />', () => {
});

test('should show a loading indicator on component', async () => {
expect(exists('autoFollowPatternLoading')).toBe(true);
expect(exists('sectionLoading')).toBe(true);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('<FollowerIndicesList />', () => {
});

test('should show a loading indicator on component', async () => {
expect(exists('followerIndexLoading')).toBe(true);
expect(exists('sectionLoading')).toBe(true);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiButton, EuiEmptyPrompt, EuiText, EuiSpacer } from '@elastic/eui';
import { EuiPageContent, EuiButton, EuiEmptyPrompt, EuiText, EuiSpacer } from '@elastic/eui';

import { reactRouterNavigate } from '../../../../../../../../src/plugins/kibana_react/public';
import { extractQueryParams, SectionLoading } from '../../../../shared_imports';
import { extractQueryParams, PageError, PageLoading } from '../../../../shared_imports';
import { trackUiMetric, METRIC_TYPE } from '../../../services/track_ui_metric';
import { API_STATUS, UIM_AUTO_FOLLOW_PATTERN_LIST_LOAD } from '../../../constants';
import { SectionError, SectionUnauthorized } from '../../../components';
import { AutoFollowPatternTable, DetailPanel } from './components';

const REFRESH_RATE_MS = 30000;
Expand Down Expand Up @@ -98,7 +97,12 @@ export class AutoFollowPatternList extends PureComponent {

renderEmpty() {
return (
<section>
<EuiPageContent
hasShadow={false}
paddingSize="none"
verticalPosition="center"
horizontalPosition="center"
>
<EuiEmptyPrompt
iconType="managementApp"
data-test-subj="emptyPrompt"
Expand Down Expand Up @@ -133,7 +137,7 @@ export class AutoFollowPatternList extends PureComponent {
</EuiButton>
}
/>
</section>
</EuiPageContent>
);
}

Expand Down Expand Up @@ -170,19 +174,22 @@ export class AutoFollowPatternList extends PureComponent {

if (!isAuthorized) {
return (
<SectionUnauthorized
<PageError
title={
<FormattedMessage
id="xpack.crossClusterReplication.autoFollowPatternList.permissionErrorTitle"
defaultMessage="Permission error"
/>
}
>
<FormattedMessage
id="xpack.crossClusterReplication.autoFollowPatternList.noPermissionText"
defaultMessage="You do not have permission to view or add auto-follow patterns."
/>
</SectionUnauthorized>
error={{
error: (
<FormattedMessage
id="xpack.crossClusterReplication.autoFollowPatternList.noPermissionText"
defaultMessage="You do not have permission to view or add auto-follow patterns."
/>
),
}}
/>
);
}

Expand All @@ -194,7 +201,7 @@ export class AutoFollowPatternList extends PureComponent {
}
);

return <SectionError title={title} error={apiError} />;
return <PageError title={title} error={apiError.body} />;
}

if (isEmpty) {
Expand All @@ -203,14 +210,12 @@ export class AutoFollowPatternList extends PureComponent {

if (apiStatus === API_STATUS.LOADING) {
return (
<section data-test-subj="autoFollowPatternLoading">
<SectionLoading>
<FormattedMessage
id="xpack.crossClusterReplication.autoFollowPatternList.loadingTitle"
defaultMessage="Loading auto-follow patterns..."
/>
</SectionLoading>
</section>
<PageLoading>
<FormattedMessage
id="xpack.crossClusterReplication.autoFollowPatternList.loadingTitle"
defaultMessage="Loading auto-follow patterns..."
/>
</PageLoading>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiButton, EuiEmptyPrompt, EuiText, EuiSpacer } from '@elastic/eui';
import { EuiPageContent, EuiButton, EuiEmptyPrompt, EuiText, EuiSpacer } from '@elastic/eui';

import { reactRouterNavigate } from '../../../../../../../../src/plugins/kibana_react/public';
import { extractQueryParams, SectionLoading } from '../../../../shared_imports';
import { extractQueryParams, PageLoading, PageError } from '../../../../shared_imports';
import { trackUiMetric, METRIC_TYPE } from '../../../services/track_ui_metric';
import { API_STATUS, UIM_FOLLOWER_INDEX_LIST_LOAD } from '../../../constants';
import { SectionError, SectionUnauthorized } from '../../../components';
import { FollowerIndicesTable, DetailPanel } from './components';

const REFRESH_RATE_MS = 30000;
Expand Down Expand Up @@ -89,7 +88,12 @@ export class FollowerIndicesList extends PureComponent {

renderEmpty() {
return (
<section>
<EuiPageContent
hasShadow={false}
paddingSize="none"
verticalPosition="center"
horizontalPosition="center"
>
<EuiEmptyPrompt
iconType="managementApp"
data-test-subj="emptyPrompt"
Expand Down Expand Up @@ -123,20 +127,18 @@ export class FollowerIndicesList extends PureComponent {
</EuiButton>
}
/>
</section>
</EuiPageContent>
);
}

renderLoading() {
return (
<section data-test-subj="followerIndexLoading">
<SectionLoading>
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexList.loadingTitle"
defaultMessage="Loading follower indices..."
/>
</SectionLoading>
</section>
<PageLoading>
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexList.loadingTitle"
defaultMessage="Loading follower indices..."
/>
</PageLoading>
);
}

Expand Down Expand Up @@ -171,19 +173,22 @@ export class FollowerIndicesList extends PureComponent {

if (!isAuthorized) {
return (
<SectionUnauthorized
<PageError
title={
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexList.permissionErrorTitle"
defaultMessage="Permission error"
/>
}
>
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexList.noPermissionText"
defaultMessage="You do not have permission to view or add follower indices."
/>
</SectionUnauthorized>
error={{
error: (
<FormattedMessage
id="xpack.crossClusterReplication.followerIndexList.noPermissionText"
defaultMessage="You do not have permission to view or add follower indices."
/>
),
}}
/>
);
}

Expand All @@ -195,7 +200,7 @@ export class FollowerIndicesList extends PureComponent {
}
);

return <SectionError title={title} error={apiError} />;
return <PageError title={title} error={apiError.body} />;
}

if (isEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ export {
indices,
SectionLoading,
PageError,
PageLoading,
} from '../../../../src/plugins/es_ui_shared/public';

export { APP_WRAPPER_CLASS } from '../../../../src/core/public';
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ export const PolicyTable: React.FunctionComponent<Props> = ({
);
}

// Wrapping the actual contents inside a div, otherwise the table layout will get messed up
// if the table size changes (ie: applying a filter) due to the flex props of the page wrapper.
content = (
<Fragment>
<div>
<EuiFlexGroup gutterSize="l" alignItems="center">
<EuiFlexItem>
<EuiFieldSearch
Expand All @@ -113,7 +115,7 @@ export const PolicyTable: React.FunctionComponent<Props> = ({
</EuiFlexGroup>
<EuiSpacer size="m" />
{tableContent}
</Fragment>
</div>
);
} else {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export type TestSubjects =
| 'snapshotDetail.version'
| 'snapshotLink'
| 'snapshotList'
| 'snapshotListEmpty'
| 'snapshotList.cell'
| 'snapshotList.closeButton'
| 'snapshotList.content'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('<SnapshotRestoreHome />', () => {
});

expect(exists('repositoryList')).toBe(false);
expect(exists('snapshotList')).toBe(true);
expect(exists('snapshotListEmpty')).toBe(true);
});
});
});
Expand Down
Loading

0 comments on commit 09bd630

Please sign in to comment.