* Move TSVB into new platform

* Get rid of isFunction checks

* Remove extra import of styling constants

* Move styles importing into plugin.ts

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Daniil Suleiman 2020-04-15 17:03:20 +03:00 committed by GitHub
parent d1d0a44d5d
commit 23a5734d07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
212 changed files with 66 additions and 130 deletions

2
.github/CODEOWNERS vendored
View file

@ -12,13 +12,13 @@
/src/legacy/core_plugins/kibana/public/visualize/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
/src/legacy/core_plugins/metrics/ @elastic/kibana-app
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
/src/legacy/core_plugins/vis_type_xy/ @elastic/kibana-app
/src/plugins/kibana_legacy/ @elastic/kibana-app
/src/plugins/timelion/ @elastic/kibana-app
/src/plugins/dashboard/ @elastic/kibana-app
/src/plugins/discover/ @elastic/kibana-app
/src/plugins/vis_type_timeseries/ @elastic/kibana-app
# Core UI
# Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon

View file

@ -1,45 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { resolve } from 'path';
import { Legacy } from 'kibana';
import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types';
const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
new Plugin({
id: 'metrics',
require: ['kibana', 'elasticsearch'],
publicDir: resolve(__dirname, 'public'),
uiExports: {
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
hacks: [resolve(__dirname, 'public/legacy')],
injectDefaultVars: server => ({}),
},
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),
chartResolution: Joi.number().default(150),
minimumBucketSize: Joi.number().default(10),
}).default();
},
} as Legacy.PluginSpecOptions);
// eslint-disable-next-line import/no-default-export
export default metricsPluginInitializer;

View file

@ -1,6 +0,0 @@
{
"author": "Chris Cowan<chris@elastic.co>",
"name": "metrics",
"version": "kibana"
}

View file

@ -3,5 +3,7 @@
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["data", "expressions", "visualizations"],
"optionalPlugins": ["usageCollection"]
}

View file

@ -18,7 +18,6 @@
*/
import uuid from 'uuid';
import _ from 'lodash';
const newFn = () => ({ id: uuid.v1() });
@ -30,9 +29,7 @@ export function handleChange(props, doc) {
if (row.id === doc.id) return doc;
return row;
});
if (_.isFunction(props.onChange)) {
props.onChange(_.assign({}, model, part));
}
props.onChange?.({ ...model, ...part });
}
export function handleDelete(props, doc) {
@ -40,20 +37,15 @@ export function handleDelete(props, doc) {
const collection = model[name] || [];
const part = {};
part[name] = collection.filter(row => row.id !== doc.id);
if (_.isFunction(props.onChange)) {
props.onChange(_.assign({}, model, part));
}
props.onChange?.({ ...model, ...part });
}
export function handleAdd(props, fn = newFn) {
if (!_.isFunction(fn)) fn = newFn;
const { model, name } = props;
const collection = model[name] || [];
const part = {};
part[name] = collection.concat([fn()]);
if (_.isFunction(props.onChange)) {
props.onChange(_.assign({}, model, part));
}
props.onChange?.({ ...model, ...part });
}
export const collectionActions = { handleAdd, handleDelete, handleChange };

View file

@ -25,8 +25,6 @@ export const createNumberHandler = handleChange => {
if (!detectIE() || e.keyCode === 13) e.preventDefault();
const value = Number(_.get(e, 'target.value', defaultValue));
if (_.isFunction(handleChange)) {
return handleChange({ [name]: value });
}
return handleChange?.({ [name]: value });
};
};

View file

@ -21,10 +21,8 @@ import _ from 'lodash';
export const createSelectHandler = handleChange => {
return name => selectedOptions => {
if (_.isFunction(handleChange)) {
return handleChange({
[name]: _.get(selectedOptions, '[0].value', null),
});
}
return handleChange?.({
[name]: _.get(selectedOptions, '[0].value', null),
});
};
};

View file

@ -26,8 +26,6 @@ export const createTextHandler = handleChange => {
if (!detectIE() || e.keyCode === 13) e.preventDefault();
const value = _.get(e, 'target.value', defaultValue);
if (_.isFunction(handleChange)) {
return handleChange({ [name]: value });
}
return handleChange?.({ [name]: value });
};
};

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { getUISettings } from '../../services';
import { getUISettings } from '../../../services';
export function getDefaultQueryLanguage() {
return getUISettings().get('search:queryLanguage');

View file

@ -20,7 +20,7 @@
import handlebars from 'handlebars/dist/handlebars';
import { isNumber } from 'lodash';
import { inputFormats, outputFormats, isDuration } from '../lib/durations';
import { getFieldFormats } from '../../services';
import { getFieldFormats } from '../../../services';
export const createTickFormatter = (format = '0,0.[00]', template, getConfig = null) => {
const fieldFormats = getFieldFormats();

Some files were not shown because too many files have changed in this diff Show more