[Uptime] Migrate client to New Platform (#55086)
* Move uptime legacy server to plugins directory. * Re-add feature registration code. * Move uptime legacy server to plugins directory. * Re-add feature registration code. * Move all files. * WIP fixing things. * WIP fixing things. * WIP fixing things. * Finished fixing server. * Fix alert type registration glitch. * Remove obsolete file. * Fix unwanted revisions, uncomment previously un-migrated code, delete accidentally-merged files. * More cleanup. * Fix all non-maps unit tests. * Get functional tests working. * Delete misplaced file. * Add uptime CODEOWNERS entry. * Get map working in Uptime app on NP. * Update CODEOWNERS to remove legacy entry. * Update server imports. * Delete and clean up unused or redundant code/comments. * Move new files from legacy to NP to fix merge error. * Fix broken import. * Delete obsolete test snapshots. * Clean up imports and types, delete obsolete code. * Clean up redundant common imports. * Delete obsolete translation keys. * Add additional explicit typing to plugin class. * Combine redundant common imports. * Delete unneeded optionalPlugin entry. * Revert "Combine redundant common imports." This reverts commit159e66c349
. * Update a translation description. * Revert "Clean up redundant common imports." This reverts commit8794013fbe
. * Remove new common index file and revert imports from only common to more specific paths. * Fix broken imports in `~/x-pack/test`. * Move new file from legacy to NP location. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
8bb67f2c62
commit
05f0d0ac8a
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -84,7 +84,6 @@
|
|||
/x-pack/legacy/plugins/ingest_manager/ @elastic/ingest-management
|
||||
/x-pack/plugins/observability/ @elastic/logs-metrics-ui @elastic/apm-ui @elastic/uptime @elastic/ingest-management
|
||||
/x-pack/legacy/plugins/monitoring/ @elastic/stack-monitoring-ui
|
||||
/x-pack/legacy/plugins/uptime @elastic/uptime
|
||||
/x-pack/plugins/uptime @elastic/uptime
|
||||
|
||||
# Machine Learning
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"xpack.transform": "plugins/transform",
|
||||
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
|
||||
"xpack.upgradeAssistant": "plugins/upgrade_assistant",
|
||||
"xpack.uptime": ["plugins/uptime", "legacy/plugins/uptime"],
|
||||
"xpack.uptime": ["plugins/uptime"],
|
||||
"xpack.watcher": "plugins/watcher"
|
||||
},
|
||||
"translations": [
|
||||
|
|
|
@ -16,7 +16,6 @@ import { spaces } from './legacy/plugins/spaces';
|
|||
import { canvas } from './legacy/plugins/canvas';
|
||||
import { infra } from './legacy/plugins/infra';
|
||||
import { taskManager } from './legacy/plugins/task_manager';
|
||||
import { uptime } from './legacy/plugins/uptime';
|
||||
import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects';
|
||||
import { actions } from './legacy/plugins/actions';
|
||||
import { alerting } from './legacy/plugins/alerting';
|
||||
|
@ -37,7 +36,6 @@ module.exports = function(kibana) {
|
|||
canvas(kibana),
|
||||
infra(kibana),
|
||||
taskManager(kibana),
|
||||
uptime(kibana),
|
||||
encryptedSavedObjects(kibana),
|
||||
actions(kibana),
|
||||
alerting(kibana),
|
||||
|
|
|
@ -1,36 +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;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { resolve } from 'path';
|
||||
import { PLUGIN } from './common/constants';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
|
||||
export const uptime = (kibana: any) =>
|
||||
new kibana.Plugin({
|
||||
configPrefix: 'xpack.uptime',
|
||||
id: PLUGIN.ID,
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
require: ['alerting', 'kibana', 'elasticsearch', 'xpack_main'],
|
||||
uiExports: {
|
||||
app: {
|
||||
description: i18n.translate('xpack.uptime.pluginDescription', {
|
||||
defaultMessage: 'Uptime monitoring',
|
||||
description: 'The description text that will be shown to users in Kibana',
|
||||
}),
|
||||
icon: 'plugins/uptime/icons/heartbeat_white.svg',
|
||||
euiIconType: 'uptimeApp',
|
||||
title: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', {
|
||||
defaultMessage: 'Uptime',
|
||||
}),
|
||||
main: 'plugins/uptime/app',
|
||||
order: 8900,
|
||||
url: '/app/uptime#/',
|
||||
category: DEFAULT_APP_CATEGORIES.observability,
|
||||
},
|
||||
home: ['plugins/uptime/register_feature'],
|
||||
},
|
||||
});
|
|
@ -1,16 +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;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { Plugin } from './plugin';
|
||||
import 'uiExports/embeddableFactories';
|
||||
|
||||
const plugin = new Plugin({
|
||||
opaqueId: Symbol('uptime'),
|
||||
env: {} as any,
|
||||
config: { get: () => ({} as any) },
|
||||
});
|
||||
plugin.setup(npSetup);
|
|
@ -1,56 +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;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { LegacyCoreSetup, PluginInitializerContext, AppMountParameters } from 'src/core/public';
|
||||
import { PluginsSetup } from 'ui/new_platform/new_platform';
|
||||
import { FeatureCatalogueCategory } from '../../../../../../src/plugins/home/public';
|
||||
import { UMFrontendLibs } from '../lib/lib';
|
||||
import { PLUGIN } from '../../common/constants';
|
||||
import { getKibanaFrameworkAdapter } from '../lib/adapters/framework/new_platform_adapter';
|
||||
|
||||
export interface SetupObject {
|
||||
core: LegacyCoreSetup;
|
||||
plugins: PluginsSetup;
|
||||
}
|
||||
|
||||
export class Plugin {
|
||||
constructor(
|
||||
// @ts-ignore this is added to satisfy the New Platform typing constraint,
|
||||
// but we're not leveraging any of its functionality yet.
|
||||
private readonly initializerContext: PluginInitializerContext
|
||||
) {}
|
||||
|
||||
public setup(setup: SetupObject) {
|
||||
const { core, plugins } = setup;
|
||||
const { home } = plugins;
|
||||
|
||||
home.featureCatalogue.register({
|
||||
category: FeatureCatalogueCategory.DATA,
|
||||
description: PLUGIN.DESCRIPTION,
|
||||
icon: 'uptimeApp',
|
||||
id: PLUGIN.ID,
|
||||
path: '/app/uptime#/',
|
||||
showOnHomePage: true,
|
||||
title: PLUGIN.TITLE,
|
||||
});
|
||||
|
||||
core.application.register({
|
||||
id: PLUGIN.ID,
|
||||
euiIconType: 'uptimeApp',
|
||||
order: 8900,
|
||||
title: 'Uptime',
|
||||
async mount(params: AppMountParameters) {
|
||||
const [coreStart] = await core.getStartServices();
|
||||
const { element } = params;
|
||||
const libs: UMFrontendLibs = {
|
||||
framework: getKibanaFrameworkAdapter(coreStart, plugins),
|
||||
};
|
||||
libs.framework.render(element);
|
||||
return () => {};
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,25 +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;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public';
|
||||
|
||||
const {
|
||||
plugins: { home },
|
||||
} = npSetup;
|
||||
|
||||
home.featureCatalogue.register({
|
||||
id: 'uptime',
|
||||
title: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', { defaultMessage: 'Uptime' }),
|
||||
description: i18n.translate('xpack.uptime.featureCatalogueDescription', {
|
||||
defaultMessage: 'Perform endpoint health checks and uptime monitoring.',
|
||||
}),
|
||||
icon: 'uptimeApp',
|
||||
path: `uptime#/`,
|
||||
showOnHomePage: true,
|
||||
category: FeatureCatalogueCategory.DATA,
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"exclude": ["**/node_modules/**"],
|
||||
"paths": {
|
||||
"react": ["../../../node_modules/@types/react"]
|
||||
}
|
||||
}
|
|
@ -16112,7 +16112,6 @@
|
|||
"xpack.uptime.emptyStateError.notAuthorized": "アップタイムデータの表示が承認されていません。システム管理者にお問い合わせください。",
|
||||
"xpack.uptime.emptyStateError.notFoundPage": "ページが見つかりません",
|
||||
"xpack.uptime.emptyStateError.title": "エラー",
|
||||
"xpack.uptime.featureCatalogueDescription": "エンドポイントヘルスチェックとアップタイム監視を行います。",
|
||||
"xpack.uptime.featureRegistry.uptimeFeatureName": "アップタイム",
|
||||
"xpack.uptime.filterBar.ariaLabel": "概要ページのインプットフィルター基準",
|
||||
"xpack.uptime.filterBar.filterDownLabel": "ダウン",
|
||||
|
|
|
@ -16117,7 +16117,6 @@
|
|||
"xpack.uptime.emptyStateError.notAuthorized": "您无权查看 Uptime 数据,请联系系统管理员。",
|
||||
"xpack.uptime.emptyStateError.notFoundPage": "未找到页面",
|
||||
"xpack.uptime.emptyStateError.title": "错误",
|
||||
"xpack.uptime.featureCatalogueDescription": "执行终端节点运行状况检查和运行时间监测。",
|
||||
"xpack.uptime.featureRegistry.uptimeFeatureName": "运行时间",
|
||||
"xpack.uptime.filterBar.ariaLabel": "概览页面的输入筛选条件",
|
||||
"xpack.uptime.filterBar.filterDownLabel": "关闭",
|
||||
|
|
|
@ -8,12 +8,17 @@ import { i18n } from '@kbn/i18n';
|
|||
|
||||
export const PLUGIN = {
|
||||
APP_ROOT_ID: 'react-uptime-root',
|
||||
DESCRIPTION: 'Uptime monitoring',
|
||||
DESCRIPTION: i18n.translate('xpack.uptime.pluginDescription', {
|
||||
defaultMessage: 'Uptime monitoring',
|
||||
description: 'The description text that will appear in the feature catalogue.',
|
||||
}),
|
||||
ID: 'uptime',
|
||||
LOCAL_STORAGE_KEY: 'xpack.uptime',
|
||||
NAME: i18n.translate('xpack.uptime.featureRegistry.uptimeFeatureName', {
|
||||
defaultMessage: 'Uptime',
|
||||
}),
|
||||
ROUTER_BASE_NAME: '/app/uptime#',
|
||||
TITLE: 'uptime',
|
||||
TITLE: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', {
|
||||
defaultMessage: 'Uptime',
|
||||
}),
|
||||
};
|
|
@ -7,8 +7,8 @@
|
|||
export * from './alerts';
|
||||
export * from './certs';
|
||||
export * from './common';
|
||||
export * from './dynamic_settings';
|
||||
export * from './monitor';
|
||||
export * from './overview_filters';
|
||||
export * from './ping';
|
||||
export * from './snapshot';
|
||||
export * from './dynamic_settings';
|
|
@ -4,18 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
/** Represents a bucket of monitor status information. */
|
||||
export interface StatusData {
|
||||
/** The timeseries point for this status data. */
|
||||
x: number;
|
||||
/** The value of up counts for this point. */
|
||||
up?: number | null;
|
||||
/** The value for down counts for this point. */
|
||||
down?: number | null;
|
||||
/** The total down counts for this point. */
|
||||
total?: number | null;
|
||||
}
|
||||
|
||||
/** Represents the average monitor duration ms at a point in time. */
|
||||
export interface MonitorDurationAveragePoint {
|
||||
/** The timeseries value for this point. */
|
|
@ -2,8 +2,16 @@
|
|||
"configPath": ["xpack", "uptime"],
|
||||
"id": "uptime",
|
||||
"kibanaVersion": "kibana",
|
||||
"requiredPlugins": ["alerting", "features", "licensing", "usageCollection"],
|
||||
"optionalPlugins": ["capabilities", "data", "home"],
|
||||
"requiredPlugins": [
|
||||
"alerting",
|
||||
"embeddable",
|
||||
"features",
|
||||
"licensing",
|
||||
"triggers_actions_ui",
|
||||
"usageCollection"
|
||||
],
|
||||
"server": true,
|
||||
"ui": false,
|
||||
"ui": true,
|
||||
"version": "8.0.0"
|
||||
}
|
||||
|
|
|
@ -4,10 +4,4 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
type UMResolverResult<T> = Promise<T> | T;
|
||||
|
||||
export type UMResolver<Result, Parent, Args, Context> = (
|
||||
parent: Parent,
|
||||
args: Args,
|
||||
context: Context
|
||||
) => UMResolverResult<Result>;
|
||||
export { UptimePlugin } from './plugin';
|
72
x-pack/plugins/uptime/public/apps/plugin.ts
Normal file
72
x-pack/plugins/uptime/public/apps/plugin.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { LegacyCoreStart, AppMountParameters } from 'src/core/public';
|
||||
import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'kibana/public';
|
||||
import { UMFrontendLibs } from '../lib/lib';
|
||||
import { PLUGIN } from '../../common/constants';
|
||||
import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public';
|
||||
import { getKibanaFrameworkAdapter } from '../lib/adapters/framework/new_platform_adapter';
|
||||
import { HomePublicPluginSetup } from '../../../../../src/plugins/home/public';
|
||||
import { EmbeddableStart } from '../../../../../src/plugins/embeddable/public';
|
||||
import { TriggersAndActionsUIPublicPluginSetup } from '../../../triggers_actions_ui/public';
|
||||
import { DataPublicPluginSetup } from '../../../../../src/plugins/data/public';
|
||||
|
||||
export interface StartObject {
|
||||
core: LegacyCoreStart;
|
||||
plugins: any;
|
||||
}
|
||||
|
||||
export interface ClientPluginsSetup {
|
||||
data: DataPublicPluginSetup;
|
||||
home: HomePublicPluginSetup;
|
||||
triggers_actions_ui: TriggersAndActionsUIPublicPluginSetup;
|
||||
}
|
||||
|
||||
export interface ClientPluginsStart {
|
||||
embeddable: EmbeddableStart;
|
||||
}
|
||||
|
||||
export class UptimePlugin implements Plugin<void, void, ClientPluginsSetup, ClientPluginsStart> {
|
||||
constructor(_context: PluginInitializerContext) {}
|
||||
|
||||
public async setup(
|
||||
core: CoreSetup<ClientPluginsStart, unknown>,
|
||||
plugins: ClientPluginsSetup
|
||||
): Promise<void> {
|
||||
if (plugins.home) {
|
||||
plugins.home.featureCatalogue.register({
|
||||
id: PLUGIN.ID,
|
||||
title: PLUGIN.TITLE,
|
||||
description: PLUGIN.DESCRIPTION,
|
||||
icon: 'uptimeApp',
|
||||
path: '/app/uptime#/',
|
||||
showOnHomePage: true,
|
||||
category: FeatureCatalogueCategory.DATA,
|
||||
});
|
||||
}
|
||||
|
||||
core.application.register({
|
||||
appRoute: '/app/uptime#/',
|
||||
id: PLUGIN.ID,
|
||||
euiIconType: 'uptimeApp',
|
||||
order: 8900,
|
||||
title: PLUGIN.TITLE,
|
||||
async mount(params: AppMountParameters) {
|
||||
const [coreStart, corePlugins] = await core.getStartServices();
|
||||
const { element } = params;
|
||||
const libs: UMFrontendLibs = {
|
||||
framework: getKibanaFrameworkAdapter(coreStart, plugins, corePlugins),
|
||||
};
|
||||
libs.framework.render(element);
|
||||
return () => {};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
public start(_start: CoreStart, _plugins: {}): void {}
|
||||
|
||||
public stop(): void {}
|
||||
}
|
|
@ -9,11 +9,11 @@ import moment from 'moment';
|
|||
import { AnnotationTooltipFormatter, RectAnnotation } from '@elastic/charts';
|
||||
import { RectAnnotationDatum } from '@elastic/charts/dist/chart_types/xy_chart/utils/specs';
|
||||
import { AnnotationTooltip } from './annotation_tooltip';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../../../plugins/ml/common/constants/anomalies';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../../plugins/ml/common/constants/anomalies';
|
||||
import {
|
||||
getSeverityColor,
|
||||
getSeverityType,
|
||||
} from '../../../../../../../plugins/ml/common/util/anomaly_utils';
|
||||
} from '../../../../../../plugins/ml/common/util/anomaly_utils';
|
||||
|
||||
interface Props {
|
||||
anomalies: any;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue