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 & Snapshot+Restore] Center align states under tabs #103237

Merged
merged 16 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
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 @@ -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: (
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved
<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
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved
// 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