mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
chore(slo): Migrate to server-route-repository (#198726)
This commit is contained in:
parent
da85efe509
commit
efcc2ab004
162 changed files with 1322 additions and 1366 deletions
|
@ -36267,7 +36267,7 @@ paths:
|
|||
- $ref: '#/components/parameters/SLOs_space_id'
|
||||
- $ref: '#/components/parameters/SLOs_slo_id'
|
||||
responses:
|
||||
'204':
|
||||
'200':
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
schema:
|
||||
|
@ -36311,7 +36311,7 @@ paths:
|
|||
- $ref: '#/components/parameters/SLOs_space_id'
|
||||
- $ref: '#/components/parameters/SLOs_slo_id'
|
||||
responses:
|
||||
'200':
|
||||
'204':
|
||||
description: Successful request
|
||||
'400':
|
||||
content:
|
||||
|
|
|
@ -40728,7 +40728,7 @@ paths:
|
|||
- $ref: '#/components/parameters/SLOs_space_id'
|
||||
- $ref: '#/components/parameters/SLOs_slo_id'
|
||||
responses:
|
||||
'204':
|
||||
'200':
|
||||
content:
|
||||
application/json; Elastic-Api-Version=2023-10-31:
|
||||
schema:
|
||||
|
@ -40772,7 +40772,7 @@ paths:
|
|||
- $ref: '#/components/parameters/SLOs_space_id'
|
||||
- $ref: '#/components/parameters/SLOs_slo_id'
|
||||
responses:
|
||||
'200':
|
||||
'204':
|
||||
description: Successful request
|
||||
'400':
|
||||
content:
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* eslint-disable max-classes-per-file */
|
||||
|
||||
export class ObservabilityError extends Error {
|
||||
constructor(message?: string) {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
}
|
||||
}
|
||||
|
||||
export class SLONotFound extends ObservabilityError {}
|
||||
export class SLOIdConflict extends ObservabilityError {}
|
||||
|
||||
export class InvalidQueryError extends ObservabilityError {}
|
||||
export class InternalQueryError extends ObservabilityError {}
|
||||
export class NotSupportedError extends ObservabilityError {}
|
||||
export class IllegalArgumentError extends ObservabilityError {}
|
||||
export class InvalidTransformError extends ObservabilityError {}
|
||||
|
||||
export class SecurityException extends ObservabilityError {}
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* 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 { ObservabilityError, SecurityException, SLOIdConflict, SLONotFound } from './errors';
|
||||
|
||||
export function getHTTPResponseCode(error: ObservabilityError): number {
|
||||
if (error instanceof SLONotFound) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
if (error instanceof SLOIdConflict) {
|
||||
return 409;
|
||||
}
|
||||
|
||||
if (error instanceof SecurityException) {
|
||||
return 403;
|
||||
}
|
||||
|
||||
return 400;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export * from './errors';
|
||||
export * from './handler';
|
|
@ -8,20 +8,19 @@ import { errors } from '@elastic/elasticsearch';
|
|||
import Boom from '@hapi/boom';
|
||||
import { RulesClientApi } from '@kbn/alerting-plugin/server/types';
|
||||
import { CoreSetup, KibanaRequest, Logger, RouteRegistrar } from '@kbn/core/server';
|
||||
import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server';
|
||||
import { RuleDataPluginService } from '@kbn/rule-registry-plugin/server';
|
||||
import {
|
||||
IoTsParamsObject,
|
||||
decodeRequestParams,
|
||||
stripNullishRequestParameters,
|
||||
parseEndpoint,
|
||||
passThroughValidationObject,
|
||||
stripNullishRequestParameters,
|
||||
} from '@kbn/server-route-repository';
|
||||
import { SpacesPluginStart } from '@kbn/spaces-plugin/server';
|
||||
import axios from 'axios';
|
||||
import * as t from 'io-ts';
|
||||
import { DataViewsServerPluginStart } from '@kbn/data-views-plugin/server';
|
||||
import { ObservabilityConfig } from '..';
|
||||
import { getHTTPResponseCode, ObservabilityError } from '../errors';
|
||||
import { AlertDetailsContextualInsightsService } from '../services';
|
||||
import { ObservabilityRequestHandlerContext } from '../types';
|
||||
import { AbstractObservabilityServerRouteRepository } from './types';
|
||||
|
@ -88,16 +87,6 @@ export function registerRoutes({ config, repository, core, logger, dependencies
|
|||
|
||||
return response.ok({ body: data });
|
||||
} catch (error) {
|
||||
if (error instanceof ObservabilityError) {
|
||||
logger.error(error.message);
|
||||
return response.customError({
|
||||
statusCode: getHTTPResponseCode(error),
|
||||
body: {
|
||||
message: error.message,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (axios.isAxiosError(error)) {
|
||||
logger.error(error);
|
||||
return response.customError({
|
||||
|
|
|
@ -25,7 +25,7 @@ import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/publi
|
|||
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||
import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';
|
||||
import { LensPublicStart } from '@kbn/lens-plugin/public';
|
||||
import { SloPublicStart } from '@kbn/slo-plugin/public';
|
||||
import { SLOPublicStart } from '@kbn/slo-plugin/public';
|
||||
import { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
|
||||
import {
|
||||
ObservabilityLogsExplorerLocators,
|
||||
|
@ -53,7 +53,7 @@ export interface ObservabilityLogsExplorerStartDeps {
|
|||
logsDataAccess: LogsDataAccessPluginStart;
|
||||
observabilityAIAssistant?: ObservabilityAIAssistantPublicStart;
|
||||
observabilityShared: ObservabilitySharedPluginStart;
|
||||
slo: SloPublicStart;
|
||||
slo: SLOPublicStart;
|
||||
serverless?: ServerlessPluginStart;
|
||||
triggersActionsUi?: TriggersAndActionsUIPublicPluginStart;
|
||||
unifiedSearch?: UnifiedSearchPublicPluginStart;
|
||||
|
|
|
@ -25,5 +25,5 @@ export const config = {
|
|||
experimental: true,
|
||||
},
|
||||
};
|
||||
export type SloConfig = TypeOf<typeof configSchema>;
|
||||
export type ExperimentalFeatures = SloConfig['experimental'];
|
||||
export type SLOConfig = TypeOf<typeof configSchema>;
|
||||
export type ExperimentalFeatures = SLOConfig['experimental'];
|
||||
|
|
|
@ -559,7 +559,7 @@
|
|||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"204": {
|
||||
"description": "Successful request"
|
||||
},
|
||||
"400": {
|
||||
|
@ -625,7 +625,7 @@
|
|||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"200": {
|
||||
"description": "Successful request",
|
||||
"content": {
|
||||
"application/json": {
|
||||
|
|
|
@ -341,7 +341,7 @@ paths:
|
|||
- $ref: '#/components/parameters/space_id'
|
||||
- $ref: '#/components/parameters/slo_id'
|
||||
responses:
|
||||
'200':
|
||||
'204':
|
||||
description: Successful request
|
||||
'400':
|
||||
description: Bad request
|
||||
|
@ -380,7 +380,7 @@ paths:
|
|||
- $ref: '#/components/parameters/space_id'
|
||||
- $ref: '#/components/parameters/slo_id'
|
||||
responses:
|
||||
'204':
|
||||
'200':
|
||||
description: Successful request
|
||||
content:
|
||||
application/json:
|
||||
|
|
|
@ -11,7 +11,7 @@ post:
|
|||
- $ref: ../components/parameters/space_id.yaml
|
||||
- $ref: ../components/parameters/slo_id.yaml
|
||||
responses:
|
||||
'204':
|
||||
'200':
|
||||
description: Successful request
|
||||
content:
|
||||
application/json:
|
||||
|
|
|
@ -11,7 +11,7 @@ post:
|
|||
- $ref: ../components/parameters/space_id.yaml
|
||||
- $ref: ../components/parameters/slo_id.yaml
|
||||
responses:
|
||||
'200':
|
||||
'204':
|
||||
description: Successful request
|
||||
'400':
|
||||
description: Bad request
|
||||
|
|
|
@ -38,14 +38,14 @@
|
|||
"presentationUtil",
|
||||
"features",
|
||||
"licensing",
|
||||
"usageCollection"
|
||||
"usageCollection",
|
||||
],
|
||||
"optionalPlugins": [
|
||||
"cloud",
|
||||
"spaces",
|
||||
"serverless",
|
||||
"discover",
|
||||
"observabilityAIAssistant"
|
||||
"observabilityAIAssistant",
|
||||
"spaces",
|
||||
],
|
||||
"requiredBundles": [
|
||||
"controls",
|
||||
|
|
|
@ -25,26 +25,20 @@ import { ExperimentalFeatures } from '../common/config';
|
|||
import { PluginContext } from './context/plugin_context';
|
||||
import { usePluginContext } from './hooks/use_plugin_context';
|
||||
import { getRoutes } from './routes/routes';
|
||||
import { SloPublicPluginsStart } from './types';
|
||||
import { SLORepositoryClient, SLOPublicPluginsStart } from './types';
|
||||
|
||||
function App() {
|
||||
const { isServerless } = usePluginContext();
|
||||
|
||||
const routes = getRoutes(isServerless);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Routes>
|
||||
{Object.keys(routes).map((path) => {
|
||||
const { handler, exact } = routes[path];
|
||||
const Wrapper = () => {
|
||||
return handler();
|
||||
};
|
||||
return <Route key={path} path={path} exact={exact} component={Wrapper} />;
|
||||
})}
|
||||
</Routes>
|
||||
</>
|
||||
);
|
||||
interface Props {
|
||||
core: CoreStart;
|
||||
plugins: SLOPublicPluginsStart;
|
||||
appMountParameters: AppMountParameters;
|
||||
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
|
||||
ObservabilityPageTemplate: React.ComponentType<LazyObservabilityPageTemplateProps>;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
isDev?: boolean;
|
||||
kibanaVersion: string;
|
||||
isServerless?: boolean;
|
||||
experimentalFeatures: ExperimentalFeatures;
|
||||
sloClient: SLORepositoryClient;
|
||||
}
|
||||
|
||||
export const renderApp = ({
|
||||
|
@ -58,18 +52,8 @@ export const renderApp = ({
|
|||
isServerless,
|
||||
observabilityRuleTypeRegistry,
|
||||
experimentalFeatures,
|
||||
}: {
|
||||
core: CoreStart;
|
||||
plugins: SloPublicPluginsStart;
|
||||
appMountParameters: AppMountParameters;
|
||||
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
|
||||
ObservabilityPageTemplate: React.ComponentType<LazyObservabilityPageTemplateProps>;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
isDev?: boolean;
|
||||
kibanaVersion: string;
|
||||
isServerless?: boolean;
|
||||
experimentalFeatures: ExperimentalFeatures;
|
||||
}) => {
|
||||
sloClient,
|
||||
}: Props) => {
|
||||
const { element, history, theme$ } = appMountParameters;
|
||||
const isDarkMode = core.theme.getTheme().darkMode;
|
||||
|
||||
|
@ -128,6 +112,7 @@ export const renderApp = ({
|
|||
ObservabilityPageTemplate,
|
||||
observabilityRuleTypeRegistry,
|
||||
experimentalFeatures,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<Router history={history}>
|
||||
|
@ -160,3 +145,21 @@ export const renderApp = ({
|
|||
ReactDOM.unmountComponentAtNode(element);
|
||||
};
|
||||
};
|
||||
|
||||
function App() {
|
||||
const { isServerless } = usePluginContext();
|
||||
|
||||
const routes = getRoutes(isServerless);
|
||||
|
||||
return (
|
||||
<Routes>
|
||||
{Object.keys(routes).map((path) => {
|
||||
const { handler, exact } = routes[path];
|
||||
const Wrapper = () => {
|
||||
return handler();
|
||||
};
|
||||
return <Route key={path} path={path} exact={exact} component={Wrapper} />;
|
||||
})}
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import React, { useRef } from 'react';
|
|||
import { useAnnotations } from '@kbn/observability-plugin/public';
|
||||
import { TimeBounds } from '../../pages/slo_details/types';
|
||||
import { getBrushTimeBounds } from '../../utils/slo/duration';
|
||||
import { useKibana } from '../../utils/kibana_react';
|
||||
import { useKibana } from '../../hooks/use_kibana';
|
||||
import { openInDiscover } from '../../utils/slo/get_discover_link';
|
||||
|
||||
export interface Props {
|
||||
|
|
|
@ -9,7 +9,7 @@ import React from 'react';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiHeaderLink, EuiHeaderLinks } from '@elastic/eui';
|
||||
import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public';
|
||||
import { useKibana } from '../../utils/kibana_react';
|
||||
import { useKibana } from '../../hooks/use_kibana';
|
||||
import { usePluginContext } from '../../hooks/use_plugin_context';
|
||||
import { SLOS_BASE_PATH, SLO_SETTINGS_PATH } from '../../../common/locators/paths';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import React, { useEffect } from 'react';
|
|||
import { EuiFlexGroup, EuiLink } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { AlertDetailsAppSectionProps } from '@kbn/observability-plugin/public';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { useFetchSloDetails } from '../../../../hooks/use_fetch_slo_details';
|
||||
import { CustomAlertDetailsPanel } from './components/custom_panels/custom_panels';
|
||||
import { ErrorRatePanel } from './components/error_rate/error_rate_panel';
|
||||
|
|
|
@ -27,7 +27,7 @@ import type { WindowSchema } from '../../../../../../../typings';
|
|||
import { TimeRange } from '../../../../../error_rate_chart/use_lens_definition';
|
||||
import { BurnRateAlert, BurnRateRule } from '../../../types';
|
||||
import { getActionGroupFromReason } from '../../../utils/alert';
|
||||
import { useKibana } from '../../../../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../../../../hooks/use_kibana';
|
||||
import { getESQueryForLogRateAnalysis } from './helpers/log_rate_analysis_query';
|
||||
function getDataTimeRange(
|
||||
timeRange: { gte: string; lte?: string },
|
||||
|
|
|
@ -23,7 +23,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
|
|||
import { ALERT_EVALUATION_VALUE, ALERT_TIME_RANGE } from '@kbn/rule-data-utils';
|
||||
import { GetSLOResponse } from '@kbn/slo-schema';
|
||||
import React from 'react';
|
||||
import { useKibana } from '../../../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../../../hooks/use_kibana';
|
||||
import { ErrorRateChart } from '../../../../error_rate_chart';
|
||||
import { TimeRange } from '../../../../error_rate_chart/use_lens_definition';
|
||||
import { BurnRateAlert } from '../../types';
|
||||
|
|
|
@ -11,7 +11,7 @@ import moment from 'moment';
|
|||
import React from 'react';
|
||||
import { SloTabId } from '../../../pages/slo_details/components/slo_details';
|
||||
import { TimeBounds } from '../../../pages/slo_details/types';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { getDelayInSecondsFromSLO } from '../../../utils/slo/get_delay_in_seconds_from_slo';
|
||||
import { AlertAnnotation, TimeRange, useLensDefinition } from './use_lens_definition';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import { EuiButton, EuiCallOut, EuiSpacer } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { useFetchSloDefinitions } from '../../../hooks/use_fetch_slo_definitions';
|
||||
import { paths } from '../../../../common/locators/paths';
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import React, { MouseEvent } from 'react';
|
||||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
|
||||
export interface Props {
|
||||
viewMode?: 'compact' | 'default';
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
* 2.0.
|
||||
*/
|
||||
export const SLO_LONG_REFETCH_INTERVAL = 60 * 1000; // 1 minute
|
||||
export const SLO_SHORT_REFETCH_INTERVAL = 5 * 1000; // 5 seconds
|
||||
|
|
|
@ -10,6 +10,7 @@ import type { AppMountParameters } from '@kbn/core/public';
|
|||
import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public';
|
||||
import type { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public';
|
||||
import { ExperimentalFeatures } from '../../common/config';
|
||||
import type { SLORepositoryClient } from '../types';
|
||||
|
||||
export interface PluginContextValue {
|
||||
isDev?: boolean;
|
||||
|
@ -18,6 +19,7 @@ export interface PluginContextValue {
|
|||
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
|
||||
ObservabilityPageTemplate: React.ComponentType<LazyObservabilityPageTemplateProps>;
|
||||
experimentalFeatures?: ExperimentalFeatures;
|
||||
sloClient: SLORepositoryClient;
|
||||
}
|
||||
|
||||
export const PluginContext = createContext<PluginContextValue | null>(null);
|
||||
|
|
|
@ -5,27 +5,28 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import type { CoreStart } from '@kbn/core-lifecycle-browser';
|
||||
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { Storage } from '@kbn/kibana-utils-plugin/public';
|
||||
import {
|
||||
FetchContext,
|
||||
fetch$,
|
||||
initializeTitles,
|
||||
useBatchedPublishingSubjects,
|
||||
fetch$,
|
||||
FetchContext,
|
||||
useFetchContext,
|
||||
} from '@kbn/presentation-publishing';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import { Storage } from '@kbn/kibana-utils-plugin/public';
|
||||
import type { StartServicesAccessor } from '@kbn/core-lifecycle-browser';
|
||||
import React, { useEffect } from 'react';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import { SLOPublicPluginsStart, SLORepositoryClient } from '../../../types';
|
||||
import { SLO_ALERTS_EMBEDDABLE_ID } from './constants';
|
||||
import { SloAlertsEmbeddableState, SloAlertsApi } from './types';
|
||||
import { SloPublicPluginsStart, SloPublicStart } from '../../../types';
|
||||
import { SloAlertsWrapper } from './slo_alerts_wrapper';
|
||||
import { SloAlertsApi, SloAlertsEmbeddableState } from './types';
|
||||
const history = createBrowserHistory();
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
|
@ -34,10 +35,17 @@ export const getAlertsPanelTitle = () =>
|
|||
defaultMessage: 'SLO Alerts',
|
||||
});
|
||||
|
||||
export function getAlertsEmbeddableFactory(
|
||||
getStartServices: StartServicesAccessor<SloPublicPluginsStart, SloPublicStart>,
|
||||
kibanaVersion: string
|
||||
) {
|
||||
export function getAlertsEmbeddableFactory({
|
||||
coreStart,
|
||||
pluginsStart,
|
||||
sloClient,
|
||||
kibanaVersion,
|
||||
}: {
|
||||
coreStart: CoreStart;
|
||||
pluginsStart: SLOPublicPluginsStart;
|
||||
sloClient: SLORepositoryClient;
|
||||
kibanaVersion: string;
|
||||
}) {
|
||||
const factory: ReactEmbeddableFactory<
|
||||
SloAlertsEmbeddableState,
|
||||
SloAlertsEmbeddableState,
|
||||
|
@ -48,15 +56,15 @@ export function getAlertsEmbeddableFactory(
|
|||
return state.rawState as SloAlertsEmbeddableState;
|
||||
},
|
||||
buildEmbeddable: async (state, buildApi, uuid, parentApi) => {
|
||||
const [coreStart, pluginStart] = await getStartServices();
|
||||
const deps = { ...coreStart, ...pluginStart };
|
||||
const deps = { ...coreStart, ...pluginsStart };
|
||||
async function onEdit() {
|
||||
try {
|
||||
const { openSloConfiguration } = await import('./slo_alerts_open_configuration');
|
||||
|
||||
const result = await openSloConfiguration(
|
||||
coreStart,
|
||||
pluginStart,
|
||||
pluginsStart,
|
||||
sloClient,
|
||||
api.getSloAlertsConfig()
|
||||
);
|
||||
api.updateSloAlertsConfig(result);
|
||||
|
@ -143,18 +151,28 @@ export function getAlertsEmbeddableFactory(
|
|||
kibanaVersion,
|
||||
}}
|
||||
>
|
||||
<Router history={history}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloAlertsWrapper
|
||||
onEdit={onEdit}
|
||||
deps={deps}
|
||||
slos={slos}
|
||||
timeRange={fetchContext.timeRange ?? { from: 'now-15m/m', to: 'now' }}
|
||||
reloadSubject={reload$}
|
||||
showAllGroupByInstances={showAllGroupByInstances}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</Router>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate:
|
||||
pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<Router history={history}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloAlertsWrapper
|
||||
onEdit={onEdit}
|
||||
deps={deps}
|
||||
slos={slos}
|
||||
timeRange={fetchContext.timeRange ?? { from: 'now-15m/m', to: 'now' }}
|
||||
reloadSubject={reload$}
|
||||
showAllGroupByInstances={showAllGroupByInstances}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</Router>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>
|
||||
</I18nContext>
|
||||
);
|
||||
|
|
|
@ -4,17 +4,21 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import React from 'react';
|
||||
import type { CoreStart } from '@kbn/core/public';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { SloPublicPluginsStart } from '../../..';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import React from 'react';
|
||||
import { SLOPublicPluginsStart } from '../../..';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import { SLORepositoryClient } from '../../../types';
|
||||
import { SloConfiguration } from './slo_configuration';
|
||||
import type { EmbeddableSloProps } from './types';
|
||||
|
||||
export async function openSloConfiguration(
|
||||
coreStart: CoreStart,
|
||||
pluginStart: SloPublicPluginsStart,
|
||||
pluginsStart: SLOPublicPluginsStart,
|
||||
sloClient: SLORepositoryClient,
|
||||
initialState?: EmbeddableSloProps
|
||||
): Promise<EmbeddableSloProps> {
|
||||
const { overlays } = coreStart;
|
||||
|
@ -26,22 +30,31 @@ export async function openSloConfiguration(
|
|||
<KibanaContextProvider
|
||||
services={{
|
||||
...coreStart,
|
||||
...pluginStart,
|
||||
...pluginsStart,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloConfiguration
|
||||
initialInput={initialState}
|
||||
onCreate={(update: EmbeddableSloProps) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloConfiguration
|
||||
initialInput={initialState}
|
||||
onCreate={(update: EmbeddableSloProps) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>,
|
||||
coreStart
|
||||
)
|
||||
|
|
|
@ -4,31 +4,40 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import {
|
||||
fetch$,
|
||||
initializeTitles,
|
||||
useBatchedPublishingSubjects,
|
||||
fetch$,
|
||||
} from '@kbn/presentation-publishing';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { SLO_BURN_RATE_EMBEDDABLE_ID } from './constants';
|
||||
import { SloBurnRateEmbeddableState, SloEmbeddableDeps, BurnRateApi } from './types';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import React, { useEffect } from 'react';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { CoreStart } from '@kbn/core-lifecycle-browser';
|
||||
import { BurnRate } from './burn_rate';
|
||||
import { SLO_BURN_RATE_EMBEDDABLE_ID } from './constants';
|
||||
import { BurnRateApi, SloBurnRateEmbeddableState } from './types';
|
||||
import type { SLOPublicPluginsStart, SLORepositoryClient } from '../../../types';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
|
||||
export const getTitle = () =>
|
||||
const getTitle = () =>
|
||||
i18n.translate('xpack.slo.burnRateEmbeddable.title', {
|
||||
defaultMessage: 'SLO Burn Rate',
|
||||
});
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
export const getBurnRateEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
||||
export const getBurnRateEmbeddableFactory = ({
|
||||
coreStart,
|
||||
pluginsStart,
|
||||
sloClient,
|
||||
}: {
|
||||
coreStart: CoreStart;
|
||||
pluginsStart: SLOPublicPluginsStart;
|
||||
sloClient: SLORepositoryClient;
|
||||
}) => {
|
||||
const factory: ReactEmbeddableFactory<
|
||||
SloBurnRateEmbeddableState,
|
||||
SloBurnRateEmbeddableState,
|
||||
|
@ -39,6 +48,7 @@ export const getBurnRateEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
|||
return state.rawState as SloBurnRateEmbeddableState;
|
||||
},
|
||||
buildEmbeddable: async (state, buildApi, uuid, parentApi) => {
|
||||
const deps = { ...coreStart, ...pluginsStart };
|
||||
const { titlesApi, titleComparators, serializeTitles } = initializeTitles(state);
|
||||
const defaultTitle$ = new BehaviorSubject<string | undefined>(getTitle());
|
||||
const sloId$ = new BehaviorSubject(state.sloId);
|
||||
|
@ -84,18 +94,26 @@ export const getBurnRateEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
|||
duration$
|
||||
);
|
||||
|
||||
const I18nContext = deps.i18n.Context;
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
fetchSubscription.unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
return (
|
||||
<I18nContext>
|
||||
<Router history={createBrowserHistory()}>
|
||||
<KibanaContextProvider services={deps}>
|
||||
<Router history={createBrowserHistory()}>
|
||||
<KibanaContextProvider services={deps}>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate:
|
||||
pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BurnRate
|
||||
sloId={sloId}
|
||||
|
@ -104,9 +122,9 @@ export const getBurnRateEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
|||
reloadSubject={reload$}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</KibanaContextProvider>
|
||||
</Router>
|
||||
</I18nContext>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>
|
||||
</Router>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -10,13 +10,16 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
|||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import React from 'react';
|
||||
import { SloPublicPluginsStart } from '../../..';
|
||||
import { SLOPublicPluginsStart } from '../../..';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import { SLORepositoryClient } from '../../../types';
|
||||
import { Configuration } from './configuration';
|
||||
import type { EmbeddableProps, SloBurnRateEmbeddableState } from './types';
|
||||
|
||||
export async function openConfiguration(
|
||||
coreStart: CoreStart,
|
||||
pluginStart: SloPublicPluginsStart,
|
||||
pluginsStart: SLOPublicPluginsStart,
|
||||
sloClient: SLORepositoryClient,
|
||||
initialState?: SloBurnRateEmbeddableState
|
||||
): Promise<EmbeddableProps> {
|
||||
const { overlays } = coreStart;
|
||||
|
@ -28,21 +31,30 @@ export async function openConfiguration(
|
|||
<KibanaContextProvider
|
||||
services={{
|
||||
...coreStart,
|
||||
...pluginStart,
|
||||
...pluginsStart,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Configuration
|
||||
onCreate={(update: EmbeddableProps) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Configuration
|
||||
onCreate={(update: EmbeddableProps) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>,
|
||||
coreStart
|
||||
)
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* 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 React from 'react';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import { SloEmbeddableDeps } from '../overview/types';
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
export interface SloEmbeddableContextProps {
|
||||
deps: SloEmbeddableDeps;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function SloEmbeddableContext({ deps, children }: SloEmbeddableContextProps) {
|
||||
const { observabilityRuleTypeRegistry } = deps.observability;
|
||||
const { navigation } = deps.observabilityShared;
|
||||
|
||||
return (
|
||||
<Router history={createBrowserHistory()}>
|
||||
<EuiThemeProvider darkMode={true}>
|
||||
<KibanaContextProvider services={deps}>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate: navigation.PageTemplate,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>
|
||||
</EuiThemeProvider>
|
||||
</Router>
|
||||
);
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import {
|
||||
EuiButton,
|
||||
|
@ -14,22 +13,23 @@ import {
|
|||
EuiFlyoutBody,
|
||||
EuiFlyoutFooter,
|
||||
EuiFlyoutHeader,
|
||||
EuiTitle,
|
||||
EuiTabs,
|
||||
EuiTab,
|
||||
EuiSpacer,
|
||||
EuiTab,
|
||||
EuiTabs,
|
||||
EuiTitle,
|
||||
} from '@elastic/eui';
|
||||
import React, { useState } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useSloDetailsTabs } from '../../../pages/slo_details/hooks/use_slo_details_tabs';
|
||||
import React, { useState } from 'react';
|
||||
import { HeaderTitle } from '../../../pages/slo_details/components/header_title';
|
||||
import { getSloFormattedSummary } from '../../../pages/slos/hooks/use_slo_summary';
|
||||
import {
|
||||
OVERVIEW_TAB_ID,
|
||||
SloDetails,
|
||||
SloTabId,
|
||||
} from '../../../pages/slo_details/components/slo_details';
|
||||
import { useSloDetailsTabs } from '../../../pages/slo_details/hooks/use_slo_details_tabs';
|
||||
import { getSloFormattedSummary } from '../../../pages/slos/hooks/use_slo_summary';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
|
||||
export function SloOverviewDetails({
|
||||
slo,
|
||||
|
|
|
@ -4,17 +4,21 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import React from 'react';
|
||||
import type { CoreStart } from '@kbn/core/public';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { SloPublicPluginsStart } from '../../..';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import React from 'react';
|
||||
import { SLOPublicPluginsStart } from '../../..';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import { SloConfiguration } from './slo_configuration';
|
||||
import type { SloErrorBudgetEmbeddableState, EmbeddableSloProps } from './types';
|
||||
import type { EmbeddableSloProps, SloErrorBudgetEmbeddableState } from './types';
|
||||
import { SLORepositoryClient } from '../../../types';
|
||||
|
||||
export async function openSloConfiguration(
|
||||
coreStart: CoreStart,
|
||||
pluginStart: SloPublicPluginsStart,
|
||||
pluginsStart: SLOPublicPluginsStart,
|
||||
sloClient: SLORepositoryClient,
|
||||
initialState?: SloErrorBudgetEmbeddableState
|
||||
): Promise<EmbeddableSloProps> {
|
||||
const { overlays } = coreStart;
|
||||
|
@ -26,21 +30,30 @@ export async function openSloConfiguration(
|
|||
<KibanaContextProvider
|
||||
services={{
|
||||
...coreStart,
|
||||
...pluginStart,
|
||||
...pluginsStart,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloConfiguration
|
||||
onCreate={(update: EmbeddableSloProps) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloConfiguration
|
||||
onCreate={(update: EmbeddableSloProps) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>,
|
||||
coreStart
|
||||
)
|
||||
|
|
|
@ -4,30 +4,40 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import { CoreStart } from '@kbn/core-lifecycle-browser';
|
||||
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import {
|
||||
fetch$,
|
||||
initializeTitles,
|
||||
useBatchedPublishingSubjects,
|
||||
fetch$,
|
||||
} from '@kbn/presentation-publishing';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import React, { useEffect } from 'react';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import { SLOPublicPluginsStart, SLORepositoryClient } from '../../../types';
|
||||
import { SLO_ERROR_BUDGET_ID } from './constants';
|
||||
import { SloErrorBudgetEmbeddableState, SloEmbeddableDeps, ErrorBudgetApi } from './types';
|
||||
import { SloErrorBudget } from './error_budget_burn_down';
|
||||
import { ErrorBudgetApi, SloErrorBudgetEmbeddableState } from './types';
|
||||
|
||||
export const getErrorBudgetPanelTitle = () =>
|
||||
const getErrorBudgetPanelTitle = () =>
|
||||
i18n.translate('xpack.slo.errorBudgetEmbeddable.title', {
|
||||
defaultMessage: 'SLO Error Budget burn down',
|
||||
});
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
export const getErrorBudgetEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
||||
export const getErrorBudgetEmbeddableFactory = ({
|
||||
coreStart,
|
||||
pluginsStart,
|
||||
sloClient,
|
||||
}: {
|
||||
coreStart: CoreStart;
|
||||
pluginsStart: SLOPublicPluginsStart;
|
||||
sloClient: SLORepositoryClient;
|
||||
}) => {
|
||||
const factory: ReactEmbeddableFactory<
|
||||
SloErrorBudgetEmbeddableState,
|
||||
SloErrorBudgetEmbeddableState,
|
||||
|
@ -38,6 +48,7 @@ export const getErrorBudgetEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
|||
return state.rawState as SloErrorBudgetEmbeddableState;
|
||||
},
|
||||
buildEmbeddable: async (state, buildApi, uuid, parentApi) => {
|
||||
const deps = { ...coreStart, ...pluginsStart };
|
||||
const { titlesApi, titleComparators, serializeTitles } = initializeTitles(state);
|
||||
const defaultTitle$ = new BehaviorSubject<string | undefined>(getErrorBudgetPanelTitle());
|
||||
const sloId$ = new BehaviorSubject(state.sloId);
|
||||
|
@ -76,18 +87,26 @@ export const getErrorBudgetEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
|||
Component: () => {
|
||||
const [sloId, sloInstanceId] = useBatchedPublishingSubjects(sloId$, sloInstanceId$);
|
||||
|
||||
const I18nContext = deps.i18n.Context;
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
fetchSubscription.unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
return (
|
||||
<I18nContext>
|
||||
<Router history={createBrowserHistory()}>
|
||||
<KibanaContextProvider services={deps}>
|
||||
<Router history={createBrowserHistory()}>
|
||||
<KibanaContextProvider services={deps}>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate:
|
||||
pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloErrorBudget
|
||||
sloId={sloId}
|
||||
|
@ -95,9 +114,9 @@ export const getErrorBudgetEmbeddableFactory = (deps: SloEmbeddableDeps) => {
|
|||
reloadSubject={reload$}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</KibanaContextProvider>
|
||||
</Router>
|
||||
</I18nContext>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>
|
||||
</Router>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -15,8 +15,8 @@ import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../../../../common/consta
|
|||
import { useCreateDataView } from '../../../../hooks/use_create_data_view';
|
||||
import { useFetchSloGroups } from '../../../../hooks/use_fetch_slo_groups';
|
||||
import { SLI_OPTIONS } from '../../../../pages/slo_edit/constants';
|
||||
import { useGetSettings } from '../../../../pages/slo_settings/use_get_settings';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useGetSettings } from '../../../../pages/slo_settings/hooks/use_get_settings';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import type { GroupBy, GroupFilters } from '../types';
|
||||
import './slo_group_filters.scss';
|
||||
|
||||
|
|
|
@ -5,33 +5,45 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useEffect } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
|
||||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import type { CoreStart } from '@kbn/core-lifecycle-browser';
|
||||
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import {
|
||||
fetch$,
|
||||
initializeTitles,
|
||||
useBatchedPublishingSubjects,
|
||||
fetch$,
|
||||
} from '@kbn/presentation-publishing';
|
||||
import { Router } from '@kbn/shared-ux-router';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { createBrowserHistory } from 'history';
|
||||
import React, { useEffect } from 'react';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import type { StartServicesAccessor } from '@kbn/core-lifecycle-browser';
|
||||
import styled from 'styled-components';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
import type { SLOPublicPluginsStart, SLORepositoryClient } from '../../../types';
|
||||
import { SLO_OVERVIEW_EMBEDDABLE_ID } from './constants';
|
||||
import { SloCardChartList } from './slo_overview_grid';
|
||||
import { SloOverview } from './slo_overview';
|
||||
import { GroupSloView } from './group_view/group_view';
|
||||
import { SloOverviewEmbeddableState, SloOverviewApi, GroupSloCustomInput } from './types';
|
||||
import { SloPublicPluginsStart, SloPublicStart } from '../../../types';
|
||||
import { SloEmbeddableContext } from '../common/slo_embeddable_context';
|
||||
import { SloOverview } from './slo_overview';
|
||||
import { SloCardChartList } from './slo_overview_grid';
|
||||
import { GroupSloCustomInput, SloOverviewApi, SloOverviewEmbeddableState } from './types';
|
||||
|
||||
export const getOverviewPanelTitle = () =>
|
||||
const getOverviewPanelTitle = () =>
|
||||
i18n.translate('xpack.slo.sloEmbeddable.displayName', {
|
||||
defaultMessage: 'SLO Overview',
|
||||
});
|
||||
export const getOverviewEmbeddableFactory = (
|
||||
getStartServices: StartServicesAccessor<SloPublicPluginsStart, SloPublicStart>
|
||||
) => {
|
||||
|
||||
export const getOverviewEmbeddableFactory = ({
|
||||
coreStart,
|
||||
pluginsStart,
|
||||
sloClient,
|
||||
}: {
|
||||
coreStart: CoreStart;
|
||||
pluginsStart: SLOPublicPluginsStart;
|
||||
sloClient: SLORepositoryClient;
|
||||
}) => {
|
||||
const factory: ReactEmbeddableFactory<
|
||||
SloOverviewEmbeddableState,
|
||||
SloOverviewEmbeddableState,
|
||||
|
@ -42,15 +54,15 @@ export const getOverviewEmbeddableFactory = (
|
|||
return state.rawState as SloOverviewEmbeddableState;
|
||||
},
|
||||
buildEmbeddable: async (state, buildApi, uuid, parentApi) => {
|
||||
const [coreStart, pluginStart] = await getStartServices();
|
||||
const deps = { ...coreStart, ...pluginStart };
|
||||
const deps = { ...coreStart, ...pluginsStart };
|
||||
async function onEdit() {
|
||||
try {
|
||||
const { openSloConfiguration } = await import('./slo_overview_open_configuration');
|
||||
|
||||
const result = await openSloConfiguration(
|
||||
coreStart,
|
||||
pluginStart,
|
||||
pluginsStart,
|
||||
sloClient,
|
||||
api.getSloGroupOverviewConfig()
|
||||
);
|
||||
api.updateSloGroupOverviewConfig(result as GroupSloCustomInput);
|
||||
|
@ -184,10 +196,33 @@ export const getOverviewEmbeddableFactory = (
|
|||
);
|
||||
}
|
||||
};
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
return (
|
||||
<SloEmbeddableContext deps={deps}>
|
||||
{showAllGroupByInstances ? <SloCardChartList sloId={sloId!} /> : renderOverview()}
|
||||
</SloEmbeddableContext>
|
||||
<Router history={createBrowserHistory()}>
|
||||
<EuiThemeProvider darkMode={true}>
|
||||
<KibanaContextProvider services={deps}>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate:
|
||||
pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{showAllGroupByInstances ? (
|
||||
<SloCardChartList sloId={sloId!} />
|
||||
) : (
|
||||
renderOverview()
|
||||
)}
|
||||
</QueryClientProvider>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>
|
||||
</EuiThemeProvider>
|
||||
</Router>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiLoadingSpinner } from '@elastic/eui';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { SloOverviewDetails } from '../common/slo_overview_details';
|
||||
import { useFetchSloList } from '../../../hooks/use_fetch_slo_list';
|
||||
import { formatHistoricalData } from '../../../utils/slo/chart_data_formatter';
|
||||
|
|
|
@ -11,15 +11,21 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import type { GroupSloCustomInput, SingleSloCustomInput } from './types';
|
||||
import { SloPublicPluginsStart } from '../../..';
|
||||
import { SLOPublicPluginsStart } from '../../..';
|
||||
import { SloConfiguration } from './slo_configuration';
|
||||
import { SLORepositoryClient } from '../../../types';
|
||||
import { PluginContext } from '../../../context/plugin_context';
|
||||
|
||||
export async function openSloConfiguration(
|
||||
coreStart: CoreStart,
|
||||
pluginStart: SloPublicPluginsStart,
|
||||
pluginsStart: SLOPublicPluginsStart,
|
||||
sloClient: SLORepositoryClient,
|
||||
initialState?: GroupSloCustomInput
|
||||
): Promise<GroupSloCustomInput | SingleSloCustomInput> {
|
||||
const { overlays } = coreStart;
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const flyoutSession = overlays.openFlyout(
|
||||
|
@ -27,22 +33,31 @@ export async function openSloConfiguration(
|
|||
<KibanaContextProvider
|
||||
services={{
|
||||
...coreStart,
|
||||
...pluginStart,
|
||||
...pluginsStart,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloConfiguration
|
||||
initialInput={initialState}
|
||||
onCreate={(update: GroupSloCustomInput | SingleSloCustomInput) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
<PluginContext.Provider
|
||||
value={{
|
||||
observabilityRuleTypeRegistry:
|
||||
pluginsStart.observability.observabilityRuleTypeRegistry,
|
||||
ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate,
|
||||
sloClient,
|
||||
}}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<SloConfiguration
|
||||
initialInput={initialState}
|
||||
onCreate={(update: GroupSloCustomInput | SingleSloCustomInput) => {
|
||||
flyoutSession.close();
|
||||
resolve(update);
|
||||
}}
|
||||
onCancel={() => {
|
||||
flyoutSession.close();
|
||||
reject();
|
||||
}}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
</PluginContext.Provider>
|
||||
</KibanaContextProvider>,
|
||||
coreStart
|
||||
)
|
||||
|
|
|
@ -13,15 +13,6 @@ import {
|
|||
import type { EmbeddableApiContext } from '@kbn/presentation-publishing';
|
||||
import { DefaultEmbeddableApi } from '@kbn/embeddable-plugin/public';
|
||||
import { Filter } from '@kbn/es-query';
|
||||
import {
|
||||
type CoreStart,
|
||||
IUiSettingsClient,
|
||||
ApplicationStart,
|
||||
NotificationsStart,
|
||||
} from '@kbn/core/public';
|
||||
import { ObservabilityPublicStart } from '@kbn/observability-plugin/public';
|
||||
import type { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
||||
import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public';
|
||||
|
||||
export type OverviewMode = 'single' | 'groups';
|
||||
export type GroupBy = 'slo.tags' | 'status' | 'slo.indicator.type';
|
||||
|
@ -72,18 +63,6 @@ export const apiHasSloGroupOverviewConfig = (
|
|||
);
|
||||
};
|
||||
|
||||
export interface SloEmbeddableDeps {
|
||||
uiSettings: IUiSettingsClient;
|
||||
http: CoreStart['http'];
|
||||
i18n: CoreStart['i18n'];
|
||||
theme: CoreStart['theme'];
|
||||
application: ApplicationStart;
|
||||
notifications: NotificationsStart;
|
||||
observability: ObservabilityPublicStart;
|
||||
observabilityShared: ObservabilitySharedPluginStart;
|
||||
uiActions: UiActionsStart;
|
||||
}
|
||||
|
||||
export type SloOverviewEmbeddableActionContext = EmbeddableApiContext & {
|
||||
embeddable: SloOverviewApi;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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 {
|
||||
ApplicationStart,
|
||||
CoreStart,
|
||||
IUiSettingsClient,
|
||||
NotificationsStart,
|
||||
} from '@kbn/core/public';
|
||||
import { ObservabilityPublicStart } from '@kbn/observability-plugin/public';
|
||||
import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public';
|
||||
import { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
||||
import type { SLORepositoryClient } from '../../types';
|
||||
|
||||
export interface SLOEmbeddableDeps {
|
||||
uiSettings: IUiSettingsClient;
|
||||
http: CoreStart['http'];
|
||||
i18n: CoreStart['i18n'];
|
||||
theme: CoreStart['theme'];
|
||||
application: ApplicationStart;
|
||||
notifications: NotificationsStart;
|
||||
observability: ObservabilityPublicStart;
|
||||
observabilityShared: ObservabilitySharedPluginStart;
|
||||
uiActions: UiActionsStart;
|
||||
sloClient: SLORepositoryClient;
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { observabilityPaths } from '@kbn/observability-plugin/common';
|
||||
import rison from '@kbn/rison';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export const useAlertsUrl = () => {
|
||||
const { basePath } = useKibana().services.http;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import { sloFeatureId } from '@kbn/observability-plugin/common';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export function useCapabilities() {
|
||||
const {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { encode } from '@kbn/rison';
|
|||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { useCallback } from 'react';
|
||||
import { paths } from '../../common/locators/paths';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { createRemoteSloCloneUrl } from '../utils/slo/remote_slo_urls';
|
||||
import { useSpace } from './use_space';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import type {
|
|||
} from '@kbn/alerting-plugin/common/routes/rule/apis/create';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export function useCreateRule<Params extends RuleTypeParams = never>() {
|
||||
const {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { useFetcher } from '@kbn/observability-shared-plugin/public';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
interface UseCreateDataViewProps {
|
||||
indexPatternString?: string;
|
||||
|
|
|
@ -15,9 +15,10 @@ import { toMountPoint } from '@kbn/react-kibana-mount';
|
|||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { paths } from '../../common/locators/paths';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
type ServerError = IHttpFetchError<ResponseErrorBody>;
|
||||
|
||||
|
@ -29,6 +30,7 @@ export function useCreateSlo() {
|
|||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
const services = useKibana().services;
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
@ -40,8 +42,7 @@ export function useCreateSlo() {
|
|||
>(
|
||||
['createSlo'],
|
||||
({ slo }) => {
|
||||
const body = JSON.stringify(slo);
|
||||
return http.post<CreateSLOResponse>(`/api/observability/slos`, { body });
|
||||
return sloClient.fetch(`POST /api/observability/slos 2023-10-31`, { params: { body: slo } });
|
||||
},
|
||||
{
|
||||
onSuccess: (data, { slo }) => {
|
||||
|
|
|
@ -8,23 +8,26 @@
|
|||
import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
type ServerError = IHttpFetchError<ResponseErrorBody>;
|
||||
|
||||
export function useDeleteSlo() {
|
||||
const {
|
||||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<string, ServerError, { id: string; name: string }>(
|
||||
return useMutation<void, ServerError, { id: string; name: string }>(
|
||||
['deleteSlo'],
|
||||
({ id }) => {
|
||||
try {
|
||||
return http.delete<string>(`/api/observability/slos/${id}`);
|
||||
return sloClient.fetch(`DELETE /api/observability/slos/{id} 2023-10-31`, {
|
||||
params: { path: { id } },
|
||||
});
|
||||
} catch (error) {
|
||||
return Promise.reject(`Something went wrong: ${String(error)}`);
|
||||
}
|
||||
|
|
|
@ -7,34 +7,37 @@
|
|||
|
||||
import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
type ServerError = IHttpFetchError<ResponseErrorBody>;
|
||||
|
||||
export function useDeleteSloInstance() {
|
||||
const {
|
||||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<string, ServerError, { slo: SLOWithSummaryResponse; excludeRollup: boolean }>(
|
||||
return useMutation<void, ServerError, { slo: SLOWithSummaryResponse; excludeRollup: boolean }>(
|
||||
['deleteSloInstance'],
|
||||
({ slo, excludeRollup }) => {
|
||||
try {
|
||||
return http.post(`/api/observability/slos/_delete_instances`, {
|
||||
body: JSON.stringify({
|
||||
list: [
|
||||
{
|
||||
sloId: slo.id,
|
||||
instanceId: slo.instanceId,
|
||||
excludeRollup,
|
||||
},
|
||||
],
|
||||
}),
|
||||
return sloClient.fetch(`POST /api/observability/slos/_delete_instances 2023-10-31`, {
|
||||
params: {
|
||||
body: {
|
||||
list: [
|
||||
{
|
||||
sloId: slo.id,
|
||||
instanceId: slo.instanceId ?? ALL_VALUE,
|
||||
excludeRollup,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
return Promise.reject(`Something went wrong: ${String(error)}`);
|
||||
|
|
|
@ -9,7 +9,7 @@ import { useQuery } from '@tanstack/react-query';
|
|||
import { BASE_RAC_ALERTS_API_PATH } from '@kbn/rule-registry-plugin/common';
|
||||
|
||||
import { AlertConsumers } from '@kbn/rule-registry-plugin/common/technical_rule_data_field_names';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { ActiveAlerts } from './active_alerts';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
type ApmIndex = string;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import moment from 'moment';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export type Suggestion = string;
|
||||
|
||||
|
|
|
@ -9,9 +9,10 @@ import type { SecurityHasPrivilegesResponse } from '@elastic/elasticsearch/lib/a
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import type { PublicLicenseJSON } from '@kbn/licensing-plugin/public';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { convertErrorForUseInToast } from './helpers/convert_error_for_use_in_toast';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
interface SloGlobalDiagnosisResponse {
|
||||
licenseAndFeatures: PublicLicenseJSON;
|
||||
|
@ -25,23 +26,17 @@ export interface UseFetchSloGlobalDiagnoseResponse {
|
|||
|
||||
export function useFetchSloGlobalDiagnosis(): UseFetchSloGlobalDiagnoseResponse {
|
||||
const {
|
||||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
const { isLoading, data } = useQuery({
|
||||
queryKey: sloKeys.globalDiagnosis(),
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const response = await http.get<SloGlobalDiagnosisResponse>(
|
||||
'/internal/observability/slos/_diagnosis',
|
||||
{
|
||||
query: {},
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
||||
return response;
|
||||
return await sloClient.fetch('GET /internal/observability/slos/_diagnosis', {
|
||||
signal,
|
||||
});
|
||||
} catch (error) {
|
||||
throw convertErrorForUseInToast(error);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import { ALL_VALUE, QuerySchema } from '@kbn/slo-schema';
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { getElasticsearchQueryOrThrow } from '../../common/parse_kuery';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export interface UseFetchGroupByCardinalityResponse {
|
||||
isLoading: boolean;
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { ALL_VALUE, FetchHistoricalSummaryResponse, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { SLO_LONG_REFETCH_INTERVAL } from '../constants';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface UseFetchHistoricalSummaryResponse {
|
||||
data: FetchHistoricalSummaryResponse | undefined;
|
||||
|
@ -34,7 +34,7 @@ export function useFetchHistoricalSummary({
|
|||
shouldRefetch,
|
||||
range,
|
||||
}: Params): UseFetchHistoricalSummaryResponse {
|
||||
const { http } = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
const list = sloList.map((slo) => ({
|
||||
sloId: slo.id,
|
||||
|
@ -57,15 +57,10 @@ export function useFetchHistoricalSummary({
|
|||
queryKey: sloKeys.historicalSummary(list),
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const response = await http.post<FetchHistoricalSummaryResponse>(
|
||||
'/internal/observability/slos/_historical_summary',
|
||||
{
|
||||
body: JSON.stringify({ list }),
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
||||
return response;
|
||||
return await sloClient.fetch('POST /internal/observability/slos/_historical_summary', {
|
||||
params: { body: { list } },
|
||||
signal,
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore error
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import type { Rule, AsApiContract } from '@kbn/triggers-actions-ui-plugin/public
|
|||
import { transformRule } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { BurnRateRuleParams } from '../typings';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
|
||||
interface Params {
|
||||
|
|
|
@ -12,8 +12,8 @@ import {
|
|||
useQuery,
|
||||
} from '@tanstack/react-query';
|
||||
import { SLO_LONG_REFETCH_INTERVAL } from '../constants';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface UseFetchSloBurnRatesResponse {
|
||||
isLoading: boolean;
|
||||
|
@ -34,19 +34,24 @@ export function useFetchSloBurnRates({
|
|||
windows,
|
||||
shouldRefetch,
|
||||
}: UseFetchSloBurnRatesParams): UseFetchSloBurnRatesResponse {
|
||||
const { http } = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
const { isLoading, data, refetch } = useQuery({
|
||||
queryKey: sloKeys.burnRates(slo.id, slo.instanceId, windows),
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const response = await http.post<GetSLOBurnRatesResponse>(
|
||||
`/internal/observability/slos/${slo.id}/_burn_rates`,
|
||||
const response = await sloClient.fetch(
|
||||
'POST /internal/observability/slos/{id}/_burn_rates',
|
||||
{
|
||||
body: JSON.stringify({
|
||||
windows,
|
||||
instanceId: slo.instanceId ?? ALL_VALUE,
|
||||
remoteName: slo.remote?.remoteName,
|
||||
}),
|
||||
params: {
|
||||
path: {
|
||||
id: slo.id,
|
||||
},
|
||||
body: {
|
||||
windows,
|
||||
instanceId: slo.instanceId ?? ALL_VALUE,
|
||||
remoteName: slo.remote?.remoteName,
|
||||
},
|
||||
},
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import { FindSLODefinitionsResponse } from '@kbn/slo-schema';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface UseFetchSloDefinitionsResponse {
|
||||
data: FindSLODefinitionsResponse | undefined;
|
||||
|
@ -31,19 +31,19 @@ export function useFetchSloDefinitions({
|
|||
page = 1,
|
||||
perPage = 100,
|
||||
}: Params): UseFetchSloDefinitionsResponse {
|
||||
const { http } = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
const search = name.endsWith('*') ? name : `${name}*`;
|
||||
|
||||
const { isLoading, isError, isSuccess, data, refetch } = useQuery({
|
||||
queryKey: sloKeys.definitions(search, page, perPage, includeOutdatedOnly),
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const response = await http.get<FindSLODefinitionsResponse>(
|
||||
'/api/observability/slos/_definitions',
|
||||
{ query: { search, includeOutdatedOnly, page, perPage }, signal }
|
||||
);
|
||||
|
||||
return response;
|
||||
return await sloClient.fetch('GET /api/observability/slos/_definitions 2023-10-31', {
|
||||
params: {
|
||||
query: { search, includeOutdatedOnly, page: String(page), perPage: String(perPage) },
|
||||
},
|
||||
signal,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(`Something went wrong. Error: ${error}`);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ import {
|
|||
RefetchQueryFilters,
|
||||
useQuery,
|
||||
} from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { SLO_LONG_REFETCH_INTERVAL } from '../constants';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface UseFetchSloDetailsResponse {
|
||||
isInitialLoading: boolean;
|
||||
|
@ -39,17 +39,20 @@ export function useFetchSloDetails({
|
|||
remoteName?: string;
|
||||
shouldRefetch?: boolean;
|
||||
}): UseFetchSloDetailsResponse {
|
||||
const { http } = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
const { isInitialLoading, isLoading, isError, isSuccess, isRefetching, data, refetch } = useQuery(
|
||||
{
|
||||
queryKey: sloKeys.detail(sloId!, instanceId, remoteName),
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const response = await http.get<GetSLOResponse>(`/api/observability/slos/${sloId}`, {
|
||||
query: {
|
||||
...(!!instanceId && instanceId !== ALL_VALUE && { instanceId }),
|
||||
...(remoteName && { remoteName }),
|
||||
const response = await sloClient.fetch('GET /api/observability/slos/{id} 2023-10-31', {
|
||||
params: {
|
||||
path: { id: sloId! },
|
||||
query: {
|
||||
...(!!instanceId && instanceId !== ALL_VALUE && { instanceId }),
|
||||
...(remoteName && { remoteName }),
|
||||
},
|
||||
},
|
||||
signal,
|
||||
});
|
||||
|
|
|
@ -4,25 +4,26 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import {
|
||||
useQuery,
|
||||
RefetchOptions,
|
||||
QueryObserverResult,
|
||||
RefetchQueryFilters,
|
||||
} from '@tanstack/react-query';
|
||||
import { Filter, buildQueryFromFilters } from '@kbn/es-query';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { buildQueryFromFilters, Filter } from '@kbn/es-query';
|
||||
import { useMemo } from 'react';
|
||||
import { FindSLOGroupsResponse } from '@kbn/slo-schema';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useCreateDataView } from './use_create_data_view';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import {
|
||||
QueryObserverResult,
|
||||
RefetchOptions,
|
||||
RefetchQueryFilters,
|
||||
useQuery,
|
||||
} from '@tanstack/react-query';
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
DEFAULT_SLO_GROUPS_PAGE_SIZE,
|
||||
SLO_SUMMARY_DESTINATION_INDEX_PATTERN,
|
||||
} from '../../common/constants';
|
||||
import { SearchState } from '../pages/slos/hooks/use_url_search_state';
|
||||
import { GroupByField } from '../pages/slos/components/slo_list_group_by';
|
||||
import { SearchState } from '../pages/slos/hooks/use_url_search_state';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { useCreateDataView } from './use_create_data_view';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
interface SLOGroupsParams {
|
||||
page?: number;
|
||||
|
@ -58,8 +59,8 @@ export function useFetchSloGroups({
|
|||
filters: filterDSL = [],
|
||||
lastRefresh,
|
||||
}: SLOGroupsParams = {}): UseFetchSloGroupsResponse {
|
||||
const { sloClient } = usePluginContext();
|
||||
const {
|
||||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
|
||||
|
@ -97,20 +98,19 @@ export function useFetchSloGroups({
|
|||
lastRefresh,
|
||||
}),
|
||||
queryFn: async ({ signal }) => {
|
||||
const response = await http.get<FindSLOGroupsResponse>(
|
||||
'/internal/observability/slos/_groups',
|
||||
{
|
||||
const response = await sloClient.fetch('GET /internal/observability/slos/_groups', {
|
||||
params: {
|
||||
query: {
|
||||
...(page && { page }),
|
||||
...(perPage && { perPage }),
|
||||
...(page && { page: String(page) }),
|
||||
...(perPage && { perPage: String(perPage) }),
|
||||
...(groupBy && { groupBy }),
|
||||
...(groupsFilter && { groupsFilter }),
|
||||
...(kqlQuery && { kqlQuery }),
|
||||
...(filters && { filters }),
|
||||
},
|
||||
signal,
|
||||
}
|
||||
);
|
||||
},
|
||||
signal,
|
||||
});
|
||||
return response;
|
||||
},
|
||||
cacheTime: 0,
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import { ALL_VALUE, FetchSLOHealthResponse, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface UseFetchSloHealth {
|
||||
data: FetchSLOHealthResponse | undefined;
|
||||
|
@ -21,7 +21,7 @@ export interface Params {
|
|||
}
|
||||
|
||||
export function useFetchSloHealth({ list }: Params): UseFetchSloHealth {
|
||||
const { http } = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
const payload = list.map((slo) => ({
|
||||
sloId: slo.id,
|
||||
sloInstanceId: slo.instanceId ?? ALL_VALUE,
|
||||
|
@ -31,15 +31,10 @@ export function useFetchSloHealth({ list }: Params): UseFetchSloHealth {
|
|||
queryKey: sloKeys.health(payload),
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const response = await http.post<FetchSLOHealthResponse>(
|
||||
'/internal/observability/slos/_health',
|
||||
{
|
||||
body: JSON.stringify({ list: payload }),
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
||||
return response;
|
||||
return await sloClient.fetch('POST /internal/observability/slos/_health', {
|
||||
params: { body: { list: payload } },
|
||||
signal,
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore error
|
||||
}
|
||||
|
|
|
@ -5,39 +5,21 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { CreateSLOInput, SLODefinitionResponse } from '@kbn/slo-schema';
|
||||
import type { CreateSLOInput } from '@kbn/slo-schema';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
|
||||
interface SLOInspectResponse {
|
||||
slo: SLODefinitionResponse;
|
||||
rollUpPipeline: Record<string, any>;
|
||||
summaryPipeline: Record<string, any>;
|
||||
rollUpTransform: TransformPutTransformRequest;
|
||||
summaryTransform: TransformPutTransformRequest;
|
||||
temporaryDoc: Record<string, any>;
|
||||
rollUpTransformCompositeQuery: string;
|
||||
summaryTransformCompositeQuery: string;
|
||||
}
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export function useFetchSloInspect(slo: CreateSLOInput, shouldInspect: boolean) {
|
||||
const { http } = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
const { isLoading, isError, isSuccess, data } = useQuery({
|
||||
queryKey: ['slo', 'inspect'],
|
||||
queryFn: async ({ signal }) => {
|
||||
try {
|
||||
const body = JSON.stringify(slo);
|
||||
const response = await http.post<SLOInspectResponse>(
|
||||
'/internal/observability/slos/_inspect',
|
||||
{
|
||||
body,
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
||||
return response;
|
||||
return await sloClient.fetch('POST /internal/observability/slos/_inspect', {
|
||||
params: { body: slo },
|
||||
signal,
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore error
|
||||
}
|
||||
|
|
|
@ -14,17 +14,17 @@ import {
|
|||
DEFAULT_SLO_PAGE_SIZE,
|
||||
SLO_SUMMARY_DESTINATION_INDEX_PATTERN,
|
||||
} from '../../common/constants';
|
||||
import { SearchState } from '../pages/slos/hooks/use_url_search_state';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useCreateDataView } from './use_create_data_view';
|
||||
|
||||
import { SearchState, SortDirection, SortField } from '../pages/slos/hooks/use_url_search_state';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { useCreateDataView } from './use_create_data_view';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface SLOListParams {
|
||||
kqlQuery?: string;
|
||||
page?: number;
|
||||
sortBy?: string;
|
||||
sortDirection?: 'asc' | 'desc';
|
||||
sortBy?: SortField;
|
||||
sortDirection?: SortDirection;
|
||||
perPage?: number;
|
||||
filters?: Filter[];
|
||||
lastRefresh?: number;
|
||||
|
@ -55,9 +55,10 @@ export function useFetchSloList({
|
|||
disabled = false,
|
||||
}: SLOListParams = {}): UseFetchSloListResponse {
|
||||
const {
|
||||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const { dataView } = useCreateDataView({
|
||||
|
@ -95,15 +96,17 @@ export function useFetchSloList({
|
|||
lastRefresh,
|
||||
}),
|
||||
queryFn: async ({ signal }) => {
|
||||
return await http.get<FindSLOResponse>(`/api/observability/slos`, {
|
||||
query: {
|
||||
...(kqlQuery && { kqlQuery }),
|
||||
...(sortBy && { sortBy }),
|
||||
...(sortDirection && { sortDirection }),
|
||||
...(page !== undefined && { page }),
|
||||
...(perPage !== undefined && { perPage }),
|
||||
...(filters && { filters }),
|
||||
hideStale: true,
|
||||
return await sloClient.fetch('GET /api/observability/slos 2023-10-31', {
|
||||
params: {
|
||||
query: {
|
||||
...(kqlQuery && { kqlQuery }),
|
||||
...(sortBy && { sortBy }),
|
||||
...(sortDirection && { sortDirection }),
|
||||
...(page !== undefined && { page: String(page) }),
|
||||
...(perPage !== undefined && { perPage: String(perPage) }),
|
||||
...(filters && { filters }),
|
||||
hideStale: true,
|
||||
},
|
||||
},
|
||||
signal,
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
import type { Rule } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { BASE_ALERTING_API_PATH } from '@kbn/alerting-plugin/common';
|
||||
import { HttpSetup } from '@kbn/core/public';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { WindowSchema } from '../typings';
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export interface Suggestion {
|
||||
label: string;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import { GetPreviewDataResponse, Indicator, Objective } from '@kbn/slo-schema';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
export interface UseGetPreviewData {
|
||||
data: GetPreviewDataResponse | undefined;
|
||||
|
@ -18,6 +18,20 @@ export interface UseGetPreviewData {
|
|||
isError: boolean;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
isValid: boolean;
|
||||
groupBy?: string | string[];
|
||||
instanceId?: string;
|
||||
remoteName?: string;
|
||||
groupings?: Record<string, unknown>;
|
||||
objective?: Objective;
|
||||
indicator: Indicator;
|
||||
range: {
|
||||
from: Date;
|
||||
to: Date;
|
||||
};
|
||||
}
|
||||
|
||||
export function useGetPreviewData({
|
||||
isValid,
|
||||
range,
|
||||
|
@ -27,36 +41,29 @@ export function useGetPreviewData({
|
|||
groupings,
|
||||
instanceId,
|
||||
remoteName,
|
||||
}: {
|
||||
isValid: boolean;
|
||||
groupBy?: string | string[];
|
||||
instanceId?: string;
|
||||
remoteName?: string;
|
||||
groupings?: Record<string, unknown>;
|
||||
objective?: Objective;
|
||||
indicator: Indicator;
|
||||
range: { from: Date; to: Date };
|
||||
}): UseGetPreviewData {
|
||||
const { http } = useKibana().services;
|
||||
}: Props): UseGetPreviewData {
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
const { isInitialLoading, isLoading, isError, isSuccess, data } = useQuery({
|
||||
queryKey: sloKeys.preview(indicator, range, groupings),
|
||||
queryFn: async ({ signal }) => {
|
||||
const response = await http.post<GetPreviewDataResponse>(
|
||||
'/internal/observability/slos/_preview',
|
||||
{
|
||||
body: JSON.stringify({
|
||||
const response = await sloClient.fetch('POST /internal/observability/slos/_preview', {
|
||||
params: {
|
||||
body: {
|
||||
indicator,
|
||||
range,
|
||||
range: {
|
||||
from: range.from.toISOString(),
|
||||
to: range.to.toISOString(),
|
||||
},
|
||||
groupBy,
|
||||
instanceId,
|
||||
groupings,
|
||||
remoteName,
|
||||
...(objective ? { objective } : null),
|
||||
}),
|
||||
signal,
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
signal,
|
||||
});
|
||||
|
||||
return Array.isArray(response) ? response : [];
|
||||
},
|
||||
|
|
|
@ -8,14 +8,15 @@
|
|||
import { CoreStart } from '@kbn/core/public';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { Storage } from '@kbn/kibana-utils-plugin/public';
|
||||
import { SloPublicPluginsStart } from '../types';
|
||||
import { SLOPublicPluginsStart } from '../types';
|
||||
|
||||
export type StartServices<AdditionalServices extends object = {}> = CoreStart &
|
||||
SloPublicPluginsStart &
|
||||
type StartServices<AdditionalServices extends object = {}> = CoreStart &
|
||||
SLOPublicPluginsStart &
|
||||
AdditionalServices & {
|
||||
storage: Storage;
|
||||
kibanaVersion: string;
|
||||
};
|
||||
|
||||
const useTypedKibana = <AdditionalServices extends object = {}>() =>
|
||||
useKibana<StartServices<AdditionalServices>>();
|
||||
|
|
@ -9,7 +9,7 @@ import { useCallback } from 'react';
|
|||
import { Observable } from 'rxjs';
|
||||
import useObservable from 'react-use/lib/useObservable';
|
||||
import type { ILicense, LicenseType } from '@kbn/licensing-plugin/public';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
interface UseLicenseReturnValue {
|
||||
getLicense: () => ILicense | null;
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import { sloFeatureId } from '@kbn/observability-shared-plugin/common';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { useFetchSloGlobalDiagnosis } from './use_fetch_global_diagnosis';
|
||||
import { usePermissions } from './use_permissions';
|
||||
|
||||
jest.mock('../utils/kibana_react');
|
||||
jest.mock('./use_kibana');
|
||||
jest.mock('./use_fetch_global_diagnosis');
|
||||
|
||||
const useKibanaMock = useKibana as jest.Mock;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import { sloFeatureId } from '@kbn/observability-plugin/common';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { useFetchSloGlobalDiagnosis } from './use_fetch_global_diagnosis';
|
||||
|
||||
export function usePermissions() {
|
||||
|
|
|
@ -7,23 +7,27 @@
|
|||
import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { ResetSLOResponse } from '@kbn/slo-schema';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
type ServerError = IHttpFetchError<ResponseErrorBody>;
|
||||
|
||||
export function useResetSlo() {
|
||||
const {
|
||||
http,
|
||||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const queryClient = useQueryClient();
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
return useMutation<string, ServerError, { id: string; name: string }>(
|
||||
return useMutation<ResetSLOResponse, ServerError, { id: string; name: string }>(
|
||||
['resetSlo'],
|
||||
({ id, name }) => {
|
||||
try {
|
||||
return http.post(`/api/observability/slos/${id}/_reset`);
|
||||
return sloClient.fetch('POST /api/observability/slos/{id}/_reset 2023-10-31', {
|
||||
params: { path: { id } },
|
||||
});
|
||||
} catch (error) {
|
||||
return Promise.reject(
|
||||
i18n.translate('xpack.slo.slo.reset.errorMessage', {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { useKibana } from './use_kibana';
|
||||
|
||||
export function useSpace() {
|
||||
const { spaces } = useKibana().services;
|
||||
|
|
|
@ -10,9 +10,10 @@ import { i18n } from '@kbn/i18n';
|
|||
import { encode } from '@kbn/rison';
|
||||
import type { FindSLOResponse, UpdateSLOInput, UpdateSLOResponse } from '@kbn/slo-schema';
|
||||
import { QueryKey, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useKibana } from '../utils/kibana_react';
|
||||
import { paths } from '../../common/locators/paths';
|
||||
import { useKibana } from './use_kibana';
|
||||
import { sloKeys } from './query_key_factory';
|
||||
import { usePluginContext } from './use_plugin_context';
|
||||
|
||||
type ServerError = IHttpFetchError<ResponseErrorBody>;
|
||||
|
||||
|
@ -23,6 +24,7 @@ export function useUpdateSlo() {
|
|||
notifications: { toasts },
|
||||
} = useKibana().services;
|
||||
const queryClient = useQueryClient();
|
||||
const { sloClient } = usePluginContext();
|
||||
|
||||
return useMutation<
|
||||
UpdateSLOResponse,
|
||||
|
@ -32,8 +34,9 @@ export function useUpdateSlo() {
|
|||
>(
|
||||
['updateSlo'],
|
||||
({ sloId, slo }) => {
|
||||
const body = JSON.stringify(slo);
|
||||
return http.put<UpdateSLOResponse>(`/api/observability/slos/${sloId}`, { body });
|
||||
return sloClient.fetch('PUT /api/observability/slos/{id} 2023-10-31', {
|
||||
params: { path: { id: sloId }, body: slo },
|
||||
});
|
||||
},
|
||||
{
|
||||
onSuccess: (_data, { slo: { name } }) => {
|
||||
|
|
|
@ -5,20 +5,26 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import { PluginInitializer, PluginInitializerContext } from '@kbn/core/public';
|
||||
import { SloPlugin } from './plugin';
|
||||
import { SLOPlugin } from './plugin';
|
||||
import type {
|
||||
SloPublicSetup,
|
||||
SloPublicStart,
|
||||
SloPublicPluginsSetup,
|
||||
SloPublicPluginsStart,
|
||||
SLOPublicSetup,
|
||||
SLOPublicStart,
|
||||
SLOPublicPluginsSetup,
|
||||
SLOPublicPluginsStart,
|
||||
} from './types';
|
||||
|
||||
export const plugin: PluginInitializer<
|
||||
SloPublicSetup,
|
||||
SloPublicStart,
|
||||
SloPublicPluginsSetup,
|
||||
SloPublicPluginsStart
|
||||
SLOPublicSetup,
|
||||
SLOPublicStart,
|
||||
SLOPublicPluginsSetup,
|
||||
SLOPublicPluginsStart
|
||||
> = (initializerContext: PluginInitializerContext) => {
|
||||
return new SloPlugin(initializerContext);
|
||||
return new SLOPlugin(initializerContext);
|
||||
};
|
||||
export type { SloPublicPluginsSetup, SloPublicPluginsStart, SloPublicStart } from './types';
|
||||
|
||||
export type {
|
||||
SLOPublicPluginsSetup,
|
||||
SLOPublicPluginsStart,
|
||||
SLOPublicStart,
|
||||
SLOPublicSetup,
|
||||
} from './types';
|
||||
|
|
|
@ -12,7 +12,7 @@ import numeral from '@elastic/numeral';
|
|||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { TimeBounds } from '../types';
|
||||
import { SloTabId } from './slo_details';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { toDuration, toMinutes } from '../../../utils/slo/duration';
|
||||
import { ChartData } from '../../../typings/slo';
|
||||
import { WideChart } from './wide_chart';
|
||||
|
|
|
@ -16,7 +16,7 @@ import React, { useState, useCallback } from 'react';
|
|||
import { SaveModalDashboardProps } from '@kbn/presentation-util-plugin/public';
|
||||
import { TimeBounds } from '../types';
|
||||
import { SloTabId } from './slo_details';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { ChartData } from '../../../typings/slo';
|
||||
import { ErrorBudgetChart } from './error_budget_chart';
|
||||
import { ErrorBudgetHeader } from './error_budget_header';
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
|
||||
import React from 'react';
|
||||
import { screen } from '@testing-library/react';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { render } from '../../../utils/test_helper';
|
||||
import { buildSlo } from '../../../data/slo/slo';
|
||||
import { ErrorBudgetHeader } from './error_budget_header';
|
||||
|
||||
jest.mock('../../../utils/kibana_react');
|
||||
jest.mock('../../../hooks/use_kibana');
|
||||
const useKibanaMock = useKibana as jest.Mock;
|
||||
|
||||
describe('In Observability Context', () => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { rollingTimeWindowTypeSchema, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { SloTabId } from './slo_details';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { toDurationAdverbLabel, toDurationLabel } from '../../../utils/slo/labels';
|
||||
|
||||
import { ErrorBudgetActions } from './error_budget_actions';
|
||||
|
|
|
@ -16,7 +16,7 @@ import { useActiveCursor } from '@kbn/charts-plugin/public';
|
|||
import moment from 'moment';
|
||||
import { getBrushTimeBounds } from '../../../utils/slo/duration';
|
||||
import { TimeBounds } from '../types';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
|
||||
export function EventsAreaChart({
|
||||
slo,
|
||||
|
|
|
@ -25,7 +25,7 @@ import { EventsAreaChart } from './events_area_chart';
|
|||
import { TimeBounds } from '../types';
|
||||
import { SloTabId } from './slo_details';
|
||||
import { useGetPreviewData } from '../../../hooks/use_get_preview_data';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { GoodBadEventsChart } from '../../../components/good_bad_events_chart/good_bad_events_chart';
|
||||
import { getDiscoverLink } from '../../../utils/slo/get_discover_link';
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import { useCloneSlo } from '../../../hooks/use_clone_slo';
|
|||
import { useFetchRulesForSlo } from '../../../hooks/use_fetch_rules_for_slo';
|
||||
import { usePermissions } from '../../../hooks/use_permissions';
|
||||
import { useResetSlo } from '../../../hooks/use_reset_slo';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { convertSliApmParamsToApmAppDeeplinkUrl } from '../../../utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url';
|
||||
import { isApmIndicatorType } from '../../../utils/slo/indicator';
|
||||
import { EditBurnRateRuleFlyout } from '../../slos/components/common/edit_burn_rate_rule_flyout';
|
||||
|
|
|
@ -16,7 +16,7 @@ import DateMath from '@kbn/datemath';
|
|||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { BurnRates } from '../../../../components/slo/burn_rate/burn_rates';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { useBurnRateOptions } from '../../hooks/use_burn_rate_options';
|
||||
import { TimeBounds } from '../../types';
|
||||
import { EventsChartPanel } from '../events_chart_panel';
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
SLOWithSummaryResponse,
|
||||
} from '@kbn/slo-schema';
|
||||
import React from 'react';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { convertSliApmParamsToApmAppDeeplinkUrl } from '../../../../utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url';
|
||||
import { OverviewItem } from './overview_item';
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { QuerySchema } from '@kbn/slo-schema';
|
|||
import { EuiCodeBlock, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
||||
import { FilterItem } from '@kbn/unified-search-plugin/public';
|
||||
import { injectI18n } from '@kbn/i18n-react';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { useCreateDataView } from '../../../../hooks/use_create_data_view';
|
||||
|
||||
const FilterItemI18n = injectI18n(FilterItem);
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
import React from 'react';
|
||||
import { TagsList } from '@kbn/observability-shared-plugin/public';
|
||||
import { DisplayQuery } from './display_query';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import {
|
||||
BUDGETING_METHOD_OCCURRENCES,
|
||||
BUDGETING_METHOD_TIMESLICES,
|
||||
|
|
|
@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import { syntheticsAvailabilityIndicatorSchema, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import React from 'react';
|
||||
import { syntheticsMonitorDetailLocatorID } from '@kbn/observability-plugin/common';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { OverviewItem } from './overview_item';
|
||||
|
||||
interface Props {
|
||||
|
|
|
@ -12,7 +12,7 @@ import { rollingTimeWindowTypeSchema, SLOWithSummaryResponse } from '@kbn/slo-sc
|
|||
import React from 'react';
|
||||
import { TimeBounds } from '../types';
|
||||
import { SloTabId } from './slo_details';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { ChartData } from '../../../typings/slo';
|
||||
import { toDurationAdverbLabel, toDurationLabel } from '../../../utils/slo/labels';
|
||||
import { WideChart } from './wide_chart';
|
||||
|
|
|
@ -10,7 +10,7 @@ import { AlertConsumers } from '@kbn/rule-data-utils';
|
|||
|
||||
import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { SLO_ALERTS_TABLE_ID } from '@kbn/observability-shared-plugin/common';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
|
||||
export interface Props {
|
||||
slo: SLOWithSummaryResponse;
|
||||
|
|
|
@ -19,7 +19,7 @@ import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
|||
import React from 'react';
|
||||
import { getSLOSummaryTransformId, getSLOTransformId } from '../../../../common/constants';
|
||||
import { useFetchSloHealth } from '../../../hooks/use_fetch_slo_health';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
|
||||
export function SloHealthCallout({ slo }: { slo: SLOWithSummaryResponse }) {
|
||||
const { http } = useKibana().services;
|
||||
|
|
|
@ -26,7 +26,7 @@ import { useAnnotations } from '@kbn/observability-plugin/public';
|
|||
import { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { getBrushTimeBounds } from '../../../utils/slo/duration';
|
||||
import { TimeBounds } from '../types';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { ChartData } from '../../../typings';
|
||||
|
||||
type ChartType = 'area' | 'line';
|
||||
|
|
|
@ -12,7 +12,7 @@ import path from 'path';
|
|||
import { paths } from '../../../../common/locators/paths';
|
||||
import { useSpace } from '../../../hooks/use_space';
|
||||
import { BurnRateRuleParams } from '../../../typings';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import {
|
||||
createRemoteSloDeleteUrl,
|
||||
createRemoteSloEditUrl,
|
||||
|
|
|
@ -10,7 +10,7 @@ import { EuiNotificationBadge, EuiToolTip } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { paths } from '../../../../common/locators/paths';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { useFetchActiveAlerts } from '../../../hooks/use_fetch_active_alerts';
|
||||
import {
|
||||
ALERTS_TAB_ID,
|
||||
|
|
|
@ -30,7 +30,7 @@ import { useFetchHistoricalSummary } from '../../hooks/use_fetch_historical_summ
|
|||
import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details';
|
||||
import { useLicense } from '../../hooks/use_license';
|
||||
import { usePermissions } from '../../hooks/use_permissions';
|
||||
import { useKibana } from '../../utils/kibana_react';
|
||||
import { useKibana } from '../../hooks/use_kibana';
|
||||
import { render } from '../../utils/test_helper';
|
||||
import { SloDetailsPage } from './slo_details';
|
||||
import { usePerformanceContext } from '@kbn/ebt-tools';
|
||||
|
@ -41,7 +41,7 @@ jest.mock('react-router-dom', () => ({
|
|||
}));
|
||||
|
||||
jest.mock('@kbn/observability-shared-plugin/public');
|
||||
jest.mock('../../utils/kibana_react');
|
||||
jest.mock('../../hooks/use_kibana');
|
||||
jest.mock('../../hooks/use_license');
|
||||
jest.mock('../../hooks/use_permissions');
|
||||
jest.mock('../../hooks/use_fetch_active_alerts');
|
||||
|
|
|
@ -24,7 +24,7 @@ import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details';
|
|||
import { useLicense } from '../../hooks/use_license';
|
||||
import { usePermissions } from '../../hooks/use_permissions';
|
||||
import { usePluginContext } from '../../hooks/use_plugin_context';
|
||||
import { useKibana } from '../../utils/kibana_react';
|
||||
import { useKibana } from '../../hooks/use_kibana';
|
||||
import PageNotFound from '../404';
|
||||
import { HeaderControl } from './components/header_control';
|
||||
import { HeaderTitle } from './components/header_title';
|
||||
|
|
|
@ -37,7 +37,7 @@ import { max, min } from 'lodash';
|
|||
import moment from 'moment';
|
||||
import React, { useState } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { GoodBadEventsChart } from '../../../../components/good_bad_events_chart/good_bad_events_chart';
|
||||
import { useDebouncedGetPreviewData } from '../../hooks/use_preview';
|
||||
import { useSectionFormValidation } from '../../hooks/use_section_form_validation';
|
||||
|
|
|
@ -16,7 +16,7 @@ import { EuiResizableContainer, EuiProgress, EuiCallOut, EuiSpacer } from '@elas
|
|||
import { buildFilter, FILTERS, TimeRange } from '@kbn/es-query';
|
||||
import { FieldPath, useFormContext } from 'react-hook-form';
|
||||
import { Serializable } from '@kbn/utility-types';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { CreateSLOForm } from '../../types';
|
||||
import { QuerySearchBar } from './query_search_bar';
|
||||
import { SearchBarProps } from './query_builder';
|
||||
|
|
|
@ -13,7 +13,7 @@ import React, { memo } from 'react';
|
|||
import styled from 'styled-components';
|
||||
import { observabilityAppId } from '@kbn/observability-shared-plugin/common';
|
||||
import { SearchBarProps } from './query_builder';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { CreateSLOForm } from '../../types';
|
||||
import { OptionalText } from './optional_text';
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { XJsonLang } from '@kbn/monaco';
|
|||
import React, { ReactNode, useCallback } from 'react';
|
||||
import { CodeEditor } from '@kbn/code-editor';
|
||||
import { compressToEncodedURIComponent } from 'lz-string';
|
||||
import { useKibana } from '../../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../../hooks/use_kibana';
|
||||
|
||||
interface RequestCodeViewerProps {
|
||||
value: string;
|
||||
|
|
|
@ -27,7 +27,7 @@ import { GetSLOResponse } from '@kbn/slo-schema';
|
|||
import React, { useState } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { enableInspectEsQueries } from '@kbn/observability-plugin/common';
|
||||
import { useKibana } from '../../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../../hooks/use_kibana';
|
||||
import { useFetchSloInspect } from '../../../../../hooks/use_fetch_slo_inspect';
|
||||
import { usePluginContext } from '../../../../../hooks/use_plugin_context';
|
||||
import { transformCreateSLOFormToCreateSLOInput } from '../../../helpers/process_slo_form_values';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import React, { useMemo, SetStateAction } from 'react';
|
||||
import { UnifiedFieldListSidebarContainer } from '@kbn/unified-field-list';
|
||||
import { DataView } from '@kbn/data-views-plugin/common';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
|
||||
export const useFieldSidebar = ({
|
||||
dataView,
|
||||
|
|
|
@ -12,8 +12,8 @@ import React, { useEffect } from 'react';
|
|||
import { Controller, useFormContext } from 'react-hook-form';
|
||||
import { DataViewPicker } from '@kbn/unified-search-plugin/public';
|
||||
import { getDataViewPattern, useAdhocDataViews } from './use_adhoc_data_views';
|
||||
import { SloPublicPluginsStart } from '../../../..';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { SLOPublicPluginsStart } from '../../../..';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
import { CreateSLOForm } from '../../types';
|
||||
|
||||
const BTN_MAX_WIDTH = 515;
|
||||
|
@ -26,7 +26,7 @@ export function IndexSelection({ selectedDataView }: { selectedDataView?: DataVi
|
|||
const { control, getFieldState, setValue, watch } = useFormContext<CreateSLOForm>();
|
||||
const { dataViews: dataViewsService, dataViewFieldEditor } = useKibana().services;
|
||||
|
||||
const { dataViewEditor } = useKibana<SloPublicPluginsStart>().services;
|
||||
const { dataViewEditor } = useKibana<SLOPublicPluginsStart>().services;
|
||||
|
||||
const currentIndexPattern = watch(INDEX_FIELD);
|
||||
const currentDataViewId = watch(DATA_VIEW_FIELD);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { useEffect, useState } from 'react';
|
||||
import { DataView, DataViewListItem } from '@kbn/data-views-plugin/common';
|
||||
import { useFetchDataViews } from '@kbn/observability-plugin/public';
|
||||
import { useKibana } from '../../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../../hooks/use_kibana';
|
||||
|
||||
export const getDataViewPattern = ({
|
||||
byId,
|
||||
|
|
|
@ -12,7 +12,7 @@ import React, { useCallback, useMemo } from 'react';
|
|||
import { useFormContext } from 'react-hook-form';
|
||||
import { InPortal } from 'react-reverse-portal';
|
||||
import { useCreateRule } from '../../../hooks/use_create_burn_rate_rule';
|
||||
import { useKibana } from '../../../utils/kibana_react';
|
||||
import { useKibana } from '../../../hooks/use_kibana';
|
||||
import { sloEditFormFooterPortal } from '../shared_flyout/slo_add_form_flyout';
|
||||
import { paths } from '../../../../common/locators/paths';
|
||||
import { useCreateSlo } from '../../../hooks/use_create_slo';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue