mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Kibana Sustainable Architecture: Expose StatusResponse
in core-status-common (#200524)
## Summary - Exposes the interfaces that define the format of the response of the `/api/status` endpoint. - Moves them from `@kbn/core-status-common-internal` to `@kbn/core-status-common`. - Removes the former package, as it no longer contains anything. - Fixes some of the illegal dependencies uncovered by https://github.com/elastic/kibana/pull/199630. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
55134abbed
commit
ab0375f56f
31 changed files with 35 additions and 130 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -225,7 +225,6 @@ packages/core/security/core-security-server @elastic/kibana-core
|
|||
packages/core/security/core-security-server-internal @elastic/kibana-core
|
||||
packages/core/security/core-security-server-mocks @elastic/kibana-core
|
||||
packages/core/status/core-status-common @elastic/kibana-core
|
||||
packages/core/status/core-status-common-internal @elastic/kibana-core
|
||||
packages/core/status/core-status-server @elastic/kibana-core
|
||||
packages/core/status/core-status-server-internal @elastic/kibana-core
|
||||
packages/core/status/core-status-server-mocks @elastic/kibana-core
|
||||
|
|
|
@ -384,7 +384,6 @@
|
|||
"@kbn/core-security-server-internal": "link:packages/core/security/core-security-server-internal",
|
||||
"@kbn/core-security-server-mocks": "link:packages/core/security/core-security-server-mocks",
|
||||
"@kbn/core-status-common": "link:packages/core/status/core-status-common",
|
||||
"@kbn/core-status-common-internal": "link:packages/core/status/core-status-common-internal",
|
||||
"@kbn/core-status-server": "link:packages/core/status/core-status-server",
|
||||
"@kbn/core-status-server-internal": "link:packages/core/status/core-status-server-internal",
|
||||
"@kbn/core-test-helpers-deprecations-getters": "link:packages/core/test-helpers/core-test-helpers-deprecations-getters",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import type { StatusInfoServiceStatus as ServiceStatus } from '@kbn/core-status-common-internal';
|
||||
import type { StatusInfoServiceStatus as ServiceStatus } from '@kbn/core-status-common';
|
||||
import { StatusTable } from './status_table';
|
||||
|
||||
const state = {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { mountWithIntl, findTestSubject } from '@kbn/test-jest-helpers';
|
||||
import type { ServerVersion } from '@kbn/core-status-common-internal';
|
||||
import type { ServerVersion } from '@kbn/core-status-common';
|
||||
import { VersionHeader } from './version_header';
|
||||
|
||||
const buildServerVersion = (parts: Partial<ServerVersion> = {}): ServerVersion => ({
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
import React, { FC } from 'react';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import type { ServerVersion } from '@kbn/core-status-common-internal';
|
||||
import type { ServerVersion } from '@kbn/core-status-common';
|
||||
|
||||
interface VersionHeaderProps {
|
||||
version: ServerVersion;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
|
||||
import type { StatusResponse } from '@kbn/core-status-common-internal';
|
||||
import type { StatusResponse } from '@kbn/core-status-common';
|
||||
import { notificationServiceMock } from '@kbn/core-notifications-browser-mocks';
|
||||
import { mocked } from '@kbn/core-metrics-collectors-server-mocks';
|
||||
import { loadStatus } from './load_status';
|
||||
|
|
|
@ -11,11 +11,11 @@ import numeral from '@elastic/numeral';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import type { HttpSetup } from '@kbn/core-http-browser';
|
||||
import type { NotificationsSetup } from '@kbn/core-notifications-browser';
|
||||
import type { ServiceStatusLevelId } from '@kbn/core-status-common';
|
||||
import type {
|
||||
ServiceStatusLevelId,
|
||||
StatusResponse,
|
||||
StatusInfoServiceStatus as ServiceStatus,
|
||||
} from '@kbn/core-status-common-internal';
|
||||
} from '@kbn/core-status-common';
|
||||
import type { DataType } from './format_number';
|
||||
|
||||
interface MetricMeta {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import type { StatusInfoServiceStatus as ServiceStatus } from '@kbn/core-status-common-internal';
|
||||
import type { StatusInfoServiceStatus as ServiceStatus } from '@kbn/core-status-common';
|
||||
import { getLevelSortValue, groupByLevel, getHighestStatus } from './status_level';
|
||||
import { FormattedStatus, StatusState } from './load_status';
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
"@kbn/core-application-browser",
|
||||
"@kbn/core-application-browser-internal",
|
||||
"@kbn/core-mount-utils-browser-internal",
|
||||
"@kbn/core-status-common-internal",
|
||||
"@kbn/core-http-browser-internal",
|
||||
"@kbn/core-application-browser-mocks",
|
||||
"@kbn/core-notifications-browser-mocks",
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# @kbn/core-status-common-internal
|
||||
|
||||
This package contains the common internal types for Core's `status` domain.
|
|
@ -1,17 +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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export type {
|
||||
StatusInfoCoreStatus,
|
||||
StatusInfoServiceStatus,
|
||||
StatusInfo,
|
||||
StatusResponse,
|
||||
ServerVersion,
|
||||
ServerMetrics,
|
||||
} from './src';
|
|
@ -1,14 +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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/status/core-status-common-internal'],
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/core-status-common-internal",
|
||||
"owner": "@elastic/kibana-core"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "@kbn/core-status-common-internal",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"author": "Kibana Core",
|
||||
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
|
||||
}
|
|
@ -1,17 +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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export type {
|
||||
StatusInfo,
|
||||
StatusInfoCoreStatus,
|
||||
StatusInfoServiceStatus,
|
||||
StatusResponse,
|
||||
ServerVersion,
|
||||
ServerMetrics,
|
||||
} from './status';
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/core-status-common",
|
||||
"@kbn/core-metrics-server",
|
||||
"@kbn/config"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
]
|
||||
}
|
|
@ -7,5 +7,14 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { ServiceStatusLevels } from './src';
|
||||
export type { ServiceStatus, ServiceStatusLevel, ServiceStatusLevelId, CoreStatus } from './src';
|
||||
export { ServiceStatusLevels } from './src/service_status';
|
||||
export type { CoreStatus } from './src/core_status';
|
||||
export type { ServiceStatus, ServiceStatusLevel, ServiceStatusLevelId } from './src/service_status';
|
||||
export type {
|
||||
StatusInfo,
|
||||
StatusInfoCoreStatus,
|
||||
StatusInfoServiceStatus,
|
||||
StatusResponse,
|
||||
ServerVersion,
|
||||
ServerMetrics,
|
||||
} from './src/status';
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../../..',
|
||||
roots: ['<rootDir>/packages/core/status/core-status-common-internal'],
|
||||
roots: ['<rootDir>/packages/core/status/core-status-common'],
|
||||
};
|
||||
|
|
|
@ -1,12 +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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { ServiceStatusLevels } from './service_status';
|
||||
export type { ServiceStatus, ServiceStatusLevel, ServiceStatusLevelId } from './service_status';
|
||||
export type { CoreStatus } from './core_status';
|
|
@ -8,8 +8,9 @@
|
|||
*/
|
||||
|
||||
import type { BuildFlavor } from '@kbn/config';
|
||||
import type { ServiceStatusLevelId, ServiceStatus, CoreStatus } from '@kbn/core-status-common';
|
||||
import type { OpsMetrics } from '@kbn/core-metrics-server';
|
||||
import type { ServiceStatusLevelId, ServiceStatus } from './service_status';
|
||||
import type { CoreStatus } from './core_status';
|
||||
|
||||
export interface StatusInfoServiceStatus extends Omit<ServiceStatus, 'level'> {
|
||||
level: ServiceStatusLevelId;
|
|
@ -12,7 +12,9 @@
|
|||
"**/*.tsx",
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/std"
|
||||
"@kbn/std",
|
||||
"@kbn/config",
|
||||
"@kbn/core-metrics-server"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
|
@ -15,7 +15,7 @@ import type { IRouter } from '@kbn/core-http-server';
|
|||
import type { MetricsServiceSetup } from '@kbn/core-metrics-server';
|
||||
import type { CoreIncrementUsageCounter } from '@kbn/core-usage-data-server';
|
||||
import { type ServiceStatus, type CoreStatus, ServiceStatusLevels } from '@kbn/core-status-common';
|
||||
import { StatusResponse } from '@kbn/core-status-common-internal';
|
||||
import type { StatusResponse } from '@kbn/core-status-common';
|
||||
import { calculateLegacyStatus, type LegacyStatusInfo } from '../legacy_status';
|
||||
import { statusResponse, type RedactedStatusHttpBody } from './status_response_schemas';
|
||||
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
import { schema, type Type, type TypeOf } from '@kbn/config-schema';
|
||||
import type { BuildFlavor } from '@kbn/config';
|
||||
import type { ServiceStatusLevelId, ServiceStatus } from '@kbn/core-status-common';
|
||||
|
||||
import type {
|
||||
ServiceStatusLevelId,
|
||||
ServiceStatus,
|
||||
StatusResponse,
|
||||
StatusInfoCoreStatus,
|
||||
ServerMetrics,
|
||||
StatusInfo,
|
||||
ServerVersion,
|
||||
} from '@kbn/core-status-common-internal';
|
||||
} from '@kbn/core-status-common';
|
||||
|
||||
const serviceStatusLevelId: () => Type<ServiceStatusLevelId> = () =>
|
||||
schema.oneOf(
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
"@kbn/core-saved-objects-server-internal",
|
||||
"@kbn/core-status-server",
|
||||
"@kbn/core-status-common",
|
||||
"@kbn/core-status-common-internal",
|
||||
"@kbn/core-usage-data-base-server-internal",
|
||||
"@kbn/core-base-server-mocks",
|
||||
"@kbn/core-environment-server-mocks",
|
||||
|
|
|
@ -37,7 +37,7 @@ export const runKbnManifestCli = () => {
|
|||
--list all List all the manifests
|
||||
--package [packageId] Select a package to update.
|
||||
--plugin [pluginId] Select a plugin to update.
|
||||
--set [property] [value] Set the desired "[property]": "[value]"
|
||||
--set [property]=[value] Set the desired "[property]": "[value]"
|
||||
--unset [property] Removes the desired "[property]: value" from the manifest
|
||||
`,
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@ import useAsyncFn from 'react-use/lib/useAsyncFn';
|
|||
import useTimeoutFn from 'react-use/lib/useTimeoutFn';
|
||||
|
||||
import type { IHttpFetchError } from '@kbn/core-http-browser';
|
||||
import type { StatusResponse } from '@kbn/core-status-common-internal';
|
||||
import type { StatusResponse } from '@kbn/core-status-common';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { useKibana } from './use_kibana';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"@kbn/i18n",
|
||||
"@kbn/ui-theme",
|
||||
"@kbn/core-http-browser",
|
||||
"@kbn/core-status-common-internal",
|
||||
"@kbn/core-status-common",
|
||||
"@kbn/safer-lodash-set",
|
||||
"@kbn/test-jest-helpers",
|
||||
"@kbn/config-schema",
|
||||
|
|
|
@ -606,8 +606,6 @@
|
|||
"@kbn/core-security-server-mocks/*": ["packages/core/security/core-security-server-mocks/*"],
|
||||
"@kbn/core-status-common": ["packages/core/status/core-status-common"],
|
||||
"@kbn/core-status-common/*": ["packages/core/status/core-status-common/*"],
|
||||
"@kbn/core-status-common-internal": ["packages/core/status/core-status-common-internal"],
|
||||
"@kbn/core-status-common-internal/*": ["packages/core/status/core-status-common-internal/*"],
|
||||
"@kbn/core-status-server": ["packages/core/status/core-status-server"],
|
||||
"@kbn/core-status-server/*": ["packages/core/status/core-status-server/*"],
|
||||
"@kbn/core-status-server-internal": ["packages/core/status/core-status-server-internal"],
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { KbnClient } from '@kbn/test';
|
||||
import type { Client } from '@elastic/elasticsearch';
|
||||
import type { StatusResponse } from '@kbn/core-status-common-internal';
|
||||
import type { StatusResponse } from '@kbn/core-status-common';
|
||||
import { catchAxiosErrorFormatAndThrow } from '../format_axios_error';
|
||||
|
||||
export const fetchKibanaStatus = async (kbnClient: KbnClient): Promise<StatusResponse> => {
|
||||
|
@ -15,11 +15,11 @@ export const fetchKibanaStatus = async (kbnClient: KbnClient): Promise<StatusRes
|
|||
// client (created by `x-pack/plugins/security_solution/scripts/endpoint/common/stack_services.ts:267`)
|
||||
// which could be using an API key (which the core KbnClient does not support)
|
||||
return kbnClient
|
||||
.request({
|
||||
.request<StatusResponse>({
|
||||
method: 'GET',
|
||||
path: '/api/status',
|
||||
})
|
||||
.then((response) => response.data as StatusResponse)
|
||||
.then(({ data }) => data)
|
||||
.catch(catchAxiosErrorFormatAndThrow);
|
||||
};
|
||||
/**
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
"@kbn/dev-cli-errors",
|
||||
"@kbn/dev-utils",
|
||||
"@kbn/tooling-log",
|
||||
"@kbn/core-status-common-internal",
|
||||
"@kbn/core-status-common",
|
||||
"@kbn/repo-info",
|
||||
"@kbn/storybook",
|
||||
"@kbn/controls-plugin",
|
||||
|
|
|
@ -4458,10 +4458,6 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-status-common-internal@link:packages/core/status/core-status-common-internal":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/core-status-common@link:packages/core/status/core-status-common":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue