[Logs onboarding] fixing type issues (#167340)

`OBSERVABILITY_ONBOARDING_LOCATOR` and
`ObservabilityOnboardingLocatorParams` were removed from
`observability_onboarding` plugin in
[#165962](https://github.com/elastic/kibana/pull/165962) and are now
part of `@kbn/deeplinks-observability/locators`.

`datsetName` was transformed into an optional variable in the wizard
state in [#166654](https://github.com/elastic/kibana/pull/166654) which
makes sense for first step of custom logs onboarding but it's required
in onboarding saved object.
This commit is contained in:
Yngrid Coello 2023-09-27 10:38:58 +02:00 committed by GitHub
parent 750c4bedbf
commit 05c637f316
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -41,6 +41,8 @@ import { BackButton } from './back_button';
import { WindowsInstallStep } from '../../shared/windows_install_step';
import { TroubleshootingLink } from '../../shared/troubleshooting_link';
const defaultDatasetName = '';
export function InstallElasticAgent() {
const {
services: { share },
@ -63,7 +65,8 @@ export function InstallElasticAgent() {
useState<ElasticAgentPlatform>('linux-tar');
const enforcedDatasetName =
(integration === dataset ? dataset : `${integration}.${dataset}`) || '';
(integration === dataset ? dataset : `${integration}.${dataset}`) ??
defaultDatasetName;
async function onContinue() {
await singleDatasetLocator!.navigate({
@ -109,11 +112,15 @@ export function InstallElasticAgent() {
customConfigurations,
logFilePaths,
} = getState();
if (!hasAlreadySavedFlow(getState()) && monitoringRole?.hasPrivileges) {
if (
!hasAlreadySavedFlow(getState()) &&
monitoringRole?.hasPrivileges &&
datasetName
) {
return callApi('POST /internal/observability_onboarding/logs/flow', {
params: {
body: {
name: datasetName || '',
name: datasetName,
type: 'logFiles',
state: {
datasetName,

View file

@ -17,9 +17,6 @@ import {
ObservabilityOnboardingPluginStart,
} from './plugin';
export type { OBSERVABILITY_ONBOARDING_LOCATOR } from './locators/onboarding_locator/locator_definition';
export type { ObservabilityOnboardingLocatorParams } from './locators/onboarding_locator/types';
export interface ConfigSchema {
ui: {
enabled: boolean;

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { ObservabilityOnboardingLocatorParams } from './types';
import type { ObservabilityOnboardingLocatorParams } from '@kbn/deeplinks-observability/locators';
import { PLUGIN_ID } from '../../../common';
export function getLocation(params: ObservabilityOnboardingLocatorParams) {