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

[7.15] [User Experience app] Simplify page header responsiveness in ux app (#112930) #113973

Merged
merged 2 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions x-pack/plugins/apm/public/application/uxApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import {
} from '../../../../../src/plugins/kibana_react/public';
import { APMRouteDefinition } from '../application/routes';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { RumHome, UX_LABEL } from '../components/app/RumDashboard/RumHome';
import {
RumHome,
DASHBOARD_LABEL,
} from '../components/app/RumDashboard/RumHome';
import { ApmPluginContext } from '../context/apm_plugin/apm_plugin_context';
import { UrlParamsProvider } from '../context/url_params_context/url_params_context';
import { ConfigSchema } from '../index';
Expand All @@ -40,7 +43,7 @@ export const uxRoutes: APMRouteDefinition[] = [
exact: true,
path: '/',
render: redirectTo('/ux'),
breadcrumb: UX_LABEL,
breadcrumb: DASHBOARD_LABEL,
},
];

Expand Down
44 changes: 10 additions & 34 deletions x-pack/plugins/apm/public/components/app/RumDashboard/RumHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,73 +17,49 @@ import { EnvironmentFilter } from '../../shared/EnvironmentFilter';
import { UserPercentile } from './UserPercentile';
import { useBreakpoints } from '../../../hooks/use_breakpoints';

export const UX_LABEL = i18n.translate('xpack.apm.ux.title', {
export const DASHBOARD_LABEL = i18n.translate('xpack.apm.ux.title', {
defaultMessage: 'Dashboard',
});

export function RumHome() {
const { observability } = useApmPluginContext();
const PageTemplateComponent = observability.navigation.PageTemplate;

const { isSmall, isXXL } = useBreakpoints();

const envStyle = isSmall ? {} : { maxWidth: 500 };

return (
<CsmSharedContextProvider>
<PageTemplateComponent
pageHeader={
isXXL
? {
pageTitle: i18n.translate('xpack.apm.ux.overview', {
defaultMessage: 'Dashboard',
}),
rightSideItems: [
<DatePicker />,
<div style={envStyle}>
<EnvironmentFilter />
</div>,
<UserPercentile />,
<WebApplicationSelect />,
],
}
: { children: <PageHeader /> }
}
>
<PageTemplateComponent pageHeader={{ children: <PageHeader /> }}>
<RumOverview />
</PageTemplateComponent>
</CsmSharedContextProvider>
);
}

function PageHeader() {
const { isSmall } = useBreakpoints();
const sizes = useBreakpoints();

const envStyle = isSmall ? {} : { maxWidth: 400 };
const datePickerStyle = sizes.isMedium ? {} : { maxWidth: '70%' };

return (
<div style={{ width: '100%' }}>
<EuiFlexGroup wrap>
<EuiFlexItem>
<EuiTitle>
<h1>{UX_LABEL}</h1>
<h1 className="eui-textNoWrap">{DASHBOARD_LABEL}</h1>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexItem style={{ alignItems: 'flex-end', ...datePickerStyle }}>
<DatePicker />
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup wrap>
<EuiFlexItem grow={false}>
<EuiFlexItem>
<WebApplicationSelect />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexItem>
<UserPercentile />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<div style={envStyle}>
<EnvironmentFilter />
</div>
<EuiFlexItem>
<EnvironmentFilter />
</EuiFlexItem>
</EuiFlexGroup>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,22 @@ function ServiceNameFilter({ loading, serviceNames }: Props) {
}, [serviceNames, selectedServiceName, updateServiceName, loading]);

return (
<>
<EuiSelect
prepend={i18n.translate(
'xpack.apm.ux.localFilters.titles.webApplication',
{
defaultMessage: 'Web application',
}
)}
isLoading={loading}
data-cy="serviceNameFilter"
options={options}
value={selectedServiceName}
onChange={(event) => {
updateServiceName(event.target.value);
}}
/>
</>
<EuiSelect
fullWidth
prepend={i18n.translate(
'xpack.apm.ux.localFilters.titles.webApplication',
{
defaultMessage: 'Web application',
}
)}
isLoading={loading}
data-cy="serviceNameFilter"
options={options}
value={selectedServiceName}
onChange={(event) => {
updateServiceName(event.target.value);
}}
/>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export function UserPercentile() {

return (
<EuiSelect
fullWidth
prepend={I18LABELS.percentile}
data-test-subj="uxPercentileSelect"
style={{ width: 150 }}
options={options}
onChange={(evt) => onChange(evt.target.value)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export function EnvironmentFilter() {

return (
<EuiSelect
fullWidth
prepend={i18n.translate('xpack.apm.filter.environment.label', {
defaultMessage: 'Environment',
})}
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -7491,7 +7491,6 @@
"xpack.apm.ux.localFilters.titles.webApplication": "Webアプリケーション",
"xpack.apm.ux.median": "中間",
"xpack.apm.ux.metrics": "メトリック",
"xpack.apm.ux.overview": "ダッシュボード",
"xpack.apm.ux.overview.heading": "ダッシュボード",
"xpack.apm.ux.percentile.50thMedian": "50 番目(中央値)",
"xpack.apm.ux.percentile.75th": "75番目",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -7552,7 +7552,6 @@
"xpack.apm.ux.localFilters.titles.webApplication": "Web 应用程序",
"xpack.apm.ux.median": "中值",
"xpack.apm.ux.metrics": "指标",
"xpack.apm.ux.overview": "仪表板",
"xpack.apm.ux.overview.heading": "仪表板",
"xpack.apm.ux.percentile.50thMedian": "第 50 个(中值)",
"xpack.apm.ux.percentile.75th": "第 75 个",
Expand Down