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

[Monitoring] NP Migration complete client cutover #62908

Merged
merged 29 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6d3d1a9
Final phase before the complete cutover
igoristic Mar 9, 2020
71b7d49
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Mar 31, 2020
ed94446
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 4, 2020
4471d02
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 6, 2020
a082e94
NP migration
igoristic Apr 8, 2020
aba1cce
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 8, 2020
ce397b3
lint fix
igoristic Apr 8, 2020
5f10444
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 21, 2020
2de9011
More NP stuff
igoristic Apr 22, 2020
9a1fca3
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 22, 2020
d07305f
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 22, 2020
a66c9ca
Moved Stack Monitoring client plugin outside legacy and fixed all tests
igoristic Apr 23, 2020
27c9ded
...
igoristic Apr 23, 2020
bf6e693
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 23, 2020
79bcef7
Removed unused files
igoristic Apr 23, 2020
a811f21
Fix for main links
igoristic Apr 23, 2020
15578d7
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 23, 2020
2ff87d6
Fixed more tests
igoristic Apr 23, 2020
bc02938
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 23, 2020
f8e48d6
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 24, 2020
3335746
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 24, 2020
d2df9c0
Fixed redirect when clicking on SM icon again
igoristic Apr 25, 2020
1c79cc5
Code review feedback
igoristic Apr 27, 2020
ceb888c
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 27, 2020
6881048
Addressed code review feedback
igoristic Apr 27, 2020
4b0ec8e
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 27, 2020
b862136
Fixed return value
igoristic Apr 30, 2020
fd68442
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 30, 2020
076aa6c
Merge branch 'master' of https://github.com/elastic/kibana into np_re…
igoristic Apr 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/moc
/x-pack/legacy/plugins/canvas/shareable_runtime/build
/x-pack/legacy/plugins/canvas/storybook
/x-pack/legacy/plugins/canvas/canvas_plugin_src/lib/flot-charts
/x-pack/legacy/plugins/monitoring/public/lib/jquery_flot
/x-pack/legacy/plugins/infra/common/graphql/types.ts
/x-pack/legacy/plugins/infra/public/graphql/types.ts
/x-pack/legacy/plugins/infra/server/graphql/types.ts
Expand Down
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,12 @@ module.exports = {
jquery: true,
},
},
{
files: ['x-pack/legacy/plugins/monitoring/public/lib/jquery_flot/**/*.js'],
env: {
jquery: true,
},
},

/**
* TSVB overrides
Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/monitoring/.agignore

This file was deleted.

147 changes: 0 additions & 147 deletions x-pack/legacy/plugins/monitoring/config.js

This file was deleted.

57 changes: 0 additions & 57 deletions x-pack/legacy/plugins/monitoring/index.js

This file was deleted.

39 changes: 39 additions & 0 deletions x-pack/legacy/plugins/monitoring/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 Hapi from 'hapi';
import { KIBANA_ALERTING_ENABLED } from './common/constants';

/**
* Invokes plugin modules to instantiate the Monitoring plugin for Kibana
* @param kibana {Object} Kibana plugin instance
* @return {Object} Monitoring UI Kibana plugin object
*/
const deps = ['kibana', 'elasticsearch', 'xpack_main'];
if (KIBANA_ALERTING_ENABLED) {
deps.push(...['alerting', 'actions']);
}
export const monitoring = (kibana: any) => {
return new kibana.Plugin({
require: deps,
id: 'monitoring',
configPrefix: 'monitoring',
init(server: Hapi.Server) {
const npMonitoring = server.newPlatform.setup.plugins.monitoring as object & {
registerLegacyAPI: (api: unknown) => void;
};
if (npMonitoring) {
const kbnServerStatus = this.kbnServer.status;
npMonitoring.registerLegacyAPI({
getServerStatus: () => {
const status = kbnServerStatus.toJSON();
return status?.overall?.state;
},
});
}
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
chrisronline marked this conversation as resolved.
Show resolved Hide resolved

import React from 'react';
import chrome from '../../np_imports/ui/chrome';
import { Legacy } from '../../np_ready/legacy';
import { capitalize, get } from 'lodash';
import { formatDateTimeLocal } from '../../../common/formatting';
import { formatTimestampToDuration } from '../../../common';
Expand All @@ -16,8 +16,8 @@ import {
ALERT_TYPE_CLUSTER_STATE,
} from '../../../common/constants';
import { mapSeverity } from './map_severity';
import { FormattedAlert } from 'plugins/monitoring/components/alerts/formatted_alert';
import { EuiMonitoringTable } from 'plugins/monitoring/components/table';
import { FormattedAlert } from '../../components/alerts/formatted_alert';
import { EuiMonitoringTable } from '../../components/table';
import { EuiHealth, EuiIcon, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

Expand Down Expand Up @@ -162,7 +162,7 @@ export const Alerts = ({ alerts, angular, sorting, pagination, onTableChange })
category: get(alert, 'metadata.link', get(alert, 'type', null)),
}));

const injector = chrome.dangerouslyGetActiveInjector();
const injector = Legacy.shims.getAngularInjector();
const timezone = injector.get('config').get('dateFormat:tz');

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import React from 'react';
import { mockUseEffects } from '../../../jest.helpers';
import { shallow, ShallowWrapper } from 'enzyme';
import { kfetch } from 'ui/kfetch';
import { kfetch } from '../../../np_ready/ui/kfetch';
import { AlertsConfiguration, AlertsConfigurationProps } from './configuration';

jest.mock('ui/kfetch', () => ({
jest.mock('../../../np_ready/ui/kfetch', () => ({
kfetch: jest.fn(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import React, { ReactNode } from 'react';
import { kfetch } from 'ui/kfetch';
import { EuiSteps } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { Legacy } from '../../../np_ready/legacy';
import { ActionResult } from '../../../../../../../plugins/actions/common';
import { ALERT_ACTION_TYPE_EMAIL } from '../../../../common/constants';
import { getMissingFieldErrors } from '../../../lib/form_validation';
Expand Down Expand Up @@ -59,7 +59,7 @@ export const AlertsConfiguration: React.FC<AlertsConfigurationProps> = (
}, [emailAddress]);

async function fetchEmailActions() {
const kibanaActions = await kfetch({
const kibanaActions = await Legacy.shims.kfetch({
method: 'GET',
pathname: `/api/action/_getAll`,
});
Expand All @@ -84,7 +84,7 @@ export const AlertsConfiguration: React.FC<AlertsConfigurationProps> = (
setShowFormErrors(false);

try {
await kfetch({
await Legacy.shims.kfetch({
method: 'POST',
pathname: `/api/monitoring/v1/alerts`,
body: JSON.stringify({ selectedEmailActionId, emailAddress }),
Expand Down
Loading