Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uptime] Migrate client to New Platform #55086

Merged
merged 58 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
84d3941
Move uptime legacy server to plugins directory.
justinkambic Jan 3, 2020
77f0186
Merge branch 'master' into uptime_migrate-server-to-np
justinkambic Jan 3, 2020
a6caa0c
Re-add feature registration code.
justinkambic Jan 3, 2020
66873c1
Move uptime legacy server to plugins directory.
justinkambic Jan 3, 2020
4660e36
Re-add feature registration code.
justinkambic Jan 3, 2020
a9764c4
Move all files.
justinkambic Jan 6, 2020
c5bd00f
Merge branch 'master' into uptime_migrate-server-to-np
justinkambic Jan 9, 2020
e885abd
Merge branch 'master' into uptime_migrate-server-to-np
justinkambic Jan 15, 2020
8d8e77e
Merge branch 'uptime_migrate-server-to-np' into uptime_migrate-client…
justinkambic Jan 16, 2020
a1d53d9
Merge master.
justinkambic Apr 1, 2020
64bc7e4
Merge master.
justinkambic Apr 1, 2020
824647c
WIP fixing things.
justinkambic Apr 1, 2020
ab9d5c9
WIP fixing things.
justinkambic Apr 1, 2020
b322a18
WIP fixing things.
justinkambic Apr 1, 2020
9565e6a
Finished fixing server.
justinkambic Apr 1, 2020
6300206
Fix alert type registration glitch.
justinkambic Apr 1, 2020
c50e949
Remove obsolete file.
justinkambic Apr 2, 2020
5cd39dc
Fix unwanted revisions, uncomment previously un-migrated code, delete…
justinkambic Apr 2, 2020
4b35b4e
More cleanup.
justinkambic Apr 2, 2020
d190e42
Fix all non-maps unit tests.
justinkambic Apr 2, 2020
ce96694
Get functional tests working.
justinkambic Apr 2, 2020
805661f
Delete misplaced file.
justinkambic Apr 2, 2020
624c0c4
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 2, 2020
1e02b8f
Merge master.
justinkambic Apr 3, 2020
49f9d25
Merge master.
justinkambic Apr 10, 2020
1380d69
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 13, 2020
ece7b4c
Add uptime CODEOWNERS entry.
justinkambic Apr 15, 2020
d61f1c0
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 15, 2020
f3ded76
Merge master.
justinkambic Apr 20, 2020
9019d1b
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 23, 2020
55da8c0
Get map working in Uptime app on NP.
justinkambic Apr 20, 2020
f7c7830
Update CODEOWNERS to remove legacy entry.
justinkambic Apr 24, 2020
1a75ae0
Update server imports.
justinkambic Apr 24, 2020
9a72af4
Delete and clean up unused or redundant code/comments.
justinkambic Apr 24, 2020
38c4553
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 24, 2020
ba164ce
Move new files from legacy to NP to fix merge error.
justinkambic Apr 24, 2020
d98cafb
Fix broken import.
justinkambic Apr 24, 2020
21bdffc
Delete obsolete test snapshots.
justinkambic Apr 24, 2020
484c3ed
Clean up imports and types, delete obsolete code.
justinkambic Apr 24, 2020
8794013
Clean up redundant common imports.
justinkambic Apr 24, 2020
3da60f4
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 27, 2020
1c42cc8
Delete obsolete translation keys.
justinkambic Apr 27, 2020
93e421c
Add additional explicit typing to plugin class.
justinkambic Apr 27, 2020
159e66c
Combine redundant common imports.
justinkambic Apr 27, 2020
f9aee04
Delete unneeded optionalPlugin entry.
justinkambic Apr 27, 2020
a792b57
Merge branch 'master' into uptime_migrate-client-to-np
elasticmachine Apr 27, 2020
365b915
Merge branch 'master' into uptime_migrate-client-to-np
elasticmachine Apr 27, 2020
d77978f
Revert "Combine redundant common imports."
justinkambic Apr 28, 2020
3b9dfb2
Update a translation description.
justinkambic Apr 28, 2020
d9cd2f5
Merge branch 'uptime_migrate-client-to-np' of github.com:justinkambic…
justinkambic Apr 28, 2020
7fff70f
Revert "Clean up redundant common imports."
justinkambic Apr 28, 2020
04ce6cc
Remove new common index file and revert imports from only common to m…
justinkambic Apr 28, 2020
4db4d9c
Fix broken imports in `~/x-pack/test`.
justinkambic Apr 28, 2020
2c30f34
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 28, 2020
8fc53eb
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 28, 2020
eaa40e9
Merge branch 'master' into uptime_migrate-client-to-np
justinkambic Apr 28, 2020
b11b4e6
Move new file from legacy to NP location.
justinkambic Apr 28, 2020
e467d5a
Merge branch 'master' into uptime_migrate-client-to-np
elasticmachine Apr 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { taskManager } from './legacy/plugins/task_manager';
import { siem } from './legacy/plugins/siem';
import { remoteClusters } from './legacy/plugins/remote_clusters';
import { upgradeAssistant } from './legacy/plugins/upgrade_assistant';
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';
Expand All @@ -45,7 +44,6 @@ module.exports = function(kibana) {
siem(kibana),
remoteClusters(kibana),
upgradeAssistant(kibana),
uptime(kibana),
encryptedSavedObjects(kibana),
actions(kibana),
alerting(kibana),
Expand Down
Empty file.
36 changes: 0 additions & 36 deletions x-pack/legacy/plugins/uptime/index.ts

This file was deleted.

16 changes: 0 additions & 16 deletions x-pack/legacy/plugins/uptime/public/apps/index.ts

This file was deleted.

56 changes: 0 additions & 56 deletions x-pack/legacy/plugins/uptime/public/apps/plugin.ts

This file was deleted.

25 changes: 0 additions & 25 deletions x-pack/legacy/plugins/uptime/public/register_feature.ts

This file was deleted.

7 changes: 0 additions & 7 deletions x-pack/legacy/plugins/uptime/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -16147,7 +16147,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": "ダウン",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -16152,7 +16152,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": "关闭",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 be shown to users in Kibana',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this default description text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the text that will be shown in the feature catalogue - I changed the description a bit to reflect that. LMK if you have a recommendation.

}),
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',
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* 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 * from './constants';
export * from './runtime_types';
export * from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
andrewvc marked this conversation as resolved.
Show resolved Hide resolved
/** 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. */
Expand Down
12 changes: 10 additions & 2 deletions x-pack/plugins/uptime/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
7 changes: 7 additions & 0 deletions x-pack/plugins/uptime/public/apps/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* 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.
*/

export { UptimePlugin } from './plugin';
72 changes: 72 additions & 0 deletions x-pack/plugins/uptime/public/apps/plugin.ts
Original file line number Diff line number Diff line change
@@ -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';
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 {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import DateMath from '@elastic/datemath';
import { DurationChartComponent } from '../duration_chart';
import { MonitorDurationResult } from '../../../../../common/types';
import { MonitorDurationResult } from '../../../../../common';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AS much as i love short imports, but i think in this case, it make sense to keep types, runtimetype and constants separate. I fully realize this impact many files in this PR, so reverting it will be quite an effort. Let me know your thoughts about this?

cc @andrewvc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries - I had thought we discussed using just common in the past. Are you saying you'd want it reverted for just types, or ['types', 'runtime_types']?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahan, i must have forgotten it, for me i think keeping types and constants make more sense, but if you guys feel different, i have no objection to importing them via 'common'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed/reverted this in d77978f, 7fff70f, and 04ce6cc.

import { shallowWithRouter } from '../../../../lib';

describe('MonitorCharts component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import { MonitorBarSeries, MonitorBarSeriesProps } from '../monitor_bar_series';
import { renderWithRouter, shallowWithRouter } from '../../../../lib';
import { HistogramPoint } from '../../../../../common/runtime_types';
import { HistogramPoint } from '../../../../../common';

describe('MonitorBarSeries component', () => {
let props: MonitorBarSeriesProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import moment from 'moment';
import { FormattedMessage } from '@kbn/i18n/react';
import { Axis, Chart, Position, timeFormatter, Settings, SeriesIdentifier } from '@elastic/charts';
import { getChartDateLabel } from '../../../lib/helper';
import { LocationDurationLine } from '../../../../common/types';
import { LocationDurationLine } from '../../../../common';
import { DurationLineSeriesList } from './duration_line_series_list';
import { ChartWrapper } from './chart_wrapper';
import { useUrlParams } from '../../../hooks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading