Skip to content

Commit

Permalink
Merge branch 'security-navigation' of https://github.com/XavierM/kibana
Browse files Browse the repository at this point in the history
… into security-navigation
  • Loading branch information
MadameSheema committed Jun 3, 2020
2 parents 0639936 + 2fdb92b commit d2f4d33
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, Route } from 'react-router-dom';

import { CoreStart, AppMountParams } from 'src/core/public';
import { CoreStart, AppMountParameters } from 'src/core/public';
import { MyPluginDepsStart } from './plugin';

export renderApp = ({ element, history, onAppLeave }: AppMountParams) => {
export renderApp = ({ element, history, onAppLeave }: AppMountParameters) => {
const { renderApp, hasUnsavedChanges } = await import('./application');
onAppLeave(actions => {
if(hasUnsavedChanges()) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@elastic/eui": "23.3.1",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.4.0",
"@elastic/numeral": "^2.5.0",
"@elastic/request-crypto": "1.1.4",
"@elastic/ui-ace": "0.2.3",
"@hapi/good-squeeze": "5.2.1",
Expand Down Expand Up @@ -365,7 +365,6 @@
"@types/node": ">=10.17.17 <10.20.0",
"@types/node-forge": "^0.9.0",
"@types/normalize-path": "^3.0.0",
"@types/numeral": "^0.0.26",
"@types/opn": "^5.1.0",
"@types/pegjs": "^0.10.1",
"@types/pngjs": "^3.3.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ module.exports = {
to: false,
disallowedMessage: `Don't use 'mkdirp', use the new { recursive: true } option of Fs.mkdir instead`
},
{
from: 'numeral',
to: '@elastic/numeral',
},
{
from: '@kbn/elastic-idx',
to: false,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Moment.tz.load(require('moment-timezone/data/packed/latest.json'));
// big deps which are locked to a single version
export const Rxjs = require('rxjs');
export const RxjsOperators = require('rxjs/operators');
export const ElasticNumeral = require('@elastic/numeral');
export const ElasticCharts = require('@elastic/charts');
export const ElasticEui = require('@elastic/eui');
export const ElasticEuiLibServices = require('@elastic/eui/lib/services');
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-ui-shared-deps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ exports.externals = {
*/
rxjs: '__kbnSharedDeps__.Rxjs',
'rxjs/operators': '__kbnSharedDeps__.RxjsOperators',
numeral: '__kbnSharedDeps__.ElasticNumeral',
'@elastic/numeral': '__kbnSharedDeps__.ElasticNumeral',
'@elastic/charts': '__kbnSharedDeps__.ElasticCharts',
'@elastic/eui': '__kbnSharedDeps__.ElasticEui',
'@elastic/eui/lib/services': '__kbnSharedDeps__.ElasticEuiLibServices',
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@elastic/charts": "19.2.0",
"@elastic/eui": "23.3.1",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
"abortcontroller-polyfill": "^1.4.0",
"angular": "^1.7.9",
Expand Down
8 changes: 0 additions & 8 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,6 @@
'@types/normalize-path',
],
},
{
groupSlug: 'numeral',
groupName: 'numeral related packages',
packageNames: [
'numeral',
'@types/numeral',
],
},
{
groupSlug: 'object-hash',
groupName: 'object-hash related packages',
Expand Down
10 changes: 7 additions & 3 deletions src/core/CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,21 @@ leverage this pattern.

import React from 'react';
import ReactDOM from 'react-dom';
import { CoreStart, AppMountParams } from '../../src/core/public';
import { CoreStart, AppMountParameters } from 'src/core/public';

import { MyAppRoot } from './components/app.ts';

/**
* This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle.
*/
export const renderApp = (core: CoreStart, deps: MyPluginDepsStart, { element, history }: AppMountParams) => {
export const renderApp = (
core: CoreStart,
deps: MyPluginDepsStart,
{ element, history }: AppMountParameters
) => {
ReactDOM.render(<MyAppRoot core={core} deps={deps} routerHistory={history} />, element);
return () => ReactDOM.unmountComponentAtNode(element);
}
};
```

```ts
Expand Down
8 changes: 6 additions & 2 deletions src/core/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,14 @@ The more interesting logic is in `renderApp`:
import React from 'react';
import ReactDOM from 'react-dom';

import { AppMountParams, CoreStart } from 'src/core/public';
import { AppMountParameters, CoreStart } from 'src/core/public';
import { AppRoot } from './components/app_root';

export const renderApp = ({ element, history }: AppMountParams, core: CoreStart, plugins: MyPluginDepsStart) => {
export const renderApp = (
{ element, history }: AppMountParameters,
core: CoreStart,
plugins: MyPluginDepsStart
) => {
// Hide the chrome while this app is mounted for a full screen experience
core.chrome.setIsVisible(false);

Expand Down
2 changes: 1 addition & 1 deletion src/core/public/application/scoped_history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class ScopedHistory<HistoryLocationState = unknown>
prompt?: boolean | string | TransitionPromptHook<HistoryLocationState>
): UnregisterCallback => {
throw new Error(
`history.block is not supported. Please use the AppMountParams.onAppLeave API.`
`history.block is not supported. Please use the AppMountParameters.onAppLeave API.`
);
};

Expand Down
4 changes: 2 additions & 2 deletions src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ export interface AppMountParameters<HistoryLocationState = unknown> {
* import ReactDOM from 'react-dom';
* import { BrowserRouter, Route } from 'react-router-dom';
*
* import { CoreStart, AppMountParams } from 'src/core/public';
* import { CoreStart, AppMountParameters } from 'src/core/public';
* import { MyPluginDepsStart } from './plugin';
*
* export renderApp = ({ element, history, onAppLeave }: AppMountParams) => {
* export renderApp = ({ element, history, onAppLeave }: AppMountParameters) => {
* const { renderApp, hasUnsavedChanges } = await import('./application');
* onAppLeave(actions => {
* if(hasUnsavedChanges()) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ const MS_METRIC = {

test('general metric', () => {
const component = shallow(<MetricTile metric={GENERAL_METRIC} />);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});

test('byte metric', () => {
const component = shallow(<MetricTile metric={BYTE_METRIC} />);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});

test('float metric', () => {
const component = shallow(<MetricTile metric={FLOAT_METRIC} />);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});

test('millisecond metric', () => {
const component = shallow(<MetricTile metric={MS_METRIC} />);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import numeral from 'numeral';
import numeral from '@elastic/numeral';

export default function formatNumber(num, which) {
let format = '0.00';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,42 @@ import formatNumber from './format_number';

describe('format byte', () => {
test('zero', () => {
expect(formatNumber(0, 'byte')).toEqual('0.00 B');
expect(formatNumber(0, 'byte')).toMatchInlineSnapshot(`"0.00 B"`);
});

test('mb', () => {
expect(formatNumber(181142512, 'byte')).toEqual('181.14 MB');
expect(formatNumber(181142512, 'byte')).toMatchInlineSnapshot(`"172.75 MB"`);
});

test('gb', () => {
expect(formatNumber(273727485000, 'byte')).toEqual('273.73 GB');
expect(formatNumber(273727485000, 'byte')).toMatchInlineSnapshot(`"254.93 GB"`);
});
});

describe('format ms', () => {
test('zero', () => {
expect(formatNumber(0, 'ms')).toEqual('0.00 ms');
expect(formatNumber(0, 'ms')).toMatchInlineSnapshot(`"0.00 ms"`);
});

test('sub ms', () => {
expect(formatNumber(0.128, 'ms')).toEqual('0.13 ms');
expect(formatNumber(0.128, 'ms')).toMatchInlineSnapshot(`"0.13 ms"`);
});

test('many ms', () => {
expect(formatNumber(3030.284, 'ms')).toEqual('3030.28 ms');
expect(formatNumber(3030.284, 'ms')).toMatchInlineSnapshot(`"3030.28 ms"`);
});
});

describe('format integer', () => {
test('zero', () => {
expect(formatNumber(0, 'integer')).toEqual('0');
expect(formatNumber(0, 'integer')).toMatchInlineSnapshot(`"0"`);
});

test('sub integer', () => {
expect(formatNumber(0.728, 'integer')).toEqual('1');
expect(formatNumber(0.728, 'integer')).toMatchInlineSnapshot(`"1"`);
});

test('many integer', () => {
expect(formatNumber(3030.284, 'integer')).toEqual('3030');
expect(formatNumber(3030.284, 'integer')).toMatchInlineSnapshot(`"3030"`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const names: Record<string, string> = {
defaultMessage: 'Search',
}),
securitySolution: i18n.translate('advancedSettings.categoryNames.securitySolutionLabel', {
defaultMessage: 'Security solution',
defaultMessage: 'Security Solution',
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';
import _ from 'lodash';
import numeral from 'numeral';
import numeral from '@elastic/numeral';
import { renderToStaticMarkup } from 'react-dom/server';

import { FormattedMessage, I18nProvider } from '@kbn/i18n/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import d3 from 'd3';
import _ from 'lodash';
import $ from 'jquery';
import numeral from 'numeral';
import numeral from '@elastic/numeral';
import { PieContainsAllZeros, ContainerTooSmall } from '../errors';
import { Chart } from './_chart';
import { truncateLabel } from '../components/labels/truncate_labels';
Expand Down
20 changes: 0 additions & 20 deletions webpackShims/numeral.js

This file was deleted.

2 changes: 1 addition & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"@elastic/filesaver": "1.1.2",
"@elastic/maki": "6.3.0",
"@elastic/node-crypto": "1.1.1",
"@elastic/numeral": "2.4.0",
"@elastic/numeral": "^2.5.0",
"@kbn/babel-preset": "1.0.0",
"@kbn/config-schema": "1.0.0",
"@kbn/i18n": "1.0.0",
Expand Down
20 changes: 0 additions & 20 deletions x-pack/plugins/apm/typings/numeral.d.ts

This file was deleted.

22 changes: 11 additions & 11 deletions x-pack/plugins/security_solution/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
'xpack.securitySolution.uiSettings.defaultRefreshIntervalDescription',
{
defaultMessage:
'<p>Default refresh interval for the SIEM time filter, in milliseconds.</p>',
'<p>Default refresh interval for the Security time filter, in milliseconds.</p>',
}
),
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.object({
value: schema.number(),
Expand All @@ -60,9 +60,9 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
"to": "${DEFAULT_TO}"
}`,
description: i18n.translate('xpack.securitySolution.uiSettings.defaultTimeRangeDescription', {
defaultMessage: '<p>Default period of time in the SIEM time filter.</p>',
defaultMessage: '<p>Default period of time in the Security time filter.</p>',
}),
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.object({
from: schema.string(),
Expand All @@ -76,9 +76,9 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
value: DEFAULT_INDEX_PATTERN,
description: i18n.translate('xpack.securitySolution.uiSettings.defaultIndexDescription', {
defaultMessage:
'<p>Comma-delimited list of Elasticsearch indices from which the SIEM app collects events.</p>',
'<p>Comma-delimited list of Elasticsearch indices from which the Security app collects events.</p>',
}),
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.arrayOf(schema.string()),
},
Expand All @@ -92,10 +92,10 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
'xpack.securitySolution.uiSettings.defaultAnomalyScoreDescription',
{
defaultMessage:
'<p>Value above which Machine Learning job anomalies are displayed in the SIEM app.</p><p>Valid values: 0 to 100.</p>',
'<p>Value above which Machine Learning job anomalies are displayed in the Security app.</p><p>Valid values: 0 to 100.</p>',
}
),
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.number(),
},
Expand All @@ -108,7 +108,7 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
defaultMessage: '<p>Enables the News feed</p>',
}),
type: 'boolean',
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.boolean(),
},
Expand All @@ -120,7 +120,7 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
description: i18n.translate('xpack.securitySolution.uiSettings.newsFeedUrlDescription', {
defaultMessage: '<p>News feed content will be retrieved from this URL</p>',
}),
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.string(),
},
Expand All @@ -137,7 +137,7 @@ export const initUiSettings = (uiSettings: CoreSetup['uiSettings']) => {
'Array of URL templates to build the list of reputation URLs to be displayed on the IP Details page.',
}
),
category: ['siem'],
category: ['securitySolution'],
requiresPageReload: true,
schema: schema.arrayOf(
schema.object({
Expand Down
Loading

0 comments on commit d2f4d33

Please sign in to comment.