Skip to content

Commit

Permalink
[ML] Transforms: Fix page layout (elastic#48628)
Browse files Browse the repository at this point in the history
Fixes the overall page layout of the transform plugin to be in line with the rest of the Kibana Elasticsearch management section.
  • Loading branch information
walterra committed Oct 21, 2019
1 parent e28ea61 commit d9397fe
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export enum SECTION_SLUG {
export enum TRANSFORM_DOC_PATHS {
default = 'docs.html',
plugins = 'plugins.html',
transforms = 'transforms.html',
}

// UI Metric constants
Expand Down
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/transform/public/app/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

@import 'sections/create_transform/components/aggregation_list/index';
@import 'sections/create_transform/components/group_by_list/index';
@import 'sections/create_transform/components/wizard/index';
@import 'sections/transform_management/components/create_transform_button/index';
@import 'sections/transform_management/components/stats_bar/index';
@import 'sections/transform_management/components/transform_list/index';
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ export const StepDefineForm: SFC<Props> = React.memo(({ overrides = {}, onChange

<EuiFlexItem>
<SourceIndexPreview cellClick={addToSearch} query={pivotQuery} />
<EuiSpacer size="l" />
<EuiSpacer size="m" />
<PivotPreview aggs={aggList} groupBy={groupByList} query={pivotQuery} />
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './wizard';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.transform__steps {
.euiStep__content {
padding-right: 0px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,5 @@ export const Wizard: SFC = React.memo(() => {
},
];

return <EuiSteps steps={stepsConfig} />;
return <EuiSteps className="transform__steps" steps={stepsConfig} />;
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ import { i18n } from '@kbn/i18n';

import {
EuiBetaBadge,
EuiPage,
EuiButtonEmpty,
EuiFlexGroup,
EuiFlexItem,
EuiPageContent,
EuiPageBody,
EuiPageContentBody,
EuiPageContentHeader,
EuiPageContentHeaderSection,
EuiSpacer,
EuiTitle,
} from '@elastic/eui';

import { APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES } from '../../../../common/constants';
import { breadcrumbService, docTitleService, BREADCRUMB_SECTION } from '../../services/navigation';
import { documentationLinksService } from '../../services/documentation';
import { PrivilegesWrapper } from '../../lib/authorization';
import { KibanaProvider } from '../../lib/kibana';

Expand All @@ -39,11 +41,11 @@ export const CreateTransformSection: FC<Props> = ({ match }) => {
return (
<PrivilegesWrapper privileges={APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES}>
<KibanaProvider savedObjectId={match.params.savedObjectId}>
<EuiPage>
<EuiPageBody>
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle>
<EuiPageBody data-test-subj="transformPageCreateTransform">
<EuiPageContent>
<EuiTitle size="l">
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={true}>
<h1>
<FormattedMessage
id="xpack.transform.transformsWizard.createTransformTitle"
Expand All @@ -62,15 +64,28 @@ export const CreateTransformSection: FC<Props> = ({ match }) => {
)}
/>
</h1>
</EuiTitle>
</EuiPageContentHeaderSection>
</EuiPageContentHeader>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
href={documentationLinksService.getTransformsDocUrl()}
target="_blank"
iconType="help"
data-test-subj="documentationLink"
>
<FormattedMessage
id="xpack.transform.transformsWizard.transformDocsLinkText"
defaultMessage="Transform docs"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
</EuiTitle>
<EuiPageContentBody>
<EuiSpacer size="l" />
<Wizard />
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
</EuiPageContent>
</EuiPageBody>
</KibanaProvider>
</PrivilegesWrapper>
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ export const CreateTransformButton: FC<CreateTransformButtonProps> = ({ onClick
fill
onClick={onClick}
iconType="plusInCircle"
size="s"
data-test-subj="transformButtonCreate"
>
<FormattedMessage
id="xpack.transform.transformList.createTransformButton"
defaultMessage="Create transform"
defaultMessage="Create a transform"
/>
</EuiButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React, { FC } from 'react';

import { EuiButtonEmpty } from '@elastic/eui';
import { EuiButton } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

interface RefreshTransformListButton {
Expand All @@ -17,14 +17,16 @@ export const RefreshTransformListButton: FC<RefreshTransformListButton> = ({
onClick,
isLoading,
}) => (
<EuiButtonEmpty
<EuiButton
color="secondary"
iconType="refresh"
data-test-subj="transformRefreshTransformListButton"
onClick={onClick}
isLoading={isLoading}
>
<FormattedMessage
id="xpack.transform.transformList.refreshButtonLabel"
defaultMessage="Refresh"
defaultMessage="Reload"
/>
</EuiButtonEmpty>
</EuiButton>
);
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ import {
EuiButtonIcon,
EuiCallOut,
EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
EuiPopover,
EuiTitle,
} from '@elastic/eui';

import { OnTableChangeArg, SortDirection, SORT_DIRECTION } from '../../../../../shared_imports';

import {
useRefreshTransformList,
TransformId,
TransformListRow,
TRANSFORM_MODE,
TRANSFORM_LIST_COLUMN,
TRANSFORM_STATE,
} from '../../../../common';
import { AuthorizationContext } from '../../../../lib/authorization';

import { CreateTransformButton } from '../create_transform_button';
import { RefreshTransformListButton } from '../refresh_transform_list_button';
import { getTaskStateBadge } from './columns';
import { DeleteAction } from './action_delete';
import { StartAction } from './action_start';
Expand Down Expand Up @@ -78,6 +84,8 @@ export const TransformList: FC<Props> = ({
transformsLoading,
}) => {
const [isLoading, setIsLoading] = useState(false);
const { refresh } = useRefreshTransformList({ isLoading: setIsLoading });

const [filterActive, setFilterActive] = useState(false);

const [filteredTransforms, setFilteredTransforms] = useState<TransformListRow[]>([]);
Expand Down Expand Up @@ -300,8 +308,20 @@ export const TransformList: FC<Props> = ({
];
};

const renderToolsRight = () => (
<EuiFlexGroup gutterSize="m" justifyContent="spaceAround">
<EuiFlexItem>
<RefreshTransformListButton onClick={refresh} isLoading={isLoading} />
</EuiFlexItem>
<EuiFlexItem>
<CreateTransformButton onClick={onCreateTransform} />
</EuiFlexItem>
</EuiFlexGroup>
);

const search = {
toolsLeft: transformSelection.length > 0 ? renderToolsLeft() : undefined,
toolsRight: renderToolsRight(),
onChange: onQueryChange,
box: {
incremental: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ import { i18n } from '@kbn/i18n';

import {
EuiBetaBadge,
EuiButtonEmpty,
EuiFlexGroup,
EuiFlexItem,
EuiModal,
EuiOverlayMask,
EuiPage,
EuiPageBody,
EuiPageContent,
EuiPageContentBody,
EuiPageContentHeader,
EuiPageContentHeaderSection,
EuiPanel,
EuiSpacer,
EuiText,
EuiTitle,
} from '@elastic/eui';

Expand All @@ -31,22 +30,19 @@ import { useGetTransforms } from '../../hooks';
import { RedirectToCreateTransform } from '../../common/navigation';
import { PrivilegesWrapper } from '../../lib/authorization';
import { breadcrumbService, docTitleService, BREADCRUMB_SECTION } from '../../services/navigation';
import { documentationLinksService } from '../../services/documentation';

import { useRefreshInterval } from './components/transform_list/use_refresh_interval';
import { CreateTransformButton } from './components/create_transform_button';
import { RefreshTransformListButton } from './components/refresh_transform_list_button';
import { SearchSelection } from './components/search_selection';
import { TransformList } from './components/transform_list';
import { TransformStatsBar } from './components/transform_list/transforms_stats_bar';

export const TransformManagement: FC = () => {
const [isLoading, setIsLoading] = useState(false);
const [transformsLoading, setTransformsLoading] = useState(false);
const [isInitialized, setIsInitialized] = useState(false);
const [blockRefresh, setBlockRefresh] = useState(false);
const [transforms, setTransforms] = useState<TransformListRow[]>([]);
const [errorMessage, setErrorMessage] = useState<any>(undefined);
const { refresh } = useRefreshTransformList({ isLoading: setIsLoading });

const getTransforms = useGetTransforms(
setTransforms,
Expand Down Expand Up @@ -78,12 +74,12 @@ export const TransformManagement: FC = () => {

return (
<Fragment>
<EuiPage data-test-subj="transformPageTransform">
<EuiPageBody>
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle>
<h1>
<EuiPageBody data-test-subj="transformPageTransformList">
<EuiPageContent>
<EuiTitle size="l">
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={true}>
<h1 data-test-subj="transformAppTitle">
<FormattedMessage
id="xpack.transform.transformList.transformTitle"
defaultMessage="Transforms"
Expand All @@ -101,37 +97,45 @@ export const TransformManagement: FC = () => {
)}
/>
</h1>
</EuiTitle>
</EuiPageContentHeaderSection>
<EuiPageContentHeaderSection>
<EuiFlexGroup alignItems="center">
{/* grow={false} fixes IE11 issue with nested flex */}
<EuiFlexItem grow={false}>
<RefreshTransformListButton onClick={refresh} isLoading={isLoading} />
</EuiFlexItem>
{/* grow={false} fixes IE11 issue with nested flex */}
<EuiFlexItem grow={false}>
<CreateTransformButton onClick={onOpenModal} />
</EuiFlexItem>
</EuiFlexGroup>
</EuiPageContentHeaderSection>
</EuiPageContentHeader>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
href={documentationLinksService.getTransformsDocUrl()}
target="_blank"
iconType="help"
data-test-subj="documentationLink"
>
<FormattedMessage
id="xpack.transform.transformList.transformDocsLinkText"
defaultMessage="Transform docs"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
</EuiTitle>
<EuiSpacer size="s" />
<EuiTitle size="s">
<EuiText color="subdued">
<FormattedMessage
id="xpack.transform.transformList.transformDescription"
defaultMessage="Use transforms to pivot existing Elasticsearch indices into summarized or entity-centric indices."
/>
</EuiText>
</EuiTitle>
<EuiPageContentBody>
<EuiSpacer size="l" />
<TransformStatsBar transformsList={transforms} />
<EuiSpacer size="s" />
<EuiPanel>
<TransformList
errorMessage={errorMessage}
isInitialized={isInitialized}
onCreateTransform={onOpenModal}
transforms={transforms}
transformsLoading={transformsLoading}
/>
</EuiPanel>
<TransformList
errorMessage={errorMessage}
isInitialized={isInitialized}
onCreateTransform={onOpenModal}
transforms={transforms}
transformsLoading={transformsLoading}
/>
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
</EuiPageContent>
</EuiPageBody>
{isSearchSelectionVisible && (
<EuiOverlayMask>
<EuiModal onClose={onCloseModal} className="transformCreateTransformSearchDialog">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import { TRANSFORM_DOC_PATHS } from '../../constants';

class DocumentationLinksService {
private esPluginDocBasePath: string = '';
private esDocBasePath: string = '';

public init(esPluginDocBasePath: string): void {
this.esPluginDocBasePath = esPluginDocBasePath;
public init(esDocBasePath: string): void {
this.esDocBasePath = esDocBasePath;
}

public getTransformPluginDocUrl() {
return `${this.esPluginDocBasePath}${TRANSFORM_DOC_PATHS.plugins}`;
public getTransformsDocUrl() {
return `${this.esDocBasePath}${TRANSFORM_DOC_PATHS.transforms}`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/transform/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class Plugin {
textService.init();
breadcrumbService.init(chrome, management.constants.BREADCRUMB);
uiMetricService.init(uiMetric.createUiStatsReporter);
documentationLinksService.init(documentation.esPluginDocBasePath);
documentationLinksService.init(documentation.esDocBasePath);
docTitleService.init(docTitle.change);

const unmountReactApp = (): void => {
Expand Down

0 comments on commit d9397fe

Please sign in to comment.