Skip to content

Commit

Permalink
[Fleet] Add initial config libs and adapters (#43483)
Browse files Browse the repository at this point in the history
* Project init

* initial client libs

* add initial UI framework

* move fleet to legacy

* add readme

* Add shell ingest plugin

* fix typo

* update paths for legacy API. cleanup linting in vscode

* remove CRUFT

* remove more CRUFT

* [Ingest] cleanup names and files/paths to confirm to a standard format (#41773)

* [Maps] Rename modules for clarity (#41608)

* [Docs] Add simple phrase highlighting to Logs UI (#41610)

* [Docs] Add simple phrase highlighting to Logs UI

* Fix heading level

* [DOCS] Timelion cleanup (#41381)

* [Canvas] Removes doc links from backticks. (#41601)

* Upgrade EUI to 12.4.0 (#41577)

* eui 12.4.0

* styled-components ts conflict

* update combobox test service to always open on open call

* Revert "update combobox test service to always open on open call"

This reverts commit 43074e6.

* scroll combobox into view

* scroll before filter

* Move CSP config default values to csp module (#41676)

This gives us a little more control over the default values of these
configurations to help ensure (though not guarantee) that any changes
here can be audited by the security team.

* Remove notifications plugin (#41674)

The notifications functionality has been replaced by the features of the
actions plugin. This notifications plugin was never actually used by
end-user facing features of Kibana.

* [Logs UI] Make column configurations reorderable (#41035)

* [Logs UI] Make column configurations reorderable

* Improve typing aand memoize callback

* Guard against index bounds and rename reorderLogColumns

* Fix useCallback memoization

* Add functional test for reordering log columns

* Use browser.keys instead of Key in functional test

* [Maps] populate _id in tooltip (#41684)

* [ML] Data Frames - search bar on list page (#41415)

* add search and filter to df list table

* add mode filter to list table

* adds id + description search

* type fix

* ensure search syntax is valid

* ensure types are correct

* retain filter on refresh

* fix progress bar jump

* [DOCS] Changed Visual Builder to TSVB (#39539)

* [DOCS] Changed Visual Builder to TSVB

* Reorg of interface changes

* Content reorg

* Updated image

* Added task content

* Content conslidation

* Final clean up

* Comments from Gail

* [DOCS] Adds missing Timelion link (#41709)

* [Infra UI] Fix section mapping bug in node detail page (#41641)

* [Infra UI] Fix section mapping bug in node detail page

* Fixing filter to match TSVB

* Adding an enum for the InfraMetricsQueryType

* removing unnecessary change

* Change id to InfraMetric to make less error prone

* Fixing type in Metrics Explorer

* [Infra UI] Add UI to customize Metrics Explorer chart style (#41022)

* Add UI to customize Metrics Explorer chart style

* Re-order chart options form

* Adding chart options to TSVB link

* Rename line series to series chart

* Fixing chart context menu tests

* Adding test for calculate domain

* Ensure caclulateDomain returns numbers

* fixing typo

* Bump backport to 4.6.1 (#41720)

* hide top nav menu in full screen mode of maps and dashboard (#41672)

* hide top nav menu in full screen mode of maps and dashboard

* Fixed dashboard full screen mode and added full screen mode test to maps

* improve typing (#41563)

* [Code] test colorize before load a file (#41645)

* [Code] handle status when repo is not exists (#41643)

fix can't switch to head on root path

* [Code] implement filtree api by using isogit (#41558)

* remove obsolete http secutiry settings (#41569)

* core doesn't use Record<string, unknown> for public API (#41448)

* core contracts don't use unknown to support type assignment

limitations of https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#-k-string-unknown--is-no-longer-a-wildcard-assignment-target

* regenereate docs

* remove type over-write

* Narrow type of PluginDeps to an object (#40846)

* Narrow type of PluginDeps to an object

* re-generate docs

* [APM] Fix "Show trace logs" link (#41570)

* [APM] Fix "Show trace logs" link

* Add type for infra link items; escape url.domain param for uptime link

* Comment out flakey test steps (#41743)

This comments out the problematic portions of the functional test, which caused #41717 to occur.

* [ML] Fixes model memory limit for metricbeat system module jobs (#41747)

* [i18n] fix i18nrc parsing (#41741)

* check for translations in file

* update template

* Add ownership of new platform security plugin to security team. (#41748)

* Clean up top nav \ search bar \ query bar directives (#41636)

* Move timepicker (to be deprecated) into old kbn_top_nav

* Deleted search-bar and query-bar directives!

* moved search bar to kibana_react (it's a generic react component, not a service)

* translations

* Moved superDatePicker directive to kbn_top_nav (to be deprecated)
Deleted unused react_component directives call-out and tool-bar-search-box

* TS test fix

* Delete relative options

* [ML] Use NavigationMenu without angularjs wrapper. (#41343)

Follow up to #40830 and #41054 in preparation for single metric viewer migration.
The previous PR introduced the navigation menu as a React component. This PR moves dependencies down from the angularjs wrapper directive directly to the React component so the component can also be used stand-alone without the angularjs wrapper.
For simple angularjs based HTML templates this stand-alone usage is also part of this PR. Unfortunately the PR turned out to be quite big due to: Most page react components had to be wrapped in another <Fragment> to allow the addition of <NavigationMenu> thus leading to large diffs for the components. All component code inside the <Fragment> was not touched though.

* [telemetry] Analytics Package (#41113)

* kbn-analytics

* kbn-analytics

* expose provider

* add logger

* performance and stats reporters

* finalize ui stats metric

* functional tests

* remove readme file for now

* update readme

* add types file into to tsconfigs

* Update packages/kbn-analytics/src/report.ts

Co-Authored-By: Josh Dover <[email protected]>

* fix typechecks

* use enum instead of strings for metric types

* getUiStatsReporter -> createUiStatsReporter

* fix special typo in README

* remove unused stop method

* fix tests

* default debug to false

* use chrome.getInjected

* add METRIC_TYPE to jest module mocks

* mock create fn

* handle enabled:false

* init ui_metric in test setup env

* regenerator runtime

* transform-regenerator

* update lock file

* update babel configs

* runtime dep

* add regenerator

* babel configs

* use env-preset

* merge conflicts

* fix workpad telemetry tests

* regeneratorRuntime attempt to fix number 30000

* env targets

* remove module config

* try again

* try without regenerator

* use kbn/babel-preset/webpack_preset only

* runtime

* just use typescript

* update tsconfig

* Caches trackers by app value for infra useTrackMetric hook

* replace all occurences of placeholder in drilldown url template (#41673)

* cleanup names and files/paths to confirm to a standard format

* tack down WIP code

* remove things not or not yet needed

* Added Flexmonster Pivot Table to known plugins list (#41655)

* Add Flexmonster Pivot Table to known plugins list

* Update docs/plugins/known-plugins.asciidoc

Co-Authored-By: Larry Gregory <[email protected]>

* Fix typo (#41705)

* turn on filtering tests (#41202)

* turn on filtering tests

* run x-pack-firefoxSmoke ciGroup 40 times, run dashboard tests 20 times per job

* Revert "run x-pack-firefoxSmoke ciGroup 40 times, run dashboard tests 20 times per job"

This reverts commit 5ef02cc53ba5085c3f74431cb6ef20be2d876cde.

* GoodBye Notifier (#41663)

* Begin notifier removal

* Remove remaining notifier traces

* Remove dead translations

* Remove Angular from config listener

* Import angular-sanitize explicitly in map

* Revert "lock es snapshot to avoid failing CI" (#41539)

This reverts commit 4eca0f3.

* fix more types, define SO

* [SIEM] - Fix Jest test errors and warnings (#41712)

* Fixes #41787 (#41791)

* [DOCS] Puts Spaces content on single page (#41536)

* [DOCS] Puts Spaces content on single page

* [DOCS] Incorporates review comments

* [DOCS] Incorporated review comments

* [SIEM] - Hosts and Network Tables from LoadMore to Paginated (#41532)

* [DOCS] Updates Console doc (#41371)

* [DOCS] Updates Console doc

* [DOCS] Incorporates comments on Console docs

* [DOCS] Updated Console images

* Fixed unused variables. Added a few methods to the SO adapter

Co-authored-by: Nicolas Chaulet <[email protected]>

* fix type

* Revert "Merge branch 'master' of github.com:elastic/kibana into feature-fleet"

This reverts commit 997490f, reversing
changes made to db5fc8f.

* removed blank test file

* Fix file path

* add i18n

* initial client libs

* cleanup names and files/paths to confirm to a standard format

* tack down WIP code

* remove things not or not yet needed

* fix more types, define SO

* Fixed unused variables. Added a few methods to the SO adapter

Co-authored-by: Nicolas Chaulet <[email protected]>

* fix type

* removed blank test file

* add config adapter (no tests yet)

* progress with config lib

* working!

* tweaks

* fix test

* remove whitespace

* remove isVersionGreater

* remove CRUFT from a bad merge
  • Loading branch information
Matt Apperson authored and nchaulet committed Sep 23, 2019
1 parent 511e626 commit f780196
Show file tree
Hide file tree
Showing 18 changed files with 864 additions and 67 deletions.
2 changes: 2 additions & 0 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects'
import { snapshotRestore } from './legacy/plugins/snapshot_restore';
import { actions } from './legacy/plugins/actions';
import { alerting } from './legacy/plugins/alerting';
import { ingest } from './legacy/plugins/ingest';
import { advancedUiActions } from './legacy/plugins/advanced_ui_actions';
import { lens } from './legacy/plugins/lens';
import { fleet } from './legacy/plugins/fleet';
Expand Down Expand Up @@ -89,6 +90,7 @@ module.exports = function (kibana) {
snapshotRestore(kibana),
actions(kibana),
alerting(kibana),
ingest(kibana),
advancedUiActions(kibana),
fleet(kibana),
];
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/fleet/public/lib/compose/kibana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import chrome from 'ui/chrome';
// @ts-ignore not typed yet
import { management } from 'ui/management';
import routes from 'ui/routes';
import { INDEX_NAMES } from '../../../common/constants/index_names';
import { RestAgentAdapter } from '../adapters/agent/rest_agent_adapter';
import { RestElasticsearchAdapter } from '../adapters/elasticsearch/rest';
import { KibanaFrameworkAdapter } from '../adapters/framework/kibana_framework_adapter';
Expand All @@ -22,6 +21,7 @@ import { ElasticsearchLib } from '../elasticsearch';
import { FrontendLibs } from '../types';
import { PLUGIN } from '../../../common/constants/plugin';
import { FrameworkLib } from '../framework';
import { INDEX_NAMES } from '../../../common/constants';

// A super early spot in kibana loading that we can use to hook before most other things
const onKibanaReady = chrome.dangerouslyGetActiveInjector;
Expand Down
24 changes: 0 additions & 24 deletions x-pack/legacy/plugins/fleet/public/lib/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,6 @@ export class FrameworkLib {
);
}

public versionGreaterThen(version: string) {
const pa = this.adapter.version.split('.');
const pb = version.split('.');
for (let i = 0; i < 3; i++) {
const na = Number(pa[i]);
const nb = Number(pb[i]);
// version is greater
if (na > nb) {
return true;
}
// version is less then
if (nb > na) {
return false;
}
if (!isNaN(na) && isNaN(nb)) {
return true;
}
if (isNaN(na) && !isNaN(nb)) {
return false;
}
}
return true;
}

public currentUserHasOneOfRoles(roles: string[]) {
// If the user has at least one of the roles requested, the returnd difference will be less
// then the orig array size. difference only compares based on the left side arg
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/ingest/common/constants/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
*/

export const PLUGIN = {
ID: 'ingest-data',
ID: 'ingest',
};
export const CONFIG_PREFIX = 'xpack.ingest-do-not-disable';
41 changes: 41 additions & 0 deletions x-pack/legacy/plugins/ingest/common/utils/is_version_greater.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 function isVersionGreater(v1: string, v2: string): 1 | 0 | -1 {
const v1parts = v1.split('.');
const v2parts = v2.split('.');

function isValidPart(x: string) {
return /^\d+$/.test(x);
}

if (!v1parts.every(isValidPart) || !v2parts.every(isValidPart)) {
throw new Error('versions are not valid');
}

while (v1parts.length < v2parts.length) v1parts.push('0');
while (v2parts.length < v1parts.length) v2parts.push('0');

for (let i = 0; i < v1parts.length; ++i) {
if (v2parts.length === i) {
return 1;
}

if (v1parts[i] === v2parts[i]) {
continue;
} else if (v1parts[i] > v2parts[i]) {
return 1;
} else {
return -1;
}
}

if (v1parts.length !== v2parts.length) {
return -1;
}

return 0;
}
4 changes: 4 additions & 0 deletions x-pack/legacy/plugins/ingest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { resolve } from 'path';
import { PLUGIN } from './common/constants';
import { CONFIG_PREFIX } from './common/constants/plugin';
import { initServerWithKibana } from './server/kibana.index';
import { mappings } from './server/mappings';

export const config = Joi.object({
enabled: Joi.boolean().default(true),
Expand All @@ -20,6 +21,9 @@ export function ingest(kibana: any) {
publicDir: resolve(__dirname, 'public'),
config: () => config,
configPrefix: CONFIG_PREFIX,
uiExports: {
mappings,
},
init(server: any) {
initServerWithKibana(server);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

exports['Configurations Lib create should create a new configuration - create - {"name":"test","description":"test description","output":"defaut","monitoring_enabled":true,"agent_version":"8.0.0","data_sources":[]} (2)'] = {
"results": {
"id": "8a8874b0-bd51-11e9-a21b-dbec3e1a8be1"
}
}

exports['Configurations Lib create should create a new configuration - create - {"name":"test","description":"test description","output":"defaut","monitoring_enabled":true,"shared_id":"994528b0-887f-4c71-923e-4ffe5dd302e2","version":0,"agent_version":"8.0.0","data_sources":[]} (2)'] = {
"results": {
"id": "715d5cb0-bd53-11e9-bb4e-fb77f27555ca",
"shared_id": "994528b0-887f-4c71-923e-4ffe5dd302e2",
"version": 0
}
}

exports['Configurations Lib create should create a new configuration - create - {"name":"test","description":"test description","output":"defaut","monitoring_enabled":true,"shared_id":"997e6674-d072-475b-89d3-9b9202e0dd99","version":0,"agent_version":"8.0.0","data_sources":[]} (2)'] = {
"results": {
"id": "9cd167f0-c065-11e9-9b54-89c2396bf183",
"shared_id": "997e6674-d072-475b-89d3-9b9202e0dd99",
"version": 0
}
}

exports['Configurations Lib create should create a new configuration - create - {"name":"test","description":"test description","output":"defaut","monitoring_enabled":true,"version":0,"agent_version":"8.0.0","data_sources":[],"shared_id":"string"} (2)'] = {
"results": {
"id": "385d2130-c068-11e9-a90f-d9a51a8c04f8",
"shared_id": "de5a13b9-4b80-4983-8e6a-1619e3f97b9a",
"version": 0
}
}

exports['Configurations Lib create should create a new configuration - get info (1)'] = {
"results": {
"kibana": {
"version": "8.0.0"
},
"license": {
"type": "trial",
"expired": false,
"expiry_date_in_millis": 1568580919209
},
"security": {
"enabled": true,
"available": true
},
"watcher": {
"enabled": true,
"available": true
}
}
}

exports['Configurations Lib create should create a new configuration - get info (2)'] = {
"results": {
"kibana": {
"version": "8.0.0"
},
"license": {
"type": "trial",
"expired": false,
"expiry_date_in_millis": 1568240322629
},
"security": {
"enabled": true,
"available": true
},
"watcher": {
"enabled": true,
"available": true
}
}
}

exports['Configurations Lib create should create a new configuration - get info (3)'] = {
"results": {
"kibana": {
"version": "8.0.0"
},
"license": {
"type": "trial",
"expired": false,
"expiry_date_in_millis": 1568240322629
},
"security": {
"enabled": true,
"available": true
},
"watcher": {
"enabled": true,
"available": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const RuntimeDatasourceInput = t.interface(
{
id: t.string,
meta: t.union([t.undefined, t.string]),
config: t.string,
config_id: t.string,
},
'DatasourceInput'
);
Expand All @@ -29,6 +29,8 @@ export const NewRuntimeConfigurationFile = t.interface(
description: t.string,
output: t.string,
monitoring_enabled: t.boolean,
shared_id: t.string,
version: t.number,
agent_version: t.string,
data_sources: t.array(DataSource),
},
Expand All @@ -51,7 +53,7 @@ const ExistingDocument = t.interface({
id: t.string,
shared_id: t.string,
version: t.number,
active: t.boolean,
status: t.union(['active', 'locked', 'inactive'].map(s => t.literal(s))),
updated_at: t.string,
created_by: t.union([t.undefined, t.string]),
updated_on: t.string,
Expand Down
Loading

0 comments on commit f780196

Please sign in to comment.