Skip to content

Commit 838ab8a

Browse files
authored
Add doc titles to ES UI apps (#71045) (#72643)
* Add doc titles to CCR, ILM, Index Management, Ingest Node Pipelines, License Management, Remote Clusters, Rollup Jobs, Watcher, and Upgrade Assistant. Clear doc title when leaving Dev Tools. * Refactor Watcher boot file to follow index-oriented pattern of other plugins.
1 parent f6957a8 commit 838ab8a

File tree

14 files changed

+149
-40
lines changed

14 files changed

+149
-40
lines changed

src/plugins/dev_tools/public/application.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export function renderApp(
203203
});
204204

205205
return () => {
206+
chrome.docTitle.reset();
206207
ReactDOM.unmountComponentAtNode(element);
207208
unlisten();
208209
};

x-pack/plugins/cross_cluster_replication/public/plugin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ export class CrossClusterReplicationPlugin implements Plugin {
4545

4646
const [coreStart] = await getStartServices();
4747
const {
48+
chrome: { docTitle },
4849
i18n: { Context: I18nContext },
4950
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
5051
application: { getUrlForApp },
5152
} = coreStart;
5253

53-
return mountApp({
54+
docTitle.change(PLUGIN.TITLE);
55+
56+
const unmountAppCallback = await mountApp({
5457
element,
5558
setBreadcrumbs,
5659
I18nContext,
@@ -59,6 +62,11 @@ export class CrossClusterReplicationPlugin implements Plugin {
5962
history,
6063
getUrlForApp,
6164
});
65+
66+
return () => {
67+
docTitle.reset();
68+
unmountAppCallback();
69+
};
6270
},
6371
});
6472

x-pack/plugins/index_lifecycle_management/public/plugin.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,26 @@ export class IndexLifecycleManagementPlugin {
4444
mount: async ({ element, history }) => {
4545
const [coreStart] = await getStartServices();
4646
const {
47+
chrome: { docTitle },
4748
i18n: { Context: I18nContext },
4849
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
4950
application: { navigateToApp },
5051
} = coreStart;
5152

53+
docTitle.change(PLUGIN.TITLE);
54+
5255
// Initialize additional services.
5356
initDocumentation(
5457
`${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`
5558
);
5659

5760
const { renderApp } = await import('./application');
58-
return renderApp(element, I18nContext, history, navigateToApp);
61+
const unmountAppCallback = renderApp(element, I18nContext, history, navigateToApp);
62+
63+
return () => {
64+
docTitle.reset();
65+
unmountAppCallback();
66+
};
5967
},
6068
});
6169

x-pack/plugins/index_management/public/application/mount_management_section.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7+
import { i18n } from '@kbn/i18n';
78
import { CoreSetup } from 'src/core/public';
89
import { ManagementAppMountParams } from 'src/plugins/management/public/';
910
import { UsageCollectionSetup } from 'src/plugins/usage_collection/public';
1011

1112
import { IngestManagerSetup } from '../../../ingest_manager/public';
13+
import { PLUGIN } from '../../common/constants';
1214
import { ExtensionsService } from '../services';
1315
import { IndexMgmtMetricsType } from '../types';
1416
import { AppDependencies } from './app_context';
@@ -34,7 +36,14 @@ export async function mountManagementSection(
3436
) {
3537
const { element, setBreadcrumbs, history } = params;
3638
const [core] = await coreSetup.getStartServices();
37-
const { docLinks, fatalErrors, application } = core;
39+
const {
40+
docLinks,
41+
fatalErrors,
42+
application,
43+
chrome: { docTitle },
44+
} = core;
45+
46+
docTitle.change(PLUGIN.getI18nName(i18n));
3847

3948
breadcrumbService.setup(setBreadcrumbs);
4049
documentationService.setup(docLinks);
@@ -53,5 +62,10 @@ export async function mountManagementSection(
5362
setBreadcrumbs,
5463
};
5564

56-
return renderApp(element, { core, dependencies: appDependencies });
65+
const unmountAppCallback = renderApp(element, { core, dependencies: appDependencies });
66+
67+
return () => {
68+
docTitle.reset();
69+
unmountAppCallback();
70+
};
5771
}

x-pack/plugins/ingest_pipelines/public/plugin.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,36 @@ import { Dependencies } from './types';
1414
export class IngestPipelinesPlugin implements Plugin {
1515
public setup(coreSetup: CoreSetup, plugins: Dependencies): void {
1616
const { management, usageCollection } = plugins;
17-
const { http } = coreSetup;
17+
const { http, getStartServices } = coreSetup;
1818

1919
// Initialize services
2020
uiMetricService.setup(usageCollection);
2121
apiService.setup(http, uiMetricService);
2222

23+
const pluginName = i18n.translate('xpack.ingestPipelines.appTitle', {
24+
defaultMessage: 'Ingest Node Pipelines',
25+
});
26+
2327
management.sections.section.ingest.registerApp({
2428
id: PLUGIN_ID,
2529
order: 1,
26-
title: i18n.translate('xpack.ingestPipelines.appTitle', {
27-
defaultMessage: 'Ingest Node Pipelines',
28-
}),
30+
title: pluginName,
2931
mount: async (params) => {
32+
const [coreStart] = await getStartServices();
33+
34+
const {
35+
chrome: { docTitle },
36+
} = coreStart;
37+
38+
docTitle.change(pluginName);
39+
3040
const { mountManagementSection } = await import('./application/mount_management_section');
41+
const unmountAppCallback = await mountManagementSection(coreSetup, params);
3142

32-
return await mountManagementSection(coreSetup, params);
43+
return () => {
44+
docTitle.reset();
45+
unmountAppCallback();
46+
};
3347
},
3448
});
3549
}

x-pack/plugins/license_management/public/plugin.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,27 @@ export class LicenseManagementUIPlugin
5555
title: PLUGIN.title,
5656
order: 0,
5757
mount: async ({ element, setBreadcrumbs, history }) => {
58-
const [core, { telemetry }] = await getStartServices();
58+
const [coreStart, { telemetry }] = await getStartServices();
5959
const initialLicense = await plugins.licensing.license$.pipe(first()).toPromise();
6060

6161
// Setup documentation links
62-
const { docLinks } = core;
62+
const {
63+
docLinks,
64+
chrome: { docTitle },
65+
} = coreStart;
6366
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
6467
const esBase = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}`;
6568
const appDocLinks = {
6669
security: `${esBase}/security-settings.html`,
6770
};
6871

72+
docTitle.change(PLUGIN.title);
73+
6974
// Setup services
7075
this.breadcrumbService.setup(setBreadcrumbs);
7176

7277
const appDependencies: AppDependencies = {
73-
core,
78+
core: coreStart,
7479
config,
7580
plugins: {
7681
licensing,
@@ -87,8 +92,12 @@ export class LicenseManagementUIPlugin
8792
};
8893

8994
const { renderApp } = await import('./application');
95+
const unmountAppCallback = renderApp(element, appDependencies);
9096

91-
return renderApp(element, appDependencies);
97+
return () => {
98+
docTitle.reset();
99+
unmountAppCallback();
100+
};
92101
},
93102
});
94103

x-pack/plugins/remote_clusters/public/plugin.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { i18n } from '@kbn/i18n';
88
import { CoreSetup, Plugin, CoreStart, PluginInitializerContext } from 'kibana/public';
99

10+
import { PLUGIN } from '../common/constants';
1011
import { init as initBreadcrumbs } from './application/services/breadcrumb';
1112
import { init as initDocumentation } from './application/services/documentation';
1213
import { init as initHttp } from './application/services/http';
@@ -43,11 +44,14 @@ export class RemoteClustersUIPlugin
4344
mount: async ({ element, setBreadcrumbs, history }) => {
4445
const [core] = await getStartServices();
4546
const {
47+
chrome: { docTitle },
4648
i18n: { Context: i18nContext },
4749
docLinks,
4850
fatalErrors,
4951
} = core;
5052

53+
docTitle.change(PLUGIN.getI18nName());
54+
5155
// Initialize services
5256
initBreadcrumbs(setBreadcrumbs);
5357
initDocumentation(docLinks);
@@ -58,7 +62,17 @@ export class RemoteClustersUIPlugin
5862
const isCloudEnabled = Boolean(cloud?.isCloudEnabled);
5963

6064
const { renderApp } = await import('./application');
61-
return renderApp(element, i18nContext, { isCloudEnabled }, history);
65+
const unmountAppCallback = await renderApp(
66+
element,
67+
i18nContext,
68+
{ isCloudEnabled },
69+
history
70+
);
71+
72+
return () => {
73+
docTitle.reset();
74+
unmountAppCallback();
75+
};
6276
},
6377
});
6478
}

x-pack/plugins/rollup/public/plugin.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,31 @@ export class RollupPlugin implements Plugin {
7575
});
7676
}
7777

78+
const pluginName = i18n.translate('xpack.rollupJobs.appTitle', {
79+
defaultMessage: 'Rollup Jobs',
80+
});
81+
7882
management.sections.section.data.registerApp({
7983
id: 'rollup_jobs',
80-
title: i18n.translate('xpack.rollupJobs.appTitle', { defaultMessage: 'Rollup Jobs' }),
84+
title: pluginName,
8185
order: 4,
8286
async mount(params) {
83-
params.setBreadcrumbs([
84-
{
85-
text: i18n.translate('xpack.rollupJobs.breadcrumbsTitle', {
86-
defaultMessage: 'Rollup Jobs',
87-
}),
88-
},
89-
]);
87+
const [coreStart] = await core.getStartServices();
88+
89+
const {
90+
chrome: { docTitle },
91+
} = coreStart;
92+
93+
docTitle.change(pluginName);
94+
params.setBreadcrumbs([{ text: pluginName }]);
95+
9096
const { renderApp } = await import('./application');
97+
const unmountAppCallback = await renderApp(core, params);
9198

92-
return renderApp(core, params);
99+
return () => {
100+
docTitle.reset();
101+
unmountAppCallback();
102+
};
93103
},
94104
});
95105
}

x-pack/plugins/snapshot_restore/public/application/mount_management_section.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export async function mountManagementSection(
4848
const unmountAppCallback = renderApp(element, appDependencies);
4949

5050
return () => {
51-
// Change tab label back to Kibana.
5251
docTitle.reset();
5352
unmountAppCallback();
5453
};

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12335,7 +12335,6 @@
1233512335
"xpack.reporting.shareContextMenu.pdfReportsButtonLabel": "PDF レポート",
1233612336
"xpack.reporting.shareContextMenu.pngReportsButtonLabel": "PNG レポート",
1233712337
"xpack.rollupJobs.appTitle": "ロールアップジョブ",
12338-
"xpack.rollupJobs.breadcrumbsTitle": "ロールアップジョブ",
1233912338
"xpack.rollupJobs.create.backButton.label": "戻る",
1234012339
"xpack.rollupJobs.create.dateTypeField": "日付",
1234112340
"xpack.rollupJobs.create.errors.dateHistogramFieldMissing": "日付フィールドが必要です。",

0 commit comments

Comments
 (0)