mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Infrastructure UI] Propagate Kibana version to hosts view feedback form (#159210)
closes:
[#1053](https://github.com/elastic/obs-infraobs-team/issues/1053)
## Summary
This PR changes the Hosts View feedback button to pass also the current
Kibana version.
<img width="716" alt="image"
src="9089d2c3
-590c-46c2-89ce-c6bd7bd42a6b">
The URL is no longer a shortened one, and that's because it wasn't
forwarding query parameters.
### How to test
- Start a local Kibana
- Navigate to `Infrastructure > Hosts`
- Click on "Tell us what you think" button
- On the forms, the question "What version of Elastic are you using?"
should be filled automatically with the Kibana version
---------
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
3a34200afd
commit
ee6f0f773f
3 changed files with 27 additions and 4 deletions
|
@ -12,6 +12,7 @@ import { APP_WRAPPER_CLASS } from '@kbn/core/public';
|
|||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { css } from '@emotion/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
|
||||
import { SourceErrorPage } from '../../../components/source_error_page';
|
||||
import { SourceLoadingPage } from '../../../components/source_loading_page';
|
||||
import { useSourceContext } from '../../../containers/metrics_source';
|
||||
|
@ -25,10 +26,24 @@ import { HostContainer } from './components/hosts_container';
|
|||
import { BetaBadge } from '../../../components/beta_badge';
|
||||
import { NoRemoteCluster } from '../../../components/empty_states';
|
||||
|
||||
const HOSTS_FEEDBACK_LINK = 'https://ela.st/host-feedback';
|
||||
const HOSTS_FEEDBACK_LINK =
|
||||
'https://docs.google.com/forms/d/e/1FAIpQLScRHG8TIVb1Oq8ZhD4aks3P1TmgiM58TY123QpDCcBz83YC6w/viewform';
|
||||
const KIBANA_VERSION_QUERY_PARAM = 'entry.548460210';
|
||||
|
||||
const getHostFeedbackURL = (kibanaVersion?: string) => {
|
||||
const url = new URL(HOSTS_FEEDBACK_LINK);
|
||||
if (kibanaVersion) {
|
||||
url.searchParams.append(KIBANA_VERSION_QUERY_PARAM, kibanaVersion);
|
||||
}
|
||||
|
||||
return url.href;
|
||||
};
|
||||
|
||||
export const HostsPage = () => {
|
||||
const { isLoading, loadSourceFailureMessage, loadSource, source } = useSourceContext();
|
||||
const {
|
||||
services: { kibanaVersion },
|
||||
} = useKibanaContextForPlugin();
|
||||
|
||||
useTrackPageview({ app: 'infra_metrics', path: 'hosts' });
|
||||
useTrackPageview({ app: 'infra_metrics', path: 'hosts', delay: 15000 });
|
||||
|
@ -83,7 +98,7 @@ export const HostsPage = () => {
|
|||
rightSideItems: [
|
||||
<EuiButton
|
||||
data-test-subj="infraHostsPageTellUsWhatYouThinkButton"
|
||||
href={HOSTS_FEEDBACK_LINK}
|
||||
href={getHostFeedbackURL(kibanaVersion)}
|
||||
target="_blank"
|
||||
color="warning"
|
||||
iconType="editorComment"
|
||||
|
|
|
@ -61,6 +61,7 @@ export class Plugin implements InfraClientPluginClass {
|
|||
private telemetry: TelemetryService;
|
||||
private locators?: InfraLocators;
|
||||
private appTarget: string;
|
||||
private kibanaVersion: string;
|
||||
private readonly appUpdater$ = new BehaviorSubject<AppUpdater>(() => ({}));
|
||||
|
||||
constructor(context: PluginInitializerContext<InfraPublicConfig>) {
|
||||
|
@ -74,6 +75,7 @@ export class Plugin implements InfraClientPluginClass {
|
|||
this.metricsExplorerViews = new MetricsExplorerViewsService();
|
||||
this.telemetry = new TelemetryService();
|
||||
this.appTarget = this.config.logs.app_target;
|
||||
this.kibanaVersion = context.env.packageInfo.version;
|
||||
}
|
||||
|
||||
setup(core: InfraClientCoreSetup, pluginsSetup: InfraClientSetupDeps) {
|
||||
|
@ -286,10 +288,15 @@ export class Plugin implements InfraClientPluginClass {
|
|||
deepLinks: infraDeepLinks,
|
||||
mount: async (params: AppMountParameters) => {
|
||||
// mount callback should not use setup dependencies, get start dependencies instead
|
||||
const [coreStart, pluginsStart, pluginStart] = await core.getStartServices();
|
||||
const [coreStart, plugins, pluginStart] = await core.getStartServices();
|
||||
const { renderApp } = await import('./apps/metrics_app');
|
||||
|
||||
return renderApp(coreStart, pluginsStart, pluginStart, params);
|
||||
return renderApp(
|
||||
coreStart,
|
||||
{ ...plugins, kibanaVersion: this.kibanaVersion },
|
||||
pluginStart,
|
||||
params
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ export interface InfraClientStartDeps {
|
|||
dataViews: DataViewsPublicPluginStart;
|
||||
discover: DiscoverStart;
|
||||
embeddable?: EmbeddableStart;
|
||||
kibanaVersion?: string;
|
||||
lens: LensPublicStart;
|
||||
ml: MlPluginStart;
|
||||
observability: ObservabilityPublicStart;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue