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

[Infra UI] Add Features section to Infra settings #168712

Merged
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
3 changes: 2 additions & 1 deletion x-pack/plugins/infra/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"kibanaReact",
"ml",
"embeddable",
"controls"
"controls",
"advancedSettings"
]
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 5 additions & 3 deletions x-pack/plugins/infra/public/pages/metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import React, { useContext } from 'react';
import { Routes, Route } from '@kbn/shared-ux-router';

import { EuiErrorBoundary, EuiHeaderLinks, EuiHeaderLink } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useKibana, useUiSetting } from '@kbn/kibana-react-plugin/public';
import { HeaderMenuPortal, useLinkProps } from '@kbn/observability-shared-plugin/public';
import { ObservabilityAIAssistantActionMenuItem } from '@kbn/observability-ai-assistant-plugin/public';
import { enableInfrastructureHostsView } from '@kbn/observability-plugin/common';
import { MetricsSourceConfigurationProperties } from '../../../common/metrics_sources';
import { HelpCenterContent } from '../../components/help_center_content';
import { useReadOnlyBadge } from '../../hooks/use_readonly_badge';
Expand All @@ -23,7 +24,6 @@ import { MetricsExplorerPage } from './metrics_explorer';
import { SnapshotPage } from './inventory_view';
import { NodeDetail } from './metric_detail';
import { MetricsSettingsPage } from './settings';
import { HostsLandingPage } from './hosts/hosts_landing_page';
import { SourceLoadingPage } from '../../components/source_loading_page';
import { WaffleOptionsProvider } from './inventory_view/hooks/use_waffle_options';
import { WaffleTimeProvider } from './inventory_view/hooks/use_waffle_time';
Expand All @@ -37,6 +37,7 @@ import { CreateDerivedIndexPattern, useSourceContext } from '../../containers/me
import { NotFoundPage } from '../404';
import { ReactQueryProvider } from '../../containers/react_query_provider';
import { usePluginConfig } from '../../containers/plugin_config_context';
import { HostsPage } from './hosts';

const ADD_DATA_LABEL = i18n.translate('xpack.infra.metricsHeaderAddDataButtonLabel', {
defaultMessage: 'Add data',
Expand All @@ -46,6 +47,7 @@ export const InfrastructurePage = () => {
const config = usePluginConfig();
const uiCapabilities = useKibana().services.application?.capabilities;
const { setHeaderActionMenu, theme$ } = useContext(HeaderActionMenuContext);
const isHostsViewEnabled = useUiSetting(enableInfrastructureHostsView);

const settingsTabTitle = i18n.translate('xpack.infra.metrics.settingsTabTitle', {
defaultMessage: 'Settings',
Expand Down Expand Up @@ -113,7 +115,7 @@ export const InfrastructurePage = () => {
</Route>
)}
<Route path="/detail/:type/:node" component={NodeDetail} />
<Route path={'/hosts'} component={HostsLandingPage} />
{isHostsViewEnabled && <Route path={'/hosts'} component={HostsPage} />}
<Route path={'/settings'} component={MetricsSettingsPage} />
<Route render={() => <NotFoundPage title="Infrastructure" />} />
</Routes>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiTitle } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
import { EuiForm } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import React from 'react';
import { enableInfrastructureHostsView } from '@kbn/observability-plugin/common';
import { useEditableSettings } from '@kbn/observability-shared-plugin/public';
import { LazyField } from '@kbn/advanced-settings-plugin/public';
import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';

type Props = Pick<
ReturnType<typeof useEditableSettings>,
'handleFieldChange' | 'settingsEditableConfig' | 'unsavedChanges'
> & {
readOnly: boolean;
};

export function FeaturesConfigurationPanel({
readOnly,
handleFieldChange,
settingsEditableConfig,
unsavedChanges,
}: Props) {
const {
services: { docLinks, notifications },
} = useKibanaContextForPlugin();

return (
<EuiForm>
<EuiTitle size="s" data-test-subj="sourceConfigurationFeaturesSectionTitle">
<h3>
<FormattedMessage
id="xpack.infra.sourceConfiguration.featuresSectionTitle"
defaultMessage="Features"
/>
</h3>
</EuiTitle>
<EuiSpacer size="m" />
<LazyField
key={enableInfrastructureHostsView}
setting={settingsEditableConfig[enableInfrastructureHostsView]}
handleChange={handleFieldChange}
enableSaving={!readOnly}
docLinks={docLinks.links}
toasts={notifications.toasts}
unsavedChanges={unsavedChanges[enableInfrastructureHostsView]}
/>
</EuiForm>
);
}
Loading
Loading